nns

package
v0.96.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 10 Imported by: 1

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 the committee before new domain name can be registered.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRoot

func AddRoot(root string)

AddRoot registers new root.

func BalanceOf

func BalanceOf(owner interop.Hash160) int

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

func Decimals

func Decimals() int

Decimals returns NeoNameService decimals.

func DeleteRecord

func DeleteRecord(name string, typ RecordType)

DeleteRecord removes domain record with the specified type.

func GetPrice

func GetPrice() int

GetPrice returns the domain registration price.

func GetRecord

func GetRecord(name string, typ RecordType) string

GetRecord 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 provided domain name is available.

func OwnerOf

func OwnerOf(tokenID []byte) interop.Hash160

OwnerOf returns owner of the specified domain.

func Properties

func Properties(tokenID []byte) map[string]interface{}

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

func Register

func Register(name string, owner interop.Hash160) bool

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

func Renew

func Renew(name string) int

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

SetPrice sets the domain registration price.

func SetRecord

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

SetRecord adds 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 overall number of domains minted by the NeoNameService contract.

func Transfer

func Transfer(to interop.Hash160, tokenID []byte, data interface{}) bool

Transfer transfers domain with the specified name to new owner.

func Update

func Update(nef []byte, manifest string)

Update updates NameService contract.

Types

type NameState

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

NameState represents domain name state.

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 defined in [RFC 1035](https://tools.ietf.org/html/rfc1035)

const (
	// AAAA represents IPv6 address record type.
	AAAA RecordType = 28
)

Record types 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