diff --git a/rpcclient/policy/client.go b/rpcclient/policy/client.go index 8ca373b..7bc57fb 100644 --- a/rpcclient/policy/client.go +++ b/rpcclient/policy/client.go @@ -52,6 +52,11 @@ func New(actor Actor, hash util.Uint160) *Contract { return &Contract{ContractReader{actor, hash}, actor, hash} } +// GetAdmin invokes `getAdmin` method of contract. +func (c *ContractReader) GetAdmin() (util.Uint160, error) { + return unwrap.Uint160(c.invoker.Call(c.hash, "getAdmin")) +} + // GetChain invokes `getChain` method of contract. func (c *ContractReader) GetChain(entity *big.Int, entityName string, name string) ([]byte, error) { return unwrap.Bytes(c.invoker.Call(c.hash, "getChain", entity, entityName, name)) @@ -132,3 +137,25 @@ func (c *Contract) RemoveChainsByPrefixTransaction(entity *big.Int, entityName s func (c *Contract) RemoveChainsByPrefixUnsigned(entity *big.Int, entityName string, name string) (*transaction.Transaction, error) { return c.actor.MakeUnsignedCall(c.hash, "removeChainsByPrefix", nil, entity, entityName, name) } + +// SetAdmin creates a transaction invoking `setAdmin` method of the contract. +// This transaction is signed and immediately sent to the network. +// The values returned are its hash, ValidUntilBlock value and error if any. +func (c *Contract) SetAdmin(addr util.Uint160) (util.Uint256, uint32, error) { + return c.actor.SendCall(c.hash, "setAdmin", addr) +} + +// SetAdminTransaction creates a transaction invoking `setAdmin` method of the contract. +// This transaction is signed, but not sent to the network, instead it's +// returned to the caller. +func (c *Contract) SetAdminTransaction(addr util.Uint160) (*transaction.Transaction, error) { + return c.actor.MakeCall(c.hash, "setAdmin", addr) +} + +// SetAdminUnsigned creates a transaction invoking `setAdmin` method of the contract. +// This transaction is not signed, it's simply returned to the caller. +// Any fields of it that do not affect fees can be changed (ValidUntilBlock, +// Nonce), fee values (NetworkFee, SystemFee) can be increased as well. +func (c *Contract) SetAdminUnsigned(addr util.Uint160) (*transaction.Transaction, error) { + return c.actor.MakeUnsignedCall(c.hash, "setAdmin", nil, addr) +}