forked from TrueCloudLab/frostfs-contract
parent
23e85d11c4
commit
bce7ef18c8
|
@ -6,9 +6,11 @@ import (
|
|||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-contract/commonclient"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/actor"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/notary"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
|
@ -24,7 +26,7 @@ type (
|
|||
}
|
||||
|
||||
Options struct {
|
||||
// todo add proxy params
|
||||
ProxyContract util.Uint160
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -122,9 +124,28 @@ const (
|
|||
deleteGroupMethod = "deleteGroup"
|
||||
)
|
||||
|
||||
// New creates a new Client. Options can be nil.
|
||||
func New(ra actor.RPCActor, acc *wallet.Account, contract util.Uint160, _ *Options) (*Client, error) {
|
||||
act, err := actor.NewSimple(ra, acc)
|
||||
// New creates a new Client. Options can be empty.
|
||||
func New(ra actor.RPCActor, acc *wallet.Account, contract util.Uint160, opt Options) (*Client, error) {
|
||||
signers := []actor.SignerAccount{{
|
||||
Signer: transaction.Signer{
|
||||
Account: acc.Contract.ScriptHash(),
|
||||
Scopes: transaction.CalledByEntry,
|
||||
},
|
||||
Account: acc,
|
||||
}}
|
||||
|
||||
if !opt.ProxyContract.Equals(util.Uint160{}) {
|
||||
signers = append([]actor.SignerAccount{{
|
||||
Signer: transaction.Signer{
|
||||
Account: opt.ProxyContract,
|
||||
Scopes: transaction.CustomContracts,
|
||||
AllowedContracts: []util.Uint160{contract},
|
||||
},
|
||||
Account: notary.FakeContractAccount(opt.ProxyContract),
|
||||
}}, signers...)
|
||||
}
|
||||
|
||||
act, err := actor.New(ra, signers)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init actor: %w", err)
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ func frostfsidRPCClient(t *testing.T, address string, contractHash util.Uint160,
|
|||
acc = accs[0]
|
||||
}
|
||||
|
||||
cli, err := client.New(rpcCli, acc, contractHash, nil)
|
||||
cli, err := client.New(rpcCli, acc, contractHash, client.Options{})
|
||||
require.NoError(t, err)
|
||||
|
||||
return cli, rpcCli
|
||||
|
|
Loading…
Reference in New Issue