From 624a14f7309c04350ee70b5d83a16af2be41152f Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 28 Feb 2020 14:14:35 +0300 Subject: [PATCH] rpc: rename (*Client).SendToAddress to TransferAsset SendToAddress name is similar to the `sendtoaddress` RPC call, this can cause confusion. Closes #686. --- pkg/rpc/client/rpc.go | 6 +++--- pkg/rpc/request/txTypes.go | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/rpc/client/rpc.go b/pkg/rpc/client/rpc.go index 44f69e419..85c04960c 100644 --- a/pkg/rpc/client/rpc.go +++ b/pkg/rpc/client/rpc.go @@ -126,10 +126,10 @@ func (c *Client) sendRawTransaction(rawTX *transaction.Transaction) error { return nil } -// SendToAddress sends an amount of specific asset to a given address. +// TransferAsset sends an amount of specific asset to a given address. // This call requires open wallet. (`wif` key in client struct.) // If response.Result is `true` then transaction was formed correctly and was written in blockchain. -func (c *Client) SendToAddress(asset util.Uint256, address string, amount util.Fixed8) (util.Uint256, error) { +func (c *Client) TransferAsset(asset util.Uint256, address string, amount util.Fixed8) (util.Uint256, error) { var ( err error rawTx *transaction.Transaction @@ -144,7 +144,7 @@ func (c *Client) SendToAddress(asset util.Uint256, address string, amount util.F ) if rawTx, err = request.CreateRawContractTransaction(txParams); err != nil { - return resp, errors.Wrap(err, "failed to create raw transaction for `sendtoaddress`") + return resp, errors.Wrap(err, "failed to create raw transaction") } if err = c.sendRawTransaction(rawTx); err != nil { return resp, errors.Wrap(err, "failed to send raw transaction") diff --git a/pkg/rpc/request/txTypes.go b/pkg/rpc/request/txTypes.go index b97809bf0..0201e63e1 100644 --- a/pkg/rpc/request/txTypes.go +++ b/pkg/rpc/request/txTypes.go @@ -12,9 +12,8 @@ import ( ) type ( - // ContractTxParams contains parameters for tx to transfer assets; - // includes parameters duplication `sendtoaddress` RPC call params - // and also some utility data; + // ContractTxParams contains parameters for tx to transfer assets. + // It includes (*Client).TransferAsset call params and utility data. ContractTxParams struct { AssetID util.Uint256 Address string