nameservice

package
v0.19.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package nameservice contains RPC wrappers for NameService contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor interface {
	Invoker

	nep11.Actor

	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
	nep11.BaseWriter
	// contains filtered or unexported fields
}

Contract implements all contract methods.

func New

func New(actor Actor, hash util.Uint160) *Contract

New creates an instance of Contract using provided contract hash and the given Actor.

func (*Contract) AddRecord

func (c *Contract) AddRecord(name string, typ *big.Int, data string) (util.Uint256, uint32, error)

AddRecord creates a transaction invoking `addRecord` 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) AddRecordTransaction

func (c *Contract) AddRecordTransaction(name string, typ *big.Int, data string) (*transaction.Transaction, error)

AddRecordTransaction creates a transaction invoking `addRecord` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) AddRecordUnsigned

func (c *Contract) AddRecordUnsigned(name string, typ *big.Int, data string) (*transaction.Transaction, error)

AddRecordUnsigned creates a transaction invoking `addRecord` 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) DeleteRecords

func (c *Contract) DeleteRecords(name string, typ *big.Int) (util.Uint256, uint32, error)

DeleteRecords creates a transaction invoking `deleteRecords` 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) DeleteRecordsTransaction

func (c *Contract) DeleteRecordsTransaction(name string, typ *big.Int) (*transaction.Transaction, error)

DeleteRecordsTransaction creates a transaction invoking `deleteRecords` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) DeleteRecordsUnsigned

func (c *Contract) DeleteRecordsUnsigned(name string, typ *big.Int) (*transaction.Transaction, error)

DeleteRecordsUnsigned creates a transaction invoking `deleteRecords` 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) GetAllRecords

func (c *Contract) GetAllRecords(name string) (util.Uint256, uint32, error)

GetAllRecords creates a transaction invoking `getAllRecords` 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) GetAllRecordsTransaction

func (c *Contract) GetAllRecordsTransaction(name string) (*transaction.Transaction, error)

GetAllRecordsTransaction creates a transaction invoking `getAllRecords` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) GetAllRecordsUnsigned

func (c *Contract) GetAllRecordsUnsigned(name string) (*transaction.Transaction, error)

GetAllRecordsUnsigned creates a transaction invoking `getAllRecords` 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) Register

func (c *Contract) Register(name string, owner util.Uint160, email string, refresh *big.Int, retry *big.Int, expire *big.Int, ttl *big.Int) (util.Uint256, uint32, error)

Register creates a transaction invoking `register` 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) RegisterTransaction

func (c *Contract) RegisterTransaction(name string, owner util.Uint160, email string, refresh *big.Int, retry *big.Int, expire *big.Int, ttl *big.Int) (*transaction.Transaction, error)

RegisterTransaction creates a transaction invoking `register` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) RegisterUnsigned

func (c *Contract) RegisterUnsigned(name string, owner util.Uint160, email string, refresh *big.Int, retry *big.Int, expire *big.Int, ttl *big.Int) (*transaction.Transaction, error)

RegisterUnsigned creates a transaction invoking `register` 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) Renew

func (c *Contract) Renew(name string) (util.Uint256, uint32, error)

Renew creates a transaction invoking `renew` 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) RenewTransaction

func (c *Contract) RenewTransaction(name string) (*transaction.Transaction, error)

RenewTransaction creates a transaction invoking `renew` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) RenewUnsigned

func (c *Contract) RenewUnsigned(name string) (*transaction.Transaction, error)

RenewUnsigned creates a transaction invoking `renew` 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

func (c *Contract) SetAdmin(name string, admin util.Uint160) (util.Uint256, uint32, error)

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(name string, admin 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(name string, admin 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) SetPrice

func (c *Contract) SetPrice(price *big.Int) (util.Uint256, uint32, error)

SetPrice creates a transaction invoking `setPrice` 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) SetPriceTransaction

func (c *Contract) SetPriceTransaction(price *big.Int) (*transaction.Transaction, error)

SetPriceTransaction creates a transaction invoking `setPrice` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) SetPriceUnsigned

func (c *Contract) SetPriceUnsigned(price *big.Int) (*transaction.Transaction, error)

SetPriceUnsigned creates a transaction invoking `setPrice` 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) SetRecord

func (c *Contract) SetRecord(name string, typ *big.Int, id *big.Int, data string) (util.Uint256, uint32, error)

SetRecord creates a transaction invoking `setRecord` 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) SetRecordTransaction

func (c *Contract) SetRecordTransaction(name string, typ *big.Int, id *big.Int, data string) (*transaction.Transaction, error)

SetRecordTransaction creates a transaction invoking `setRecord` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) SetRecordUnsigned

func (c *Contract) SetRecordUnsigned(name string, typ *big.Int, id *big.Int, data string) (*transaction.Transaction, error)

SetRecordUnsigned creates a transaction invoking `setRecord` 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

func (c *Contract) Update(nef []byte, manifest string, data any) (util.Uint256, uint32, error)

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) UpdateSOA

func (c *Contract) UpdateSOA(name string, email string, refresh *big.Int, retry *big.Int, expire *big.Int, ttl *big.Int) (util.Uint256, uint32, error)

UpdateSOA creates a transaction invoking `updateSOA` 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) UpdateSOATransaction

func (c *Contract) UpdateSOATransaction(name string, email string, refresh *big.Int, retry *big.Int, expire *big.Int, ttl *big.Int) (*transaction.Transaction, error)

UpdateSOATransaction creates a transaction invoking `updateSOA` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) UpdateSOAUnsigned

func (c *Contract) UpdateSOAUnsigned(name string, email string, refresh *big.Int, retry *big.Int, expire *big.Int, ttl *big.Int) (*transaction.Transaction, error)

UpdateSOAUnsigned creates a transaction invoking `updateSOA` 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) UpdateTransaction

func (c *Contract) UpdateTransaction(nef []byte, manifest string, 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

func (c *Contract) UpdateUnsigned(nef []byte, manifest string, 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 {
	nep11.NonDivisibleReader
	// 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) GetPrice

func (c *ContractReader) GetPrice() (*big.Int, error)

GetPrice invokes `getPrice` method of contract.

func (*ContractReader) GetRecords

func (c *ContractReader) GetRecords(name string, typ *big.Int) ([]stackitem.Item, error)

GetRecords invokes `getRecords` method of contract.

func (*ContractReader) IsAvailable

func (c *ContractReader) IsAvailable(name string) (bool, error)

IsAvailable invokes `isAvailable` method of contract.

func (*ContractReader) Resolve

func (c *ContractReader) Resolve(name string, typ *big.Int) ([]stackitem.Item, error)

Resolve invokes `resolve` method of contract.

func (*ContractReader) Roots

func (c *ContractReader) Roots() (uuid.UUID, result.Iterator, error)

Roots invokes `roots` method of contract.

func (*ContractReader) RootsExpanded

func (c *ContractReader) RootsExpanded(_numOfIteratorItems int) ([]stackitem.Item, error)

RootsExpanded is similar to Roots (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) Version

func (c *ContractReader) Version() (*big.Int, error)

Version invokes `version` method of contract.

type Invoker

type Invoker interface {
	nep11.Invoker
}

Invoker is used by ContractReader to call various safe methods.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL