rpc: adjust getnep5balances RPC-call JSON fields names

Part of #1130
This commit is contained in:
Anna Shaleva 2020-07-09 15:36:13 +03:00
parent e81ccb7deb
commit dc273736be
2 changed files with 7 additions and 7 deletions

View file

@ -377,7 +377,7 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
}
return c.GetNEP5Balances(hash)
},
serverResponse: `{"jsonrpc":"2.0","id":1,"result":{"balance":[{"asset_hash":"a48b6e1291ba24211ad11bb90ae2a10bf1fcd5a8","amount":"50000000000","last_updated_block":251604}],"address":"AY6eqWjsUFCzsVELG7yG72XDukKvC34p2w"}}`,
serverResponse: `{"jsonrpc":"2.0","id":1,"result":{"balance":[{"assethash":"a48b6e1291ba24211ad11bb90ae2a10bf1fcd5a8","amount":"50000000000","lastupdatedblock":251604}],"address":"AY6eqWjsUFCzsVELG7yG72XDukKvC34p2w"}}`,
result: func(c *Client) interface{} {
hash, err := util.Uint160DecodeStringLE("a48b6e1291ba24211ad11bb90ae2a10bf1fcd5a8")
if err != nil {
@ -400,7 +400,7 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
invoke: func(c *Client) (interface{}, error) {
return c.GetNEP5Transfers("AbHgdBaWEnHkCiLtDZXjhvhaAK2cwFh5pF")
},
serverResponse: `{"jsonrpc":"2.0","id":1,"result":{"sent":[],"received":[{"timestamp":1555651816,"asset_hash":"600c4f5200db36177e3e8a09e9f18e2fc7d12a0f","transfer_address":"AYwgBNMepiv5ocGcyNT4mA8zPLTQ8pDBis","amount":"1000000","block_index":436036,"transfer_notify_index":0,"tx_hash":"df7683ece554ecfb85cf41492c5f143215dd43ef9ec61181a28f922da06aba58"}],"address":"AbHgdBaWEnHkCiLtDZXjhvhaAK2cwFh5pF"}}`,
serverResponse: `{"jsonrpc":"2.0","id":1,"result":{"sent":[],"received":[{"timestamp":1555651816,"assethash":"600c4f5200db36177e3e8a09e9f18e2fc7d12a0f","transfer_address":"AYwgBNMepiv5ocGcyNT4mA8zPLTQ8pDBis","amount":"1000000","block_index":436036,"transfer_notify_index":0,"tx_hash":"df7683ece554ecfb85cf41492c5f143215dd43ef9ec61181a28f922da06aba58"}],"address":"AbHgdBaWEnHkCiLtDZXjhvhaAK2cwFh5pF"}}`,
result: func(c *Client) interface{} {
assetHash, err := util.Uint160DecodeStringLE("600c4f5200db36177e3e8a09e9f18e2fc7d12a0f")
if err != nil {

View file

@ -14,16 +14,16 @@ type NEP5Balances struct {
// NEP5Balance represents balance for the single token contract.
type NEP5Balance struct {
Asset util.Uint160 `json:"asset_hash"`
Asset util.Uint160 `json:"assethash"`
Amount string `json:"amount"`
LastUpdated uint32 `json:"last_updated_block"`
LastUpdated uint32 `json:"lastupdatedblock"`
}
// nep5Balance is an auxilliary struct for proper Asset marshaling.
type nep5Balance struct {
Asset string `json:"asset_hash"`
Asset string `json:"assethash"`
Amount string `json:"amount"`
LastUpdated uint32 `json:"last_updated_block"`
LastUpdated uint32 `json:"lastupdatedblock"`
}
// NEP5Transfers is a result for the getnep5transfers RPC.
@ -36,7 +36,7 @@ type NEP5Transfers struct {
// NEP5Transfer represents single NEP5 transfer event.
type NEP5Transfer struct {
Timestamp uint64 `json:"timestamp"`
Asset util.Uint160 `json:"asset_hash"`
Asset util.Uint160 `json:"assethash"`
Address string `json:"transfer_address,omitempty"`
Amount string `json:"amount"`
Index uint32 `json:"block_index"`