diff --git a/pkg/morph/client/balance/balanceOf.go b/pkg/morph/client/balance/balanceOf.go index a5fb8e82a..dbb245d34 100644 --- a/pkg/morph/client/balance/balanceOf.go +++ b/pkg/morph/client/balance/balanceOf.go @@ -11,14 +11,9 @@ import ( // BalanceOf receives the amount of funds in the client's account // through the Balance contract call, and returns it. func (c *Client) BalanceOf(id user.ID) (*big.Int, error) { - h, err := id.ScriptHash() - if err != nil { - return nil, err - } - invokePrm := client.TestInvokePrm{} invokePrm.SetMethod(balanceOfMethod) - invokePrm.SetArgs(h) + invokePrm.SetArgs(id.ScriptHash()) prms, err := c.client.TestInvoke(invokePrm) if err != nil { diff --git a/pkg/morph/client/balance/transfer.go b/pkg/morph/client/balance/transfer.go index 52d69dccb..bac1f642d 100644 --- a/pkg/morph/client/balance/transfer.go +++ b/pkg/morph/client/balance/transfer.go @@ -22,22 +22,12 @@ type TransferPrm struct { // TransferX transfers p.Amount of GASe-12 from p.From to p.To // with details p.Details through direct smart contract call. func (c *Client) TransferX(ctx context.Context, p TransferPrm) error { - from, err := p.From.ScriptHash() - if err != nil { - return err - } - - to, err := p.To.ScriptHash() - if err != nil { - return err - } - prm := client.InvokePrm{} prm.SetMethod(transferXMethod) - prm.SetArgs(from, to, p.Amount, p.Details) + prm.SetArgs(p.From.ScriptHash(), p.To.ScriptHash(), p.Amount, p.Details) prm.InvokePrmOptional = p.InvokePrmOptional - _, err = c.client.Invoke(ctx, prm) + _, err := c.client.Invoke(ctx, prm) if err != nil { return fmt.Errorf("invoke method (%s): %w", transferXMethod, err) }