diff --git a/helpers/balances.ts b/helpers/balances.ts index 2ef5677b..5cc1094a 100644 --- a/helpers/balances.ts +++ b/helpers/balances.ts @@ -62,10 +62,11 @@ const fetchZRC20Balance = async (address: string) => { const provider = new ethers.providers.JsonRpcProvider(rpc); const promises = Object.keys(networks).map(async (networkName) => { try { - const zrc20 = getAddress("zrc20", networkName); + const zrc20 = getAddress("zrc20", networkName as any); const contract = new ethers.Contract(zrc20, ZRC20.abi, provider); const balance = await contract.balanceOf(address); - const denom = networks[networkName].assets[0].symbol; + const denom = + networks[networkName as keyof typeof networks].assets[0].symbol; if (balance > 0) { const b = parseFloat(formatEther(balance)).toFixed(2); return `${b} ${denom}`; @@ -86,7 +87,7 @@ const fetchZRC20Balance = async (address: string) => { return result.filter((item) => item !== undefined).join(", "); }; -export const getBalances = async (address, btc_address = null) => { +export const getBalances = async (address: any, btc_address = null) => { const balancePromises = Object.keys(networks).map((networkName) => { const api = getEndpoints("evm", networkName as any); if (api.length >= 1) { @@ -96,6 +97,7 @@ export const getBalances = async (address, btc_address = null) => { } }); const balances = await Promise.all(balancePromises); - if (btc_address) balances.push(await fetchBitcoinBalance(btc_address)); + if (btc_address) + balances.push((await fetchBitcoinBalance(btc_address)) as any); return balances.filter((balance) => balance != null); }; diff --git a/helpers/sendZETA.ts b/helpers/sendZETA.ts index c29ecb2e..189601ac 100644 --- a/helpers/sendZETA.ts +++ b/helpers/sendZETA.ts @@ -13,7 +13,8 @@ export const sendZETA = async ( recipient: string ) => { let connectorContract: any; - const destinationChainId = networks[destination]?.chain_id; + const destinationChainId = + networks[destination as keyof typeof networks]?.chain_id; if (!destinationChainId) { throw new Error("Invalid destination chain"); } diff --git a/helpers/tx.ts b/helpers/tx.ts index f54872d0..d4ad0600 100644 --- a/helpers/tx.ts +++ b/helpers/tx.ts @@ -69,7 +69,7 @@ const fetchCCTXData = async ( let confirmed_on_destination = false; if (outbound_tx_hash) { const chainName = findByChainId(networks, parseInt(receiver_chainId)); - const rpc = getEndpoints("evm", chainName)[0]?.url; + const rpc = getEndpoints("evm", chainName as any)[0]?.url; const provider = new ethers.providers.JsonRpcProvider(rpc); const confirmed = await provider.getTransaction(outbound_tx_hash); confirmed_on_destination = confirmed !== null; diff --git a/package.json b/package.json index 4cf25f53..11ada25d 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "@typechain/ethers-v5": "^10.1.0", "@typechain/hardhat": "^6.1.2", "@types/chai": "^4.2.0", + "@types/isomorphic-fetch": "^0.0.38", "@types/mocha": ">=9.1.0", "@types/node": ">=12.0.0", "@types/ws": "^8.5.5", @@ -73,8 +74,8 @@ "@nomiclabs/hardhat-ethers": "^2.2.3", "@openzeppelin/contracts": "^4.9.2", "@uniswap/v2-periphery": "^1.1.0-beta.0", - "@zetachain/networks": "^2.4.3", "@zetachain/faucet-cli": "^4.0.1", + "@zetachain/networks": "^2.4.3", "@zetachain/protocol-contracts": "^2.1.0", "axios": "^1.4.0", "bech32": "^2.0.0", @@ -95,4 +96,4 @@ "tiny-secp256k1": "^2.2.3", "ws": "^8.13.0" } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index fdd7ac0a..0b013949 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1566,6 +1566,11 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/isomorphic-fetch@^0.0.38": + version "0.0.38" + resolved "https://registry.yarnpkg.com/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.38.tgz#90882932a371e294a3c6143430275c15cb6ebf1b" + integrity sha512-DcXWx26qmt89lQ1Saoit0P38yHqT7fGceVs7UpMy2gU7AjEZISPdM7rqoFY5VHtl33H+cJ+VBDYmNRssTM4Zlw== + "@types/json-schema@^7.0.9": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb"