Documentation ¶
Index ¶
- Constants
- func EntropyFromString(entropy string) []byte
- func MnemonicHasAddress(addressHex, mnemonic, passphrase string, maxIndex int) (common.Address, bool, error)
- type HDWallet
- func (w HDWallet) Accounts() []*HDWalletAddress
- func (w *HDWallet) DeriveAddress() (*HDWalletAddress, error)
- func (w *HDWallet) DeriveAddressFromIndex(idx int) (*HDWalletAddress, error)
- func (w *HDWallet) DeriveHardenedAddress() (*HDWalletAddress, error)
- func (w HDWallet) Entropy() []byte
- func (w HDWallet) MasterKey() *hdkeychain.ExtendedKey
- func (w HDWallet) Mnemonic() string
- func (w HDWallet) Seed() []byte
- type HDWalletAddress
- func (a HDWalletAddress) Address() common.Address
- func (a HDWalletAddress) DerivationIndex() int
- func (a HDWalletAddress) DerivationPath() string
- func (a HDWalletAddress) Hardened() bool
- func (a HDWalletAddress) HardenedDerivationIndex() int
- func (a HDWalletAddress) PrivateKey() *ecdsa.PrivateKey
- func (a HDWalletAddress) PrivateKeyBytes() []byte
- func (a HDWalletAddress) PrivateKeyHex() string
- func (a HDWalletAddress) PublicKey() ecdsa.PublicKey
- func (a HDWalletAddress) PublicKeyBytes() []byte
- func (a HDWalletAddress) PublicKeyHex() string
- func (a *HDWalletAddress) TransactOptsForChainID(chainID *big.Int) (*bind.TransactOpts, error)
- type NewWalletOpt
Constants ¶
const ( // Entropy128Bit is the minimum entropy amount allowed by BIP39, // and results in a BIP39 mnemonic of length 12. Entropy128Bit int = 128 // Entropy160Bit results in a BIP39 mnemonic of length 15. Entropy160Bit int = 160 // Entropy192Bit results in a BIP39 mnemonic of length 18. Entropy192Bit int = 192 // Entropy224Bit results in a BIP39 mnemonic of length 21. Entropy224Bit int = 224 // Entropy256Bit is the maximum entropy amount allowed by BIP39, // and results in a BIP39 mnemonic of length 24. Entropy256Bit int = 256 )
Variables ¶
This section is empty.
Functions ¶
func EntropyFromString ¶
EntropyFromString returns the []byte representation of a hex-encoded entropy string.
Types ¶
type HDWallet ¶
type HDWallet struct {
// contains filtered or unexported fields
}
HDWallet represents a BIP32/BIP44 Hierarchical Deterministic Wallet.
func NewHDWallet ¶
func NewHDWallet(opts ...NewWalletOpt) (*HDWallet, error)
NewHDWallet constructs and returns an *HDWallet instance using any passed NewWalletOpt parameters.
func (HDWallet) Accounts ¶
func (w HDWallet) Accounts() []*HDWalletAddress
func (*HDWallet) DeriveAddress ¶
func (w *HDWallet) DeriveAddress() (*HDWalletAddress, error)
DeriveAddress derives a new, non-hardened child account using the next available derivation index. If the next available derivation index is the start of available "hardened" derivation indices, an error is returned.
func (*HDWallet) DeriveAddressFromIndex ¶
func (w *HDWallet) DeriveAddressFromIndex(idx int) (*HDWalletAddress, error)
DeriveAddressFromIndex derives a new child account using the provided derivation index, which can be a hardened or non-hardened index.
func (*HDWallet) DeriveHardenedAddress ¶
func (w *HDWallet) DeriveHardenedAddress() (*HDWalletAddress, error)
DeriveHardenedAddress derives a new, hardened child account using the next available derivation index.
func (HDWallet) MasterKey ¶
func (w HDWallet) MasterKey() *hdkeychain.ExtendedKey
type HDWalletAddress ¶
type HDWalletAddress struct {
// contains filtered or unexported fields
}
HDWalletAddress represents a BIP32-compliant derived HD Wallet address (see https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki), consisting of an on-chain address and ECDSA private/public keys.
func (HDWalletAddress) Address ¶
func (a HDWalletAddress) Address() common.Address
func (HDWalletAddress) DerivationIndex ¶
func (a HDWalletAddress) DerivationIndex() int
func (HDWalletAddress) DerivationPath ¶
func (a HDWalletAddress) DerivationPath() string
func (HDWalletAddress) Hardened ¶
func (a HDWalletAddress) Hardened() bool
func (HDWalletAddress) HardenedDerivationIndex ¶
func (a HDWalletAddress) HardenedDerivationIndex() int
func (HDWalletAddress) PrivateKey ¶
func (a HDWalletAddress) PrivateKey() *ecdsa.PrivateKey
func (HDWalletAddress) PrivateKeyBytes ¶
func (a HDWalletAddress) PrivateKeyBytes() []byte
func (HDWalletAddress) PrivateKeyHex ¶
func (a HDWalletAddress) PrivateKeyHex() string
func (HDWalletAddress) PublicKey ¶
func (a HDWalletAddress) PublicKey() ecdsa.PublicKey
func (HDWalletAddress) PublicKeyBytes ¶
func (a HDWalletAddress) PublicKeyBytes() []byte
func (HDWalletAddress) PublicKeyHex ¶
func (a HDWalletAddress) PublicKeyHex() string
func (*HDWalletAddress) TransactOptsForChainID ¶
func (a *HDWalletAddress) TransactOptsForChainID(chainID *big.Int) (*bind.TransactOpts, error)
TransactOptsForChainID wraps go-ethereum's low-level bind.NewKeyedTransactorWithChainID function, returning a keyed *bind.TransactOpts object for the passed chainID. If the HDWalletAddress instance has already successfully constructed a transactor for the passed chainID, the previously constructed transactor is returned. Otherwise, the result of bind.NewKeyedTransactorWithChainID is returned.
type NewWalletOpt ¶
type NewWalletOpt interface {
// contains filtered or unexported methods
}
func WithDeriveKeyForAccount ¶
func WithDeriveKeyForAccount(newKey bool) NewWalletOpt
func WithEntropy ¶
func WithEntropy(entropy []byte) NewWalletOpt
func WithEntropyBits ¶
func WithEntropyBits(entropyBits int) NewWalletOpt
func WithMnemonic ¶
func WithMnemonic(mnemonic string) NewWalletOpt
func WithPassphrase ¶
func WithPassphrase(passphrase string) NewWalletOpt