Documentation ¶
Overview ¶
Package nns provide RPC wrappers for the non-native NNS contract. This is Neo N3 NNS contract wrapper, the source code of the contract can be found here: https://github.com/neo-project/non-native-contracts/blob/8d72b92e5e5705d763232bcc24784ced0fb8fc87/src/NameService/NameService.cs
Index ¶
- Constants
- type Actor
- type Contract
- func (c *Contract) AddRoot(root string) (util.Uint256, uint32, error)
- func (c *Contract) AddRootTransaction(root string) (*transaction.Transaction, error)
- func (c *Contract) AddRootUnsigned(root string) (*transaction.Transaction, error)
- func (c *Contract) DeleteRecord(name string, typev RecordType) (util.Uint256, uint32, error)
- func (c *Contract) DeleteRecordTransaction(name string, typev RecordType) (*transaction.Transaction, error)
- func (c *Contract) DeleteRecordUnsigned(name string, typev RecordType) (*transaction.Transaction, error)
- func (c *Contract) Register(name string, owner util.Uint160) (util.Uint256, uint32, error)
- func (c *Contract) RegisterTransaction(name string, owner util.Uint160) (*transaction.Transaction, error)
- func (c *Contract) RegisterUnsigned(name string, owner util.Uint160) (*transaction.Transaction, error)
- func (c *Contract) Renew(name string) (util.Uint256, uint32, error)
- func (c *Contract) Renew2(name string, years int64) (util.Uint256, uint32, error)
- func (c *Contract) Renew2Transaction(name string, years int64) (*transaction.Transaction, error)
- func (c *Contract) Renew2Unsigned(name string, years int64) (*transaction.Transaction, error)
- func (c *Contract) RenewTransaction(name string) (*transaction.Transaction, error)
- func (c *Contract) RenewUnsigned(name string) (*transaction.Transaction, error)
- func (c *Contract) SetAdmin(name string, admin util.Uint160) (util.Uint256, uint32, error)
- func (c *Contract) SetAdminTransaction(name string, admin util.Uint160) (*transaction.Transaction, error)
- func (c *Contract) SetAdminUnsigned(name string, admin util.Uint160) (*transaction.Transaction, error)
- func (c *Contract) SetPrice(priceList []int64) (util.Uint256, uint32, error)
- func (c *Contract) SetPriceTransaction(priceList []int64) (*transaction.Transaction, error)
- func (c *Contract) SetPriceUnsigned(priceList []int64) (*transaction.Transaction, error)
- func (c *Contract) SetRecord(name string, typev RecordType, data string) (util.Uint256, uint32, error)
- func (c *Contract) SetRecordTransaction(name string, typev RecordType, data string) (*transaction.Transaction, error)
- func (c *Contract) SetRecordUnsigned(name string, typev RecordType, data string) (*transaction.Transaction, error)
- func (c *Contract) Update(nef []byte, manifest string) (util.Uint256, uint32, error)
- func (c *Contract) UpdateTransaction(nef []byte, manifest string) (*transaction.Transaction, error)
- func (c *Contract) UpdateUnsigned(nef []byte, manifest string) (*transaction.Transaction, error)
- type ContractReader
- func (c *ContractReader) GetAllRecords(name string) (*RecordIterator, error)
- func (c *ContractReader) GetAllRecordsExpanded(name string, _numOfIteratorItems int) ([]RecordState, error)
- func (c *ContractReader) GetPrice(length uint8) (*big.Int, error)
- func (c *ContractReader) GetRecord(name string, typev RecordType) (string, error)
- func (c *ContractReader) IsAvailable(name string) (bool, error)
- func (c *ContractReader) Resolve(name string, typev RecordType) (string, error)
- func (c *ContractReader) Roots() (*RootIterator, error)
- func (c *ContractReader) RootsExpanded(_numOfIteratorItems int) ([]string, error)
- type Invoker
- type RecordIterator
- type RecordState
- type RecordType
- type RenewEvent
- type RootIterator
- type SetAdminEvent
Constants ¶
const MaxNameLength = 255
MaxNameLength is the max length of domain name.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actor ¶ added in v0.106.0
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 ¶ added in v0.106.0
type Contract struct { ContractReader nep11.BaseWriter // contains filtered or unexported fields }
Contract provides full NeoNameService interface, both safe and state-changing methods.
func New ¶ added in v0.106.0
New creates an instance of Contract using provided contract hash and the given Actor.
func (*Contract) AddRoot ¶ added in v0.106.0
AddRoot creates a transaction invoking `addRoot` 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) AddRootTransaction ¶ added in v0.106.0
func (c *Contract) AddRootTransaction(root string) (*transaction.Transaction, error)
AddRootTransaction creates a transaction invoking `addRoot` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.
func (*Contract) AddRootUnsigned ¶ added in v0.106.0
func (c *Contract) AddRootUnsigned(root string) (*transaction.Transaction, error)
AddRootUnsigned creates a transaction invoking `addRoot` 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.106.0
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.106.0
func (c *Contract) DeleteRecordTransaction(name string, typev RecordType) (*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.106.0
func (c *Contract) DeleteRecordUnsigned(name string, typev RecordType) (*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) Register ¶ added in v0.106.0
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 ¶ added in v0.106.0
func (c *Contract) RegisterTransaction(name string, owner util.Uint160) (*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 ¶ added in v0.106.0
func (c *Contract) RegisterUnsigned(name string, owner util.Uint160) (*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 ¶ added in v0.106.0
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) Renew2 ¶ added in v0.106.0
Renew2 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) Renew2Transaction ¶ added in v0.106.0
func (c *Contract) Renew2Transaction(name string, years int64) (*transaction.Transaction, error)
Renew2Transaction 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) Renew2Unsigned ¶ added in v0.106.0
func (c *Contract) Renew2Unsigned(name string, years int64) (*transaction.Transaction, error)
Renew2Unsigned 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) RenewTransaction ¶ added in v0.106.0
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 ¶ added in v0.106.0
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 ¶ added in v0.106.0
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 ¶ added in v0.106.0
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 ¶ added in v0.106.0
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 ¶ added in v0.106.0
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 ¶ added in v0.106.0
func (c *Contract) SetPriceTransaction(priceList []int64) (*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 ¶ added in v0.106.0
func (c *Contract) SetPriceUnsigned(priceList []int64) (*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 ¶ added in v0.106.0
func (c *Contract) SetRecord(name string, typev RecordType, 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 ¶ added in v0.106.0
func (c *Contract) SetRecordTransaction(name string, typev RecordType, 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 ¶ added in v0.106.0
func (c *Contract) SetRecordUnsigned(name string, typev RecordType, 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 ¶ added in v0.106.0
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.106.0
func (c *Contract) UpdateTransaction(nef []byte, manifest string) (*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.106.0
func (c *Contract) UpdateUnsigned(nef []byte, manifest string) (*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 ¶ added in v0.99.3
type ContractReader struct { nep11.NonDivisibleReader // contains filtered or unexported fields }
ContractReader implements safe contract methods.
func NewReader ¶ added in v0.99.3
func NewReader(invoker Invoker, hash util.Uint160) *ContractReader
NewReader creates an instance of ContractReader using provided contract hash and the given Invoker.
func (*ContractReader) GetAllRecords ¶ added in v0.99.3
func (c *ContractReader) GetAllRecords(name string) (*RecordIterator, error)
GetAllRecords invokes `getAllRecords` method of contract.
func (*ContractReader) GetAllRecordsExpanded ¶ added in v0.99.3
func (c *ContractReader) GetAllRecordsExpanded(name string, _numOfIteratorItems int) ([]RecordState, error)
GetAllRecordsExpanded is similar to GetAllRecords (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) GetPrice ¶ added in v0.99.3
func (c *ContractReader) GetPrice(length uint8) (*big.Int, error)
GetPrice invokes `getPrice` method of contract.
func (*ContractReader) GetRecord ¶ added in v0.106.0
func (c *ContractReader) GetRecord(name string, typev RecordType) (string, error)
GetRecord invokes `getRecord` method of contract.
func (*ContractReader) IsAvailable ¶ added in v0.99.3
func (c *ContractReader) IsAvailable(name string) (bool, error)
IsAvailable invokes `isAvailable` method of contract.
func (*ContractReader) Resolve ¶ added in v0.99.3
func (c *ContractReader) Resolve(name string, typev RecordType) (string, error)
Resolve invokes `resolve` method of contract.
func (*ContractReader) Roots ¶ added in v0.106.0
func (c *ContractReader) Roots() (*RootIterator, error)
Roots invokes `roots` method of contract.
func (*ContractReader) RootsExpanded ¶ added in v0.106.0
func (c *ContractReader) RootsExpanded(_numOfIteratorItems int) ([]string, 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.
type RecordIterator ¶ added in v0.99.3
type RecordIterator struct {
// contains filtered or unexported fields
}
RecordIterator is used for iterating over GetAllRecords results.
func (*RecordIterator) Next ¶ added in v0.99.3
func (r *RecordIterator) Next(num int) ([]RecordState, error)
Next returns the next set of elements from the iterator (up to num of them). It can return less than num elements in case iterator doesn't have that many or zero elements if the iterator has no more elements or the session is expired.
func (*RecordIterator) Terminate ¶ added in v0.99.3
func (r *RecordIterator) Terminate() error
Terminate closes the iterator session used by RecordIterator (if it's session-based).
type RecordState ¶
type RecordState struct { Name string Type RecordType Data string }
RecordState is a type that registered entities are saved as.
func (*RecordState) FromStackItem ¶ added in v0.99.3
func (r *RecordState) FromStackItem(itm stackitem.Item) error
FromStackItem fills RecordState with data from the given stack item if it can be correctly converted to RecordState.
type RecordType ¶
type RecordType byte
RecordType is domain name service record types.
const ( // A represents address record type. A RecordType = 1 // CNAME represents canonical name record type. CNAME RecordType = 5 // TXT represents text record type. TXT RecordType = 16 )
Record types are defined in [RFC 1035](https://tools.ietf.org/html/rfc1035)
const ( // AAAA represents IPv6 address record type. AAAA RecordType = 28 )
Record types are defined in [RFC 3596](https://tools.ietf.org/html/rfc3596)
func (RecordType) ToSCParameter ¶ added in v0.106.0
func (r RecordType) ToSCParameter() (smartcontract.Parameter, error)
ToSCParameter implements smartcontract.Convertible interface.
type RenewEvent ¶ added in v0.106.0
RenewEvent represents "Renew" event emitted by the contract.
func RenewEventsFromApplicationLog ¶ added in v0.106.0
func RenewEventsFromApplicationLog(log *result.ApplicationLog) ([]*RenewEvent, error)
RenewEventsFromApplicationLog retrieves a set of all emitted events with "Renew" name from the provided result.ApplicationLog.
func (*RenewEvent) FromStackItem ¶ added in v0.106.0
func (e *RenewEvent) FromStackItem(item *stackitem.Array) error
FromStackItem converts provided stackitem.Array to RenewEvent or returns an error if it's not possible to do to so.
type RootIterator ¶ added in v0.106.0
type RootIterator struct {
// contains filtered or unexported fields
}
RootIterator is used for iterating over Roots results.
func (*RootIterator) Next ¶ added in v0.106.0
func (r *RootIterator) Next(num int) ([]string, error)
Next returns the next set of elements from the iterator (up to num of them). It can return less than num elements in case iterator doesn't have that many or zero elements if the iterator has no more elements or the session is expired.
func (*RootIterator) Terminate ¶ added in v0.106.0
func (r *RootIterator) Terminate() error
Terminate closes the iterator session used by RootIterator (if it's session-based).
type SetAdminEvent ¶ added in v0.106.0
SetAdminEvent represents "SetAdmin" event emitted by the contract.
func SetAdminEventsFromApplicationLog ¶ added in v0.106.0
func SetAdminEventsFromApplicationLog(log *result.ApplicationLog) ([]*SetAdminEvent, error)
SetAdminEventsFromApplicationLog retrieves a set of all emitted events with "SetAdmin" name from the provided result.ApplicationLog.
func (*SetAdminEvent) FromStackItem ¶ added in v0.106.0
func (e *SetAdminEvent) FromStackItem(item *stackitem.Array) error
FromStackItem converts provided stackitem.Array to SetAdminEvent or returns an error if it's not possible to do to so.