From f28d918727bedea8d8a7b5f78b1a47476cac6769 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 28 Nov 2023 13:53:48 +0300 Subject: [PATCH] [#55] frostfsid: Add missing safe methods All of them can be called in read-only context. Signed-off-by: Evgenii Stratonikov --- frostfsid/config.yml | 14 ++ rpcclient/frostfsid/client.go | 427 ++++++++++------------------------ 2 files changed, 133 insertions(+), 308 deletions(-) diff --git a/frostfsid/config.yml b/frostfsid/config.yml index eeaec4d..02ea164 100644 --- a/frostfsid/config.yml +++ b/frostfsid/config.yml @@ -1,6 +1,20 @@ name: "Identity" safemethods: - "getAdmin" + - "getGroup" + - "getGroupExtended" + - "getGroupIDByName" + - "getNamespace" + - "getNamespaceExtended" + - "getSubject" + - "getSubjectExtended" + - "getSubjectByKey" + - "getSubjectKeyByName" + - "listGroups" + - "listGroupSubjects" + - "listNamespaces" + - "listNamespaceSubjects" + - "listSubjects" - "version" permissions: - methods: ["update"] diff --git a/rpcclient/frostfsid/client.go b/rpcclient/frostfsid/client.go index c210329..39bf6dc 100644 --- a/rpcclient/frostfsid/client.go +++ b/rpcclient/frostfsid/client.go @@ -7,6 +7,7 @@ import ( "crypto/elliptic" "errors" "fmt" + "github.com/google/uuid" "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" @@ -126,6 +127,9 @@ type DeleteGroupEvent struct { // Invoker is used by ContractReader to call various safe methods. type Invoker interface { Call(contract util.Uint160, operation string, params ...any) (*result.Invoke, error) + CallAndExpandIterator(contract util.Uint160, method string, maxItems int, params ...any) (*result.Invoke, error) + TerminateSession(sessionID uuid.UUID) error + TraverseIterator(sessionID uuid.UUID, iterator *result.Iterator, num int) ([]stackitem.Item, error) } // Actor is used by Contract to call state-changing methods. @@ -168,6 +172,121 @@ func (c *ContractReader) GetAdmin() (util.Uint160, error) { return unwrap.Uint160(c.invoker.Call(c.hash, "getAdmin")) } +// GetGroup invokes `getGroup` method of contract. +func (c *ContractReader) GetGroup(ns string, groupID *big.Int) ([]stackitem.Item, error) { + return unwrap.Array(c.invoker.Call(c.hash, "getGroup", ns, groupID)) +} + +// GetGroupExtended invokes `getGroupExtended` method of contract. +func (c *ContractReader) GetGroupExtended(ns string, groupID *big.Int) ([]stackitem.Item, error) { + return unwrap.Array(c.invoker.Call(c.hash, "getGroupExtended", ns, groupID)) +} + +// GetGroupIDByName invokes `getGroupIDByName` method of contract. +func (c *ContractReader) GetGroupIDByName(ns string, name string) (*big.Int, error) { + return unwrap.BigInt(c.invoker.Call(c.hash, "getGroupIDByName", ns, name)) +} + +// GetNamespace invokes `getNamespace` method of contract. +func (c *ContractReader) GetNamespace(ns string) ([]stackitem.Item, error) { + return unwrap.Array(c.invoker.Call(c.hash, "getNamespace", ns)) +} + +// GetNamespaceExtended invokes `getNamespaceExtended` method of contract. +func (c *ContractReader) GetNamespaceExtended(ns string) ([]stackitem.Item, error) { + return unwrap.Array(c.invoker.Call(c.hash, "getNamespaceExtended", ns)) +} + +// GetSubject invokes `getSubject` method of contract. +func (c *ContractReader) GetSubject(addr util.Uint160) ([]stackitem.Item, error) { + return unwrap.Array(c.invoker.Call(c.hash, "getSubject", addr)) +} + +// GetSubjectByKey invokes `getSubjectByKey` method of contract. +func (c *ContractReader) GetSubjectByKey(key *keys.PublicKey) ([]stackitem.Item, error) { + return unwrap.Array(c.invoker.Call(c.hash, "getSubjectByKey", key)) +} + +// GetSubjectExtended invokes `getSubjectExtended` method of contract. +func (c *ContractReader) GetSubjectExtended(addr util.Uint160) ([]stackitem.Item, error) { + return unwrap.Array(c.invoker.Call(c.hash, "getSubjectExtended", addr)) +} + +// GetSubjectKeyByName invokes `getSubjectKeyByName` method of contract. +func (c *ContractReader) GetSubjectKeyByName(ns string, name string) (*keys.PublicKey, error) { + return unwrap.PublicKey(c.invoker.Call(c.hash, "getSubjectKeyByName", ns, name)) +} + +// ListGroupSubjects invokes `listGroupSubjects` method of contract. +func (c *ContractReader) ListGroupSubjects(ns string, groupID *big.Int) (uuid.UUID, result.Iterator, error) { + return unwrap.SessionIterator(c.invoker.Call(c.hash, "listGroupSubjects", ns, groupID)) +} + +// ListGroupSubjectsExpanded is similar to ListGroupSubjects (uses the same contract +// method), but can be useful if the server used doesn't support sessions and +// doesn't expand iterators. It creates a script that will get the specified +// number of result items from the iterator right in the VM and return them to +// you. It's only limited by VM stack and GAS available for RPC invocations. +func (c *ContractReader) ListGroupSubjectsExpanded(ns string, groupID *big.Int, _numOfIteratorItems int) ([]stackitem.Item, error) { + return unwrap.Array(c.invoker.CallAndExpandIterator(c.hash, "listGroupSubjects", _numOfIteratorItems, ns, groupID)) +} + +// ListGroups invokes `listGroups` method of contract. +func (c *ContractReader) ListGroups(ns string) (uuid.UUID, result.Iterator, error) { + return unwrap.SessionIterator(c.invoker.Call(c.hash, "listGroups", ns)) +} + +// ListGroupsExpanded is similar to ListGroups (uses the same contract +// method), but can be useful if the server used doesn't support sessions and +// doesn't expand iterators. It creates a script that will get the specified +// number of result items from the iterator right in the VM and return them to +// you. It's only limited by VM stack and GAS available for RPC invocations. +func (c *ContractReader) ListGroupsExpanded(ns string, _numOfIteratorItems int) ([]stackitem.Item, error) { + return unwrap.Array(c.invoker.CallAndExpandIterator(c.hash, "listGroups", _numOfIteratorItems, ns)) +} + +// ListNamespaceSubjects invokes `listNamespaceSubjects` method of contract. +func (c *ContractReader) ListNamespaceSubjects(ns string) (uuid.UUID, result.Iterator, error) { + return unwrap.SessionIterator(c.invoker.Call(c.hash, "listNamespaceSubjects", ns)) +} + +// ListNamespaceSubjectsExpanded is similar to ListNamespaceSubjects (uses the same contract +// method), but can be useful if the server used doesn't support sessions and +// doesn't expand iterators. It creates a script that will get the specified +// number of result items from the iterator right in the VM and return them to +// you. It's only limited by VM stack and GAS available for RPC invocations. +func (c *ContractReader) ListNamespaceSubjectsExpanded(ns string, _numOfIteratorItems int) ([]stackitem.Item, error) { + return unwrap.Array(c.invoker.CallAndExpandIterator(c.hash, "listNamespaceSubjects", _numOfIteratorItems, ns)) +} + +// ListNamespaces invokes `listNamespaces` method of contract. +func (c *ContractReader) ListNamespaces() (uuid.UUID, result.Iterator, error) { + return unwrap.SessionIterator(c.invoker.Call(c.hash, "listNamespaces")) +} + +// ListNamespacesExpanded is similar to ListNamespaces (uses the same contract +// method), but can be useful if the server used doesn't support sessions and +// doesn't expand iterators. It creates a script that will get the specified +// number of result items from the iterator right in the VM and return them to +// you. It's only limited by VM stack and GAS available for RPC invocations. +func (c *ContractReader) ListNamespacesExpanded(_numOfIteratorItems int) ([]stackitem.Item, error) { + return unwrap.Array(c.invoker.CallAndExpandIterator(c.hash, "listNamespaces", _numOfIteratorItems)) +} + +// ListSubjects invokes `listSubjects` method of contract. +func (c *ContractReader) ListSubjects() (uuid.UUID, result.Iterator, error) { + return unwrap.SessionIterator(c.invoker.Call(c.hash, "listSubjects")) +} + +// ListSubjectsExpanded is similar to ListSubjects (uses the same contract +// method), but can be useful if the server used doesn't support sessions and +// doesn't expand iterators. It creates a script that will get the specified +// number of result items from the iterator right in the VM and return them to +// you. It's only limited by VM stack and GAS available for RPC invocations. +func (c *ContractReader) ListSubjectsExpanded(_numOfIteratorItems int) ([]stackitem.Item, error) { + return unwrap.Array(c.invoker.CallAndExpandIterator(c.hash, "listSubjects", _numOfIteratorItems)) +} + // Version invokes `version` method of contract. func (c *ContractReader) Version() (*big.Int, error) { return unwrap.BigInt(c.invoker.Call(c.hash, "version")) @@ -415,314 +534,6 @@ func (c *Contract) DeleteSubjectKVUnsigned(addr util.Uint160, key string) (*tran return c.actor.MakeUnsignedCall(c.hash, "deleteSubjectKV", nil, addr, key) } -// GetGroup creates a transaction invoking `getGroup` 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) GetGroup(ns string, groupID *big.Int) (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "getGroup", ns, groupID) -} - -// GetGroupTransaction creates a transaction invoking `getGroup` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) GetGroupTransaction(ns string, groupID *big.Int) (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "getGroup", ns, groupID) -} - -// GetGroupUnsigned creates a transaction invoking `getGroup` 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) GetGroupUnsigned(ns string, groupID *big.Int) (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "getGroup", nil, ns, groupID) -} - -// GetGroupExtended creates a transaction invoking `getGroupExtended` 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) GetGroupExtended(ns string, groupID *big.Int) (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "getGroupExtended", ns, groupID) -} - -// GetGroupExtendedTransaction creates a transaction invoking `getGroupExtended` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) GetGroupExtendedTransaction(ns string, groupID *big.Int) (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "getGroupExtended", ns, groupID) -} - -// GetGroupExtendedUnsigned creates a transaction invoking `getGroupExtended` 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) GetGroupExtendedUnsigned(ns string, groupID *big.Int) (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "getGroupExtended", nil, ns, groupID) -} - -// GetGroupIDByName creates a transaction invoking `getGroupIDByName` 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) GetGroupIDByName(ns string, name string) (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "getGroupIDByName", ns, name) -} - -// GetGroupIDByNameTransaction creates a transaction invoking `getGroupIDByName` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) GetGroupIDByNameTransaction(ns string, name string) (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "getGroupIDByName", ns, name) -} - -// GetGroupIDByNameUnsigned creates a transaction invoking `getGroupIDByName` 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) GetGroupIDByNameUnsigned(ns string, name string) (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "getGroupIDByName", nil, ns, name) -} - -// GetNamespace creates a transaction invoking `getNamespace` 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) GetNamespace(ns string) (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "getNamespace", ns) -} - -// GetNamespaceTransaction creates a transaction invoking `getNamespace` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) GetNamespaceTransaction(ns string) (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "getNamespace", ns) -} - -// GetNamespaceUnsigned creates a transaction invoking `getNamespace` 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) GetNamespaceUnsigned(ns string) (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "getNamespace", nil, ns) -} - -// GetNamespaceExtended creates a transaction invoking `getNamespaceExtended` 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) GetNamespaceExtended(ns string) (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "getNamespaceExtended", ns) -} - -// GetNamespaceExtendedTransaction creates a transaction invoking `getNamespaceExtended` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) GetNamespaceExtendedTransaction(ns string) (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "getNamespaceExtended", ns) -} - -// GetNamespaceExtendedUnsigned creates a transaction invoking `getNamespaceExtended` 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) GetNamespaceExtendedUnsigned(ns string) (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "getNamespaceExtended", nil, ns) -} - -// GetSubject creates a transaction invoking `getSubject` 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) GetSubject(addr util.Uint160) (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "getSubject", addr) -} - -// GetSubjectTransaction creates a transaction invoking `getSubject` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) GetSubjectTransaction(addr util.Uint160) (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "getSubject", addr) -} - -// GetSubjectUnsigned creates a transaction invoking `getSubject` 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) GetSubjectUnsigned(addr util.Uint160) (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "getSubject", nil, addr) -} - -// GetSubjectByKey creates a transaction invoking `getSubjectByKey` 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) GetSubjectByKey(key *keys.PublicKey) (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "getSubjectByKey", key) -} - -// GetSubjectByKeyTransaction creates a transaction invoking `getSubjectByKey` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) GetSubjectByKeyTransaction(key *keys.PublicKey) (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "getSubjectByKey", key) -} - -// GetSubjectByKeyUnsigned creates a transaction invoking `getSubjectByKey` 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) GetSubjectByKeyUnsigned(key *keys.PublicKey) (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "getSubjectByKey", nil, key) -} - -// GetSubjectExtended creates a transaction invoking `getSubjectExtended` 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) GetSubjectExtended(addr util.Uint160) (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "getSubjectExtended", addr) -} - -// GetSubjectExtendedTransaction creates a transaction invoking `getSubjectExtended` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) GetSubjectExtendedTransaction(addr util.Uint160) (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "getSubjectExtended", addr) -} - -// GetSubjectExtendedUnsigned creates a transaction invoking `getSubjectExtended` 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) GetSubjectExtendedUnsigned(addr util.Uint160) (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "getSubjectExtended", nil, addr) -} - -// GetSubjectKeyByName creates a transaction invoking `getSubjectKeyByName` 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) GetSubjectKeyByName(ns string, name string) (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "getSubjectKeyByName", ns, name) -} - -// GetSubjectKeyByNameTransaction creates a transaction invoking `getSubjectKeyByName` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) GetSubjectKeyByNameTransaction(ns string, name string) (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "getSubjectKeyByName", ns, name) -} - -// GetSubjectKeyByNameUnsigned creates a transaction invoking `getSubjectKeyByName` 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) GetSubjectKeyByNameUnsigned(ns string, name string) (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "getSubjectKeyByName", nil, ns, name) -} - -// ListGroupSubjects creates a transaction invoking `listGroupSubjects` 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) ListGroupSubjects(ns string, groupID *big.Int) (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "listGroupSubjects", ns, groupID) -} - -// ListGroupSubjectsTransaction creates a transaction invoking `listGroupSubjects` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) ListGroupSubjectsTransaction(ns string, groupID *big.Int) (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "listGroupSubjects", ns, groupID) -} - -// ListGroupSubjectsUnsigned creates a transaction invoking `listGroupSubjects` 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) ListGroupSubjectsUnsigned(ns string, groupID *big.Int) (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "listGroupSubjects", nil, ns, groupID) -} - -// ListGroups creates a transaction invoking `listGroups` 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) ListGroups(ns string) (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "listGroups", ns) -} - -// ListGroupsTransaction creates a transaction invoking `listGroups` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) ListGroupsTransaction(ns string) (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "listGroups", ns) -} - -// ListGroupsUnsigned creates a transaction invoking `listGroups` 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) ListGroupsUnsigned(ns string) (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "listGroups", nil, ns) -} - -// ListNamespaceSubjects creates a transaction invoking `listNamespaceSubjects` 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) ListNamespaceSubjects(ns string) (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "listNamespaceSubjects", ns) -} - -// ListNamespaceSubjectsTransaction creates a transaction invoking `listNamespaceSubjects` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) ListNamespaceSubjectsTransaction(ns string) (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "listNamespaceSubjects", ns) -} - -// ListNamespaceSubjectsUnsigned creates a transaction invoking `listNamespaceSubjects` 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) ListNamespaceSubjectsUnsigned(ns string) (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "listNamespaceSubjects", nil, ns) -} - -// ListNamespaces creates a transaction invoking `listNamespaces` 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) ListNamespaces() (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "listNamespaces") -} - -// ListNamespacesTransaction creates a transaction invoking `listNamespaces` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) ListNamespacesTransaction() (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "listNamespaces") -} - -// ListNamespacesUnsigned creates a transaction invoking `listNamespaces` 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) ListNamespacesUnsigned() (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "listNamespaces", nil) -} - -// ListSubjects creates a transaction invoking `listSubjects` 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) ListSubjects() (util.Uint256, uint32, error) { - return c.actor.SendCall(c.hash, "listSubjects") -} - -// ListSubjectsTransaction creates a transaction invoking `listSubjects` method of the contract. -// This transaction is signed, but not sent to the network, instead it's -// returned to the caller. -func (c *Contract) ListSubjectsTransaction() (*transaction.Transaction, error) { - return c.actor.MakeCall(c.hash, "listSubjects") -} - -// ListSubjectsUnsigned creates a transaction invoking `listSubjects` 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) ListSubjectsUnsigned() (*transaction.Transaction, error) { - return c.actor.MakeUnsignedCall(c.hash, "listSubjects", nil) -} - // RemoveSubjectFromGroup creates a transaction invoking `removeSubjectFromGroup` 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.