How to use the @ethersproject/networks.getNetwork function in @ethersproject/networks

To help you get started, we’ve selected a few @ethersproject/networks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ethers-io / ethers.js / packages / providers / lib / base-provider.js View on Github external
BaseProvider.getNetwork = function (network) {
        return networks_1.getNetwork((network == null) ? "homestead" : network);
    };
    BaseProvider.prototype._getInternalBlockNumber = function (maxAge) {
github ethers-io / ethers.js / packages / providers / lib.esm / index.js View on Github external
function getDefaultProvider(network, options) {
    if (network == null) {
        network = "homestead";
    }
    const n = getNetwork(network);
    if (!n || !n._defaultProvider) {
        logger.throwError("unsupported getDefaultProvider network", Logger.errors.NETWORK_ERROR, {
            operation: "getDefaultProvider",
            network: network
        });
    }
    return n._defaultProvider({
        FallbackProvider,
        AlchemyProvider,
        CloudflareProvider,
        EtherscanProvider,
        InfuraProvider,
        JsonRpcProvider,
        NodesmithProvider,
        Web3Provider,
        IpcProvider,
github ethers-io / ethers.js / packages / providers / lib.esm / base-provider.js View on Github external
static getNetwork(network) {
        return getNetwork((network == null) ? "homestead" : network);
    }
    _getInternalBlockNumber(maxAge) {
github ethers-io / ethers.js / packages / providers / lib / index.js View on Github external
function getDefaultProvider(network, options) {
    if (network == null) {
        network = "homestead";
    }
    var n = networks_1.getNetwork(network);
    if (!n || !n._defaultProvider) {
        logger.throwError("unsupported getDefaultProvider network", logger_1.Logger.errors.NETWORK_ERROR, {
            operation: "getDefaultProvider",
            network: network
        });
    }
    return n._defaultProvider({
        FallbackProvider: fallback_provider_1.FallbackProvider,
        AlchemyProvider: alchemy_provider_1.AlchemyProvider,
        CloudflareProvider: cloudflare_provider_1.CloudflareProvider,
        EtherscanProvider: etherscan_provider_1.EtherscanProvider,
        InfuraProvider: infura_provider_1.InfuraProvider,
        JsonRpcProvider: json_rpc_provider_1.JsonRpcProvider,
        NodesmithProvider: nodesmith_provider_1.NodesmithProvider,
        Web3Provider: web3_provider_1.Web3Provider,
        IpcProvider: ipc_provider_1.IpcProvider,
github ethers-io / ethers.js / packages / providers / src.ts / index.ts View on Github external
function getDefaultProvider(network?: Network | string, options?: any): BaseProvider {
    if (network == null) { network = "homestead"; }
    const n = getNetwork(network);
    if (!n || !n._defaultProvider) {
        logger.throwError("unsupported getDefaultProvider network", Logger.errors.NETWORK_ERROR, {
            operation: "getDefaultProvider",
            network: network
        });
    }

    return n._defaultProvider({
        FallbackProvider,

        AlchemyProvider,
        CloudflareProvider,
        EtherscanProvider,
        InfuraProvider,
        JsonRpcProvider,
        NodesmithProvider,

@ethersproject/networks

Network definitions for ethers.

MIT
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis

Popular @ethersproject/networks functions