mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-02-05 05:24:24 +00:00
b2bd8e4a0a
Close #3451 Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
57 lines
3.1 KiB
Text
57 lines
3.1 KiB
Text
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
|
|
|
|
// Package royalty contains RPC wrappers for Test royalty contract.
|
|
package royalty
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
"math/big"
|
|
)
|
|
|
|
// Hash contains contract hash.
|
|
var Hash = util.Uint160{0x33, 0x22, 0x11, 0x0, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x0}
|
|
|
|
// Actor is used by Contract to call state-changing methods.
|
|
type Actor interface {
|
|
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)
|
|
}
|
|
|
|
// Contract implements all contract methods.
|
|
type Contract struct {
|
|
actor Actor
|
|
hash util.Uint160
|
|
}
|
|
|
|
// New creates an instance of Contract using Hash and the given Actor.
|
|
func New(actor Actor) *Contract {
|
|
var hash = Hash
|
|
return &Contract{actor, hash}
|
|
}
|
|
|
|
// RoyaltiesTransferred creates a transaction invoking `royaltiesTransferred` 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) RoyaltiesTransferred(royaltyToken util.Uint160, royaltyRecipient util.Uint160, buyer util.Uint160, tokenId []byte, amount *big.Int) (util.Uint256, uint32, error) {
|
|
return c.actor.SendCall(c.hash, "royaltiesTransferred", royaltyToken, royaltyRecipient, buyer, tokenId, amount)
|
|
}
|
|
|
|
// RoyaltiesTransferredTransaction creates a transaction invoking `royaltiesTransferred` method of the contract.
|
|
// This transaction is signed, but not sent to the network, instead it's
|
|
// returned to the caller.
|
|
func (c *Contract) RoyaltiesTransferredTransaction(royaltyToken util.Uint160, royaltyRecipient util.Uint160, buyer util.Uint160, tokenId []byte, amount *big.Int) (*transaction.Transaction, error) {
|
|
return c.actor.MakeCall(c.hash, "royaltiesTransferred", royaltyToken, royaltyRecipient, buyer, tokenId, amount)
|
|
}
|
|
|
|
// RoyaltiesTransferredUnsigned creates a transaction invoking `royaltiesTransferred` 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) RoyaltiesTransferredUnsigned(royaltyToken util.Uint160, royaltyRecipient util.Uint160, buyer util.Uint160, tokenId []byte, amount *big.Int) (*transaction.Transaction, error) {
|
|
return c.actor.MakeUnsignedCall(c.hash, "royaltiesTransferred", nil, royaltyToken, royaltyRecipient, buyer, tokenId, amount)
|
|
}
|