ethers.js/lib.commonjs/providers/abstract-signer.d.ts

67 lines
2.9 KiB
TypeScript
Raw Normal View History

2023-03-04 04:25:07 +03:00
import type { TypedDataDomain, TypedDataField } from "../hash/index.js";
import type { TransactionLike } from "../transaction/index.js";
import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js";
import type { Signer } from "./signer.js";
2023-06-02 00:52:58 +03:00
/**
* An **AbstractSigner** includes most of teh functionality required
* to get a [[Signer]] working as expected, but requires a few
* Signer-specific methods be overridden.
*
*/
2023-03-04 04:25:07 +03:00
export declare abstract class AbstractSigner<P extends null | Provider = null | Provider> implements Signer {
2023-06-02 00:52:58 +03:00
/**
* The provider this signer is connected to.
*/
2023-03-04 04:25:07 +03:00
readonly provider: P;
2023-06-02 00:52:58 +03:00
/**
* Creates a new Signer connected to %%provider%%.
*/
2023-03-04 04:25:07 +03:00
constructor(provider?: P);
2023-06-02 00:52:58 +03:00
/**
* Resolves to the Signer address.
*/
2023-03-04 04:25:07 +03:00
abstract getAddress(): Promise<string>;
2023-06-02 00:52:58 +03:00
/**
* Returns the signer connected to %%provider%%.
*
* This may throw, for example, a Signer connected over a Socket or
* to a specific instance of a node may not be transferrable.
*/
2023-03-04 04:25:07 +03:00
abstract connect(provider: null | Provider): Signer;
getNonce(blockTag?: BlockTag): Promise<number>;
populateCall(tx: TransactionRequest): Promise<TransactionLike<string>>;
populateTransaction(tx: TransactionRequest): Promise<TransactionLike<string>>;
estimateGas(tx: TransactionRequest): Promise<bigint>;
call(tx: TransactionRequest): Promise<string>;
resolveName(name: string): Promise<null | string>;
sendTransaction(tx: TransactionRequest): Promise<TransactionResponse>;
abstract signTransaction(tx: TransactionRequest): Promise<string>;
abstract signMessage(message: string | Uint8Array): Promise<string>;
abstract signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
}
2023-06-02 00:52:58 +03:00
/**
* A **VoidSigner** is a class deisgned to allow an address to be used
* in any API which accepts a Signer, but for which there are no
* credentials available to perform any actual signing.
*
* This for example allow impersonating an account for the purpose of
* static calls or estimating gas, but does not allow sending transactions.
*/
2023-03-04 04:25:07 +03:00
export declare class VoidSigner extends AbstractSigner {
#private;
2023-06-02 00:52:58 +03:00
/**
* The signer address.
*/
2023-03-04 04:25:07 +03:00
readonly address: string;
2023-06-02 00:52:58 +03:00
/**
* Creates a new **VoidSigner** with %%address%% attached to
* %%provider%%.
*/
2023-03-04 04:25:07 +03:00
constructor(address: string, provider?: null | Provider);
getAddress(): Promise<string>;
connect(provider: null | Provider): VoidSigner;
signTransaction(tx: TransactionRequest): Promise<string>;
signMessage(message: string | Uint8Array): Promise<string>;
signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
}
//# sourceMappingURL=abstract-signer.d.ts.map