diff --git a/hardhat.config.js b/hardhat.config.js index ed3b617..b571443 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -10,8 +10,8 @@ const accounts = { mnemonic: process.env.MNEMONIC || `test test test test test t // const accounts = [process.env.PRIVATE_KEY0] // const accounts = [process.env.PRIVATE_KEY1, process.env.PRIVATE_KEY2] -// You can add more blockchains to this list if they don't already exist in @wagmi/chains -const additionalNetworks = { // See https://github.com/wagmi-dev/viem/blob/main/src/chains/index.ts +// You can add more blockchains to this list if they don't already exist in viem/chains +const additionalNetworks = { // See https://github.com/wevm/viem/blob/main/src/chains/index.ts bttc: { chainId: 199, url: `https://rpc.bittorrentchain.io`, @@ -68,8 +68,8 @@ const additionalNetworks = { // See https://github.com/wagmi-dev/viem/blob/main/ }, } -const hardhatVerifyBuiltinChains = [`mainnet`, `goerli`, `optimisticEthereum`, `bsc`, `sokol`, `bscTestnet`, `xdai`, `gnosis`, `heco`, `polygon`, `opera`, `hecoTestnet`, `optimisticGoerli`, `moonbeam`, `moonriver`, `moonbaseAlpha`, `ftmTestnet`, `base`, `chiado`, `arbitrumOne`, `avalancheFujiTestnet`, `avalanche`, `polygonMumbai`, `baseGoerli`, `arbitrumTestnet`, `arbitrumGoerli`, `sepolia`, `aurora`, `auroraTestnet`, `harmony`, `harmonyTest`] // https://github.com/NomicFoundation/hardhat/blob/main/packages/hardhat-verify/src/internal/chain-config.ts -const wagmiToHardhatVerifyTranslation = { // because some names don't match. So we'll use the name in hardhat-verify. +const hardhatVerifyBuiltinChains = [`mainnet`, `goerli`, `optimisticEthereum`, `bsc`, `sokol`, `bscTestnet`, `xdai`, `gnosis`, `heco`, `polygon`, `opera`, `hecoTestnet`, `optimisticGoerli`, `polygonZkEVM`, `moonbeam`, `moonriver`, `moonbaseAlpha`, `polygonZkEVMTestnet`, `ftmTestnet`, `base`, `chiado`, `holesky`, `arbitrumOne`, `avalancheFujiTestnet`, `avalanche`, `polygonMumbai`, `polygonAmoy`, `baseGoerli`, `baseSepolia`, `arbitrumSepolia`, `sepolia`, `aurora`, `auroraTestnet`, `harmony`, `harmonyTest`] // https://github.com/NomicFoundation/hardhat/blob/main/packages/hardhat-verify/src/internal/chain-config.ts +const viemChainsToHardhatVerifyTranslation = { // because some names don't match. So we'll use the name in hardhat-verify. arbitrum: `arbitrumOne`, avalancheFuji: `avalancheFujiTestnet`, fantom: `opera`, @@ -78,17 +78,20 @@ const wagmiToHardhatVerifyTranslation = { // because some names don't match. So harmonyOne: `harmony`, optimism: `optimisticEthereum`, optimismGoerli: `optimisticGoerli`, + polygonZkEvm: `polygonZkEVM`, + polygonZkEvmTestnet: `polygonZkEVMTestnet`, } let networks = {} -const chains = require(`@wagmi/chains`) +const chains = require(`viem/chains`) for (let [chainName, chainData] of Object.entries(chains)) { if (![`hardhat`, `localhost`].includes(chainName)) { // "HardhatConfig.networks.hardhat can't have an url" - chainName = wagmiToHardhatVerifyTranslation[chainName] === undefined ? chainName : wagmiToHardhatVerifyTranslation[chainName] // change to what hardhat-verify uses + chainName = viemChainsToHardhatVerifyTranslation[chainName] === undefined ? chainName : viemChainsToHardhatVerifyTranslation[chainName] // change to what hardhat-verify uses + // console.log(chainName.trim()) networks[chainName] = { chainId: chainData.id, - url: chainData.rpcUrls.public.http[0], + url: chainData.rpcUrls.default.http[0], accounts, } @@ -116,7 +119,7 @@ for (let [chainName, chainData] of Object.entries(chains)) { networks = { ...networks, ...additionalNetworks } -// RPC URL overrides in case you dont want to use the one in @wagmi/chains: +// RPC URL overrides in case you dont want to use the one in viem/chains: // networks.mainnet.url = `https://eth-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}` networks.polygonMumbai.url = `https://polygon-mumbai.blockpi.network/v1/rpc/public` @@ -150,14 +153,14 @@ module.exports = { }, networks, etherscan: { - apiKey: { // ADD LINES FOR YOUR DESIRED BLOCKCHAINS HERE + apiKey: { // ADD LINES FOR YOUR DESIRED BLOCKCHAINS HERE FOR CONTRACT VERIFICATION ON BLOCKCHAIN EXPLORER. If it's in viemChainsToHardhatVerifyTranslation then write the translated value. mainnet: process.env.ETHERSCAN_API_KEY, goerli: process.env.ETHERSCAN_API_KEY, sepolia: process.env.ETHERSCAN_API_KEY, celo: process.env.CELOSCAN_API_KEY, celoAlfajores: process.env.CELOSCAN_API_KEY, - polygonZkEvm: process.env.ZKEVM_POLYGONSCAN_API_KEY, - polygonZkEvmTestnet: process.env.ZKEVM_POLYGONSCAN_API_KEY, + polygonZkEVM: process.env.ZKEVM_POLYGONSCAN_API_KEY, + polygonZkEVMTestnet: process.env.ZKEVM_POLYGONSCAN_API_KEY, bsc: process.env.BSCSCAN_API_KEY, bscTestnet: process.env.BSCSCAN_API_KEY, avalanche: process.env.SNOWTRACE_API_KEY, diff --git a/package.json b/package.json index 53f408c..c5eb5e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SKYBIT-Keyless-Deployment", - "version": "5.0.1", + "version": "5.0.2", "packageManager": "yarn@4.2.2", "devDependencies": { "@SKYBITDev3/ZeframLou-create3-factory": "https://github.com/SKYBITDev3/ZeframLou-create3-factory#3a8db987b8a6e1b63845a0ee1d0206cb4b5748f9", @@ -24,7 +24,6 @@ "@typechain/ethers-v6": "^0.5.1", "@typechain/hardhat": "^9.1.0", "@types/mocha": "^10.0.6", - "@wagmi/chains": "^1.8.0", "axios": "^1.7.2", "chai": "4.4.1", "dotenv": "^16.4.5", @@ -34,6 +33,7 @@ "solc": "0.8.24", "solidity-coverage": "^0.8.12", "ts-node": "^10.9.2", - "typechain": "^8.3.2" + "typechain": "^8.3.2", + "viem": "^2.12.4" } } diff --git a/yarn.lock b/yarn.lock index d39b91d..2d75323 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1608,18 +1608,6 @@ __metadata: languageName: node linkType: hard -"@wagmi/chains@npm:^1.8.0": - version: 1.8.0 - resolution: "@wagmi/chains@npm:1.8.0" - peerDependencies: - typescript: ">=5.0.4" - peerDependenciesMeta: - typescript: - optional: true - checksum: 10/8248419554a90c0d514acfc46f3a6f2090a282ff546b2488705e81fcdfaf197590e67a1fc62539383b4dd22ccafe9f16018cadad27acee098dc9d87b82f173e4 - languageName: node - linkType: hard - "SKYBIT-Keyless-Deployment@workspace:.": version: 0.0.0-use.local resolution: "SKYBIT-Keyless-Deployment@workspace:." @@ -1645,7 +1633,6 @@ __metadata: "@typechain/ethers-v6": "npm:^0.5.1" "@typechain/hardhat": "npm:^9.1.0" "@types/mocha": "npm:^10.0.6" - "@wagmi/chains": "npm:^1.8.0" axios: "npm:^1.7.2" chai: "npm:4.4.1" dotenv: "npm:^16.4.5" @@ -1656,6 +1643,7 @@ __metadata: solidity-coverage: "npm:^0.8.12" ts-node: "npm:^10.9.2" typechain: "npm:^8.3.2" + viem: "npm:^2.12.4" languageName: unknown linkType: soft @@ -4678,6 +4666,15 @@ __metadata: languageName: node linkType: hard +"isows@npm:1.0.4": + version: 1.0.4 + resolution: "isows@npm:1.0.4" + peerDependencies: + ws: "*" + checksum: 10/a3ee62e3d6216abb3adeeb2a551fe2e7835eac87b05a6ecc3e7739259bf5f8e83290501f49e26137390c8093f207fc3378d4a7653aab76ad7bbab4b2dba9c5b9 + languageName: node + linkType: hard + "jackspeak@npm:^2.3.5": version: 2.3.6 resolution: "jackspeak@npm:2.3.6" @@ -7384,6 +7381,27 @@ __metadata: languageName: node linkType: hard +"viem@npm:^2.12.4": + version: 2.12.4 + resolution: "viem@npm:2.12.4" + dependencies: + "@adraffy/ens-normalize": "npm:1.10.0" + "@noble/curves": "npm:1.2.0" + "@noble/hashes": "npm:1.3.2" + "@scure/bip32": "npm:1.3.2" + "@scure/bip39": "npm:1.2.1" + abitype: "npm:1.0.0" + isows: "npm:1.0.4" + ws: "npm:8.13.0" + peerDependencies: + typescript: ">=5.0.4" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10/6e0fff9eb9bebb92f9935b0d08a8dba9dbe51dcc928b7ad3a78c3ca9dfc4eb8576218ea445491a18f5572d315c5c2bbd548502c3d9b795eefde8f87d9d287fee + languageName: node + linkType: hard + "web3-utils@npm:^1.3.6": version: 1.10.2 resolution: "web3-utils@npm:1.10.2"