[#1537] morph: Use (user.ID).ScriptHash()
where possible
All checks were successful
DCO action / DCO (pull_request) Successful in 4m46s
Vulncheck / Vulncheck (pull_request) Successful in 6m4s
Pre-commit hooks / Pre-commit (pull_request) Successful in 6m21s
Build / Build Components (pull_request) Successful in 6m39s
Tests and linters / Run gofumpt (pull_request) Successful in 1m50s
Tests and linters / gopls check (pull_request) Successful in 3m7s
Tests and linters / Staticcheck (pull_request) Successful in 3m9s
Tests and linters / Lint (pull_request) Successful in 4m6s
Tests and linters / Tests (pull_request) Successful in 4m28s
Tests and linters / Tests with -race (pull_request) Successful in 5m28s
Tests and linters / Run gofumpt (push) Successful in 2m9s
Vulncheck / Vulncheck (push) Successful in 2m43s
Tests and linters / Staticcheck (push) Successful in 3m2s
Build / Build Components (push) Successful in 3m15s
Pre-commit hooks / Pre-commit (push) Successful in 3m48s
Tests and linters / gopls check (push) Successful in 4m5s
Tests and linters / Lint (push) Successful in 4m33s
Tests and linters / Tests (push) Successful in 4m36s
Tests and linters / Tests with -race (push) Successful in 4m50s
All checks were successful
DCO action / DCO (pull_request) Successful in 4m46s
Vulncheck / Vulncheck (pull_request) Successful in 6m4s
Pre-commit hooks / Pre-commit (pull_request) Successful in 6m21s
Build / Build Components (pull_request) Successful in 6m39s
Tests and linters / Run gofumpt (pull_request) Successful in 1m50s
Tests and linters / gopls check (pull_request) Successful in 3m7s
Tests and linters / Staticcheck (pull_request) Successful in 3m9s
Tests and linters / Lint (pull_request) Successful in 4m6s
Tests and linters / Tests (pull_request) Successful in 4m28s
Tests and linters / Tests with -race (pull_request) Successful in 5m28s
Tests and linters / Run gofumpt (push) Successful in 2m9s
Vulncheck / Vulncheck (push) Successful in 2m43s
Tests and linters / Staticcheck (push) Successful in 3m2s
Build / Build Components (push) Successful in 3m15s
Pre-commit hooks / Pre-commit (push) Successful in 3m48s
Tests and linters / gopls check (push) Successful in 4m5s
Tests and linters / Lint (push) Successful in 4m33s
Tests and linters / Tests (push) Successful in 4m36s
Tests and linters / Tests with -race (push) Successful in 4m50s
Pick up changes from TrueCloudLab/frostfs-sdk-go#198. gopatch: ``` @@ var user expression @@ -address.StringToUint160(user.EncodeToString()) +user.ScriptHash() ``` Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
e3487d5af5
commit
2d5d4093be
2 changed files with 3 additions and 5 deletions
|
@ -6,13 +6,12 @@ import (
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// BalanceOf receives the amount of funds in the client's account
|
// BalanceOf receives the amount of funds in the client's account
|
||||||
// through the Balance contract call, and returns it.
|
// through the Balance contract call, and returns it.
|
||||||
func (c *Client) BalanceOf(id user.ID) (*big.Int, error) {
|
func (c *Client) BalanceOf(id user.ID) (*big.Int, error) {
|
||||||
h, err := address.StringToUint160(id.EncodeToString())
|
h, err := id.ScriptHash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TransferPrm groups parameters of TransferX method.
|
// TransferPrm groups parameters of TransferX method.
|
||||||
|
@ -25,12 +24,12 @@ type TransferPrm struct {
|
||||||
//
|
//
|
||||||
// If TryNotary is provided, calls notary contract.
|
// If TryNotary is provided, calls notary contract.
|
||||||
func (c *Client) TransferX(ctx context.Context, p TransferPrm) error {
|
func (c *Client) TransferX(ctx context.Context, p TransferPrm) error {
|
||||||
from, err := address.StringToUint160(p.From.EncodeToString())
|
from, err := p.From.ScriptHash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
to, err := address.StringToUint160(p.To.EncodeToString())
|
to, err := p.To.ScriptHash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue