@ethersproject/networks#Network TypeScript Examples
The following examples show how to use
@ethersproject/networks#Network.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: base-provider.ts From bodhi.js with Apache License 2.0 | 6 votes |
isReady = (): Promise<Network> => {
if (!this._network) {
const _getNetwork = async () => {
try {
await this.api.isReadyOrError;
const network = {
name: this.api.runtimeVersion.specName.toString(),
chainId: await this.chainId()
};
return network;
} catch (e) {
await this.api.disconnect();
throw e;
}
};
this._network = _getNetwork();
}
return this._network;
};
Example #2
Source File: provider.ts From fuels-ts with Apache License 2.0 | 6 votes |
/**
* Returns the network configuration of the connected Fuel node
*/
async getNetwork(): Promise<Network> {
return {
name: 'fuelv2',
chainId: 0xdeadbeef,
};
}
Example #3
Source File: Provider.ts From evm-provider.js with Apache License 2.0 | 6 votes |
/**
* Get the network the provider is connected to.
* @returns A promise resolving to the name and chain ID of the connected chain.
*/
async getNetwork(): Promise<Network> {
await this.resolveApi;
return {
name: this.api.runtimeVersion.specName.toString(),
chainId: 13939
};
}
Example #4
Source File: base-provider.ts From bodhi.js with Apache License 2.0 | 5 votes |
_network?: Promise<Network>;
Example #5
Source File: base-provider.ts From bodhi.js with Apache License 2.0 | 5 votes |
getNetwork = async (): Promise<Network> => {
const network = await this.isReady();
return network;
};