ethers.js/lib.commonjs/wallet/base-wallet.d.ts

48 lines
1.7 KiB
TypeScript
Raw Permalink Normal View History

2023-03-03 18:25:07 -07:00
import { AbstractSigner } from "../providers/index.js";
import type { SigningKey } from "../crypto/index.js";
import type { TypedDataDomain, TypedDataField } from "../hash/index.js";
import type { Provider, TransactionRequest } from "../providers/index.js";
/**
* The **BaseWallet** is a stream-lined implementation of a
* [[Signer]] that operates with a private key.
*
* It is preferred to use the [[Wallet]] class, as it offers
* additional functionality and simplifies loading a variety
* of JSON formats, Mnemonic Phrases, etc.
*
* This class may be of use for those attempting to implement
* a minimal Signer.
*/
export declare class BaseWallet extends AbstractSigner {
#private;
/**
* The wallet address.
*/
readonly address: string;
/**
* Creates a new BaseWallet for %%privateKey%%, optionally
* connected to %%provider%%.
*
* If %%provider%% is not specified, only offline methods can
* be used.
*/
constructor(privateKey: SigningKey, provider?: null | Provider);
/**
* The [[SigningKey]] used for signing payloads.
*/
get signingKey(): SigningKey;
/**
* The private key for this wallet.
*/
get privateKey(): string;
getAddress(): Promise<string>;
connect(provider: null | Provider): BaseWallet;
signTransaction(tx: TransactionRequest): Promise<string>;
signMessage(message: string | Uint8Array): Promise<string>;
/**
* Returns the signature for %%message%% signed with this wallet.
*/
signMessageSync(message: string | Uint8Array): string;
signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
}