Documentation ¶
Index ¶
- func DetectNamingService(domainName string) (string, error)
- func ZnsNameHash(domainName string) (string, error)
- type DomainNotConfiguredError
- type DomainNotRegisteredError
- type DomainNotSupportedError
- type InvalidDomainNameReturnedError
- type MetadataClient
- type MethodIsNotSupportedError
- type NamingService
- type TokenMetadata
- type TokenMetadataAttribute
- type Uns
- func (c *Uns) Addr(domainName string, ticker string) (string, error)
- func (c *Uns) AddrVersion(domainName string, ticker string, version string) (string, error)
- func (c *Uns) AllRecords(domainName string) (map[string]string, error)
- func (c *Uns) DNS(domainName string, types []dnsrecords.Type) ([]dnsrecords.Record, error)
- func (c *Uns) Data(domainName string, keys []string) (..., error)
- func (c *Uns) Email(domainName string) (string, error)
- func (c *Uns) HTTPUrl(domainName string) (string, error)
- func (c *Uns) IpfsHash(domainName string) (string, error)
- func (c *Uns) IsSupportedDomain(domainName string) (bool, error)
- func (c *Uns) Namehash(domainName string) (string, error)
- func (c *Uns) Owner(domainName string) (string, error)
- func (c *Uns) Record(domainName string, key string) (string, error)
- func (c *Uns) Records(domainName string, keys []string) (map[string]string, error)
- func (c *Uns) Resolver(domainName string) (string, error)
- func (c *Uns) TokenURI(domainName string) (string, error)
- func (c *Uns) TokenURIMetadata(domainName string) (TokenMetadata, error)
- func (c *Uns) Unhash(domainHash string) (string, error)
- type UnsBuilder
- type Zns
- func (z *Zns) Addr(domainName string, ticker string) (string, error)
- func (z *Zns) AddrVersion(domainName string, ticker string, version string) (string, error)
- func (z *Zns) AllRecords(domainName string) (map[string]string, error)
- func (z *Zns) DNS(domainName string, types []dnsrecords.Type) ([]dnsrecords.Record, error)
- func (z *Zns) Email(domainName string) (string, error)
- func (z *Zns) HTTPUrl(domainName string) (string, error)
- func (z *Zns) IpfsHash(domainName string) (string, error)
- func (z *Zns) IsSupportedDomain(domainName string) (bool, error)
- func (z *Zns) Namehash(domainName string) (string, error)
- func (z *Zns) Owner(domainName string) (string, error)
- func (z *Zns) Record(domainName string, key string) (string, error)
- func (z *Zns) Records(domainName string, keys []string) (map[string]string, error)
- func (z *Zns) Resolver(domainName string) (string, error)
- func (z *Zns) State(domainName string) (*ZnsDomainState, error)
- func (z *Zns) TokenURI(_ string) (string, error)
- func (z *Zns) TokenURIMetadata(_ string) (TokenMetadata, error)
- func (z *Zns) Unhash(_ string) (string, error)
- type ZnsBuilder
- type ZnsDomainState
- type ZnsProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectNamingService ¶
DetectNamingService helper to detect naming service type for provided domain. Returns ZNS or UNS for valid domain and error if domain is not valid or not supported by resolution-go library.
func ZnsNameHash ¶
ZnsNameHash Namehash for .zil domains
Types ¶
type DomainNotConfiguredError ¶
type DomainNotConfiguredError struct {
DomainName string
}
DomainNotConfiguredError Error when domain does not have a resolver set
func (*DomainNotConfiguredError) Error ¶
func (e *DomainNotConfiguredError) Error() string
type DomainNotRegisteredError ¶
DomainNotRegisteredError Error when domain is missing an owner
func (*DomainNotRegisteredError) Error ¶
func (e *DomainNotRegisteredError) Error() string
type DomainNotSupportedError ¶
type DomainNotSupportedError struct {
DomainName string
}
DomainNotSupportedError Error when domain is not supported by the naming service
func (*DomainNotSupportedError) Error ¶
func (e *DomainNotSupportedError) Error() string
type InvalidDomainNameReturnedError ¶ added in v1.1.2
InvalidDomainNameReturnedError Error when ERC721 metadata provides returns incorrect domain name
func (*InvalidDomainNameReturnedError) Error ¶ added in v1.1.2
func (e *InvalidDomainNameReturnedError) Error() string
type MetadataClient ¶ added in v1.1.2
type MethodIsNotSupportedError ¶ added in v1.1.2
type MethodIsNotSupportedError struct {
NamingServiceName string
}
MethodIsNotSupportedError Error when naming services does not support called method
func (*MethodIsNotSupportedError) Error ¶ added in v1.1.2
func (e *MethodIsNotSupportedError) Error() string
type NamingService ¶
type NamingService interface { // Records Retrieve records of domain. // Keys must be provided in raw format according to specification. // Keys specification: https://docs.unstoppabledomains.com/domain-registry-essentials/records-reference. // Supported keys reference: https://github.com/unstoppabledomains/dot-crypto/blob/master/src/supported-keys/supported-keys.json. // It returns key-value map of specified keys set on provided domain. Map can contain empty strings if keys are not found. Records(domainName string, keys []string) (map[string]string, error) // Record Retrieve single record of domain. // Keys must be provided in raw format according to specification. // Keys specification: https://docs.unstoppabledomains.com/domain-registry-essentials/records-reference. // Supported keys reference: https://github.com/unstoppabledomains/dot-crypto/blob/master/src/supported-keys/supported-keys.json. // Returns result in string or empty string if no result found. Record(domainName string, key string) (string, error) // Addr Retrieve the value of domain's currency ticker. // Ticker must contain cryptocurrency like: BTC, ETH. // Returns result in string or empty string if no result found. Addr(domainName string, ticker string) (string, error) // AddrVersion Retrieve the version value of domain's currency ticker. // This method should be used to query multi-chain currency like USDT. // Returns result in string or empty string if no result found. AddrVersion(domainName string, ticker string, version string) (string, error) // Email Retrieve the email of domain. // Returns result in string or empty string if no result found. Email(domainName string) (string, error) // Resolver Retrieve the resolver address. // Returns result or DomainNotConfiguredError if resolver is not found. Resolver(domainName string) (string, error) // Owner Retrieve the owner address. // Returns result or DomainNotRegisteredError if owner is not found. Owner(domainName string) (string, error) // IpfsHash Retrieve hash of IPFS website attached to domain. IpfsHash(domainName string) (string, error) // HTTPUrl Retrieve the http redirect url of a domain. HTTPUrl(domainName string) (string, error) // AllRecords Retrieve all records of a domain. // Returns result in string or empty string record is not found. AllRecords(domainName string) (map[string]string, error) // DNS Retrieve the DNS records of a domain. // Returns a set of valid and filtered non-empty DNS records attached to domain. DNS(domainName string, types []dnsrecords.Type) ([]dnsrecords.Record, error) // IsSupportedDomain checks whether domain name is supported by the naming service. IsSupportedDomain(domainName string) (bool, error) // TokenURI returns ERC721 metadata token URI TokenURI(domainName string) (string, error) // TokenURIMetadata returns ERC721 metadata TokenURIMetadata(domainName string) (TokenMetadata, error) // Unhash returns a domain name from a hash using TokenMetadata.Name field and ensures it indeed matches the given hash. // domainHash should be in hex numeric string format, for example: "0x29bf1b111e709f0953848df35e419490fbad5d316690e4de61adc52695ddf9f3" // ERC721 Token ID could be passed to this method but should be converted to hex numeric string before usage. // // Examples of usage: // // domainName, err := NamingService.Unhash("0x29bf1b111e709f0953848df35e419490fbad5d316690e4de61adc52695ddf9f3") // domainName, err := NamingService.Unhash("0x691f36df38168d9297e784f45a87257a70c58c4040d469c6d0b91d253a837e32") // // Usage with ERC721 token id: // // var erc721TokenID big.Int // erc721TokenID.SetString("47548000072528700265403562077742902343248290986511625310517899838602191535666", 10) // domainHash := hex.EncodeToString(erc721TokenID.Bytes()) // domainName, err := NamingService.Unhash(domainHash) // Unhash(domainHash string) (string, error) // Namehash returns a namehash of a domain following the EIP-137 standard Namehash(domainName string) (string, error) }
NamingService Unstoppable supports multiple naming services (.zil and .crypto). Each naming service implements shared interface and returns similar record types.
type TokenMetadata ¶ added in v1.1.2
type TokenMetadata struct { Name string `json:"name"` Description string `json:"description"` Image string `json:"image"` ExternalUrl string `json:"external_url"` ExternalLink string `json:"external_link"` ImageData string `json:"image_data"` BackgroundColor string `json:"background_color"` AnimationUrl string `json:"animation_url"` YoutubeUrl string `json:"youtube_url"` Attributes []TokenMetadataAttribute `json:"attributes"` }
type TokenMetadataAttribute ¶ added in v1.1.2
type Uns ¶ added in v1.1.2
type Uns struct {
// contains filtered or unexported fields
}
Uns is a naming service handles Unstoppable domains resolution.
func (*Uns) AddrVersion ¶ added in v1.1.2
func (*Uns) AllRecords ¶ added in v1.1.2
func (*Uns) DNS ¶ added in v1.1.2
func (c *Uns) DNS(domainName string, types []dnsrecords.Type) ([]dnsrecords.Record, error)
func (*Uns) Data ¶ added in v1.1.2
func (c *Uns) Data(domainName string, keys []string) (*struct { Resolver common.Address Owner common.Address Values []string }, error)
Data Get raw data attached to domain
func (*Uns) IsSupportedDomain ¶ added in v1.1.2
func (*Uns) TokenURIMetadata ¶ added in v1.1.2
func (c *Uns) TokenURIMetadata(domainName string) (TokenMetadata, error)
type UnsBuilder ¶ added in v1.1.2
type UnsBuilder interface { // SetContractBackend set Ethereum backend for communication with UNS registry SetContractBackend(backend bind.ContractBackend) UnsBuilder // SetMetadataClient set http backend for communication with ERC721 metadata server SetMetadataClient(backend MetadataClient) UnsBuilder // SetEthereumNetwork set Ethereum network for communication with UNS registry SetEthereumNetwork(network string) UnsBuilder // Build Uns instance Build() (*Uns, error) }
UnsBuilder is a builder to setup and build instance of Uns service.
func NewUnsBuilder ¶ added in v1.1.2
func NewUnsBuilder() UnsBuilder
NewUnsBuilder Creates builder to setup new instance of Uns service.
type Zns ¶
type Zns struct {
// contains filtered or unexported fields
}
Zns is a naming service handles .zil domains resolution.
func (*Zns) AddrVersion ¶
func (*Zns) DNS ¶
func (z *Zns) DNS(domainName string, types []dnsrecords.Type) ([]dnsrecords.Record, error)
func (*Zns) State ¶
func (z *Zns) State(domainName string) (*ZnsDomainState, error)
State Get raw data attached to domain.
func (*Zns) TokenURIMetadata ¶ added in v1.1.2
func (z *Zns) TokenURIMetadata(_ string) (TokenMetadata, error)
type ZnsBuilder ¶
type ZnsBuilder interface { // SetProvider set Zilliqa blockchain provider to communicate with ZNS registry SetProvider(provider ZnsProvider) ZnsBuilder // Build Zns instance Build() (*Zns, error) }
ZnsBuilder is a builder to setup and build instance of Zns service.
type ZnsDomainState ¶
ZnsDomainState State of ZNS domain
type ZnsProvider ¶
type ZnsProvider interface {
GetSmartContractSubState(contractAddress string, params ...interface{}) (string, error)
}
ZnsProvider ZnsProvider