mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 03:41:34 +00:00
rpc/client: pass token as simple hash into TransferNEP5
It doesn't need full wallet.Token structure.
This commit is contained in:
parent
ed0a3e4af5
commit
3b2644da4f
2 changed files with 3 additions and 3 deletions
|
@ -341,7 +341,7 @@ func transferNEP5(ctx *cli.Context) error {
|
|||
return cli.NewExitError(err, 1)
|
||||
}
|
||||
|
||||
hash, err := c.TransferNEP5(acc, to, token, amount, gas)
|
||||
hash, err := c.TransferNEP5(acc, to, token.Hash, amount, gas)
|
||||
if err != nil {
|
||||
return cli.NewExitError(err, 1)
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ func (c *Client) NEP5TokenInfo(tokenHash util.Uint160) (*wallet.Token, error) {
|
|||
// TransferNEP5 creates an invocation transaction that invokes 'transfer' method
|
||||
// on a given token to move specified amount of NEP5 assets (in FixedN format
|
||||
// using contract's number of decimals) to given account.
|
||||
func (c *Client) TransferNEP5(acc *wallet.Account, to util.Uint160, token *wallet.Token, amount int64, gas util.Fixed8) (util.Uint256, error) {
|
||||
func (c *Client) TransferNEP5(acc *wallet.Account, to util.Uint160, token util.Uint160, amount int64, gas util.Fixed8) (util.Uint256, error) {
|
||||
from, err := address.StringToUint160(acc.Address)
|
||||
if err != nil {
|
||||
return util.Uint256{}, fmt.Errorf("bad account address: %v", err)
|
||||
|
@ -105,7 +105,7 @@ func (c *Client) TransferNEP5(acc *wallet.Account, to util.Uint160, token *walle
|
|||
// Note: we don't use invoke function here because it requires
|
||||
// 2 round trips instead of one.
|
||||
w := io.NewBufBinWriter()
|
||||
emit.AppCallWithOperationAndArgs(w.BinWriter, token.Hash, "transfer", from, to, amount)
|
||||
emit.AppCallWithOperationAndArgs(w.BinWriter, token, "transfer", from, to, amount)
|
||||
emit.Opcode(w.BinWriter, opcode.ASSERT)
|
||||
|
||||
script := w.Bytes()
|
||||
|
|
Loading…
Reference in a new issue