Documentation
¶
Index ¶
- Variables
- type Wallet
- func (w *Wallet) Accounts() []accounts.Account
- func (w *Wallet) Address(account accounts.Account) (common.Address, error)
- func (w *Wallet) AddressBytes(account accounts.Account) ([]byte, error)
- func (w *Wallet) AddressHex(account accounts.Account) (string, error)
- func (w *Wallet) Close() error
- func (w *Wallet) Contains(account accounts.Account) bool
- func (w *Wallet) Derive(path accounts.DerivationPath, pin bool) (accounts.Account, error)
- func (w *Wallet) Open(passphrase string) error
- func (w *Wallet) Path(account accounts.Account) (string, error)
- func (w *Wallet) PrivateKey(account accounts.Account) (*ecdsa.PrivateKey, error)
- func (w *Wallet) PrivateKeyBytes(account accounts.Account) ([]byte, error)
- func (w *Wallet) PrivateKeyHex(account accounts.Account) (string, error)
- func (w *Wallet) PublicKey(account accounts.Account) (*ecdsa.PublicKey, error)
- func (w *Wallet) PublicKeyBytes(account accounts.Account) ([]byte, error)
- func (w *Wallet) PublicKeyHex(account accounts.Account) (string, error)
- func (w *Wallet) SelfDerive(base []accounts.DerivationPath, chain ethereum.ChainStateReader)
- func (w *Wallet) SignData(account accounts.Account, mimetype string, data []byte) ([]byte, error)
- func (w *Wallet) SignDataWithPassphrase(account accounts.Account, passphrase string, mimetype string, data []byte) ([]byte, error)
- func (w *Wallet) SignHash(account accounts.Account, hash []byte) ([]byte, error)
- func (w *Wallet) SignHashWithPassphrase(account accounts.Account, passphrase string, hash []byte) ([]byte, error)
- func (w *Wallet) SignText(account accounts.Account, text []byte) ([]byte, error)
- func (w *Wallet) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error)
- func (w *Wallet) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
- func (w *Wallet) SignTxEIP155(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
- func (w *Wallet) SignTxWithPassphrase(account accounts.Account, passphrase string, tx *types.Transaction, ...) (*types.Transaction, error)
- func (w *Wallet) Status() (string, error)
- func (w *Wallet) URL() accounts.URL
- func (w *Wallet) Unpin(account accounts.Account) error
Constants ¶
This section is empty.
Variables ¶
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, the second at m/44'/60'/0'/1, etc.
var DefaultRootDerivationPath = accounts.DefaultRootDerivationPath
DefaultRootDerivationPath is the root path to which custom derivation endpoints are appended. As such, the first account will be at m/44'/60'/0'/0, the second at m/44'/60'/0'/1, etc.
Functions ¶
This section is empty.
Types ¶
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func NewFromMnemonic ¶
NewFromMnemonic returns a new wallet form a BIP-39 mnemonic.
func NewFromSeed ¶
NewFromSeed returns a new wallet from a BIP-39 seed.
func (*Wallet) Accounts ¶
Accounts implements accounts.Wallet, returning the list of accounts pinned to the wallet. If self-derivation was enabled, the account list is periodically expanded based on current chain state.
func (*Wallet) AddressBytes ¶
AddressBytes returns the accress in bytes format of the account.
func (*Wallet) AddressHex ¶
addresHex returns the address in hex string format of the account.
func (*Wallet) Close ¶
Close implements accounts.Wallet, however this dow nothing since this is not a hardware wallet
func (*Wallet) Contains ¶
Contains implements accounts.Wallet, returning whether a particular account is or is not pinned into this wallet instance.
func (*Wallet) Derive ¶
Derive implements accounts.Wallet, deriving a new account at the specific derivation path. If pin is set to true, the account will be added to the list of tracked accounts.
func (*Wallet) Open ¶
Open implements accounts.Wallet, however this does nothing since this is not a hardware device.
func (*Wallet) PrivateKey ¶
PrivateKey returns the ECDSA private key of the account.
func (*Wallet) PrivateKeyBytes ¶
PrivateKeyBytes returns the ECDSA private key in bytes format of the account.
func (*Wallet) PrivateKeyHex ¶
PrivateKeyHex returns the ECDSA private key in his string format of the account.
func (*Wallet) PublicKeyBytes ¶
PublicKeyBytes returns the ECDSA public key in bytes format of the account.
func (*Wallet) PublicKeyHex ¶
PublicKeyHex returns the ECDSA public key in hex string format of the account.
func (*Wallet) SelfDerive ¶
func (w *Wallet) SelfDerive( base []accounts.DerivationPath, chain ethereum.ChainStateReader, )
SelfDerive implements accounts.Wallet, trying to discover accounts that the users used previously (based on the chain state), but ones that he/she did not explicitly pin to the wallet manually. To avoid chain head monitoring, self derivation only runs during account listing (and even then throttled).
func (*Wallet) SignData ¶
func (w *Wallet) SignData( account accounts.Account, mimetype string, data []byte, ) ([]byte, error)
SignData signs keccak256(data). The mimetype parameter describes the type of data being signed.
func (*Wallet) SignDataWithPassphrase ¶
func (w *Wallet) SignDataWithPassphrase( account accounts.Account, passphrase string, mimetype string, data []byte, ) ([]byte, error)
SignDataWithPassphrase signs keccak256(data). The mimietype parameter describes the type of data being signed.
func (*Wallet) SignHashWithPassphrase ¶
func (w *Wallet) SignHashWithPassphrase( account accounts.Account, passphrase string, hash []byte, ) ([]byte, error)
SignHashWithPassphrase implements accounts.Wallet, attempting to sign the given hash with the given account using the passphrase as extra authentication.
func (*Wallet) SignText ¶
SignText implements accounts.Wallet, attempting to sign the given text. The signature is calculated by using the hash of the text.
func (*Wallet) SignTextWithPassphrase ¶
func (w *Wallet) SignTextWithPassphrase( account accounts.Account, passphrase string, text []byte, ) ([]byte, error)
SignTextWithPassphrase implements accounts.Wallet, attempting to sign the given text using the passphrase as extra authentication. The signature is calculated by using the hash of the text.
func (*Wallet) SignTx ¶
func (w *Wallet) SignTx( account accounts.Account, tx *types.Transaction, chainID *big.Int, ) (*types.Transaction, error)
SignTx implements accounts.Wallet, which allows the account to sign an Ethereum transaction.
func (*Wallet) SignTxEIP155 ¶
func (w *Wallet) SignTxEIP155( account accounts.Account, tx *types.Transaction, chainID *big.Int, ) (*types.Transaction, error)
SignTxEIP155 implememts accounts.Wallet, which allows the account to sign an ERC-20 transaction
func (*Wallet) SignTxWithPassphrase ¶
func (w *Wallet) SignTxWithPassphrase( account accounts.Account, passphrase string, tx *types.Transaction, chainID *big.Int, ) (*types.Transaction, error)
SignTxWithPassphrase implements accounts.Wallet, attempting to sign the given transaction with the given account using passphrase as extra authentication.
func (*Wallet) Status ¶
Status implements accounts.Wallet, returning a custom status message from the underlying vendor-specivic hardware wallet implementation, however this does nothing since this is not a hardware device.