Skip to content

get_actions result unmarsha into Go struct ActionsResp error #174

@Angelo-zz

Description

@Angelo-zz

api.go:

func (api *API) GetActions(ctx context.Context, params GetActionsRequest) (out *ActionsResp, err error) {
	err = api.call(ctx, "history", "get_actions", params, &out)
	return
}

api.call end:

if err := json.Unmarshal(cnt.Bytes(), &out); err != nil {
		return fmt.Errorf("Unmarshal: %w", err)
	}

unmarshall err:

Unmarshal: json: cannot unmarshal object into Go struct field ActionTraceReceipt.actions.action_trace.receipt.auth_sequence of type []interface {}

result of request:

{
	"last_irreversible_block": 135631145,
	"actions": [{
		"account_action_seq": 1471231,
		"global_action_seq": 151769097,
		"block_num": 135451269,
		"block_time": "2022-04-15T08:46:55.000",
		"action_trace": {
			"action_ordinal": 13,
			"creator_action_ordinal": 3,
			"receipt": {
				"receiver": "eosio.token",
				"global_sequence": 151769097,
				"recv_sequence": 1471231,
				"auth_sequence": [{
					"account": "eosisverygo1",
					"sequence": 520
				}]
			},
			"receiver": "eosio.token",
			"act": {
				"account": "eosio.token",
				"name": "transfer",
				"authorization": [{
					"actor": "eosisverygo1",
					"permission": "active"
				}],
				"data": {
					"from": "eosisverygo1",
					"to": "eosio.stake",
					"amount": 0.2,
					"symbol": "EOS",
					"memo": "stake bandwidth",
					"quantity": "0.2000 EOS"
				},
				"hex_data": "7b2266726f6d223a22656f73697376657279676f31222c22746f223a22656f73696f2e7374616b65222c22616d6f756e74223a302e322c2273796d626f6c223a22454f53222c226d656d6f223a227374616b652062616e647769647468222c227175616e74697479223a22302e3230303020454f53227d"
			},
			"trx_id": "37cd2e40b9b4d298ce49adb74653ee121d87ccd499c101b40e6612d709425534",
			"block_num": 135451269,
			"block_time": "2022-04-15T08:46:55.000"
		}
	}]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions