Documentation ¶
Overview ¶
Package ape contains RPC wrappers for APE contract.
Index ¶
- type Actor
- type Contract
- func (c *Contract) AddChain(entity *big.Int, entityName string, name []byte, chain []byte) (util.Uint256, uint32, error)
- func (c *Contract) AddChainTransaction(entity *big.Int, entityName string, name []byte, chain []byte) (*transaction.Transaction, error)
- func (c *Contract) AddChainUnsigned(entity *big.Int, entityName string, name []byte, chain []byte) (*transaction.Transaction, error)
- func (c *Contract) RemoveChain(entity *big.Int, entityName string, name []byte) (util.Uint256, uint32, error)
- func (c *Contract) RemoveChainTransaction(entity *big.Int, entityName string, name []byte) (*transaction.Transaction, error)
- func (c *Contract) RemoveChainUnsigned(entity *big.Int, entityName string, name []byte) (*transaction.Transaction, error)
- func (c *Contract) RemoveChainsByPrefix(entity *big.Int, entityName string, name []byte) (util.Uint256, uint32, error)
- func (c *Contract) RemoveChainsByPrefixTransaction(entity *big.Int, entityName string, name []byte) (*transaction.Transaction, error)
- func (c *Contract) RemoveChainsByPrefixUnsigned(entity *big.Int, entityName string, name []byte) (*transaction.Transaction, error)
- func (c *Contract) SetAdmin(addr util.Uint160) (util.Uint256, uint32, error)
- func (c *Contract) SetAdminTransaction(addr util.Uint160) (*transaction.Transaction, error)
- func (c *Contract) SetAdminUnsigned(addr util.Uint160) (*transaction.Transaction, error)
- func (c *Contract) Update(script []byte, manifest []byte, data any) (util.Uint256, uint32, error)
- func (c *Contract) UpdateTransaction(script []byte, manifest []byte, data any) (*transaction.Transaction, error)
- func (c *Contract) UpdateUnsigned(script []byte, manifest []byte, data any) (*transaction.Transaction, error)
- type ContractReader
- func (c *ContractReader) GetAdmin() (util.Uint160, error)
- func (c *ContractReader) GetChain(entity *big.Int, entityName string, name []byte) ([]byte, error)
- func (c *ContractReader) IteratorChainsByPrefix(entity *big.Int, entityName string, prefix []byte) (uuid.UUID, result.Iterator, error)
- func (c *ContractReader) IteratorChainsByPrefixExpanded(entity *big.Int, entityName string, prefix []byte, _numOfIteratorItems int) ([]stackitem.Item, error)
- func (c *ContractReader) ListChainNames(entity *big.Int, entityName string) (uuid.UUID, result.Iterator, error)
- func (c *ContractReader) ListChainNamesExpanded(entity *big.Int, entityName string, _numOfIteratorItems int) ([]stackitem.Item, error)
- func (c *ContractReader) ListChains(namespace string, container string, name []byte) ([]stackitem.Item, error)
- func (c *ContractReader) ListChainsByPrefix(entity *big.Int, entityName string, prefix []byte) ([]stackitem.Item, error)
- func (c *ContractReader) ListTargets(entity *big.Int) (uuid.UUID, result.Iterator, error)
- func (c *ContractReader) ListTargetsExpanded(entity *big.Int, _numOfIteratorItems int) ([]stackitem.Item, error)
- func (c *ContractReader) Version() (*big.Int, error)
- type Invoker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actor ¶
type Actor interface { Invoker MakeCall(contract util.Uint160, method string, params ...any) (*transaction.Transaction, error) MakeRun(script []byte) (*transaction.Transaction, error) MakeUnsignedCall(contract util.Uint160, method string, attrs []transaction.Attribute, params ...any) (*transaction.Transaction, error) MakeUnsignedRun(script []byte, attrs []transaction.Attribute) (*transaction.Transaction, error) SendCall(contract util.Uint160, method string, params ...any) (util.Uint256, uint32, error) SendRun(script []byte) (util.Uint256, uint32, error) }
Actor is used by Contract to call state-changing methods.
type Contract ¶
type Contract struct { ContractReader // contains filtered or unexported fields }
Contract implements all contract methods.
func (*Contract) AddChain ¶
func (c *Contract) AddChain(entity *big.Int, entityName string, name []byte, chain []byte) (util.Uint256, uint32, error)
AddChain creates a transaction invoking `addChain` 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 (*Contract) AddChainTransaction ¶
func (c *Contract) AddChainTransaction(entity *big.Int, entityName string, name []byte, chain []byte) (*transaction.Transaction, error)
AddChainTransaction creates a transaction invoking `addChain` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.
func (*Contract) AddChainUnsigned ¶
func (c *Contract) AddChainUnsigned(entity *big.Int, entityName string, name []byte, chain []byte) (*transaction.Transaction, error)
AddChainUnsigned creates a transaction invoking `addChain` 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 (*Contract) RemoveChain ¶
func (c *Contract) RemoveChain(entity *big.Int, entityName string, name []byte) (util.Uint256, uint32, error)
RemoveChain creates a transaction invoking `removeChain` 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 (*Contract) RemoveChainTransaction ¶
func (c *Contract) RemoveChainTransaction(entity *big.Int, entityName string, name []byte) (*transaction.Transaction, error)
RemoveChainTransaction creates a transaction invoking `removeChain` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.
func (*Contract) RemoveChainUnsigned ¶
func (c *Contract) RemoveChainUnsigned(entity *big.Int, entityName string, name []byte) (*transaction.Transaction, error)
RemoveChainUnsigned creates a transaction invoking `removeChain` 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 (*Contract) RemoveChainsByPrefix ¶
func (c *Contract) RemoveChainsByPrefix(entity *big.Int, entityName string, name []byte) (util.Uint256, uint32, error)
RemoveChainsByPrefix creates a transaction invoking `removeChainsByPrefix` 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 (*Contract) RemoveChainsByPrefixTransaction ¶
func (c *Contract) RemoveChainsByPrefixTransaction(entity *big.Int, entityName string, name []byte) (*transaction.Transaction, error)
RemoveChainsByPrefixTransaction creates a transaction invoking `removeChainsByPrefix` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.
func (*Contract) RemoveChainsByPrefixUnsigned ¶
func (c *Contract) RemoveChainsByPrefixUnsigned(entity *big.Int, entityName string, name []byte) (*transaction.Transaction, error)
RemoveChainsByPrefixUnsigned creates a transaction invoking `removeChainsByPrefix` 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 (*Contract) SetAdmin ¶
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 (*Contract) SetAdminTransaction ¶
func (c *Contract) SetAdminTransaction(addr util.Uint160) (*transaction.Transaction, error)
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 (*Contract) SetAdminUnsigned ¶
func (c *Contract) SetAdminUnsigned(addr util.Uint160) (*transaction.Transaction, error)
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 (*Contract) Update ¶ added in v0.19.2
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 (*Contract) UpdateTransaction ¶ added in v0.19.2
func (c *Contract) UpdateTransaction(script []byte, manifest []byte, data any) (*transaction.Transaction, error)
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 (*Contract) UpdateUnsigned ¶ added in v0.19.2
func (c *Contract) UpdateUnsigned(script []byte, manifest []byte, data any) (*transaction.Transaction, error)
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.
type ContractReader ¶
type ContractReader struct {
// contains filtered or unexported fields
}
ContractReader implements safe contract methods.
func NewReader ¶
func NewReader(invoker Invoker, hash util.Uint160) *ContractReader
NewReader creates an instance of ContractReader using provided contract hash and the given Invoker.
func (*ContractReader) GetAdmin ¶
func (c *ContractReader) GetAdmin() (util.Uint160, error)
GetAdmin invokes `getAdmin` method of contract.
func (*ContractReader) IteratorChainsByPrefix ¶
func (c *ContractReader) IteratorChainsByPrefix(entity *big.Int, entityName string, prefix []byte) (uuid.UUID, result.Iterator, error)
IteratorChainsByPrefix invokes `iteratorChainsByPrefix` method of contract.
func (*ContractReader) IteratorChainsByPrefixExpanded ¶
func (c *ContractReader) IteratorChainsByPrefixExpanded(entity *big.Int, entityName string, prefix []byte, _numOfIteratorItems int) ([]stackitem.Item, error)
IteratorChainsByPrefixExpanded is similar to IteratorChainsByPrefix (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 (*ContractReader) ListChainNames ¶ added in v0.20.0
func (c *ContractReader) ListChainNames(entity *big.Int, entityName string) (uuid.UUID, result.Iterator, error)
ListChainNames invokes `listChainNames` method of contract.
func (*ContractReader) ListChainNamesExpanded ¶ added in v0.20.0
func (c *ContractReader) ListChainNamesExpanded(entity *big.Int, entityName string, _numOfIteratorItems int) ([]stackitem.Item, error)
ListChainNamesExpanded is similar to ListChainNames (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 (*ContractReader) ListChains ¶
func (c *ContractReader) ListChains(namespace string, container string, name []byte) ([]stackitem.Item, error)
ListChains invokes `listChains` method of contract.
func (*ContractReader) ListChainsByPrefix ¶
func (c *ContractReader) ListChainsByPrefix(entity *big.Int, entityName string, prefix []byte) ([]stackitem.Item, error)
ListChainsByPrefix invokes `listChainsByPrefix` method of contract.
func (*ContractReader) ListTargets ¶
ListTargets invokes `listTargets` method of contract.
func (*ContractReader) ListTargetsExpanded ¶
func (c *ContractReader) ListTargetsExpanded(entity *big.Int, _numOfIteratorItems int) ([]stackitem.Item, error)
ListTargetsExpanded is similar to ListTargets (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.
type Invoker ¶
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) }
Invoker is used by ContractReader to call various safe methods.