@web3-onboard/hw-common
Version:
Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, mul
72 lines (71 loc) • 1.82 kB
TypeScript
import type { Chain, AccountAddress } from '@web3-onboard/common';
import type { BigNumber } from 'ethers';
export interface CustomNetwork {
networkId: number;
genesis: GenesisBlock;
hardforks: Hardfork[];
bootstrapNodes: BootstrapNode[];
}
export interface GenesisBlock {
hash: string;
timestamp: string | null;
gasLimit: number;
difficulty: number;
nonce: string;
extraData: string;
stateRoot: string;
}
export interface Hardfork {
name: string;
block: number | null;
}
export interface BootstrapNode {
ip: string;
port: number | string;
network?: string;
chainId?: number;
id: string;
location: string;
comment: string;
}
export type AccountSelectAPI = (options: SelectAccountOptions) => Promise<Account>;
export type SelectAccountOptions = {
basePaths: BasePath[];
assets: Asset[];
chains: Chain[];
scanAccounts: ScanAccounts;
supportsCustomPath?: boolean;
containerElement?: string;
/**
* A number that defines the amount of consecutive empty addresses displayed
* within the Account Select modal. Default is 5
*/
consecutiveEmptyAccountThreshold?: number;
};
export type BasePath = {
label: string;
value: DerivationPath;
};
export type DerivationPath = string;
export type Asset = {
label: string;
address?: string;
};
export type ScanAccounts = (options: ScanAccountsOptions) => Promise<Account[]>;
export type ScanAccountsOptions = {
derivationPath: DerivationPath;
chainId: Chain['id'];
asset: Asset;
};
export type Account = {
address: AccountAddress;
derivationPath: DerivationPath;
balance: {
asset: Asset['label'];
value: BigNumber;
};
};
export type AccountsList = {
all: Account[];
filtered: Account[];
};