ens

package module
v3.0.0-...-8d123e2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 38 Imported by: 0

README

go-ens

Tag License GoDoc Travis CI codecov.io Go Report Card

Go module to simplify interacting with the Ethereum Name Service contracts.

Table of Contents

Install

go-ens is a standard Go module which can be installed with:

go get github.com/airstack-xyz/go-ens/v3

Usage

go-ens provides simple access to the Ethereum Name Service (ENS) contracts.

Resolution

The most commonly-used feature of ENS is resolution: converting an ENS name to an Ethereum address. go-ens provides a simple call to allow this:

address, err := ens.Resolve(client, domain)

where client is a connection to an Ethereum client and domain is the fully-qualified name you wish to resolve (e.g. foo.mydomain.eth) (full examples for using this are given in the Example section below).

The reverse process, converting an address to an ENS name, is just as simple:

domain, err := ens.ReverseResolve(client, address)

Note that if the address does not have a reverse resolution this will return "". If you just want a string version of an address for on-screen display then you can use ens.Format(), for example:

fmt.Printf("The address is %s\n", ens.Format(client, address))

This will carry out reverse resolution of the address and print the name if present; if not it will print a formatted version of the address.

Management of names

A top-level name is one that sits directly underneath .eth, for example mydomain.eth. Lower-level names, such as foo.mydomain.eth are covered in the following section. go-ens provides a simplified Name interface to manage top-level, removing the requirement to understand registrars, controllers, etc.

Starting out with names in go-ens is easy:

client, err := ethclient.Dial("https://infura.io/v3/SECRET")
name, err := ens.NewName(client, "mydomain.eth")

Addresses can be set and obtained using the address functions, for example to get an address:

COIN_TYPE_ETHEREUM := uint64(60)
address, err := name.Address(COIN_TYPE_ETHEREUM)

ENS supports addresses for multiple coin types; values of coin types can be found at https://github.com/satoshilabs/slips/blob/master/slip-0044.md

Registering and extending names

Most operations on a domain will involve setting resolvers and resolver information.

Management of subdomains

Because subdomains have their own registrars they do not work with the Name interface.

Example
package main

import (
	"fmt"

	"github.com/ethereum/go-ethereum/ethclient"
	ens "github.com/airstack-xyz/go-ens/v3"
)

func main() {
	// Replace SECRET with your own access token for this example to work.
	client, err := ethclient.Dial("https://mainnet.infura.io/v3/SECRET")
	if err != nil {
		panic(err)
	}

	// Resolve a name to an address.
	domain := "ethereum.eth"
	address, err := ens.Resolve(client, domain)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Address of %s is %s\n", domain, address.Hex())

	// Reverse resolve an address to a name.
	reverse, err := ens.ReverseResolve(client, address)
	if err != nil {
		panic(err)
	}
	if reverse == "" {
		fmt.Printf("%s has no reverse lookup\n", address.Hex())
	} else {
		fmt.Printf("Name of %s is %s\n", address.Hex(), reverse)
	}
}

Maintainers

Jim McDonald: @mcdee.

Contribute

Contributions welcome. Please check out the issues.

License

Apache-2.0 © 2019 Weald Technology Trading Ltd

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UnknownAddress = common.HexToAddress("00")

UnknownAddress is the address to which unknown entries resolve

Functions

func ContenthashToString

func ContenthashToString(bytes []byte) (string, error)

ContenthashToString turns EIP-1577 binary format in to EIP-1577 text format

func CreateRegistrySession

func CreateRegistrySession(chainID *big.Int, wallet *accounts.Wallet, account *accounts.Account, passphrase string, contract *registry.Contract, gasPrice *big.Int) *registry.ContractSession

CreateRegistrySession creates a session suitable for multiple calls

func DNSWireFormat

func DNSWireFormat(domain string) []byte

DNSWireFormat turns a domain name in to wire format

func DNSWireFormatDomainHash

func DNSWireFormatDomainHash(domain string) (hash [32]byte)

DNSWireFormatDomainHash hashes a domain name in wire format

func DeriveTokenID

func DeriveTokenID(backend bind.ContractBackend, domain string) (string, error)

DeriveTokenID derive tokenID from the ENS domain.

The tokenID of the ENS name is simply the uint256 representation of the tokenID of ERC721

func Domain

func Domain(domain string) string

Domain obtains the domain of an ENS name, including subdomains. It does this by removing everything up to and including the first period. For example, 'eth' will return ”

'foo.eth' will return 'eth'
'bar.foo.eth' will return 'foo.eth'

func DomainLevel

func DomainLevel(name string) (level int)

DomainLevel calculates the level of the domain presented. A top-level domain (e.g. 'eth') will be 0, a domain (e.g. 'foo.eth') will be 1, a subdomain (e.g. 'bar.foo.eth' will be 2, etc.

func DomainPart

func DomainPart(domain string, part int) (string, error)

DomainPart obtains a part of a name Positive parts start at the lowest-level of the domain and work towards the top-level domain. Negative parts start at the top-level domain and work towards the lowest-level domain. For example, with a domain bar.foo.com the following parts will be returned: Number | part

 1 |  bar
 2 |  foo
 3 |  com
-1 |  com
-2 |  foo
-3 |  bar

func Format

func Format(backend bind.ContractBackend, address common.Address) string

Format provides a string version of an address, reverse resolving it if possible

func LabelHash

func LabelHash(label string) (hash [32]byte, err error)

LabelHash generates a simple hash for a piece of a name.

func NameHash

func NameHash(name string) (hash [32]byte, err error)

NameHash generates a hash from a name that can be used to look up the name in ENS

func NormaliseDomain

func NormaliseDomain(domain string) (string, error)

NormaliseDomain turns ENS domain in to normal form

func NormaliseDomainStrict

func NormaliseDomainStrict(domain string) (string, error)

NormaliseDomainStrict turns ENS domain in to normal form, using strict DNS rules (e.g. no underscores)

func Normalize

func Normalize(input string) (output string, err error)

Normalize normalizes a name according to the ENS rules

func PublicResolverAddress

func PublicResolverAddress(backend bind.ContractBackend) (common.Address, error)

PublicResolverAddress obtains the address of the public resolver for a chain

func RegistrarContractAddress

func RegistrarContractAddress(backend bind.ContractBackend, domain string) (common.Address, error)

RegistrarContractAddress obtains the registrar contract address for a given domain

func RegistryContractAddress

func RegistryContractAddress(backend bind.ContractBackend) (common.Address, error)

RegistryContractAddress obtains the address of the registry contract for a chain. This is (currently) the same for all chains.

func RegistryContractFromRegistrar

func RegistryContractFromRegistrar(backend bind.ContractBackend, registrar *auctionregistrar.Contract) (*registry.Contract, error)

RegistryContractFromRegistrar obtains the registry contract given an existing registrar contract

func Resolve

func Resolve(backend bind.ContractBackend, input string) (address common.Address, err error)

Resolve resolves an ENS name in to an Etheruem address This will return an error if the name is not found or otherwise 0

func ReverseResolve

func ReverseResolve(backend bind.ContractBackend, address common.Address) (string, error)

ReverseResolve resolves an address in to an ENS name This will return an error if the name is not found or otherwise 0

func SetResolver

func SetResolver(session *registry.ContractSession, name string, resolverAddr *common.Address) (*types.Transaction, error)

SetResolver sets the resolver for a name

func SetSubdomainOwner

func SetSubdomainOwner(session *registry.ContractSession, name string, subdomain string, ownerAddr *common.Address) (*types.Transaction, error)

SetSubdomainOwner sets the owner for a subdomain of a name

func StringToContenthash

func StringToContenthash(text string) ([]byte, error)

StringToContenthash turns EIP-1577 text format in to EIP-1577 binary format

func Tld

func Tld(domain string) string

Tld obtains the top-level domain of an ENS name

func UnqualifiedName

func UnqualifiedName(domain string, root string) (string, error)

UnqualifiedName strips the root from the domain and ensures the result is suitable as a name

Types

type AuctionEntry

type AuctionEntry struct {
	State        string
	Deed         common.Address
	Registration time.Time
	Value        *big.Int
	HighestBid   *big.Int
}

AuctionEntry is an auction entry

type AuctionRegistrar

type AuctionRegistrar struct {
	Contract     *auctionregistrar.Contract
	ContractAddr common.Address
	// contains filtered or unexported fields
}

AuctionRegistrar is the structure for the auction registrar contract

func NewAuctionRegistrar

func NewAuctionRegistrar(backend bind.ContractBackend, domain string) (*AuctionRegistrar, error)

NewAuctionRegistrar creates a new auction registrar for a given domain

func NewAuctionRegistrarAt

func NewAuctionRegistrarAt(backend bind.ContractBackend, domain string, address common.Address) (*AuctionRegistrar, error)

NewAuctionRegistrarAt creates an auction registrar for a given domain at a given address

func (*AuctionRegistrar) Entry

func (r *AuctionRegistrar) Entry(domain string) (*AuctionEntry, error)

Entry obtains a registrar entry for a name

func (*AuctionRegistrar) Migrate

func (r *AuctionRegistrar) Migrate(opts *bind.TransactOpts, domain string) (*types.Transaction, error)

Migrate migrates a domain to the permanent registrar

func (*AuctionRegistrar) Owner

func (r *AuctionRegistrar) Owner(domain string) (common.Address, error)

Owner obtains the owner of the deed that represents the name.

func (*AuctionRegistrar) Release

func (r *AuctionRegistrar) Release(opts *bind.TransactOpts, domain string) (*types.Transaction, error)

Release releases a domain

func (*AuctionRegistrar) SetOwner

func (r *AuctionRegistrar) SetOwner(opts *bind.TransactOpts, domain string, address common.Address) (*types.Transaction, error)

SetOwner sets the owner of the deed that represents the name.

func (*AuctionRegistrar) ShaBid

func (r *AuctionRegistrar) ShaBid(hash [32]byte, address common.Address, value *big.Int, salt [32]byte) ([32]byte, error)

ShaBid calculates the hash for a bid.

func (*AuctionRegistrar) State

func (r *AuctionRegistrar) State(name string) (string, error)

State returns the state of a nam

type BaseRegistrar

type BaseRegistrar struct {
	Contract     *baseregistrar.Contract
	ContractAddr common.Address
	// contains filtered or unexported fields
}

BaseRegistrar is the structure for the registrar

func NewBaseRegistrar

func NewBaseRegistrar(backend bind.ContractBackend, domain string) (*BaseRegistrar, error)

NewBaseRegistrar obtains the registrar contract for a given domain

func (*BaseRegistrar) Expiry

func (r *BaseRegistrar) Expiry(domain string) (*big.Int, error)

Expiry obtains the unix timestamp at which the registration expires.

func (*BaseRegistrar) Owner

func (r *BaseRegistrar) Owner(domain string) (common.Address, error)

Owner obtains the owner of the underlying token that represents the name.

func (*BaseRegistrar) PriorAuctionContract

func (r *BaseRegistrar) PriorAuctionContract() (*AuctionRegistrar, error)

PriorAuctionContract obtains the previous (auction) registrar contract

func (*BaseRegistrar) Reclaim

func (r *BaseRegistrar) Reclaim(opts *bind.TransactOpts, domain string, newOwner common.Address) (*types.Transaction, error)

Reclaim reclaims a domain by the owner

func (*BaseRegistrar) RegisteredWith

func (r *BaseRegistrar) RegisteredWith(domain string) (string, error)

RegisteredWith returns one of "temporary", "permanent" or "none" for the registrar on which this name is registered

func (*BaseRegistrar) SetOwner

func (r *BaseRegistrar) SetOwner(opts *bind.TransactOpts, domain string, newOwner common.Address) (*types.Transaction, error)

SetOwner sets the owner of the token holding the name

type DNSRegistrar

type DNSRegistrar struct {
	Contract     *dnsregistrar.Contract
	ContractAddr common.Address
	// contains filtered or unexported fields
}

DNSRegistrar is the structure for the registrar

func NewDNSRegistrar

func NewDNSRegistrar(backend bind.ContractBackend, domain string) (*DNSRegistrar, error)

NewDNSRegistrar obtains the registrar contract for a given domain

type DNSResolver

type DNSResolver struct {
	Contract     *dnsresolver.Contract
	ContractAddr common.Address
	// contains filtered or unexported fields
}

DNSResolver is the structure for the DNS resolver contract

func NewDNSResolver

func NewDNSResolver(backend bind.ContractBackend, domain string) (*DNSResolver, error)

NewDNSResolver creates a new DNS resolver for a given domain

func NewDNSResolverAt

func NewDNSResolverAt(backend bind.ContractBackend, domain string, address common.Address) (*DNSResolver, error)

NewDNSResolverAt creates a new DNS resolver for a given domain at a given address

func (*DNSResolver) ClearDNSZone

func (r *DNSResolver) ClearDNSZone(opts *bind.TransactOpts) (*types.Transaction, error)

ClearDNSZone clears all records in the zone

func (*DNSResolver) HasRecords

func (r *DNSResolver) HasRecords(name string) (bool, error)

HasRecords returns true if the given name has any RRsets

func (*DNSResolver) Record

func (r *DNSResolver) Record(name string, rrType uint16) ([]byte, error)

Record obtains an RRSet for a name

func (*DNSResolver) SetRecords

func (r *DNSResolver) SetRecords(opts *bind.TransactOpts, data []byte) (*types.Transaction, error)

SetRecords sets one or more RRSets

func (*DNSResolver) SetZonehash

func (r *DNSResolver) SetZonehash(opts *bind.TransactOpts, zonehash []byte) (*types.Transaction, error)

SetZonehash sets the zone hash of the domain

func (*DNSResolver) Zonehash

func (r *DNSResolver) Zonehash() ([]byte, error)

Zonehash returns the zone hash of the domain

type DNSSECOracle

type DNSSECOracle struct {
	Contract     *dnssecoracle.Contract
	ContractAddr common.Address
	// contains filtered or unexported fields
}

DNSSECOracle is the structure for the DNSSEC oracle

func NewDNSSECOracle

func NewDNSSECOracle(backend bind.ContractBackend, domain string) (*DNSSECOracle, error)

NewDNSSECOracle obtains the DNSSEC oracle contract for a given domain

type Deed

type Deed struct {
	Contract *deed.Contract
}

Deed is the structure for the deed

func NewDeed

func NewDeed(backend bind.ContractBackend, domain string) (*Deed, error)

NewDeed obtains the deed contract for a given domain

func NewDeedAt

func NewDeedAt(backend bind.ContractBackend, address common.Address) (*Deed, error)

NewDeedAt creates a deed contract at a given address

func (*Deed) Owner

func (c *Deed) Owner() (common.Address, error)

Owner obtains the owner of the deed

func (*Deed) PreviousOwner

func (c *Deed) PreviousOwner() (common.Address, error)

PreviousOwner obtains the previous owner of the deed

func (*Deed) SetOwner

func (c *Deed) SetOwner(opts *bind.TransactOpts, address common.Address) (*types.Transaction, error)

SetOwner sets the owner of the deed

type ETHController

type ETHController struct {
	Contract     *ethcontroller.Contract
	ContractAddr common.Address
	// contains filtered or unexported fields
}

ETHController is the structure for the .eth controller contract

func NewETHController

func NewETHController(backend bind.ContractBackend, domain string) (*ETHController, error)

NewETHController creates a new controller for a given domain

func NewETHControllerAt

func NewETHControllerAt(backend bind.ContractBackend, domain string, address common.Address) (*ETHController, error)

NewETHControllerAt creates a .eth controller at a given address

func (*ETHController) Commit

func (c *ETHController) Commit(opts *bind.TransactOpts, domain string, owner common.Address, secret [32]byte) (*types.Transaction, error)

Commit sends a commitment to register a domain.

func (*ETHController) CommitmentHash

func (c *ETHController) CommitmentHash(domain string, owner common.Address, secret [32]byte) (common.Hash, error)

CommitmentHash returns the commitment hash for a label/owner/secret tuple

func (*ETHController) CommitmentTime

func (c *ETHController) CommitmentTime(domain string, owner common.Address, secret [32]byte) (*big.Int, error)

CommitmentTime states the time at which a commitment was registered on the blockchain.

func (*ETHController) IsAvailable

func (c *ETHController) IsAvailable(domain string) (bool, error)

IsAvailable returns true if the domain is available for registration.

func (*ETHController) IsValid

func (c *ETHController) IsValid(domain string) (bool, error)

IsValid returns true if the domain is considered valid by the controller.

func (*ETHController) MaxCommitmentInterval

func (c *ETHController) MaxCommitmentInterval() (*big.Int, error)

MaxCommitmentInterval returns the maximum time that has to pass between a commit and reveal

func (*ETHController) MinCommitmentInterval

func (c *ETHController) MinCommitmentInterval() (*big.Int, error)

MinCommitmentInterval returns the minimum time that has to pass between a commit and reveal

func (*ETHController) MinRegistrationDuration

func (c *ETHController) MinRegistrationDuration() (time.Duration, error)

MinRegistrationDuration returns the minimum duration for which a name can be registered

func (*ETHController) Renew

func (c *ETHController) Renew(opts *bind.TransactOpts, domain string) (*types.Transaction, error)

Renew renews a registered domain.

func (*ETHController) RentCost

func (c *ETHController) RentCost(domain string) (*big.Int, error)

RentCost returns the cost of rent in wei-per-second.

func (*ETHController) Reveal

func (c *ETHController) Reveal(opts *bind.TransactOpts, domain string, owner common.Address, secret [32]byte) (*types.Transaction, error)

Reveal reveals a commitment to register a domain.

type Name

type Name struct {

	// Name is the fully-qualified name of an ENS domain e.g. foo.bar.eth
	Name string
	// Domain is the domain of an ENS domain e.g. bar.eth
	Domain string
	// Label is the name part of an ENS domain e.g. foo
	Label string
	// contains filtered or unexported fields
}

Name represents an ENS name, for example 'foo.bar.eth'.

func NewName

func NewName(backend bind.ContractBackend, name string) (*Name, error)

NewName creates an ENS name structure. Note that this does not create the name on-chain.

func (*Name) Address

func (n *Name) Address(coinType uint64) ([]byte, error)

Address fetches the address of the name for a given coin type. Coin types are defined at https://github.com/satoshilabs/slips/blob/master/slip-0044.md

func (*Name) Controller

func (n *Name) Controller() (common.Address, error)

Controller obtains the controller for this name. The controller can carry out operations on the name such as setting records, but cannot transfer ultimate ownership of the name.

func (*Name) CreateSubdomain

func (n *Name) CreateSubdomain(label string, controller common.Address, opts *bind.TransactOpts) (*types.Transaction, error)

CreateSubdomain creates a subdomain on the name.

func (*Name) Expires

func (n *Name) Expires() (time.Time, error)

Expires obtain the time at which the registration for this name expires.

func (*Name) ExtendRegistration

func (n *Name) ExtendRegistration(opts *bind.TransactOpts) (*types.Transaction, error)

ExtendRegistration sends a transaction that extends the registration of the name.

func (*Name) IsRegistered

func (n *Name) IsRegistered() (bool, error)

IsRegistered returns true if the name is registered in the registrar

func (*Name) Reclaim

func (n *Name) Reclaim(opts *bind.TransactOpts) (*types.Transaction, error)

Reclaim reclaims controller rights by the registrant

func (*Name) RegisterStageOne

func (n *Name) RegisterStageOne(registrant common.Address, opts *bind.TransactOpts) (*types.Transaction, [32]byte, error)

RegisterStageOne sends a transaction that starts the registration process.

func (*Name) RegisterStageTwo

func (n *Name) RegisterStageTwo(registrant common.Address, secret [32]byte, opts *bind.TransactOpts) (*types.Transaction, error)

RegisterStageTwo sends a transaction that completes the registration process. The registrant must be the same as supplied in RegisterStageOne. The secret is that returned by RegisterStageOne. At least RegistrationInterval() time must have passed since the stage one transaction was mined for this to work.

func (*Name) Registrant

func (n *Name) Registrant() (common.Address, error)

Registrant obtains the registrant for this name.

func (*Name) RegistrationInterval

func (n *Name) RegistrationInterval() (time.Duration, error)

RegistrationInterval obtains the minimum interval between commit and reveal when registering this name.

func (*Name) RentCost

func (n *Name) RentCost() (*big.Int, error)

RentCost returns the cost of rent in Wei-per-second.

func (*Name) ResolverAddress

func (n *Name) ResolverAddress() (common.Address, error)

ResolverAddress fetches the address of the resolver contract for the name.

func (*Name) SetAddress

func (n *Name) SetAddress(coinType uint64, address []byte, opts *bind.TransactOpts) (*types.Transaction, error)

SetAddress sets the address of the name for a given coin type. Coin types are defined at https://github.com/satoshilabs/slips/blob/master/slip-0044.md

func (*Name) SetController

func (n *Name) SetController(controller common.Address, opts *bind.TransactOpts) (*types.Transaction, error)

SetController sets the controller for this name. The controller can carry out operations on the name such as setting records, but cannot transfer ultimate ownership of the name.

func (*Name) SetResolverAddress

func (n *Name) SetResolverAddress(address common.Address, opts *bind.TransactOpts) (*types.Transaction, error)

SetResolverAddress sets the resolver contract address for the name.

func (*Name) Transfer

func (n *Name) Transfer(registrant common.Address, opts *bind.TransactOpts) (*types.Transaction, error)

Transfer transfers the registration of this name to a new registrant.

type Registry

type Registry struct {
	Contract     *registry.Contract
	ContractAddr common.Address
	// contains filtered or unexported fields
}

Registry is the structure for the registry contract

func NewRegistry

func NewRegistry(backend bind.ContractBackend) (*Registry, error)

NewRegistry obtains the ENS registry

func NewRegistryAt

func NewRegistryAt(backend bind.ContractBackend, address common.Address) (*Registry, error)

NewRegistryAt obtains the ENS registry at a given address

func (*Registry) Owner

func (r *Registry) Owner(name string) (common.Address, error)

Owner returns the address of the owner of a name

func (*Registry) Resolver

func (r *Registry) Resolver(name string) (*Resolver, error)

Resolver returns the resolver for a name

func (*Registry) ResolverAddress

func (r *Registry) ResolverAddress(name string) (common.Address, error)

ResolverAddress returns the address of the resolver for a name

func (*Registry) SetOwner

func (r *Registry) SetOwner(opts *bind.TransactOpts, name string, address common.Address) (*types.Transaction, error)

SetOwner sets the ownership of a domain

func (*Registry) SetResolver

func (r *Registry) SetResolver(opts *bind.TransactOpts, name string, address common.Address) (*types.Transaction, error)

SetResolver sets the resolver for a name

func (*Registry) SetSubdomainOwner

func (r *Registry) SetSubdomainOwner(opts *bind.TransactOpts, name string, subname string, address common.Address) (*types.Transaction, error)

SetSubdomainOwner sets the ownership of a subdomain, potentially creating it in the process

type Resolver

type Resolver struct {
	Contract     *resolver.Contract
	ContractAddr common.Address
	// contains filtered or unexported fields
}

Resolver is the structure for the resolver contract

func NewResolver

func NewResolver(backend bind.ContractBackend, domain string) (*Resolver, error)

NewResolver obtains an ENS resolver for a given domain

func NewResolverAt

func NewResolverAt(backend bind.ContractBackend, domain string, address common.Address) (*Resolver, error)

NewResolverAt obtains an ENS resolver at a given address

func (*Resolver) ABI

func (r *Resolver) ABI(name string) (string, error)

ABI returns the ABI associated with a name

func (*Resolver) Address

func (r *Resolver) Address() (common.Address, error)

Address returns the Ethereum address of the domain

func (*Resolver) Contenthash

func (r *Resolver) Contenthash() ([]byte, error)

Contenthash returns the content hash of the domain

func (*Resolver) InterfaceImplementer

func (r *Resolver) InterfaceImplementer(interfaceID [4]byte) (common.Address, error)

InterfaceImplementer returns the address of the contract that implements the given interface for the given domain

func (*Resolver) MultiAddress

func (r *Resolver) MultiAddress(coinType uint64) ([]byte, error)

MultiAddress returns the address of the domain for a given coin type. The coin type is as per https://github.com/satoshilabs/slips/blob/master/slip-0044.md

func (*Resolver) PubKey

func (r *Resolver) PubKey() ([32]byte, [32]byte, error)

PubKey returns the public key of the domain

func (*Resolver) SetABI

func (r *Resolver) SetABI(opts *bind.TransactOpts, name string, abi string, contentType *big.Int) (*types.Transaction, error)

SetABI sets the ABI associated with a name

func (*Resolver) SetAddress

func (r *Resolver) SetAddress(opts *bind.TransactOpts, address common.Address) (*types.Transaction, error)

SetAddress sets the Ethereum address of the domain

func (*Resolver) SetContenthash

func (r *Resolver) SetContenthash(opts *bind.TransactOpts, contenthash []byte) (*types.Transaction, error)

SetContenthash sets the content hash of the domain

func (*Resolver) SetMultiAddress

func (r *Resolver) SetMultiAddress(opts *bind.TransactOpts, coinType uint64, address []byte) (*types.Transaction, error)

SetMultiAddress sets the iaddress of the domain for a given coin type. The coin type is as per https://github.com/satoshilabs/slips/blob/master/slip-0044.md

func (*Resolver) SetPubKey

func (r *Resolver) SetPubKey(opts *bind.TransactOpts, x [32]byte, y [32]byte) (*types.Transaction, error)

SetPubKey sets the public key of the domain

func (*Resolver) SetText

func (r *Resolver) SetText(opts *bind.TransactOpts, name string, value string) (*types.Transaction, error)

SetText sets the text associated with a name

func (*Resolver) Text

func (r *Resolver) Text(name string) (string, error)

Text obtains the text associated with a name

type ReverseRegistrar

type ReverseRegistrar struct {
	Contract     *reverseregistrar.Contract
	ContractAddr common.Address
}

ReverseRegistrar is the structure for the reverse registrar

func NewReverseRegistrar

func NewReverseRegistrar(backend bind.ContractBackend) (*ReverseRegistrar, error)

NewReverseRegistrar obtains the reverse registrar

func NewReverseRegistrarAt

func NewReverseRegistrarAt(backend bind.ContractBackend, address common.Address) (*ReverseRegistrar, error)

NewReverseRegistrarAt obtains the reverse registrar at a given address

func (*ReverseRegistrar) DefaultResolverAddress

func (r *ReverseRegistrar) DefaultResolverAddress() (common.Address, error)

DefaultResolverAddress obtains the default resolver address

func (*ReverseRegistrar) SetName

func (r *ReverseRegistrar) SetName(opts *bind.TransactOpts, name string) (tx *types.Transaction, err error)

SetName sets the name

type ReverseResolver

type ReverseResolver struct {
	Contract     *reverseresolver.Contract
	ContractAddr common.Address
}

ReverseResolver is the structure for the reverse resolver contract

func NewReverseResolver

func NewReverseResolver(backend bind.ContractBackend) (*ReverseResolver, error)

NewReverseResolver obtains the reverse resolver

func NewReverseResolverAt

func NewReverseResolverAt(backend bind.ContractBackend, address common.Address) (*ReverseResolver, error)

NewReverseResolverAt obtains the reverse resolver at a given address

func NewReverseResolverFor

func NewReverseResolverFor(backend bind.ContractBackend, address common.Address) (*ReverseResolver, error)

NewReverseResolverFor creates a reverse resolver contract for the given address.

func (*ReverseResolver) Name

func (r *ReverseResolver) Name(address common.Address) (string, error)

Name obtains the name for an address

Jump to

Keyboard shortcuts

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