eth

package
v0.0.0-...-d4303dc Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnsAddress = "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"
)

Variables

View Source
var ErrAddressSignatureMismatch = errors.New("address does not match signature")

ErrAddressSignatureMismatch is returned when the address signature does not match the address cryptographically

View Source
var ErrChainNotSupported = errors.New("chain not supported")
View Source
var ErrNoAvatarRecord = errors.New("no avatar record set")
View Source
var ErrNoResolution = errors.New("unable to resolve ENS domain from address")
View Source
var ErrUnknownEnsAvatarURI = errors.New("unknown ENS avatar uri")
View Source
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

func NormalizeDomain(domain string) (string, error)

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

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) Address

func (e EnsTokenRecord) Address() (persist.Address, error)

func (EnsTokenRecord) Chain

func (e EnsTokenRecord) Chain() (persist.Chain, error)

func (EnsTokenRecord) IsAvatarURI

func (EnsTokenRecord) IsAvatarURI()

func (EnsTokenRecord) TokenID

func (e EnsTokenRecord) TokenID() (persist.HexTokenID, error)

func (EnsTokenRecord) TokenType

func (e EnsTokenRecord) TokenType() (persist.TokenType, error)

type Verifier

type Verifier struct {
	Client *ethclient.Client
}

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)

Jump to

Keyboard shortcuts

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