Documentation
¶
Index ¶
- Constants
- Variables
- func ContenthashToString(bytes []byte) (string, error)
- func CreateRegistrySession(chainID *big.Int, wallet *accounts.Wallet, account *accounts.Account, ...) *registry.ContractSession
- func DNSEncode(name string) ([]byte, error)
- func DNSWireFormat(domain string) []byte
- func DNSWireFormatDomainHash(domain string) [32]byte
- func DeriveTokenID(ctx context.Context, backend bind.ContractBackend, domain string) (string, error)
- func Domain(domain string) string
- func DomainLevel(name string) int
- func DomainPart(domain string, part int) (string, error)
- func Format(ctx context.Context, backend bind.ContractBackend, address common.Address) string
- func LabelHash(label string) ([32]byte, error)
- func NameHash(name string) ([32]byte, error)
- func NormaliseDomain(domain string) (string, error)
- func NormaliseDomainStrict(domain string) (string, error)
- func Normalize(input string) (string, error)
- func PublicResolverAddress(ctx context.Context, backend bind.ContractBackend) (common.Address, error)
- func RegistrarContractAddress(backend bind.ContractBackend, domain string) (common.Address, error)
- func RegistryContractAddress(_ bind.ContractBackend) (common.Address, error)
- func RegistryContractFromRegistrar(backend bind.ContractBackend, registrar *auctionregistrar.Contract) (*registry.Contract, error)
- func Resolve(ctx context.Context, backend bind.ContractBackend, input string) (common.Address, error)
- func ReverseResolve(ctx context.Context, backend bind.ContractBackend, address common.Address) (string, error)
- func SetResolver(session *registry.ContractSession, name string, resolverAddr *common.Address) (*types.Transaction, error)
- func SetSubdomainOwner(session *registry.ContractSession, name string, subdomain string, ...) (*types.Transaction, error)
- func StringToContenthash(text string) ([]byte, error)
- func Tld(domain string) string
- func UnqualifiedName(domain string, root string) (string, error)
- type AuctionEntry
- type AuctionRegistrar
- func (r *AuctionRegistrar) Entry(domain string) (*AuctionEntry, error)
- func (r *AuctionRegistrar) Migrate(opts *bind.TransactOpts, domain string) (*types.Transaction, error)
- func (r *AuctionRegistrar) Owner(domain string) (common.Address, error)
- func (r *AuctionRegistrar) Release(opts *bind.TransactOpts, domain string) (*types.Transaction, error)
- func (r *AuctionRegistrar) SetOwner(opts *bind.TransactOpts, domain string, address common.Address) (*types.Transaction, error)
- func (r *AuctionRegistrar) ShaBid(hash [32]byte, address common.Address, value *big.Int, salt [32]byte) ([32]byte, error)
- func (r *AuctionRegistrar) State(name string) (string, error)
- type BaseRegistrar
- func (r *BaseRegistrar) Expiry(domain string) (*big.Int, error)
- func (r *BaseRegistrar) Owner(domain string) (common.Address, error)
- func (r *BaseRegistrar) PriorAuctionContract() (*AuctionRegistrar, error)
- func (r *BaseRegistrar) Reclaim(opts *bind.TransactOpts, domain string, newOwner common.Address) (*types.Transaction, error)
- func (r *BaseRegistrar) RegisteredWith(domain string) (string, error)
- func (r *BaseRegistrar) SetOwner(opts *bind.TransactOpts, domain string, newOwner common.Address) (*types.Transaction, error)
- type DNSRegistrar
- type DNSResolver
- func (r *DNSResolver) ClearDNSZone(opts *bind.TransactOpts) (*types.Transaction, error)
- func (r *DNSResolver) HasRecords(name string) (bool, error)
- func (r *DNSResolver) Record(name string, rrType uint16) ([]byte, error)
- func (r *DNSResolver) SetRecords(opts *bind.TransactOpts, data []byte) (*types.Transaction, error)
- func (r *DNSResolver) SetZonehash(opts *bind.TransactOpts, zonehash []byte) (*types.Transaction, error)
- func (r *DNSResolver) Zonehash() ([]byte, error)
- type DNSSECOracle
- type Deed
- type ETHController
- func (c *ETHController) Commit(opts *bind.TransactOpts, domain string, owner common.Address, secret [32]byte) (*types.Transaction, error)
- func (c *ETHController) CommitmentHash(domain string, owner common.Address, secret [32]byte) (common.Hash, error)
- func (c *ETHController) CommitmentTime(domain string, owner common.Address, secret [32]byte) (*big.Int, error)
- func (c *ETHController) IsAvailable(domain string) (bool, error)
- func (c *ETHController) IsValid(domain string) (bool, error)
- func (c *ETHController) MaxCommitmentInterval() (*big.Int, error)
- func (c *ETHController) MinCommitmentInterval() (*big.Int, error)
- func (c *ETHController) MinRegistrationDuration() (time.Duration, error)
- func (c *ETHController) Renew(opts *bind.TransactOpts, domain string) (*types.Transaction, error)
- func (c *ETHController) RentCost(domain string) (*big.Int, error)
- func (c *ETHController) Reveal(opts *bind.TransactOpts, domain string, owner common.Address, secret [32]byte) (*types.Transaction, error)
- type EmptyAddressError
- type HTTPGatewayError
- type Name
- func (n *Name) Address(ctx context.Context, coinType uint64) ([]byte, error)
- func (n *Name) Controller() (common.Address, error)
- func (n *Name) CreateSubdomain(label string, controller common.Address, opts *bind.TransactOpts) (*types.Transaction, error)
- func (n *Name) Expires() (time.Time, error)
- func (n *Name) ExtendRegistration(opts *bind.TransactOpts) (*types.Transaction, error)
- func (n *Name) IsRegistered() (bool, error)
- func (n *Name) Reclaim(opts *bind.TransactOpts) (*types.Transaction, error)
- func (n *Name) RegisterStageOne(registrant common.Address, opts *bind.TransactOpts) (*types.Transaction, [32]byte, error)
- func (n *Name) RegisterStageTwo(registrant common.Address, secret [32]byte, opts *bind.TransactOpts) (*types.Transaction, error)
- func (n *Name) Registrant() (common.Address, error)
- func (n *Name) RegistrationInterval() (time.Duration, error)
- func (n *Name) RentCost() (*big.Int, error)
- func (n *Name) ResolverAddress() (common.Address, error)
- func (n *Name) SetAddress(coinType uint64, address []byte, opts *bind.TransactOpts) (*types.Transaction, error)
- func (n *Name) SetController(controller common.Address, opts *bind.TransactOpts) (*types.Transaction, error)
- func (n *Name) SetResolverAddress(address common.Address, opts *bind.TransactOpts) (*types.Transaction, error)
- func (n *Name) Transfer(registrant common.Address, opts *bind.TransactOpts) (*types.Transaction, error)
- type Parameter
- type Registry
- func (r *Registry) Owner(name string) (common.Address, error)
- func (r *Registry) Resolver(name string) (*Resolver, error)
- func (r *Registry) ResolverAddress(name string) (common.Address, error)
- func (r *Registry) SetOwner(opts *bind.TransactOpts, name string, address common.Address) (*types.Transaction, error)
- func (r *Registry) SetResolver(opts *bind.TransactOpts, name string, address common.Address) (*types.Transaction, error)
- func (r *Registry) SetSubdomainOwner(opts *bind.TransactOpts, name string, subname string, address common.Address) (*types.Transaction, error)
- type Resolver
- func (r *Resolver) ABI(name string) (string, error)
- func (r *Resolver) Address() (common.Address, error)
- func (r *Resolver) Contenthash() ([]byte, error)
- func (r *Resolver) InterfaceImplementer(interfaceID [4]byte) (common.Address, error)
- func (r *Resolver) MultiAddress(coinType uint64) ([]byte, error)
- func (r *Resolver) PubKey() ([32]byte, [32]byte, error)
- func (r *Resolver) SetABI(opts *bind.TransactOpts, _ string, abi string, contentType *big.Int) (*types.Transaction, error)
- func (r *Resolver) SetAddress(opts *bind.TransactOpts, address common.Address) (*types.Transaction, error)
- func (r *Resolver) SetContenthash(opts *bind.TransactOpts, contenthash []byte) (*types.Transaction, error)
- func (r *Resolver) SetMultiAddress(opts *bind.TransactOpts, coinType uint64, address []byte) (*types.Transaction, error)
- func (r *Resolver) SetPubKey(opts *bind.TransactOpts, x [32]byte, y [32]byte) (*types.Transaction, error)
- func (r *Resolver) SetText(opts *bind.TransactOpts, name string, value string) (*types.Transaction, error)
- func (r *Resolver) Text(name string) (string, error)
- type ResolverNotContractError
- type ResolverNotFoundError
- type ResolverRevertError
- type ReverseAddressMismatchError
- type ReverseRegistrar
- type ReverseResolver
- type UniversalResolver
- func (u *UniversalResolver) Address() common.Address
- func (u *UniversalResolver) Contenthash(ctx context.Context, name string) ([]byte, error)
- func (u *UniversalResolver) MultiAddress(ctx context.Context, name string, coinType uint64) ([]byte, error)
- func (u *UniversalResolver) Resolve(ctx context.Context, name string, callData []byte) ([]byte, common.Address, error)
- func (u *UniversalResolver) ResolveAddress(ctx context.Context, name string) (common.Address, error)
- func (u *UniversalResolver) Reverse(ctx context.Context, address []byte, coinType uint64) (string, common.Address, common.Address, error)
- func (u *UniversalResolver) Text(ctx context.Context, name, key string) (string, error)
- type UnknownChainError
- type UnsupportedResolverProfileError
Constants ¶
const CoinTypeETH = uint64(60)
CoinTypeETH is SLIP-0044 coin type 60: native Ethereum addresses.
const UniversalResolverContractAddress = "0xeEeEEEeE14D718C2B47D9923Deab1335E144EeEe"
UniversalResolverContractAddress is the proxy address of the ENS UniversalResolver. The same vanity address is used on Ethereum mainnet and L1 testnets where the ENS DAO has deployed the proxy (Sepolia).
Variables ¶
var ErrNoAddress = errors.New("no address")
ErrNoAddress is returned when a resolver is found but the address record is missing or zero.
var ErrUnregistered = errors.New("unregistered name")
ErrUnregistered is returned when a name has no resolver in the registry. Callers may compare against it with errors.Is.
var UnknownAddress = common.HexToAddress("00")
UnknownAddress is the address to which unknown entries resolve.
Functions ¶
func ContenthashToString ¶
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 DNSEncode ¶
DNSEncode converts an ENS name into the DNS wire format used by EIP-137 / the Universal Resolver: each label is preceded by a single byte holding its length, and the encoding is terminated with a zero byte representing the root label. The empty string encodes to a single zero byte.
Labels of at most 255 bytes are encoded as-is. Labels longer than 255 bytes are replaced with "[" + hex(keccak256(label)) + "]", which the Universal Resolver treats as an unknown-label hash. ENSIP-10 removes RFC 1035's 255-octet limit on the total encoded name length.
func DNSWireFormat ¶
DNSWireFormat turns a domain name in to wire format.
func DNSWireFormatDomainHash ¶
DNSWireFormatDomainHash hashes a domain name in wire format.
func DeriveTokenID ¶
func DeriveTokenID(ctx context.Context, 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 ¶
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 ¶
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 ¶
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 NormaliseDomain ¶
NormaliseDomain turns an ENS domain into normal form per ENSIP-15.
A leading "*." wildcard prefix is preserved (stripped before normalisation and re-attached afterwards); the rest of the name is normalised by the canonical ENSIP-15 implementation. Empty labels, disallowed codepoints, and other ENSIP-15 violations return an error.
func NormaliseDomainStrict ¶
NormaliseDomainStrict applies strict DNS rules (e.g. no underscores) via golang.org/x/net/idna with StrictDomainName=true. This is NOT ENSIP-15 normalisation — for that, use NormaliseDomain. NormaliseDomainStrict is kept for callers that need DNS-strict validation, e.g. before publishing a name to a DNS-backed registrar.
func Normalize ¶
Normalize normalizes a name according to ENSIP-15. Empty labels, disallowed codepoints, mixed-script confusables, and other ENSIP-15 violations return an error. The implementation delegates to github.com/adraffy/go-ens-normalize, the canonical Go port (Unicode 17.0.0, passes the full ENSIP-15 validation suite).
func PublicResolverAddress ¶
func PublicResolverAddress(ctx context.Context, backend bind.ContractBackend) (common.Address, error)
PublicResolverAddress obtains the address of the public resolver for a chain.
func RegistrarContractAddress ¶
RegistrarContractAddress obtains the registrar contract address for a given domain.
func RegistryContractAddress ¶
func RegistryContractAddress(_ 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(ctx context.Context, backend bind.ContractBackend, input string) (common.Address, error)
Resolve resolves an ENS name into an Ethereum address, or parses input directly if it is already a hex address.
If input contains a dot it is treated as an ENS name and resolved through the ENS UniversalResolver, so ENSIP-10 wildcard resolution and ERC-3668 CCIP-Read are followed transparently — names backed by offchain or L2 data resolve the same way as fully on-chain names. If input contains no dot it is treated as a literal hex address and returned after validation, without any on-chain lookup.
ctx is honoured for cancellation and deadline propagation, flowing through the CCIP-Read hops, so a caller that sets a per-request deadline can cap the total resolution time end-to-end.
It returns an error if the name is not found or otherwise resolves to the zero address.
func ReverseResolve ¶
func ReverseResolve(ctx context.Context, backend bind.ContractBackend, address common.Address) (string, error)
ReverseResolve resolves an address in to an ENS name. Resolution flows through the ENS UniversalResolver, so ENSIP-10 wildcard resolution and ERC-3668 CCIP-Read are handled transparently and reverse records stored offchain or on an L2 resolve the same way as fully on-chain reverse records.
ctx is honoured for cancellation and deadline propagation through the CCIP-Read hops.
This will return an error if no primary name is set for the address.
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 ¶
StringToContenthash turns EIP-1577 text format in to EIP-1577 binary format.
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.
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 ¶
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 (*Deed) PreviousOwner ¶
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 EmptyAddressError ¶
type EmptyAddressError struct{}
EmptyAddressError corresponds to `EmptyAddress()`: thrown by reverse() when the lookup address is empty.
func (*EmptyAddressError) Error ¶
func (e *EmptyAddressError) Error() string
func (*EmptyAddressError) Unwrap ¶
func (e *EmptyAddressError) Unwrap() error
type HTTPGatewayError ¶
HTTPGatewayError corresponds to `HttpError(uint16,string)`: a CCIP-Read gateway returned a non-success status whose body the UR forwarded.
func (*HTTPGatewayError) Error ¶
func (e *HTTPGatewayError) Error() string
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 ¶
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
Resolution is delegated to the UniversalResolver, so it follows ENSIP-10 wildcard resolution and ERC-3668 CCIP-Read and returns the same answer as ens.Resolve for coin type 60. ctx is honoured for cancellation and deadline propagation.
func (*Name) Controller ¶
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) 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 ¶
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 ¶
Registrant obtains the registrant for this name.
func (*Name) RegistrationInterval ¶
RegistrationInterval obtains the minimum interval between commit and reveal when registering this name.
func (*Name) ResolverAddress ¶
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 Parameter ¶
type Parameter func(*parameters)
Parameter is a functional option for NewUniversalResolver.
func WithAddress ¶
WithAddress binds the resolver to an explicit UniversalResolver address instead of the canonical proxy. Use this on chains without a canonical deployment (devnets, forks, alt-L1s); it also skips the chain-ID guardrail.
func WithHTTPClient ¶
WithHTTPClient sets the HTTP client used for ERC-3668 CCIP-Read gateway requests. When unset, a default client is used.
func WithMaxHops ¶
WithMaxHops caps the number of OffchainLookup redirects a single resolution may chain. When unset, the ccipread package default applies.
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 ¶
NewRegistryAt obtains the ENS registry at a given address.
func (*Registry) ResolverAddress ¶
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) Address ¶
Address returns the Ethereum address of the domain.
This reads the addr(bytes32) record directly from the resolver contract this Resolver is bound to (located via the registry when the Resolver was created). It does NOT perform ENSIP-10 wildcard resolution or follow ERC-3668 CCIP-Read, so names whose addresses live off-chain or on an L2 return the zero address or a raw revert error here. For wildcard- and CCIP-Read-aware resolution use Resolve or UniversalResolver.ResolveAddress instead.
func (*Resolver) Contenthash ¶
Contenthash returns the content hash of the domain.
func (*Resolver) InterfaceImplementer ¶
InterfaceImplementer returns the address of the contract that implements the given interface for the given domain.
func (*Resolver) MultiAddress ¶
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) SetABI ¶
func (r *Resolver) SetABI(opts *bind.TransactOpts, _ 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.
type ResolverNotContractError ¶
ResolverNotContractError corresponds to `ResolverNotContract(bytes,address)`: the registry pointed at an address that holds no code.
func (*ResolverNotContractError) Error ¶
func (e *ResolverNotContractError) Error() string
type ResolverNotFoundError ¶
type ResolverNotFoundError struct {
// DNSName is the DNS-encoded name as passed to resolve().
DNSName []byte
}
ResolverNotFoundError corresponds to the UniversalResolver custom error `ResolverNotFound(bytes)`. It is reported when no resolver is set anywhere up the parent chain of the requested name.
func (*ResolverNotFoundError) Error ¶
func (e *ResolverNotFoundError) Error() string
func (*ResolverNotFoundError) Unwrap ¶
func (e *ResolverNotFoundError) Unwrap() error
type ResolverRevertError ¶
type ResolverRevertError struct {
Data []byte
}
ResolverRevertError corresponds to `ResolverError(bytes)`: the downstream resolver itself reverted; the inner revert bytes are preserved verbatim.
func (*ResolverRevertError) Error ¶
func (e *ResolverRevertError) Error() string
type ReverseAddressMismatchError ¶
ReverseAddressMismatchError corresponds to `ReverseAddressMismatch(string,bytes)`: the reverse-resolved name's forward record does not point back at the queried address.
func (*ReverseAddressMismatchError) Error ¶
func (e *ReverseAddressMismatchError) Error() string
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) (*types.Transaction, 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.
type UniversalResolver ¶
type UniversalResolver struct {
// contains filtered or unexported fields
}
UniversalResolver wraps the ENS Universal Resolver and exposes resolution helpers that transparently follow ERC-3668 OffchainLookup reverts via the ccipread package.
func NewUniversalResolver ¶
func NewUniversalResolver(ctx context.Context, backend bind.ContractBackend, params ...Parameter) (*UniversalResolver, error)
NewUniversalResolver returns a UniversalResolver for the chain reached through backend. It honours ctx for the chain-ID probe, so a cancelled or expired ctx surfaces as ctx.Err().
By default it binds to the canonical proxy address and, when the backend exposes a chain ID (ethclient.Client and most production backends do), verifies the chain has a known UR deployment — returning *UnknownChainError otherwise. Supply WithAddress to target a non-standard deployment (devnet, fork, alt-L1), which also skips the chain-ID guardrail.
func (*UniversalResolver) Address ¶
func (u *UniversalResolver) Address() common.Address
Address returns the on-chain address of the bound UniversalResolver.
func (*UniversalResolver) Contenthash ¶
Contenthash resolves the contenthash record for a name through the UniversalResolver, following ENSIP-10 wildcard resolution and ERC-3668 CCIP-Read.
func (*UniversalResolver) MultiAddress ¶
func (u *UniversalResolver) MultiAddress(ctx context.Context, name string, coinType uint64) ([]byte, error)
MultiAddress resolves the address of a name for an arbitrary SLIP-0044 coin type through the UniversalResolver, following ENSIP-10 wildcard resolution and ERC-3668 CCIP-Read. It invokes the resolver's addr(bytes32,uint256) profile. For coin type 60 (ETH) prefer ResolveAddress, which returns a typed common.Address.
func (*UniversalResolver) Resolve ¶
func (u *UniversalResolver) Resolve(ctx context.Context, name string, callData []byte) ([]byte, common.Address, error)
Resolve performs UniversalResolver.resolve(name, callData) using the chain connected via the backend, transparently following any OffchainLookup reverts. The returned bytes are the abi-encoded return value of the downstream resolver call (e.g. for `addr(bytes32)` the bytes decode as `address`); resolverAddr is the resolver contract that produced it.
func (*UniversalResolver) ResolveAddress ¶
func (u *UniversalResolver) ResolveAddress(ctx context.Context, name string) (common.Address, error)
ResolveAddress resolves an ENS name to its primary Ethereum address by invoking the legacy `addr(bytes32)` resolver profile through the UniversalResolver.
func (*UniversalResolver) Reverse ¶
func (u *UniversalResolver) Reverse(ctx context.Context, address []byte, coinType uint64) (string, common.Address, common.Address, error)
Reverse performs UniversalResolver.reverse(lookupAddress, coinType) and returns the primary name, the resolver address, and the reverse resolver address. CCIP-Read is followed transparently.
func (*UniversalResolver) Text ¶
Text resolves a text record for a name through the UniversalResolver. Unlike Resolver.Text, this follows ENSIP-10 wildcard resolution and ERC-3668 CCIP-Read, so offchain and L2 text records resolve correctly.
This is the read half of the unified read path: it builds calldata for the resolver's text(bytes32,string) profile and hands it to the same resolve() choke point as Address and Contenthash, so wildcard/CCIP behaviour is identical across every profile.
type UnknownChainError ¶
UnknownChainError is returned by NewUniversalResolver when the backend reports a chain ID without a known UR deployment at the canonical address.
func (*UnknownChainError) Error ¶
func (e *UnknownChainError) Error() string
type UnsupportedResolverProfileError ¶
type UnsupportedResolverProfileError struct {
Selector [4]byte
}
UnsupportedResolverProfileError corresponds to `UnsupportedResolverProfile(bytes4)`: the resolver did not implement the requested function selector.
func (*UnsupportedResolverProfileError) Error ¶
func (e *UnsupportedResolverProfileError) Error() string
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ccipread implements the client side of ERC-3668 (CCIP Read) so that calls into ENS contracts which revert with OffchainLookup are transparently followed: the gateway is queried, the callback is invoked, and the chain is repeated until a non-revert result is returned.
|
Package ccipread implements the client side of ERC-3668 (CCIP Read) so that calls into ENS contracts which revert with OffchainLookup are transparently followed: the gateway is queried, the callback is invoked, and the chain is repeated until a non-revert result is returned. |
|
contracts
|
|