Documentation
¶
Index ¶
- type Signer
- func (s *Signer) Accounts() []accounts.Account
- func (s *Signer) Close() error
- func (s *Signer) Contains(account accounts.Account) bool
- func (s *Signer) Derive(path accounts.DerivationPath, pin bool) (accounts.Account, error)
- func (s *Signer) Open(passphrase string) error
- func (s *Signer) SelfDerive(bases []accounts.DerivationPath, chain ethereum.ChainStateReader)
- func (s *Signer) SignData(account accounts.Account, mimeType string, data []byte) ([]byte, error)
- func (s *Signer) SignDataWithPassphrase(account accounts.Account, passphrase, mimeType string, data []byte) ([]byte, error)
- func (s *Signer) SignText(account accounts.Account, text []byte) ([]byte, error)
- func (s *Signer) SignTextWithPassphrase(account accounts.Account, passphrase string, hash []byte) ([]byte, error)
- func (s *Signer) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
- func (s *Signer) SignTxWithPassphrase(account accounts.Account, passphrase string, tx *types.Transaction, ...) (*types.Transaction, error)
- func (s *Signer) Status() (string, error)
- func (s *Signer) URL() accounts.URL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
func (*Signer) Accounts ¶
Accounts retrieves the list of signing accounts the wallet is currently aware of. For hierarchical deterministic wallets, the list will not be exhaustive, rather only contain the accounts explicitly pinned during account derivation.
func (*Signer) Contains ¶
Contains returns whether an account is part of this particular wallet or not.
func (*Signer) Derive ¶
Derive attempts to explicitly derive a hierarchical deterministic account at the specified derivation path. If requested, the derived account will be added to the wallet's tracked account list.
func (*Signer) Open ¶
Open initializes access to a wallet instance. It is not meant to unlock or decrypt account keys, rather simply to establish a connection to hardware wallets and/or to access derivation seeds.
The passphrase parameter may or may not be used by the implementation of a particular wallet instance. The reason there is no passwordless open method is to strive towards a uniform wallet handling, oblivious to the different backend providers.
Please note, if you open a wallet, you must close it to release any allocated resources (especially important when working with hardware wallets).
func (*Signer) SelfDerive ¶
func (s *Signer) SelfDerive(bases []accounts.DerivationPath, chain ethereum.ChainStateReader)
SelfDerive sets a base account derivation path from which the wallet attempts to discover non zero accounts and automatically add them to list of tracked accounts.
Note, self derivation will increment the last component of the specified path opposed to descending into a child path to allow discovering accounts starting from non zero components.
Some hardware wallets switched derivation paths through their evolution, so this method supports providing multiple bases to discover old user accounts too. Only the last base will be used to derive the next empty account.
You can disable automatic account discovery by calling SelfDerive with a nil chain state reader.
func (*Signer) SignData ¶
SignData requests the wallet to sign the hash of the given data It looks up the account specified either solely via its address contained within, or optionally with the aid of any location metadata from the embedded URL field.
If the wallet requires additional authentication to sign the request (e.g. a password to decrypt the account, or a PIN code to verify the transaction), an AuthNeededError instance will be returned, containing infos for the user about which fields or actions are needed. The user may retry by providing the needed details via SignDataWithPassphrase, or by other means (e.g. unlock the account in a keystore).
func (*Signer) SignDataWithPassphrase ¶
func (s *Signer) SignDataWithPassphrase(account accounts.Account, passphrase, mimeType string, data []byte) ([]byte, error)
SignDataWithPassphrase is identical to SignData, but also takes a password NOTE: there's a chance that an erroneous call might mistake the two strings, and supply password in the mimetype field, or vice versa. Thus, an implementation should never echo the mimetype or return the mimetype in the error-response
func (*Signer) SignText ¶
SignText requests the wallet to sign the hash of a given piece of data, prefixed by the Ethereum prefix scheme It looks up the account specified either solely via its address contained within, or optionally with the aid of any location metadata from the embedded URL field.
If the wallet requires additional authentication to sign the request (e.g. a password to decrypt the account, or a PIN code to verify the transaction), an AuthNeededError instance will be returned, containing infos for the user about which fields or actions are needed. The user may retry by providing the needed details via SignTextWithPassphrase, or by other means (e.g. unlock the account in a keystore).
This method should return the signature in 'canonical' format, with v 0 or 1.
func (*Signer) SignTextWithPassphrase ¶
func (s *Signer) SignTextWithPassphrase(account accounts.Account, passphrase string, hash []byte) ([]byte, error)
SignTextWithPassphrase is identical to Signtext, but also takes a password
func (*Signer) SignTx ¶
func (s *Signer) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
SignTx requests the wallet to sign the given transaction.
It looks up the account specified either solely via its address contained within, or optionally with the aid of any location metadata from the embedded URL field.
If the wallet requires additional authentication to sign the request (e.g. a password to decrypt the account, or a PIN code to verify the transaction), an AuthNeededError instance will be returned, containing infos for the user about which fields or actions are needed. The user may retry by providing the needed details via SignTxWithPassphrase, or by other means (e.g. unlock the account in a keystore).
func (*Signer) SignTxWithPassphrase ¶
func (s *Signer) SignTxWithPassphrase(account accounts.Account, passphrase string, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
SignTxWithPassphrase is identical to SignTx, but also takes a password