Network
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:27
A Network provides access to a chain’s properties and allows for plug-ins to extend functionality.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Network(name, chainId): Network;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:32
Creates a new Network for %%name%% and %%chainId%%.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
name | string |
chainId | BigNumberish |
Returns
Section titled “Returns”Network
Accessors
Section titled “Accessors”chainId
Section titled “chainId”Get Signature
Section titled “Get Signature”get chainId(): bigint;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:48
The network chain ID.
Returns
Section titled “Returns”bigint
Set Signature
Section titled “Set Signature”set chainId(value): void;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:49
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
value | BigNumberish |
Returns
Section titled “Returns”void
Get Signature
Section titled “Get Signature”get name(): string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:43
The network common name.
This is the canonical name, as networks migh have multiple names.
Returns
Section titled “Returns”string
Set Signature
Section titled “Set Signature”set name(value): void;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:44
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
value | string |
Returns
Section titled “Returns”void
plugins
Section titled “plugins”Get Signature
Section titled “Get Signature”get plugins(): NetworkPlugin[];
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:61
Returns the list of plugins currently attached to this Network.
Returns
Section titled “Returns”Methods
Section titled “Methods”attachPlugin()
Section titled “attachPlugin()”attachPlugin(plugin): this;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:66
Attach a new %%plugin%% to this Network. The network name must be unique, excluding any fragment.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
plugin | NetworkPlugin |
Returns
Section titled “Returns”this
clone()
Section titled “clone()”clone(): Network;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:81
Create a copy of this Network.
Returns
Section titled “Returns”Network
computeIntrinsicGas()
Section titled “computeIntrinsicGas()”computeIntrinsicGas(tx): number;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:88
Compute the intrinsic gas required for a transaction.
A GasCostPlugin can be attached to override the default values.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
tx | TransactionLike |
Returns
Section titled “Returns”number
getPlugin()
Section titled “getPlugin()”getPlugin<T>(name): null | T;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:72
Return the plugin, if any, matching %%name%% exactly. Plugins with fragments will not be returned unless %%name%% includes a fragment.
Type Parameters
Section titled “Type Parameters”Type Parameter | Default type |
---|---|
T extends NetworkPlugin | NetworkPlugin |
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
name | string |
Returns
Section titled “Returns”null
| T
getPlugins()
Section titled “getPlugins()”getPlugins<T>(basename): T[];
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:77
Gets a list of all plugins that match %%name%%, with otr without a fragment.
Type Parameters
Section titled “Type Parameters”Type Parameter | Default type |
---|---|
T extends NetworkPlugin | NetworkPlugin |
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
basename | string |
Returns
Section titled “Returns”T
[]
matches()
Section titled “matches()”matches(other): boolean;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:57
Returns true if %%other%% matches this network. Any chain ID must match, and if no chain ID is present, the name must match.
This method does not currently check for additional properties, such as ENS address or plug-in compatibility.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
other | Networkish |
Returns
Section titled “Returns”boolean
toJSON()
Section titled “toJSON()”toJSON(): any;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:36
Returns a JSON-compatible representation of a Network.
Returns
Section titled “Returns”any
from()
Section titled “from()”static from(network?): Network;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:92
Returns a new Network for the %%network%% name or chainId.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
network? | Networkish |
Returns
Section titled “Returns”Network
register()
Section titled “register()”static register(nameOrChainId, networkFunc): void;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/providers/network.d.ts:97
Register %%nameOrChainId%% with a function which returns an instance of a Network representing that chain.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
nameOrChainId | string | number | bigint |
networkFunc | () => Network |
Returns
Section titled “Returns”void