diff --git a/src.ts/providers/ens-resolver.ts b/src.ts/providers/ens-resolver.ts index cbdd12279..93d418b17 100644 --- a/src.ts/providers/ens-resolver.ts +++ b/src.ts/providers/ens-resolver.ts @@ -94,7 +94,7 @@ export abstract class MulticoinProviderPlugin implements AbstractProviderPlugin } } -const BasicMulticoinPluginId = "org.ethers.plugins.BasicMulticoin"; +const BasicMulticoinPluginId = "org.ethers.plugins.provider.BasicMulticoin"; /** * A basic multicoin provider plugin. @@ -492,7 +492,7 @@ export class EnsResolver { static async getEnsAddress(provider: Provider): Promise { const network = await provider.getNetwork(); - const ensPlugin = network.getPlugin("org.ethers.network-plugins.ens"); + const ensPlugin = network.getPlugin("org.ethers.plugins.network.Ens"); // No ENS... assert(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", { @@ -502,16 +502,10 @@ export class EnsResolver { } static async #getResolver(provider: Provider, name: string): Promise { - const network = await provider.getNetwork(); - - const ensPlugin = network.getPlugin("org.ethers.network-plugins.ens"); - - // No ENS... - assert(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", { - operation: "getResolver", info: { network: network.name } }); + const ensAddr = await EnsResolver.getEnsAddress(provider); try { - const contract = new Contract(ensPlugin.address, [ + const contract = new Contract(ensAddr, [ "function resolver(bytes32) view returns (address)" ], provider); diff --git a/src.ts/providers/network.ts b/src.ts/providers/network.ts index 5f39f7204..b718bfc5f 100644 --- a/src.ts/providers/network.ts +++ b/src.ts/providers/network.ts @@ -143,7 +143,7 @@ export class Network { } computeIntrinsicGas(tx: TransactionLike): number { - const costs = this.getPlugin("org.ethers.gas-cost") || (new GasCostPlugin()); + const costs = this.getPlugin("org.ethers.plugins.network.GasCost") || (new GasCostPlugin()); let gas = costs.txBase; if (tx.to == null) { gas += costs.txCreate; } diff --git a/src.ts/providers/plugin-fallback.ts b/src.ts/providers/plugin-fallback.ts index 76a929cb0..777b128a5 100644 --- a/src.ts/providers/plugin-fallback.ts +++ b/src.ts/providers/plugin-fallback.ts @@ -5,7 +5,7 @@ import { defineProperties } from "../utils/index.js"; import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; -export const PluginIdFallbackProvider = "org.ethers.plugins.QualifiedPlugin"; +export const PluginIdFallbackProvider = "org.ethers.plugins.provider.QualifiedPlugin"; export class CheckQualifiedPlugin implements AbstractProviderPlugin { declare name: string; diff --git a/src.ts/providers/plugins-network.ts b/src.ts/providers/plugins-network.ts index 2423d1a5f..aba8b8ad8 100644 --- a/src.ts/providers/plugins-network.ts +++ b/src.ts/providers/plugins-network.ts @@ -50,7 +50,7 @@ export class GasCostPlugin extends NetworkPlugin implements GasCostParameters { constructor(effectiveBlock?: number, costs?: GasCostParameters) { if (effectiveBlock == null) { effectiveBlock = 0; } - super(`org.ethers.network-plugins.gas-cost#${ (effectiveBlock || 0) }`); + super(`org.ethers.network.plugins.GasCost#${ (effectiveBlock || 0) }`); const props: Record = { effectiveBlock }; function set(name: keyof GasCostParameters, nullish: number): void { @@ -86,7 +86,7 @@ export class EnsPlugin extends NetworkPlugin { readonly targetNetwork!: number; constructor(address?: null | string, targetNetwork?: null | number) { - super("org.ethers.network-plugins.ens"); + super("org.ethers.plugins.network.Ens"); defineProperties(this, { address: (address || EnsAddress), targetNetwork: ((targetNetwork == null) ? 1: targetNetwork) @@ -96,39 +96,17 @@ export class EnsPlugin extends NetworkPlugin { clone(): EnsPlugin { return new EnsPlugin(this.address, this.targetNetwork); } - -// validate(network: Network): this { -// network.formatter.address(this.address); -// return this; -// } } -/* -export class MaxPriorityFeePlugin extends NetworkPlugin { - readonly priorityFee!: bigint; - constructor(priorityFee: BigNumberish) { - super("org.ethers.plugins.max-priority-fee"); - defineProperties(this, { - priorityFee: logger.getBigInt(priorityFee) - }); - } - - async getPriorityFee(provider: Provider): Promise { - return this.priorityFee; - } - - clone(): MaxPriorityFeePlugin { - return new MaxPriorityFeePlugin(this.priorityFee); - } -} -*/ export class FeeDataNetworkPlugin extends NetworkPlugin { readonly #feeDataFunc: (provider: Provider) => Promise; - get feeDataFunc(): (provider: Provider) => Promise { return this.#feeDataFunc; } + get feeDataFunc(): (provider: Provider) => Promise { + return this.#feeDataFunc; + } constructor(feeDataFunc: (provider: Provider) => Promise) { - super("org.ethers.network-plugins.fee-data"); + super("org.ethers.plugins.network.FeeData"); this.#feeDataFunc = feeDataFunc; } @@ -140,6 +118,7 @@ export class FeeDataNetworkPlugin extends NetworkPlugin { return new FeeDataNetworkPlugin(this.#feeDataFunc); } } + /* export class CustomBlockNetworkPlugin extends NetworkPlugin { readonly #blockFunc: (provider: Provider, block: BlockParams) => Block; diff --git a/src.ts/providers/provider-etherscan.ts b/src.ts/providers/provider-etherscan.ts index 0dcc90de8..a91311024 100644 --- a/src.ts/providers/provider-etherscan.ts +++ b/src.ts/providers/provider-etherscan.ts @@ -48,7 +48,7 @@ export type DebugEventEtherscanProvider = { error: any }; -const EtherscanPluginId = "org.ethers.plugins.Etherscan"; +const EtherscanPluginId = "org.ethers.plugins.provider.Etherscan"; /** * A Network can include an **EtherscanPlugin** to provide