Documentation ¶
Index ¶
- Constants
- Variables
- func DeriveTokenID(domain string) (persist.HexTokenID, error)
- func IsOwner(ctx context.Context, ethClient *ethclient.Client, addr persist.EthereumAddress, ...) (bool, error)
- func NormalizeDomain(domain string) (string, error)
- func ReverseResolve(ctx context.Context, ethClient *ethclient.Client, ...) (string, error)
- func ReverseResolves(ctx context.Context, ethClient *ethclient.Client, ...) (bool, error)
- func ReverseResolvesTo(ctx context.Context, ethClient *ethclient.Client, domain string, ...) (bool, error)
- func TokenInfoFor(r EnsTokenRecord) (persist.Chain, persist.Address, persist.TokenType, persist.HexTokenID, error)
- type AvatarRecord
- type EnsHttpRecord
- type EnsIpfsRecord
- type EnsTokenRecord
- type Verifier
Constants ¶
const (
EnsAddress = "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"
)
Variables ¶
var ErrAddressSignatureMismatch = errors.New("address does not match signature")
ErrAddressSignatureMismatch is returned when the address signature does not match the address cryptographically
var ErrChainNotSupported = errors.New("chain not supported")
var ErrNoAvatarRecord = errors.New("no avatar record set")
var ErrNoResolution = errors.New("unable to resolve ENS domain from address")
var ErrUnknownEnsAvatarURI = errors.New("unknown ENS avatar uri")
var ErrUnknownTokenType = errors.New("unknown token type")
Functions ¶
func DeriveTokenID ¶
func DeriveTokenID(domain string) (persist.HexTokenID, error)
DeriveTokenID derives the token ID (in hexadecimal) from a domain
func IsOwner ¶
func IsOwner(ctx context.Context, ethClient *ethclient.Client, addr persist.EthereumAddress, uri EnsTokenRecord) (bool, error)
IsOwner returns true if the address is the current holder of the token
func NormalizeDomain ¶
NormalizeDomain converts a domain to its canonical form
func ReverseResolve ¶
func ReverseResolve(ctx context.Context, ethClient *ethclient.Client, address persist.EthereumAddress) (string, error)
ReverseResolve returns the domain name for the given address
func ReverseResolves ¶
func ReverseResolves(ctx context.Context, ethClient *ethclient.Client, address persist.EthereumAddress) (bool, error)
ReverseResolves returns true if the reverse resolves to any domain
func ReverseResolvesTo ¶
func ReverseResolvesTo(ctx context.Context, ethClient *ethclient.Client, domain string, address persist.EthereumAddress) (bool, error)
ReverseResolvesTo returns true if the address reverse resolves to the given domain
func TokenInfoFor ¶
func TokenInfoFor(r EnsTokenRecord) (persist.Chain, persist.Address, persist.TokenType, persist.HexTokenID, error)
TokenInfoFor is a helper function for parsing info from a token record
Types ¶
type AvatarRecord ¶
type AvatarRecord interface {
IsAvatarURI()
}
func EnsAvatarRecordFor ¶
func EnsAvatarRecordFor(ctx context.Context, ethClient *ethclient.Client, a persist.EthereumAddress) (avatar AvatarRecord, domain string, err error)
EnsAvatarRecordFor returns the avatar record for the given address
type EnsHttpRecord ¶
type EnsHttpRecord struct {
URL string
}
func (EnsHttpRecord) IsAvatarURI ¶
func (EnsHttpRecord) IsAvatarURI()
type EnsIpfsRecord ¶
type EnsIpfsRecord struct {
URL string
}
func (EnsIpfsRecord) IsAvatarURI ¶
func (EnsIpfsRecord) IsAvatarURI()
type EnsTokenRecord ¶
type EnsTokenRecord struct { ChainID string AssetNamespace string AssetReference string AssetID string }
func (EnsTokenRecord) IsAvatarURI ¶
func (EnsTokenRecord) IsAvatarURI()
func (EnsTokenRecord) TokenID ¶
func (e EnsTokenRecord) TokenID() (persist.HexTokenID, error)
type Verifier ¶
func (*Verifier) VerifySignature ¶
func (p *Verifier) VerifySignature(pCtx context.Context, pAddressStr persist.PubKey, pWalletType persist.WalletType, pMessage string, pSignatureStr string) (bool, error)
VerifySignature will verify a signature using all available methods (eth_sign and personal_sign)