From 32e4912f74a13b6278f0a1e6ddf3afc8c221edf7 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Wed, 10 Jan 2024 11:22:35 +0400 Subject: [PATCH] remove zetacore from url --- package.json | 3 ++- tasks/addresses.ts | 65 ++++++++++++---------------------------------- yarn.lock | 28 ++++++++++++++++++++ 3 files changed, 47 insertions(+), 49 deletions(-) diff --git a/package.json b/package.json index 9e7bde0a..94e7504c 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@uniswap/v2-periphery": "^1.1.0-beta.0", "@uniswap/v3-periphery": "^1.4.3", "@zetachain/networks": "^2.4.3", + "axios": "^1.6.5", "chai": "^4.3.6", "cpx": "^1.5.0", "del-cli": "^5.0.0", @@ -79,4 +80,4 @@ }, "types": "./dist/lib/index.d.ts", "version": "0.0.8" -} \ No newline at end of file +} diff --git a/tasks/addresses.ts b/tasks/addresses.ts index 9da84647..3f40844e 100644 --- a/tasks/addresses.ts +++ b/tasks/addresses.ts @@ -11,8 +11,7 @@ import { import { ZetaConnector__factory } from "dist/typechain-types"; import { zetaConnectorNonEthSol } from "typechain-types/factories/contracts/evm"; -const ATHENS_EVM_RPC = - "https://zetachain-athens-evm.blockpi.network/v1/rpc/public"; +const ATHENS_EVM_RPC = "https://zetachain-athens-evm.blockpi.network/v1/rpc/public"; const ATHENS_TENDERMINT_RPC = "http://46.4.15.110:1317"; const fetchChains = async (chainObject: any) => { @@ -28,11 +27,7 @@ const fetchChains = async (chainObject: any) => { }; }); } else { - console.error( - "Error fetching chains:", - response.status, - response.statusText - ); + console.error("Error fetching chains:", response.status, response.statusText); } } catch (error) { console.error("Error fetching chains:", error); @@ -40,7 +35,7 @@ const fetchChains = async (chainObject: any) => { }; const fetchTssData = async (chainObject: any) => { - const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/zetacore/crosschain/get_tss_address`; + const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/crosschain/get_tss_address`; try { const tssResponse: AxiosResponse = await axios.get(URL); @@ -51,11 +46,7 @@ const fetchTssData = async (chainObject: any) => { chainObject[chain]["tss"] = chain.includes("btc") ? btc : eth; } } else { - console.error( - "Error fetching TSS data:", - tssResponse.status, - tssResponse.statusText - ); + console.error("Error fetching TSS data:", tssResponse.status, tssResponse.statusText); } } catch (error) { console.error("Error fetching TSS data:", error); @@ -63,7 +54,7 @@ const fetchTssData = async (chainObject: any) => { }; const fetchSystemContract = async (chainObject: any) => { - const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/zetacore/fungible/system_contract`; + const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/fungible/system_contract`; try { const systemContractResponse: AxiosResponse = await axios.get(URL); @@ -71,15 +62,10 @@ const fetchSystemContract = async (chainObject: any) => { if (!chainObject["zeta_testnet"]) { chainObject["zeta_testnet"] = {}; } - chainObject["zeta_testnet"]["systemContract"] = - systemContractResponse.data.SystemContract.system_contract; - chainObject["zeta_testnet"]["connectorZEVM"] = - systemContractResponse.data.SystemContract.connector_zevm; + chainObject["zeta_testnet"]["systemContract"] = systemContractResponse.data.SystemContract.system_contract; + chainObject["zeta_testnet"]["connectorZEVM"] = systemContractResponse.data.SystemContract.connector_zevm; } else { - console.error( - "Error fetching system contract:", - systemContractResponse.statusText - ); + console.error("Error fetching system contract:", systemContractResponse.statusText); } } catch (error) { console.error("Error fetching system contract:", error); @@ -87,7 +73,7 @@ const fetchSystemContract = async (chainObject: any) => { }; const fetchForeignCoinsData = async (chainObject: any) => { - const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/zetacore/fungible/foreign_coins`; + const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/fungible/foreign_coins`; try { const foreignCoinsResponse: AxiosResponse = await axios.get(URL); if (foreignCoinsResponse.status === 200) { @@ -102,21 +88,14 @@ const fetchForeignCoinsData = async (chainObject: any) => { } }); } else { - console.error( - "Error fetching foreign coins data:", - foreignCoinsResponse.status, - foreignCoinsResponse.statusText - ); + console.error("Error fetching foreign coins data:", foreignCoinsResponse.status, foreignCoinsResponse.statusText); } } catch (error) { console.error("Error fetching foreign coins data:", error); } }; -const fetchAthensAddresses = async ( - chainObject: any, - hre: HardhatRuntimeEnvironment -) => { +const fetchAthensAddresses = async (chainObject: any, hre: HardhatRuntimeEnvironment) => { const zeta = "zeta_testnet"; if (chainObject[zeta] && chainObject[zeta]["systemContract"]) { const athens = chainObject[zeta]; @@ -138,25 +117,18 @@ const fetchAthensAddresses = async ( }; const fetchChainSpecificAddresses = async (chainObject: any) => { - const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/zetacore/observer/get_client_params_for_chain`; + const URL = `${ATHENS_TENDERMINT_RPC}/zeta-chain/observer/get_client_params_for_chain`; try { for (const chain in chainObject) { if (chain.includes("zeta") || chain.includes("btc")) continue; const id = chainObject[chain].chainId; const response: AxiosResponse = await axios.get(`${URL}/${id}`); if (response.status === 200) { - chainObject[chain]["zetaTokenContractAddress"] = - response.data.core_params.zeta_token_contract_address; - chainObject[chain]["connectorContractAddress"] = - response.data.core_params.connector_contract_address; - chainObject[chain]["erc20CustodyContractAddress"] = - response.data.core_params.erc20_custody_contract_address; + chainObject[chain]["zetaTokenContractAddress"] = response.data.core_params.zeta_token_contract_address; + chainObject[chain]["connectorContractAddress"] = response.data.core_params.connector_contract_address; + chainObject[chain]["erc20CustodyContractAddress"] = response.data.core_params.erc20_custody_contract_address; } else { - console.error( - "Error fetching chain data:", - response.status, - response.statusText - ); + console.error("Error fetching chain data:", response.status, response.statusText); } } } catch (error) { @@ -164,10 +136,7 @@ const fetchChainSpecificAddresses = async (chainObject: any) => { } }; -const fetchPauserUpdater = async ( - chainObject: any, - hre: HardhatRuntimeEnvironment -) => { +const fetchPauserUpdater = async (chainObject: any, hre: HardhatRuntimeEnvironment) => { try { for (const chain in chainObject) { const provider = new hre.ethers.providers.JsonRpcProvider(ATHENS_EVM_RPC); diff --git a/yarn.lock b/yarn.lock index 6a8cfffc..8172cd4b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2497,6 +2497,15 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3" integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== +axios@^1.6.5: + version "1.6.5" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.5.tgz#2c090da14aeeab3770ad30c3a1461bc970fb0cd8" + integrity sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg== + dependencies: + follow-redirects "^1.15.4" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + babel-runtime@^6.9.2: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" @@ -4496,6 +4505,11 @@ follow-redirects@^1.12.1: resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== +follow-redirects@^1.15.4: + version "1.15.4" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.4.tgz#cdc7d308bf6493126b17ea2191ea0ccf3e535adf" + integrity sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw== + for-each@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" @@ -4538,6 +4552,15 @@ form-data@^3.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" +form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -7108,6 +7131,11 @@ promise@^8.0.0: dependencies: asap "~2.0.6" +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"