[#9999] morph: Fix ScriptHash calls after frostfs-sdk-go version bump
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
9e6a6e5a45
commit
dd8401728d
2 changed files with 3 additions and 18 deletions
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue