From 67077d0e25562fcccc545f0981fdbb8c970c0d25 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Thu, 31 Oct 2024 09:07:34 +0700 Subject: [PATCH] Create networkConfig.js --- .../pi_network/config/networkConfig.js | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 blockchain_integration/pi_network/config/networkConfig.js diff --git a/blockchain_integration/pi_network/config/networkConfig.js b/blockchain_integration/pi_network/config/networkConfig.js new file mode 100644 index 000000000..ea7e05d95 --- /dev/null +++ b/blockchain_integration/pi_network/config/networkConfig.js @@ -0,0 +1,68 @@ +// config/networkConfig.js + +const networks = { + mainnet: { + chainId: 1, + name: "Ethereum Mainnet", + rpcUrl: "https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID", + explorerUrl: "https://etherscan.io", + nativeCurrency: { + name: "Ether", + symbol: "ETH", + decimals: 18, + }, + }, + ropsten: { + chainId: 3, + name: "Ropsten Testnet", + rpcUrl: "https://ropsten.infura.io/v3/YOUR_INFURA_PROJECT_ID", + explorerUrl: "https://ropsten.etherscan.io", + nativeCurrency: { + name: "Test Ether", + symbol: "ETH", + decimals: 18, + }, + }, + rinkeby: { + chainId: 4, + name: "Rinkeby Testnet", + rpcUrl: "https://rinkeby.infura.io/v3/YOUR_INFURA_PROJECT_ID", + explorerUrl: "https://rinkeby.etherscan.io", + nativeCurrency: { + name: "Test Ether", + symbol: "ETH", + decimals: 18, + }, + }, + kovan: { + chainId: 42, + name: "Kovan Testnet", + rpcUrl: "https://kovan.infura.io/v3/YOUR_INFURA_PROJECT_ID", + explorerUrl: "https://kovan.etherscan.io", + nativeCurrency: { + name: "Test Ether", + symbol: "ETH", + decimals: 18, + }, + }, + localhost: { + chainId: 1337, + name: "Localhost", + rpcUrl: "http://127.0.0.1:8545", + explorerUrl: "", + nativeCurrency: { + name: "Ether", + symbol: "ETH", + decimals: 18, + }, + }, +}; + +const getNetworkConfig = (network) => { + return networks[network] || networks.localhost; +}; + +module.exports = { + networks, + getNetworkConfig, +};