diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index 2580c36d5..cdfb77b3a 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -595,7 +595,7 @@ func (s *Server) getNEP5Balances(ps request.Params) (interface{}, *response.Erro } func (s *Server) getNEP5Transfers(ps request.Params) (interface{}, *response.Error) { - u, err := ps.ValueWithType(0, request.StringT).GetUint160FromAddress() + u, err := ps.Value(0).GetUint160FromAddressOrHex() if err != nil { return nil, response.ErrInvalidParams } diff --git a/pkg/rpc/server/server_test.go b/pkg/rpc/server/server_test.go index 33af8e525..9350a0712 100644 --- a/pkg/rpc/server/server_test.go +++ b/pkg/rpc/server/server_test.go @@ -193,24 +193,13 @@ var rpcTestCases = map[string][]rpcTestCase{ name: "positive", params: `["AKkkumHbBipZ46UMZJoFynJMXzSRnBvKcs"]`, result: func(e *executor) interface{} { return &result.NEP5Transfers{} }, - check: func(t *testing.T, e *executor, acc interface{}) { - res, ok := acc.(*result.NEP5Transfers) - require.True(t, ok) - require.Equal(t, "AKkkumHbBipZ46UMZJoFynJMXzSRnBvKcs", res.Address) - - assetHash, err := util.Uint160DecodeStringLE(testContractHash) - require.NoError(t, err) - - require.Equal(t, 1, len(res.Received)) - require.Equal(t, "10", res.Received[0].Amount) - require.Equal(t, assetHash, res.Received[0].Asset) - require.Equal(t, address.Uint160ToString(assetHash), res.Received[0].Address) - - require.Equal(t, 1, len(res.Sent)) - require.Equal(t, "1.23", res.Sent[0].Amount) - require.Equal(t, assetHash, res.Sent[0].Asset) - require.Equal(t, "AWLYWXB8C9Lt1nHdDZJnC5cpYJjgRDLk17", res.Sent[0].Address) - }, + check: checkNep5Transfers, + }, + { + name: "positive_hash", + params: `["a90f00d94349a320376b7cb86c884b53ad76aa2b"]`, + result: func(e *executor) interface{} { return &result.NEP5Transfers{} }, + check: checkNep5Transfers, }, }, "getproof": { @@ -1166,3 +1155,22 @@ func checkNep5Balances(t *testing.T, e *executor, acc interface{}) { require.Equal(t, testContractHash, res.Balances[0].Asset.StringLE()) require.Equal(t, uint32(208), res.Balances[0].LastUpdated) } + +func checkNep5Transfers(t *testing.T, e *executor, acc interface{}) { + res, ok := acc.(*result.NEP5Transfers) + require.True(t, ok) + require.Equal(t, "AKkkumHbBipZ46UMZJoFynJMXzSRnBvKcs", res.Address) + + assetHash, err := util.Uint160DecodeStringLE(testContractHash) + require.NoError(t, err) + + require.Equal(t, 1, len(res.Received)) + require.Equal(t, "10", res.Received[0].Amount) + require.Equal(t, assetHash, res.Received[0].Asset) + require.Equal(t, address.Uint160ToString(assetHash), res.Received[0].Address) + + require.Equal(t, 1, len(res.Sent)) + require.Equal(t, "1.23", res.Sent[0].Amount) + require.Equal(t, assetHash, res.Sent[0].Asset) + require.Equal(t, "AWLYWXB8C9Lt1nHdDZJnC5cpYJjgRDLk17", res.Sent[0].Address) +}