@m3s/wallet
Version:
A flexible wallet interface supporting multiple blockchain wallet types, including EVM wallets and Web3Auth integration
82 lines • 3.37 kB
TypeScript
import { ethers, Provider, TransactionReceipt } from 'ethers';
import { AdapterArguments, NetworkConfig } from '@m3s/shared';
import { IEVMWallet, WalletEvent, GenericTransactionData, AssetBalance, EIP712TypedData, EstimatedFeeData } from '../../types/index.js';
/**
* Configuration specific to the EvmWalletAdapter (Ethers).
*/
export interface IEthersWalletOptionsV1 {
privateKey?: string;
provider?: NetworkConfig;
multiChainRpcs?: Record<string, string[]>;
}
interface args extends AdapterArguments<IEthersWalletOptionsV1> {
}
/**
* An adapter for EVM-based wallets using a private key, powered by ethers.js.
* It implements the IEVMWallet interface directly, without a base class.
*/
export declare class EvmWalletAdapter implements IEVMWallet {
readonly name: string;
readonly version: string;
private wallet;
private provider?;
private config;
private _connected;
protected initialized: boolean;
protected decimals: number;
protected eventListeners: Map<string, Set<(payload: any) => void>>;
private multiChainRpcs;
private network?;
private constructor();
/**
* Factory method to create and initialize an instance of EvmWalletAdapter.
*/
static create(args: args): Promise<EvmWalletAdapter>;
initialize(): Promise<void>;
disconnect(): Promise<void>;
isConnected(): boolean;
isInitialized(): boolean;
/**
* Get ALL configured RPC URLs for ALL chains
*/
getAllChainRpcs(): Record<string, string[]>;
/**
* Update ALL RPC configurations at once
*/
updateAllChainRpcs(multiChainRpcs: Record<string, string[]>): Promise<void>;
setProvider(config: NetworkConfig): Promise<void>;
on(event: WalletEvent | string, callback: (...args: any[]) => void): void;
off(event: WalletEvent | string, callback: (...args: any[]) => void): void;
protected emitEvent(eventName: WalletEvent | string, payload: any): void;
getAccounts(): Promise<string[]>;
getNetwork(): Promise<NetworkConfig>;
getBalance(account?: string): Promise<AssetBalance>;
signMessage(message: string | Uint8Array): Promise<string>;
signTransaction(tx: GenericTransactionData): Promise<string>;
signTypedData(data: EIP712TypedData): Promise<string>;
verifySignature(message: string | Uint8Array | EIP712TypedData, signature: string, address: string): Promise<boolean>;
getNonce(type?: 'latest' | 'pending'): Promise<number>;
sendTransaction(tx: GenericTransactionData, abi?: any): Promise<string>;
getTransactionReceipt(txHash: string): Promise<TransactionReceipt | null>;
callContract(options: {
contractAddress: string;
abi: any;
method: string;
args?: any[];
}): Promise<any>;
writeContract(options: {
contractAddress: string;
abi: any;
method: string;
args?: any[];
value?: string | bigint;
overrides?: Partial<GenericTransactionData['options']>;
}): Promise<any>;
estimateGas(tx: GenericTransactionData): Promise<EstimatedFeeData>;
getGasPrice(): Promise<bigint>;
protected getProvider(): Promise<Provider>;
protected getSigner(): Promise<ethers.Signer>;
prepareTransactionRequest(tx: GenericTransactionData): Promise<ethers.TransactionRequest>;
}
export {};
//# sourceMappingURL=ethersWallet.d.ts.map