@zetachain/networks
Advanced tools
Comparing version 2.2.0-athens3 to 2.3.0-athens3
@@ -45,2 +45,32 @@ { | ||
}, | ||
"btc_testnet": { | ||
"chain_id": 1, | ||
"chain_name": "Bitcoin Testnet", | ||
"assets": [ | ||
{ | ||
"denoms": [ | ||
{ | ||
"denom": "sat", | ||
"exponent": 0 | ||
}, | ||
{ | ||
"denom": "btc", | ||
"exponent": 8 | ||
} | ||
], | ||
"base": "btc", | ||
"symbol": "tBTC" | ||
} | ||
], | ||
"api": [ | ||
{ | ||
"url": "https://blockstream.info/testnet/api", | ||
"type": "esplora" | ||
}, | ||
{ | ||
"url": "https://api.blockcypher.com/v1/btc/test3", | ||
"type": "blockcypher" | ||
} | ||
] | ||
}, | ||
"zeta_testnet": { | ||
@@ -305,2 +335,2 @@ "chain_id": 7001, | ||
} | ||
} | ||
} |
@@ -10,5 +10,9 @@ interface Config { | ||
} | ||
export declare const networks: any; | ||
/** | ||
* Generate a configuration object for Hardhat with networks supported by | ||
* ZetaChain. PRIVATE_KEY is read from the environment variable. | ||
* | ||
* @returns {Config} Configuration object for Hardhat. | ||
*/ | ||
export declare const getHardhatConfigNetworks: () => Config; | ||
export declare const chainNameById: (chainId: number) => any; | ||
export {}; |
@@ -25,13 +25,12 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.chainNameById = exports.getHardhatConfigNetworks = exports.networks = void 0; | ||
exports.getHardhatConfigNetworks = void 0; | ||
const dotenv = __importStar(require("dotenv")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
exports.networks = JSON.parse(fs_1.default | ||
.readFileSync(path_1.default.resolve(__dirname, "..", "data", "networks.json")) | ||
.toString()); | ||
const networks_1 = require("./networks"); | ||
/** | ||
* Generate a configuration object for Hardhat with networks supported by | ||
* ZetaChain. PRIVATE_KEY is read from the environment variable. | ||
* | ||
* @returns {Config} Configuration object for Hardhat. | ||
*/ | ||
const getHardhatConfigNetworks = () => { | ||
@@ -59,10 +58,12 @@ const hardhat = { | ||
const config = {}; | ||
for (const network in exports.networks) { | ||
let apiUrls = exports.networks[network].api; | ||
for (const network in networks_1.networks) { | ||
if (network === "btc_testnet") | ||
continue; | ||
let apiUrls = networks_1.networks[network].api; | ||
let evmApi = apiUrls?.find((api) => api.type === "evm"); | ||
config[network] = { | ||
accounts, | ||
chainId: exports.networks[network].chain_id, | ||
gas: exports.networks[network].fees.assets[0].gas, | ||
gasPrice: exports.networks[network].fees.assets[0].gas_price, | ||
chainId: networks_1.networks[network].chain_id, | ||
gas: networks_1.networks[network].fees.assets[0].gas, | ||
gasPrice: networks_1.networks[network].fees.assets[0].gas_price, | ||
url: evmApi?.url || "", | ||
@@ -74,13 +75,1 @@ }; | ||
exports.getHardhatConfigNetworks = getHardhatConfigNetworks; | ||
// Temporary function that maps chain IDs to the old chain names | ||
// used by @zetachain/addresses | ||
const chainNameById = (chainId) => { | ||
return { | ||
1001: "klaytn-baobab", | ||
5: "goerli", | ||
7001: "athens", | ||
80001: "polygon-mumbai", | ||
97: "bsc-testnet", | ||
}[chainId]; | ||
}; | ||
exports.chainNameById = chainNameById; |
@@ -0,1 +1,4 @@ | ||
export * from "./getEndpoints"; | ||
export * from "./getHardhatConfigNetworks"; | ||
export * from "./getSupportedNetworks"; | ||
export * from "./networks"; |
@@ -17,2 +17,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./getEndpoints"), exports); | ||
__exportStar(require("./getHardhatConfigNetworks"), exports); | ||
__exportStar(require("./getSupportedNetworks"), exports); | ||
__exportStar(require("./networks"), exports); |
{ | ||
"name": "@zetachain/networks", | ||
"version": "2.2.0-athens3", | ||
"version": "2.3.0-athens3", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"output": "npx ts-node scripts/output.ts", | ||
"validate": "npx ts-node scripts/validate.ts", | ||
"build": "rm -rf dist && tsc", | ||
"build": "rm -rf dist && yarn generate:types && tsc", | ||
"lint:fix": "npx eslint . --ext .js,.ts --fix", | ||
"lint": "npx eslint . --ext .js,.ts", | ||
"prepublishOnly": "npm run build" | ||
"prepublishOnly": "npm run build", | ||
"generate:types": "npx json-schema-to-typescript networks.schema.json > src/types.ts" | ||
}, | ||
@@ -30,2 +32,3 @@ "keywords": [], | ||
"eslint-plugin-typescript-sort-keys": "^2.3.0", | ||
"json-schema-to-typescript": "^13.0.2", | ||
"prettier": "^2.8.8", | ||
@@ -32,0 +35,0 @@ "ts-node": "^10.9.1", |
@@ -11,2 +11,8 @@ # ZetaChain Blockchain Networks Registry | ||
## Prerequisites | ||
Before getting started, ensure that you have | ||
[Node.js](https://nodejs.org/en/download) and [Yarn](https://yarnpkg.com/) | ||
installed on your system. | ||
## Installation | ||
@@ -44,8 +50,2 @@ | ||
## Prerequisites | ||
Before getting started, ensure that you have | ||
[Node.js](https://nodejs.org/en/download) and [Yarn](https://yarnpkg.com/) | ||
installed on your system. | ||
## Network List Validation | ||
@@ -52,0 +52,0 @@ |
19684
15
590
16