From c2827e12f2f35934290eba9f68b74cc9456b8506 Mon Sep 17 00:00:00 2001 From: Felicio Mununga Date: Fri, 3 Nov 2023 22:17:51 +0100 Subject: [PATCH] set provider in `readOnlyUrls` (cherry picked from commit 8802e7ca432cf76122208c8cf3fad52b4febfe9b) --- .gitignore | 1 + packages/DApp/src/config.ts | 6 ++++++ packages/DApp/src/constants/contracts.ts | 2 +- packages/DApp/src/hooks/useAvailableAmount.ts | 4 ++-- packages/contracts/README.md | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 8f602b8..b1d1c93 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ yarn-error.log build cache .vscode +.vercel diff --git a/packages/DApp/src/config.ts b/packages/DApp/src/config.ts index faf2876..f62d3ff 100644 --- a/packages/DApp/src/config.ts +++ b/packages/DApp/src/config.ts @@ -57,6 +57,9 @@ const configs: Record = { }, daapConfig: { readOnlyChainId: ChainId.OptimismGoerli, + readOnlyUrls: { + [ChainId.OptimismGoerli]: `https://optimism-goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, + }, networks: [OptimismGoerli], notifications: { checkInterval: 500, @@ -76,6 +79,9 @@ const configs: Record = { }, daapConfig: { readOnlyChainId: ChainId.Optimism, + readOnlyUrls: { + [ChainId.Optimism]: `https://optimism-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + }, networks: [Optimism], notifications: { checkInterval: 500, diff --git a/packages/DApp/src/constants/contracts.ts b/packages/DApp/src/constants/contracts.ts index bf4fcbd..53ec549 100644 --- a/packages/DApp/src/constants/contracts.ts +++ b/packages/DApp/src/constants/contracts.ts @@ -11,7 +11,7 @@ export const contracts = { }, [ChainId.OptimismGoerli]: { votingContract: '0x744Fd6e98dad09Fb8CCF530B5aBd32B56D64943b', - featuredVotingContract: '0x744Fd6e98dad09Fb8CCF530B5aBd32B56D64943b', + featuredVotingContract: '0x898331B756EE1f29302DeF227a4471e960c50612', directoryContract: '0xB3Ef5B0825D5f665bE14394eea41E684CE96A4c5', tokenContract: '0xcAD273fA2bb77875333439FDf4417D995159c3E1', multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', diff --git a/packages/DApp/src/hooks/useAvailableAmount.ts b/packages/DApp/src/hooks/useAvailableAmount.ts index 84ddf21..3a06095 100644 --- a/packages/DApp/src/hooks/useAvailableAmount.ts +++ b/packages/DApp/src/hooks/useAvailableAmount.ts @@ -5,8 +5,8 @@ import { useEffect, useState } from 'react' export function useAvailableAmount() { const { account, chainId } = useEthers() - // @ts-expect-error Ethers does not type chainId - const tokenBalance = useTokenBalance(contracts[chainId ?? 3]?.tokenContract, account) + // @ts-expect-error fixme: https://github.com/status-im/community-dapp/pull/94#discussion_r1378964354 undefined or unsupported network + const tokenBalance = useTokenBalance(contracts[chainId as keyof typeof contracts | undefined].tokenContract, account) const [availableAmount, setAvailableAmount] = useState(0) diff --git a/packages/contracts/README.md b/packages/contracts/README.md index 6a6d699..4882dcf 100644 --- a/packages/contracts/README.md +++ b/packages/contracts/README.md @@ -9,7 +9,7 @@ Community directory curator contracts | **Optimism Goerli** | | | | Directory | [`0xB3Ef5B0825D5f665bE14394eea41E684CE96A4c5`](https://goerli-optimism.etherscan.io/address/0xB3Ef5B0825D5f665bE14394eea41E684CE96A4c5) | [`a3967fc`](https://github.com/status-im/community-dapp/commit/a3967fcdf92ddc0c4d814e3fd19fc3bb6b32d2ee) | | VotingContract | [`0x744Fd6e98dad09Fb8CCF530B5aBd32B56D64943b`](https://goerli-optimism.etherscan.io/address/0x744Fd6e98dad09Fb8CCF530B5aBd32B56D64943b) | [`a3967fc`](https://github.com/status-im/community-dapp/commit/a3967fcdf92ddc0c4d814e3fd19fc3bb6b32d2ee) | -| FeaturedVotingContract | [`0x898331B756EE1f29302DeF227a4471e960c50612`](https://goerli-optimism.etherscan.io/address/0x744Fd6e98dad09Fb8CCF530B5aBd32B56D64943b) | [`a3967fc`](https://github.com/status-im/community-dapp/commit/a3967fcdf92ddc0c4d814e3fd19fc3bb6b32d2ee) | +| FeaturedVotingContract | [`0x898331B756EE1f29302DeF227a4471e960c50612`](https://goerli-optimism.etherscan.io/address/0x898331B756EE1f29302DeF227a4471e960c50612) | [`a3967fc`](https://github.com/status-im/community-dapp/commit/a3967fcdf92ddc0c4d814e3fd19fc3bb6b32d2ee) | | **Optimism Mainnet** | | | | Directory | [`0xA8d270048a086F5807A8dc0a9ae0e96280C41e3A`](https://optimistic.etherscan.io/address/0xA8d270048a086F5807A8dc0a9ae0e96280C41e3A) | [`af44986`](https://github.com/status-im/community-dapp/commit/af449861d7cd259e238136bab7efb09f148fb8bd) | | VotingContract | [`0x321Ba646d994200257Ce4bfe18F66C9283ad1407`](https://optimistic.etherscan.io/address/0x321Ba646d994200257Ce4bfe18F66C9283ad1407) | [`af44986`](https://github.com/status-im/community-dapp/commit/af449861d7cd259e238136bab7efb09f148fb8bd) |