Hierarchical Deterministic wallet
Installation
npm install @erebos/wallet-hd
Usage
import { HDWallet } from '@erebos/wallet-hd'
const wallet = HDWallet.createRandom()
const sameWallet = new HDWallet(wallet.mnemonic)
Interfaces and types
Arrayish
Exported by the ethers.js library.
TransactionParams
interface TransactionParams {
from: string
to?: string
value?: string
data?: string
gasLimit: string
gasPrice: string
chainId?: string
}
Wallet
Wallet instance as exported by the ethers.js library.
HDWallet class
Arguments
mnemonic: string
activeIndexes?: Array<number> = [0]
HDWallet.createRandom()
Static function on the HDWallet
class returning an instance with a randomly generated mnemonic.
Returns HDWallet
.mnemonic
Returns string
.wallets
Returns Array<Wallet>
.accounts
Returns Array<string>
the list of wallet addresses.
.getAccountWallet()
Arguments
address: string
Returns Wallet
if found for the given address
.addAccount()
Arguments
index: number
Returns Wallet
.discardAccount()
Arguments
index: number
.signTransaction()
Arguments
params: TransactionParams
Returns Promise<string>
.signMessage()
Arguments
address: string
message: string | Arrayish
Returns Promise<string>
.signBytes()
Arguments
address: string
bytes: Array<number>
Returns Array<number>