Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_actions result unmarsha into Go struct ActionsResp error #174

Open
markall93 opened this issue Apr 20, 2022 · 0 comments
Open

get_actions result unmarsha into Go struct ActionsResp error #174

markall93 opened this issue Apr 20, 2022 · 0 comments

Comments

@markall93
Copy link

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"
		}
	}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant