Releases: api3dao/chains
v3.3.0
Version 3.1.0
Non-breaking changes
- Adds
blockTimeMs
as the average expected block time*
*
See the comments in this PR for caveats around these numbers
Bug fixes
- Updates environment variable names generated from
hardhatConfig.getEnvVariableNames()
to correctly change hyphen (-
) values to underscores (_
). Issue: #46
Version 3.0.0
Breaking Changes
Hardhat config functions have been renamed
// Hardhat related functions now live inside the `hardhatConfig` object
- import { hardhatConfigNetworks, hardhatEtherscan } from '@api3/chains';
+ import { hardhatConfig } from '@api3/chains';
// Networks
- hardhatConfigNetworks();
+ hardhatConfig.networks();
// Etherscan
- hardhatEtherscan();
+ hardhatConfig.etherscan();
The result of this is that you should now be able to import and use these values without any additional configuration.
// hardhat.config.js
const api3Chains = require('@api3/chains');
const etherscan = api3Chains.hardhatConfig.etherscan();
const networks = api3Chains.hardhatConfig.networks();
module. exports = {
...,
networks,
etherscan,
};
getEnvVariables renamed and moved to hardhatConfig
- import { getEnvVariables } from '@api3/chains';
+ import { hardhatConfig } from '@api3/chains';
// Usage
- getEnvVariables();
+ hardhatConfig.getEnvVariableNames();
Environment variable names updated
Environment variables now use a chain alias that has been converted to upper snake case
// before
getEnvVariables();
// ['MNEMONIC', 'ETHERSCAN_API_KEY_arbitrum-goerli-testnet', ...]
// after
hardhatConfig.getEnvVariableNames();
// ['MNEMONIC', 'ETHERSCAN_API_KEY_ARBITRUM_GOERLI_TESTNET', ...]
Removed
getChainByAlias
has been removed. UseCHAINS.find((chain) => chain.alias === alias)
in your code instead- Removed the
yarn env:write
script. CallhardhatConfig.getEnvVariableNames();
and implement the code to write to a file instead.
Non-breaking Changes
Etherscan API key values
When calling hardhatConfig.etherscan()
, apiKey
values will attempt to be sourced from process.env
where the keys matches the values output from hardhatConfig.getEnvVariableNames();
. If no environment variable is found, it will output the apiKey
values as NOT_FOUND
.
testnet
boolean added to each chain
Each chain now has a new boolean field called testnet
to indicate whether or not it is a testnet chain.
Updated Chains
boba-moonbeam
has been removed.
v2.1.0
Version 2.1.0
BREAKING CHANGES
hardhatConfigNetworks
hardhatConfigNetworks()
now returns chainId
as a number, rather than a string. Note that CHAINS
still returns chainId
as a string.
Features
Added chains
- Arbitrum Nova
- Aurora Testnet
- Aurora
- Boba/Avalanche
- Boba/BNB
- Boba/Ethereum
- Boba/Moonbeam
- Godwoken testnet
- Godwoken
- SX Network testnet
- SX Network
v2.0.0
Version 2.0.0
BREAKING CHANGES
The following functions have been replaced.
getChains()
getChains
has been replaced with a static list of Chain
objects. This change removes the need for fs
and path
dependencies, allowing the list of CHAINS
to be used in any environment.
- import { getChains } from '@api3/chains';
- console.log(getChains());
+ import { CHAINS } from '@api3/chains';
+ console.log(CHAINS);
getChain()
getChain
has been renamed to the more descriptive getChainByAlias
function. This function throws if the Chain
is not found for the given alias.
- import { getChain } from '@api3/chains';
- console.log(getChain('ethereum'));
+ import { getChainByAlias } from '@api3/chains';
+ console.log(getChainByAlias('ethereum'));
writeEnvFile
writeEnvFile
has has been replaced with a function that simply returns the list of expected environment variable keys (string[]
). This was also required to remove the dependency on Node libraries, specifically fs
and path
.
- import { writeEnvFile } from '@api3/chains';
- writeEnvFile('.env');
+ import { getEnvVariables } from '@api3/chains';
+ console.log(getEnvVariables());
The old functionality to write to a given file has been extracted to a script. This script uses getEnvVariables
under the hood and can be run with
yarn env:write --path .env
Features
Types
Types are now exported. These types are generated from zod schemas, which are also used to valid each chain conforms to the required structure. Types can be imported from the package as
import { Chain } from '@api3/chains';
See src/types for the full list of types and zod schemas.