nns

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: GPL-3.0 Imports: 11 Imported by: 2

Documentation

Overview

Package nns contains non-divisible non-fungible NEP11-compatible token implementation. This token is a compatible analogue of C# Neo Name Service token and is aimed to serve as a domain name service for Neo smart-contracts, thus it's NeoNameService. This token can be minted with new domain name registration, the domain name itself is your NFT. Corresponding domain root must be added by committee before a new domain name can be registered.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRecord

func AddRecord(name string, typ RecordType, data string)

AddRecord adds a new record of the specified type to the provided domain.

func BalanceOf

func BalanceOf(owner interop.Hash160) int

BalanceOf returns the overall number of domains owned by the specified owner.

func Decimals

func Decimals() int

Decimals returns NeoNameService decimals.

func DeleteRecords

func DeleteRecords(name string, typ RecordType)

DeleteRecords removes domain records with the specified type.

func GetAllRecords

func GetAllRecords(name string) iterator.Iterator

GetAllRecords returns an Iterator with RecordState items for the given name.

func GetPrice

func GetPrice() int

GetPrice returns the domain registration price.

func GetRecords

func GetRecords(name string, typ RecordType) []string

GetRecords returns domain record of the specified type if it exists or an empty string if not.

func IsAvailable

func IsAvailable(name string) bool

IsAvailable checks whether the provided domain name is available.

func OwnerOf

func OwnerOf(tokenID []byte) interop.Hash160

OwnerOf returns the owner of the specified domain.

func Properties

func Properties(tokenID []byte) map[string]any

Properties returns a domain name and an expiration date of the specified domain.

func Register

func Register(name string, owner interop.Hash160, email string, refresh, retry, expire, ttl int) bool

Register registers a new domain with the specified owner and name if it's available.

func Renew

func Renew(name string) int64

Renew increases domain expiration date.

func Resolve

func Resolve(name string, typ RecordType) []string

Resolve resolves given name (not more then three redirects are allowed).

func Roots

func Roots() iterator.Iterator

Roots returns iterator over a set of NameService roots.

func SetAdmin

func SetAdmin(name string, admin interop.Hash160)

SetAdmin updates domain admin.

func SetPrice

func SetPrice(price int64)

SetPrice sets the domain registration price.

func SetRecord

func SetRecord(name string, typ RecordType, id byte, data string)

SetRecord adds a new record of the specified type to the provided domain.

func Symbol

func Symbol() string

Symbol returns NeoNameService symbol.

func Tokens

func Tokens() iterator.Iterator

Tokens returns iterator over a set of all registered domain names.

func TokensOf

func TokensOf(owner interop.Hash160) iterator.Iterator

TokensOf returns iterator over minted domains owned by the specified owner.

func TotalSupply

func TotalSupply() int

TotalSupply returns the overall number of domains minted by NeoNameService contract.

func Transfer

func Transfer(to interop.Hash160, tokenID []byte, data any) bool

Transfer transfers the domain with the specified name to a new owner.

func Update

func Update(nef []byte, manifest string, data any)

Update updates NameService contract.

func UpdateSOA

func UpdateSOA(name, email string, refresh, retry, expire, ttl int)

UpdateSOA updates soa record.

func Version

func Version() int

Version returns the version of the contract.

Types

type NameState

type NameState struct {
	Owner      interop.Hash160
	Name       string
	Expiration int64
	Admin      interop.Hash160
}

NameState represents domain name state.

type RecordState

type RecordState struct {
	Name string
	Type RecordType
	Data string
	ID   byte
}

RecordState is a type that registered entities are saved to.

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
	// SOA represents start of authority record type.
	SOA RecordType = 6
	// 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)

Jump to

Keyboard shortcuts

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