in service/managedblockchainquery/deserializers.go [2811:3039]
func awsRestjson1_deserializeDocumentTransaction(v **types.Transaction, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.Transaction
if *v == nil {
sv = &types.Transaction{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "blockHash":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected BlockHash to be of type string, got %T instead", value)
}
sv.BlockHash = ptr.String(jtv)
}
case "blockNumber":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.BlockNumber = ptr.String(jtv)
}
case "confirmationStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ConfirmationStatus to be of type string, got %T instead", value)
}
sv.ConfirmationStatus = types.ConfirmationStatus(jtv)
}
case "contractAddress":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ChainAddress to be of type string, got %T instead", value)
}
sv.ContractAddress = ptr.String(jtv)
}
case "cumulativeGasUsed":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.CumulativeGasUsed = ptr.String(jtv)
}
case "effectiveGasPrice":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.EffectiveGasPrice = ptr.String(jtv)
}
case "executionStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExecutionStatus to be of type string, got %T instead", value)
}
sv.ExecutionStatus = types.ExecutionStatus(jtv)
}
case "from":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ChainAddress to be of type string, got %T instead", value)
}
sv.From = ptr.String(jtv)
}
case "gasUsed":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.GasUsed = ptr.String(jtv)
}
case "network":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QueryNetwork to be of type string, got %T instead", value)
}
sv.Network = types.QueryNetwork(jtv)
}
case "numberOfTransactions":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.NumberOfTransactions = ptr.Int64(i64)
}
case "signatureR":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SignatureR = ptr.String(jtv)
}
case "signatureS":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SignatureS = ptr.String(jtv)
}
case "signatureV":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.SignatureV = ptr.Int32(int32(i64))
}
case "to":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ChainAddress to be of type string, got %T instead", value)
}
sv.To = ptr.String(jtv)
}
case "transactionFee":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.TransactionFee = ptr.String(jtv)
}
case "transactionHash":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QueryTransactionHash to be of type string, got %T instead", value)
}
sv.TransactionHash = ptr.String(jtv)
}
case "transactionId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.TransactionId = ptr.String(jtv)
}
case "transactionIndex":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.TransactionIndex = ptr.Int64(i64)
}
case "transactionTimestamp":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.TransactionTimestamp = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}