From 2574b2840ecb33ce693e571ec58fd7878bc8536a Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 3 Apr 2024 16:51:12 +0300 Subject: [PATCH] [#84] rpcclient: Regenerate interface for Policy Signed-off-by: Airat Arifullin --- rpcclient/policy/client.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/rpcclient/policy/client.go b/rpcclient/policy/client.go index 6a0d551..cffad49 100644 --- a/rpcclient/policy/client.go +++ b/rpcclient/policy/client.go @@ -196,3 +196,25 @@ func (c *Contract) SetAdminTransaction(addr util.Uint160) (*transaction.Transact func (c *Contract) SetAdminUnsigned(addr util.Uint160) (*transaction.Transaction, error) { return c.actor.MakeUnsignedCall(c.hash, "setAdmin", nil, addr) } + +// Update creates a transaction invoking `update` 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) Update(script []byte, manifest []byte, data any) (util.Uint256, uint32, error) { + return c.actor.SendCall(c.hash, "update", script, manifest, data) +} + +// UpdateTransaction creates a transaction invoking `update` method of the contract. +// This transaction is signed, but not sent to the network, instead it's +// returned to the caller. +func (c *Contract) UpdateTransaction(script []byte, manifest []byte, data any) (*transaction.Transaction, error) { + return c.actor.MakeCall(c.hash, "update", script, manifest, data) +} + +// UpdateUnsigned creates a transaction invoking `update` 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) UpdateUnsigned(script []byte, manifest []byte, data any) (*transaction.Transaction, error) { + return c.actor.MakeUnsignedCall(c.hash, "update", nil, script, manifest, data) +}