Documentation ¶
Index ¶
- Constants
- Variables
- func DetectNamingService(domainName string) (string, error)
- func ZnsNameHash(domainName string) (string, error)
- type AddressNotSupportedError
- type DomainNotConfiguredError
- type DomainNotRegisteredError
- type DomainNotSupportedError
- type Ens
- func (e *Ens) Addr(domainName, ticker string) (string, error)
- func (e *Ens) AddrVersion(domainName string, ticker string, version string) (string, error)
- func (e *Ens) AllRecords(domainName string) (map[string]string, error)
- func (e *Ens) CoinAddress(domainName string, coin string) (string, error)
- func (e *Ens) ContentHash(domainName string) (string, error)
- func (e *Ens) DNS(domainName string, types []dnsrecords.Type) ([]dnsrecords.Record, error)
- func (e *Ens) DomainExpiry(domainName string) (time.Time, error)
- func (e *Ens) Email(domainName string) (string, error)
- func (e *Ens) HTTPUrl(domainName string) (string, error)
- func (e *Ens) IpfsHash(domainName string) (string, error)
- func (e *Ens) IsSupportedDomain(domainName string) (bool, error)
- func (e *Ens) Locations(domainNames []string) (map[string]namingservice.Location, error)
- func (e *Ens) Namehash(domainName string) (string, error)
- func (e *Ens) Owner(domainName string) (string, error)
- func (e *Ens) Record(domainName string, key string) (string, error)
- func (e *Ens) Records(domainName string, keys []string) (map[string]string, error)
- func (e *Ens) Resolver(domainName string) (string, error)
- func (e *Ens) ReverseOf(addr string) (string, error)
- func (e *Ens) TextRecord(domainName, key string) (string, error)
- func (e *Ens) TokenURI(domainName string) (string, error)
- func (e *Ens) TokenURIMetadata(domainName string) (TokenMetadata, error)
- func (e *Ens) Unhash(domainHash string) (string, error)
- type EnsBuilder
- type EnsConfigurationError
- type EnsInvalidCoinType
- type EnsService
- type InvalidDomainNameReturnedError
- type MetadataClient
- type MethodIsNotSupportedError
- type NamingService
- type NetworkContracts
- type TokenMetadata
- type TokenMetadataAttribute
- type TokenMetadataProperties
- 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) DomainExpiry(domainName string) (time.Time, error)
- func (c *Uns) Email(domainName string) (string, error)
- func (c *Uns) GetAddr(domainName, family, token 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) Locations(domainNames []string) (map[string]namingservice.Location, 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) ReverseOf(addr 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 UnsConfigurationError
- type UnsService
- type Web3Domain
- func (w3d Web3Domain) Addr(domain, token string) (string, error)
- func (w3d Web3Domain) DNS(domain string, types []dnsrecords.Type) ([]dnsrecords.Record, error)
- func (w3d Web3Domain) DomainExpiry(domainName string) (time.Time, error)
- func (w3d Web3Domain) Email(domain string) (string, error)
- func (w3d Web3Domain) HTTPUrl(domain string) (string, error)
- func (w3d Web3Domain) IpfsHash(domain string) (string, error)
- func (w3d Web3Domain) Locations(domains []string) (map[string]namingservice.Location, error)
- func (w3d Web3Domain) MultiReverseOf(addr string) ([]string, error)
- func (w3d Web3Domain) Namehash(domain string) (string, error)
- func (w3d Web3Domain) Owner(domain string) (string, error)
- func (w3d Web3Domain) Record(domain, key string) (string, error)
- func (w3d Web3Domain) Resolver(domain string) (string, error)
- func (w3d Web3Domain) ReverseOf(addr string) (string, error)
- func (w3d Web3Domain) TokenURI(domain string) (string, error)
- func (w3d Web3Domain) TokenURIMetadata(domain string) (TokenMetadata, error)
- func (w3d Web3Domain) Unhash(domainHash string) (string, error)
- type Web3DomainBuilder
- type Web3DomainConfigurationError
- 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) DomainExpiry(domainName string) (time.Time, 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) Locations(domainNames []string) (map[string]namingservice.Location, 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) ReverseOf(_ 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 ¶
const ( Mainnet string = "mainnet" Polygon string = "polygon" Mumbai string = "mumbai" Goerli string = "goerli" )
const ( Layer1 string = "Layer 1" Layer2 string = "Layer 2" )
const (
NullAddress = "0x0000000000000000000000000000000000000000"
)
Variables ¶
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 AddressNotSupportedError ¶ added in v3.1.0
type AddressNotSupportedError struct {
Address string
}
AddressNotSupportedError Error when domain is not supported by the naming service
func (*AddressNotSupportedError) Error ¶ added in v3.1.0
func (e *AddressNotSupportedError) Error() string
type DomainNotConfiguredError ¶
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 Ens ¶ added in v3.2.0
type Ens struct {
// contains filtered or unexported fields
}
Ens is a naming service handles Ethereum naming service resolution.
func (*Ens) AddrVersion ¶ added in v3.2.0
func (*Ens) AllRecords ¶ added in v3.2.0
AllRecords Retrieve all records of a domain. Returns result in string or empty string record is not found. Deprecated: This method will be removed in future releases
func (*Ens) CoinAddress ¶ added in v3.2.0
func (*Ens) ContentHash ¶ added in v3.2.0
func (*Ens) DNS ¶ added in v3.2.0
func (e *Ens) DNS(domainName string, types []dnsrecords.Type) ([]dnsrecords.Record, error)
func (*Ens) DomainExpiry ¶ added in v3.2.0
func (*Ens) IsSupportedDomain ¶ added in v3.2.0
func (*Ens) Locations ¶ added in v3.2.0
Locations Retrieve locations of domains Returns key-value map of domain names to location
func (*Ens) TextRecord ¶ added in v3.2.0
func (*Ens) TokenURIMetadata ¶ added in v3.2.0
func (e *Ens) TokenURIMetadata(domainName string) (TokenMetadata, error)
TokenURIMetadata returns ERC721 metadata
type EnsBuilder ¶ added in v3.2.0
type EnsBuilder interface { // SetContractBackend set Ethereum backend for communication with Ens registry SetContractBackend(backend bind.ContractBackend) EnsBuilder // SetContractBackendProviderUrl set Ethereum backend Rpc URL SetContractBackendProviderUrl(url string) EnsBuilder // SetMetadataClient set http backend for communication with ERC721 metadata server SetMetadataClient(backend MetadataClient) EnsBuilder // Set SetEthereumNetwork SetEthereumNetwork(network string) EnsBuilder // Build Uns instance Build() (*Ens, error) }
func NewEnsBuilder ¶ added in v3.2.0
func NewEnsBuilder() EnsBuilder
type EnsConfigurationError ¶ added in v3.2.0
type EnsConfigurationError struct {
InvalidField string
}
func (*EnsConfigurationError) Error ¶ added in v3.2.0
func (e *EnsConfigurationError) Error() string
type EnsInvalidCoinType ¶ added in v3.2.0
type EnsInvalidCoinType struct {
CoinType string
}
func (*EnsInvalidCoinType) Error ¶ added in v3.2.0
func (e *EnsInvalidCoinType) Error() string
type EnsService ¶ added in v3.2.0
type EnsService struct {
// contains filtered or unexported fields
}
Ens is a naming service
type InvalidDomainNameReturnedError ¶
InvalidDomainNameReturnedError Error when ERC721 metadata provides returns incorrect domain name
func (*InvalidDomainNameReturnedError) Error ¶
func (e *InvalidDomainNameReturnedError) Error() string
type MetadataClient ¶
type MethodIsNotSupportedError ¶
type MethodIsNotSupportedError struct {
NamingServiceName string
}
MethodIsNotSupportedError Error when naming services does not support called method
func (*MethodIsNotSupportedError) Error ¶
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. // Deprecated: This method will be removed in future releases AllRecords(domainName string) (map[string]string, error) // Locations Retrieve locations of domains // Returns key-value map of domain names to location Locations(domainNames []string) (map[string]namingservice.Location, 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) // DomainExpiry checks whether domain name is expired. DomainExpiry(domainName string) (time.Time, 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) ReverseOf(addr string) (string, error) }
NamingService Unstoppable supports multiple naming services (.zil and .crypto). Each naming service implements shared interface and returns similar record types.
type NetworkContracts ¶
type NetworkContracts map[string]contracts
type TokenMetadata ¶
type TokenMetadata struct { Name string `json:"name"` Description string `json:"description"` Image string `json:"image"` ExternalUrl string `json:"-"` 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"` Properties TokenMetadataProperties `json:"properties"` Attributes []TokenMetadataAttribute `json:"attributes"` }
func (*TokenMetadata) UnmarshalJSON ¶ added in v3.2.0
func (tm *TokenMetadata) UnmarshalJSON(data []byte) error
type TokenMetadataAttribute ¶
type TokenMetadataProperties ¶
type Uns ¶
type Uns struct {
// contains filtered or unexported fields
}
Uns is a naming service handles Unstoppable domains resolution.
func (*Uns) AddrVersion ¶
func (*Uns) DNS ¶
func (c *Uns) DNS(domainName string, types []dnsrecords.Type) ([]dnsrecords.Record, error)
func (*Uns) Data ¶
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) DomainExpiry ¶ added in v3.2.0
func (*Uns) TokenURIMetadata ¶
func (c *Uns) TokenURIMetadata(domainName string) (TokenMetadata, error)
type UnsBuilder ¶
type UnsBuilder interface { // SetContractBackend set Ethereum backend for communication with UNS registry SetContractBackend(backend bind.ContractBackend) UnsBuilder // SetContractBackendProviderUrl set Ethereum backend Rpc URL SetContractBackendProviderUrl(url string) UnsBuilder // SetL2ContractBackend set Ethereum backend for communication with UNS L2registry SetL2ContractBackend(backend bind.ContractBackend) UnsBuilder // SetL2ContractBackendProviderUrl set Polygon backend Rpc URL SetL2ContractBackendProviderUrl(url string) UnsBuilder // SetMetadataClient set http backend for communication with ERC721 metadata server SetMetadataClient(backend MetadataClient) UnsBuilder // SetUdClient set http proxy backends for communication with UNS registry SetUdClient(apiKey string) UnsBuilder // SetEthereumNetwork set Ethereum network for communication with UNS registry SetEthereumNetwork(network string) UnsBuilder // SetL2EthereumNetwork set Ethereum network for communication with UNS L2 registry SetL2EthereumNetwork(network string) UnsBuilder // Build Uns instance Build() (*Uns, error) }
UnsBuilder is a builder to setup and build instance of Uns
func NewUnsBuilder ¶
func NewUnsBuilder() UnsBuilder
NewUnsBuilder Creates builder to setup new instance of Uns
type UnsConfigurationError ¶
UnsConfigurationError Error when UNS resolution service is configured incorrectly
func (*UnsConfigurationError) Error ¶
func (e *UnsConfigurationError) Error() string
type UnsService ¶
type UnsService struct { Layer string // contains filtered or unexported fields }
Uns is a naming service handles Unstoppable domains resolution.
func (*UnsService) DNS ¶
func (c *UnsService) DNS(domainName string, types []dnsrecords.Type) ([]dnsrecords.Record, error)
type Web3Domain ¶ added in v3.2.0
type Web3Domain struct {
// contains filtered or unexported fields
}
func (Web3Domain) Addr ¶ added in v3.2.0
func (w3d Web3Domain) Addr(domain, token string) (string, error)
func (Web3Domain) DNS ¶ added in v3.2.0
func (w3d Web3Domain) DNS(domain string, types []dnsrecords.Type) ([]dnsrecords.Record, error)
func (Web3Domain) DomainExpiry ¶ added in v3.2.0
func (w3d Web3Domain) DomainExpiry(domainName string) (time.Time, error)
func (Web3Domain) Email ¶ added in v3.2.0
func (w3d Web3Domain) Email(domain string) (string, error)
func (Web3Domain) HTTPUrl ¶ added in v3.2.0
func (w3d Web3Domain) HTTPUrl(domain string) (string, error)
func (Web3Domain) IpfsHash ¶ added in v3.2.0
func (w3d Web3Domain) IpfsHash(domain string) (string, error)
func (Web3Domain) Locations ¶ added in v3.2.0
func (w3d Web3Domain) Locations(domains []string) (map[string]namingservice.Location, error)
maybe useless
func (Web3Domain) MultiReverseOf ¶ added in v3.2.0
func (w3d Web3Domain) MultiReverseOf(addr string) ([]string, error)
func (Web3Domain) Namehash ¶ added in v3.2.0
func (w3d Web3Domain) Namehash(domain string) (string, error)
func (Web3Domain) Owner ¶ added in v3.2.0
func (w3d Web3Domain) Owner(domain string) (string, error)
func (Web3Domain) Record ¶ added in v3.2.0
func (w3d Web3Domain) Record(domain, key string) (string, error)
func (Web3Domain) Resolver ¶ added in v3.2.0
func (w3d Web3Domain) Resolver(domain string) (string, error)
func (Web3Domain) ReverseOf ¶ added in v3.2.0
func (w3d Web3Domain) ReverseOf(addr string) (string, error)
func (Web3Domain) TokenURI ¶ added in v3.2.0
func (w3d Web3Domain) TokenURI(domain string) (string, error)
func (Web3Domain) TokenURIMetadata ¶ added in v3.2.0
func (w3d Web3Domain) TokenURIMetadata(domain string) (TokenMetadata, error)
type Web3DomainBuilder ¶ added in v3.2.0
type Web3DomainBuilder interface { // SetContractBackend set Ethereum backend for communication with Web3Domain registry SetEthContractBackend(backend bind.ContractBackend) Web3DomainBuilder // SetContractBackendProviderUrl set Ethereum backend Rpc URL SetEthContractBackendProviderUrl(url string) Web3DomainBuilder // SetL2ContractBackend set Ethereum backend for communication with Web3Domain L2registry SetMaticContractBackend(backend bind.ContractBackend) Web3DomainBuilder // SetL2ContractBackendProviderUrl set Polygon backend Rpc URL SetMaticContractBackendProviderUrl(url string) Web3DomainBuilder // SetMetadataClient set http backend for communication with ERC721 metadata server SetMetadataClient(backend MetadataClient) Web3DomainBuilder // SetUdClient set http proxy backends for communication with Web3Domain registry SetUdClient(apiKey string) Web3DomainBuilder // SetEthereumNetwork set Ethereum network for communication with Web3Domain registry SetEthereumNetwork(network string) Web3DomainBuilder // SetL2EthereumNetwork set Ethereum network for communication with Web3Domain L2 registry SetMaticNetwork(network string) Web3DomainBuilder Build() (*Web3Domain, error) }
Web3Builder is a builder to setup and build instance of Web3Domain Resolution
func NewWeb3DomainBuilder ¶ added in v3.2.0
func NewWeb3DomainBuilder() Web3DomainBuilder
Web3DomainBuilder Creates builder to setup new instance of Web3Domain
type Web3DomainConfigurationError ¶ added in v3.2.0
type Web3DomainConfigurationError struct {
InvalidField string
}
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) DomainExpiry ¶ added in v3.2.0
func (*Zns) State ¶
func (z *Zns) State(domainName string) (*ZnsDomainState, error)
State Get raw data attached to domain.
func (*Zns) TokenURIMetadata ¶
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 // SetProvider set Zilliqa network to communicate with ZNS registry SetNetwork(network string) 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