mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 01:41:48 +00:00
rpc/client: update GetNEP5Transfers call
This commit is contained in:
parent
6b7ca0ce3f
commit
b958b5c9af
2 changed files with 50 additions and 5 deletions
|
@ -214,9 +214,31 @@ func (c *Client) GetNEP5Balances(address util.Uint160) (*result.NEP5Balances, er
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
// GetNEP5Transfers is a wrapper for getnep5transfers RPC.
|
||||
func (c *Client) GetNEP5Transfers(address string) (*result.NEP5Transfers, error) {
|
||||
// GetNEP5Transfers is a wrapper for getnep5transfers RPC. Address parameter
|
||||
// is mandatory, while all the others are optional. Start and stop parameters
|
||||
// are supported since neo-go 0.77.0 and limit and page since neo-go 0.78.0.
|
||||
// These parameters are positional in the JSON-RPC call, you can't specify limit
|
||||
// and not specify start/stop for example.
|
||||
func (c *Client) GetNEP5Transfers(address string, start, stop *uint32, limit, page *int) (*result.NEP5Transfers, error) {
|
||||
params := request.NewRawParams(address)
|
||||
if start != nil {
|
||||
params.Values = append(params.Values, *start)
|
||||
if stop != nil {
|
||||
params.Values = append(params.Values, *stop)
|
||||
if limit != nil {
|
||||
params.Values = append(params.Values, *limit)
|
||||
if page != nil {
|
||||
params.Values = append(params.Values, *page)
|
||||
}
|
||||
} else if page != nil {
|
||||
return nil, errors.New("bad parameters")
|
||||
}
|
||||
} else if limit != nil || page != nil {
|
||||
return nil, errors.New("bad parameters")
|
||||
}
|
||||
} else if stop != nil || limit != nil || page != nil {
|
||||
return nil, errors.New("bad parameters")
|
||||
}
|
||||
resp := new(result.NEP5Transfers)
|
||||
if err := c.performRequest("getnep5transfers", params, resp); err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue