@tetherto/wdk-wallet-evm
Version:
A simple package to manage BIP-32 wallets for evm blockchains.
69 lines (68 loc) • 2.5 kB
TypeScript
export default class WalletManagerEvm extends WalletManager {
/**
* Multiplier for normal fee rate calculations (in %).
*
* @protected
* @type {bigint}
*/
protected static _FEE_RATE_NORMAL_MULTIPLIER: bigint;
/**
* Multiplier for fast fee rate calculations (in %).
*
* @protected
* @type {bigint}
*/
protected static _FEE_RATE_FAST_MULTIPLIER: bigint;
/**
* Creates a new wallet manager for evm blockchains.
*
* @param {string | Uint8Array} seed - The wallet's [BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) seed phrase.
* @param {EvmWalletConfig} [config] - The configuration object.
*/
constructor(seed: string | Uint8Array, config?: EvmWalletConfig);
/**
* The evm wallet configuration.
*
* @protected
* @type {EvmWalletConfig}
*/
protected _config: EvmWalletConfig;
/**
* An ethers provider to interact with a node of the blockchain.
*
* @protected
* @type {Provider | undefined}
*/
protected _provider: Provider | undefined;
/**
* Returns the wallet account at a specific index (see [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)).
*
* @example
* // Returns the account with derivation path m/44'/60'/0'/0/1
* const account = await wallet.getAccount(1);
* @param {number} [index] - The index of the account to get (default: 0).
* @returns {Promise<WalletAccountEvm>} The account.
*/
getAccount(index?: number): Promise<WalletAccountEvm>;
/**
* Returns the wallet account at a specific BIP-44 derivation path.
*
* @example
* // Returns the account with derivation path m/44'/60'/0'/0/1
* const account = await wallet.getAccountByPath("0'/0/1");
* @param {string} path - The derivation path (e.g. "0'/0/0").
* @returns {Promise<WalletAccountEvm>} The account.
*/
getAccountByPath(path: string): Promise<WalletAccountEvm>;
/**
* Returns the current fee rates.
*
* @returns {Promise<FeeRates>} The fee rates (in weis).
*/
getFeeRates(): Promise<FeeRates>;
}
export type Provider = import("ethers").Provider;
export type FeeRates = import("@tetherto/wdk-wallet").FeeRates;
export type EvmWalletConfig = import("./wallet-account-evm.js").EvmWalletConfig;
import WalletManager from '@tetherto/wdk-wallet';
import WalletAccountEvm from './wallet-account-evm.js';