nameservice

package
v0.21.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: GPL-3.0 Imports: 12 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 AddRecordEvent added in v0.20.0

type AddRecordEvent struct {
	Name string
	Type *big.Int
}

AddRecordEvent represents "AddRecord" event emitted by the contract.

func AddRecordEventsFromApplicationLog added in v0.20.0

func AddRecordEventsFromApplicationLog(log *result.ApplicationLog) ([]*AddRecordEvent, error)

AddRecordEventsFromApplicationLog retrieves a set of all emitted events with "AddRecord" name from the provided result.ApplicationLog.

func (*AddRecordEvent) FromStackItem added in v0.20.0

func (e *AddRecordEvent) FromStackItem(item *stackitem.Array) error

FromStackItem converts provided stackitem.Array to AddRecordEvent or returns an error if it's not possible to do to so.

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) DeleteDomain added in v0.20.0

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

DeleteDomain creates a transaction invoking `deleteDomain` 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) DeleteDomainTransaction added in v0.20.0

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

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

func (*Contract) DeleteDomainUnsigned added in v0.20.0

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

DeleteDomainUnsigned creates a transaction invoking `deleteDomain` 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) DeleteRecord added in v0.20.0

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

DeleteRecord creates a transaction invoking `deleteRecord` 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) DeleteRecordTransaction added in v0.20.0

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

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

func (*Contract) DeleteRecordUnsigned added in v0.20.0

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

DeleteRecordUnsigned creates a transaction invoking `deleteRecord` 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 DeleteDomainEvent added in v0.20.0

type DeleteDomainEvent struct {
	Name string
}

DeleteDomainEvent represents "DeleteDomain" event emitted by the contract.

func DeleteDomainEventsFromApplicationLog added in v0.20.0

func DeleteDomainEventsFromApplicationLog(log *result.ApplicationLog) ([]*DeleteDomainEvent, error)

DeleteDomainEventsFromApplicationLog retrieves a set of all emitted events with "DeleteDomain" name from the provided result.ApplicationLog.

func (*DeleteDomainEvent) FromStackItem added in v0.20.0

func (e *DeleteDomainEvent) FromStackItem(item *stackitem.Array) error

FromStackItem converts provided stackitem.Array to DeleteDomainEvent or returns an error if it's not possible to do to so.

type DeleteRecordEvent added in v0.20.0

type DeleteRecordEvent struct {
	Name string
	Type *big.Int
}

DeleteRecordEvent represents "DeleteRecord" event emitted by the contract.

func DeleteRecordEventsFromApplicationLog added in v0.20.0

func DeleteRecordEventsFromApplicationLog(log *result.ApplicationLog) ([]*DeleteRecordEvent, error)

DeleteRecordEventsFromApplicationLog retrieves a set of all emitted events with "DeleteRecord" name from the provided result.ApplicationLog.

func (*DeleteRecordEvent) FromStackItem added in v0.20.0

func (e *DeleteRecordEvent) FromStackItem(item *stackitem.Array) error

FromStackItem converts provided stackitem.Array to DeleteRecordEvent or returns an error if it's not possible to do to so.

type DeleteRecordsEvent added in v0.20.0

type DeleteRecordsEvent struct {
	Name string
	Type *big.Int
}

DeleteRecordsEvent represents "DeleteRecords" event emitted by the contract.

func DeleteRecordsEventsFromApplicationLog added in v0.20.0

func DeleteRecordsEventsFromApplicationLog(log *result.ApplicationLog) ([]*DeleteRecordsEvent, error)

DeleteRecordsEventsFromApplicationLog retrieves a set of all emitted events with "DeleteRecords" name from the provided result.ApplicationLog.

func (*DeleteRecordsEvent) FromStackItem added in v0.20.0

func (e *DeleteRecordsEvent) FromStackItem(item *stackitem.Array) error

FromStackItem converts provided stackitem.Array to DeleteRecordsEvent or returns an error if it's not possible to do to so.

type Invoker

type Invoker interface {
	nep11.Invoker
}

Invoker is used by ContractReader to call various safe methods.

type RegisterDomainEvent added in v0.20.0

type RegisterDomainEvent struct {
	Name string
}

RegisterDomainEvent represents "RegisterDomain" event emitted by the contract.

func RegisterDomainEventsFromApplicationLog added in v0.20.0

func RegisterDomainEventsFromApplicationLog(log *result.ApplicationLog) ([]*RegisterDomainEvent, error)

RegisterDomainEventsFromApplicationLog retrieves a set of all emitted events with "RegisterDomain" name from the provided result.ApplicationLog.

func (*RegisterDomainEvent) FromStackItem added in v0.20.0

func (e *RegisterDomainEvent) FromStackItem(item *stackitem.Array) error

FromStackItem converts provided stackitem.Array to RegisterDomainEvent or returns an error if it's not possible to do to so.

Jump to

Keyboard shortcuts

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