Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

ethers-provider-init

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethers-provider-init

Initialize ethers provider based on environment variables

latest
npmnpm
Version
1.4.0
Version published
Weekly downloads
3
-57.14%
Maintainers
1
Weekly downloads
 
Created
Source

This module helps to initialize an ethers provider based on environment variables.

Install

npm i ethers-provider-init --save

Usage

Depending of the environment variables the provider might use:

  • the default provider ethers.provider.getDefaultProvider() if no provider is configured
  • one of the currently available providers
  • the fallback provider if more than one provider is configured.
const { getProvider } = require("ethers-provider-init");

const provider = getProvider();

// alternatively you can pass an object with the environment variables:
// const provider = getProvider({ CLOUDFLARE_ENABLED: "1" });

Environment variables

  • ETHEREUM_NETWORK: Name of the ethereum network, default to mainnet.
  • FALLBACK_QUORUM: The quorum the backend responses must agree upon before a result will be resolved when using more than one provider. By default this is half the sum of the weights.
  • ETHERSCAN_API_KEY: The api key for etherscan provider.
  • INFURA_PROJECT_ID: The project id for the infura provider
  • INFURA_PROJECT_SECRET: The project secret for the infura provider
  • ALCHEMY_API_KEY: The api key for alchemy provider.
  • CLOUDFLARE_ENABLED: Set any string other than "false" to enable the cloudflare provider which doesn't require any api key.
  • POCKET_APPLICATION_ID: The application id for the pocket provider.
  • POCKET_APPLICATION_SECRET_KEY: The application secret for the pocket provider.
  • ANKR_API_KEY: The api key for alchemy provider.
  • JSON_RPC_URL: The api key for alchemy provider.

License

MIT 2022 - José Romaniello

FAQs

Package last updated on 16 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts