Documentation ¶
Index ¶
- Constants
- Variables
- func EntropyToMnemonic(entropy []byte) (string, error)
- func IsValid191Signature(address common.Address, message, signature []byte) (bool, error)
- func IsValidEOASignature(address common.Address, digest, signature []byte) (bool, error)
- func IsValidMnemonic(mnemonic string) bool
- func MnemonicToEntropy(mnemonic string) ([]byte, error)
- func NewSeedFromMnemonic(mnemonic string) ([]byte, error)
- func ParseDerivationPath(path string) (accounts.DerivationPath, error)
- func RandomEntropy(bitSize ...int) ([]byte, error)
- func RandomSeed() ([]byte, error)
- func RecoverAddress(message, signature []byte) (common.Address, error)
- func RecoverAddressFromDigest(digest, signature []byte) (common.Address, error)
- func ValidateEthereumSignature(address string, message []byte, signatureHex string) (bool, error)
- type HDNode
- func NewHDNodeFromEntropy(entropy []byte, path *accounts.DerivationPath) (*HDNode, error)
- func NewHDNodeFromMnemonic(mnemonic string, path *accounts.DerivationPath) (*HDNode, error)
- func NewHDNodeFromPrivateKey(privateKey string) (*HDNode, error)
- func NewHDNodeFromRandomEntropy(bitSize int, path *accounts.DerivationPath) (*HDNode, error)
- func (h *HDNode) Address() common.Address
- func (h *HDNode) Clone() (*HDNode, error)
- func (h *HDNode) DerivationPath() accounts.DerivationPath
- func (h *HDNode) DeriveAccountIndex(accountIndex uint32) error
- func (h *HDNode) DerivePath(derivationPath accounts.DerivationPath) error
- func (h *HDNode) DerivePathFromString(path string) error
- func (h *HDNode) Entropy() []byte
- func (h *HDNode) Mnemonic() string
- func (h *HDNode) PrivateKey() *ecdsa.PrivateKey
- func (h *HDNode) PublicKey() *ecdsa.PublicKey
- type Wallet
- func NewWalletFromHDNode(hdnode *HDNode, optPath ...accounts.DerivationPath) (*Wallet, error)
- func NewWalletFromMnemonic(mnemonic string, optPath ...string) (*Wallet, error)
- func NewWalletFromPrivateKey(key string) (*Wallet, error)
- func NewWalletFromRandomEntropy(options ...WalletOptions) (*Wallet, error)
- func (w *Wallet) Address() common.Address
- func (w *Wallet) Clone() (*Wallet, error)
- func (w *Wallet) DeriveAccountIndex(accountIndex uint32) (*Wallet, common.Address, error)
- func (w *Wallet) DerivePath(path accounts.DerivationPath) (*Wallet, common.Address, error)
- func (w *Wallet) DerivePathFromString(path string) (*Wallet, common.Address, error)
- func (w *Wallet) GetProvider() *ethrpc.Provider
- func (w *Wallet) HDNode() *HDNode
- func (w *Wallet) IsValidSignature(msg, sig []byte) (bool, error)
- func (w *Wallet) IsValidSignatureOfDigest(digest, sig []byte) (bool, error)
- func (w *Wallet) NewTransaction(ctx context.Context, txnRequest *ethtxn.TransactionRequest) (*types.Transaction, error)
- func (w *Wallet) PrivateKey() *ecdsa.PrivateKey
- func (w *Wallet) PrivateKeyHex() string
- func (w *Wallet) Provider() *WalletProvider
- func (w *Wallet) PublicKey() *ecdsa.PublicKey
- func (w *Wallet) PublicKeyHex() string
- func (w *Wallet) SelfDeriveAccountIndex(accountIndex uint32) (common.Address, error)
- func (w *Wallet) SelfDerivePath(path accounts.DerivationPath) (common.Address, error)
- func (w *Wallet) SelfDerivePathFromString(path string) (common.Address, error)
- func (w *Wallet) SendTransaction(ctx context.Context, signedTx *types.Transaction) (*types.Transaction, ethtxn.WaitReceipt, error)
- func (w *Wallet) SetProvider(provider *ethrpc.Provider)
- func (w *Wallet) SignMessage(message []byte) ([]byte, error)
- func (w *Wallet) SignTx(tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
- func (w *Wallet) Transactor(ctx context.Context) (*bind.TransactOpts, error)
- func (w *Wallet) TransactorForChainID(chainID *big.Int) (*bind.TransactOpts, error)
- type WalletOptions
- type WalletProvider
- func (w *WalletProvider) Backend() *ethrpc.Provider
- func (w *WalletProvider) GetEtherBalanceAt(ctx context.Context, blockNumber *big.Int) (*big.Int, error)
- func (w *WalletProvider) GetTransactionCount(ctx context.Context) (uint64, error)
- func (w *WalletProvider) NewTransactor(ctx context.Context) (*bind.TransactOpts, error)
Constants ¶
View Source
const ( EntropyBitSize12WordMnemonic = 128 EntropyBitSize24WordMnemonic = 256 )
Entropy bit size constants for 12 and 24 word mnemonics
Variables ¶
View Source
var DefaultBaseDerivationPath = accounts.DefaultBaseDerivationPath
DefaultBaseDerivationPath is the base path from which custom derivation endpoints are incremented. As such, the first account will be at m/44'/60'/0'/0/0, the second at m/44'/60'/0'/0/1, etc.
View Source
var DefaultWalletOptions = WalletOptions{ DerivationPath: "m/44'/60'/0'/0/0", RandomWalletEntropyBitSize: EntropyBitSize12WordMnemonic, }
Functions ¶
func EntropyToMnemonic ¶
func IsValid191Signature ¶ added in v1.12.9
func IsValidEOASignature ¶ added in v1.5.0
func IsValidMnemonic ¶
func MnemonicToEntropy ¶
func NewSeedFromMnemonic ¶
NewSeedFromMnemonic returns a BIP-39 seed based on a BIP-39 mnemonic.
func ParseDerivationPath ¶
func ParseDerivationPath(path string) (accounts.DerivationPath, error)
ParseDerivationPath parses the derivation path in string format into []uint32
func RandomEntropy ¶
func RandomSeed ¶
RandomSeed returns a randomly generated BIP-39 seed.
func RecoverAddress ¶ added in v1.5.0
func RecoverAddressFromDigest ¶ added in v1.5.0
Types ¶
type HDNode ¶
type HDNode struct {
// contains filtered or unexported fields
}
func NewHDNodeFromEntropy ¶
func NewHDNodeFromEntropy(entropy []byte, path *accounts.DerivationPath) (*HDNode, error)
func NewHDNodeFromMnemonic ¶
func NewHDNodeFromMnemonic(mnemonic string, path *accounts.DerivationPath) (*HDNode, error)
func NewHDNodeFromPrivateKey ¶ added in v1.3.5
func NewHDNodeFromRandomEntropy ¶
func NewHDNodeFromRandomEntropy(bitSize int, path *accounts.DerivationPath) (*HDNode, error)
func (*HDNode) DerivationPath ¶
func (h *HDNode) DerivationPath() accounts.DerivationPath
func (*HDNode) DeriveAccountIndex ¶
func (*HDNode) DerivePath ¶
func (h *HDNode) DerivePath(derivationPath accounts.DerivationPath) error
func (*HDNode) DerivePathFromString ¶
func (*HDNode) PrivateKey ¶
func (h *HDNode) PrivateKey() *ecdsa.PrivateKey
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func NewWalletFromHDNode ¶
func NewWalletFromHDNode(hdnode *HDNode, optPath ...accounts.DerivationPath) (*Wallet, error)
func NewWalletFromMnemonic ¶
func NewWalletFromPrivateKey ¶ added in v1.3.5
func NewWalletFromRandomEntropy ¶
func NewWalletFromRandomEntropy(options ...WalletOptions) (*Wallet, error)
func (*Wallet) DeriveAccountIndex ¶
func (*Wallet) DerivePath ¶
func (*Wallet) DerivePathFromString ¶
func (*Wallet) GetProvider ¶
func (*Wallet) IsValidSignature ¶ added in v1.5.0
func (*Wallet) IsValidSignatureOfDigest ¶ added in v1.5.0
func (*Wallet) NewTransaction ¶ added in v1.3.6
func (w *Wallet) NewTransaction(ctx context.Context, txnRequest *ethtxn.TransactionRequest) (*types.Transaction, error)
func (*Wallet) PrivateKey ¶
func (w *Wallet) PrivateKey() *ecdsa.PrivateKey
func (*Wallet) PrivateKeyHex ¶
func (*Wallet) Provider ¶
func (w *Wallet) Provider() *WalletProvider
func (*Wallet) PublicKeyHex ¶
func (*Wallet) SelfDeriveAccountIndex ¶
func (*Wallet) SelfDerivePath ¶
func (*Wallet) SelfDerivePathFromString ¶
func (*Wallet) SendTransaction ¶ added in v1.3.6
func (w *Wallet) SendTransaction(ctx context.Context, signedTx *types.Transaction) (*types.Transaction, ethtxn.WaitReceipt, error)
func (*Wallet) SetProvider ¶
func (*Wallet) SignTx ¶
func (w *Wallet) SignTx(tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
func (*Wallet) Transactor ¶
func (*Wallet) TransactorForChainID ¶ added in v1.6.0
type WalletOptions ¶
type WalletProvider ¶
type WalletProvider struct {
// contains filtered or unexported fields
}
WalletProvider is a helper to query the provider in context of the wallet address
func (*WalletProvider) Backend ¶
func (w *WalletProvider) Backend() *ethrpc.Provider
func (*WalletProvider) GetEtherBalanceAt ¶
func (*WalletProvider) GetTransactionCount ¶
func (w *WalletProvider) GetTransactionCount(ctx context.Context) (uint64, error)
func (*WalletProvider) NewTransactor ¶
func (w *WalletProvider) NewTransactor(ctx context.Context) (*bind.TransactOpts, error)
Click to show internal directories.
Click to hide internal directories.