ethers.js/lib.commonjs/providers/plugins-network.d.ts

144 lines
4.2 KiB
TypeScript
Raw Permalink Normal View History

2023-03-03 18:25:07 -07:00
import type { FeeData, Provider } from "./provider.js";
2023-06-01 17:52:58 -04:00
/**
* A **NetworkPlugin** provides additional functionality on a [[Network]].
*/
2023-03-03 18:25:07 -07:00
export declare class NetworkPlugin {
2023-06-01 17:52:58 -04:00
/**
* The name of the plugin.
*
* It is recommended to use reverse-domain-notation, which permits
* unique names with a known authority as well as hierarchal entries.
*/
2023-03-03 18:25:07 -07:00
readonly name: string;
2023-06-01 17:52:58 -04:00
/**
* Creates a new **NetworkPlugin**.
*/
2023-03-03 18:25:07 -07:00
constructor(name: string);
2023-06-01 17:52:58 -04:00
/**
* Creates a copy of this plugin.
*/
2023-03-03 18:25:07 -07:00
clone(): NetworkPlugin;
}
2023-06-01 17:52:58 -04:00
/**
* The gas cost parameters for a [[GasCostPlugin]].
*/
2023-03-03 18:25:07 -07:00
export type GasCostParameters = {
2023-06-01 17:52:58 -04:00
/**
* The transactions base fee.
*/
2023-03-03 18:25:07 -07:00
txBase?: number;
2023-06-01 17:52:58 -04:00
/**
* The fee for creating a new account.
*/
2023-03-03 18:25:07 -07:00
txCreate?: number;
2023-06-01 17:52:58 -04:00
/**
* The fee per zero-byte in the data.
*/
2023-03-03 18:25:07 -07:00
txDataZero?: number;
2023-06-01 17:52:58 -04:00
/**
* The fee per non-zero-byte in the data.
*/
2023-03-03 18:25:07 -07:00
txDataNonzero?: number;
2023-06-01 17:52:58 -04:00
/**
* The fee per storage key in the [[link-eip-2930]] access list.
*/
2023-03-03 18:25:07 -07:00
txAccessListStorageKey?: number;
2023-06-01 17:52:58 -04:00
/**
* The fee per address in the [[link-eip-2930]] access list.
*/
2023-03-03 18:25:07 -07:00
txAccessListAddress?: number;
};
2023-06-01 17:52:58 -04:00
/**
* A **GasCostPlugin** allows a network to provide alternative values when
* computing the intrinsic gas required for a transaction.
*/
2023-03-03 18:25:07 -07:00
export declare class GasCostPlugin extends NetworkPlugin implements GasCostParameters {
2023-06-01 17:52:58 -04:00
/**
* The block number to treat these values as valid from.
*
* This allows a hardfork to have updated values included as well as
* mulutiple hardforks to be supported.
*/
2023-03-03 18:25:07 -07:00
readonly effectiveBlock: number;
2023-06-01 17:52:58 -04:00
/**
* The transactions base fee.
*/
2023-03-03 18:25:07 -07:00
readonly txBase: number;
2023-06-01 17:52:58 -04:00
/**
* The fee for creating a new account.
*/
2023-03-03 18:25:07 -07:00
readonly txCreate: number;
2023-06-01 17:52:58 -04:00
/**
* The fee per zero-byte in the data.
*/
2023-03-03 18:25:07 -07:00
readonly txDataZero: number;
2023-06-01 17:52:58 -04:00
/**
* The fee per non-zero-byte in the data.
*/
2023-03-03 18:25:07 -07:00
readonly txDataNonzero: number;
2023-06-01 17:52:58 -04:00
/**
* The fee per storage key in the [[link-eip-2930]] access list.
*/
2023-03-03 18:25:07 -07:00
readonly txAccessListStorageKey: number;
2023-06-01 17:52:58 -04:00
/**
* The fee per address in the [[link-eip-2930]] access list.
*/
2023-03-03 18:25:07 -07:00
readonly txAccessListAddress: number;
2023-06-01 17:52:58 -04:00
/**
* Creates a new GasCostPlugin from %%effectiveBlock%% until the
* latest block or another GasCostPlugin supercedes that block number,
* with the associated %%costs%%.
*/
2023-03-03 18:25:07 -07:00
constructor(effectiveBlock?: number, costs?: GasCostParameters);
clone(): GasCostPlugin;
}
2023-06-01 17:52:58 -04:00
/**
* An **EnsPlugin** allows a [[Network]] to specify the ENS Registry
* Contract address and the target network to use when using that
* contract.
*
* Various testnets have their own instance of the contract to use, but
* in general, the mainnet instance supports multi-chain addresses and
* should be used.
*/
2023-03-03 18:25:07 -07:00
export declare class EnsPlugin extends NetworkPlugin {
2023-06-01 17:52:58 -04:00
/**
* The ENS Registrty Contract address.
*/
2023-03-03 18:25:07 -07:00
readonly address: string;
2023-06-01 17:52:58 -04:00
/**
* The chain ID that the ENS contract lives on.
*/
2023-03-03 18:25:07 -07:00
readonly targetNetwork: number;
2023-06-01 17:52:58 -04:00
/**
* Creates a new **EnsPlugin** connected to %%address%% on the
* %%targetNetwork%%. The default ENS address and mainnet is used
* if unspecified.
*/
2023-03-03 18:25:07 -07:00
constructor(address?: null | string, targetNetwork?: null | number);
clone(): EnsPlugin;
}
2023-06-01 17:52:58 -04:00
/**
* A **FeeDataNetworkPlugin** allows a network to provide and alternate
* means to specify its fee data.
*
* For example, a network which does not support [[link-eip-1559]] may
* choose to use a Gas Station site to approximate the gas price.
*/
2023-03-03 18:25:07 -07:00
export declare class FeeDataNetworkPlugin extends NetworkPlugin {
#private;
2023-06-01 17:52:58 -04:00
/**
* The fee data function provided to the constructor.
*/
2023-03-03 18:25:07 -07:00
get feeDataFunc(): (provider: Provider) => Promise<FeeData>;
2023-06-01 17:52:58 -04:00
/**
* Creates a new **FeeDataNetworkPlugin**.
*/
2023-03-03 18:25:07 -07:00
constructor(feeDataFunc: (provider: Provider) => Promise<FeeData>);
2023-06-01 17:52:58 -04:00
/**
* Resolves to the fee data.
*/
2023-03-03 18:25:07 -07:00
getFeeData(provider: Provider): Promise<FeeData>;
clone(): FeeDataNetworkPlugin;
}
//# sourceMappingURL=plugins-network.d.ts.map