From 137ac4fd9f85f6740a15a22adf158e9290aa2cf0 Mon Sep 17 00:00:00 2001 From: zzggo Date: Fri, 15 Nov 2024 17:17:33 +1100 Subject: [PATCH 1/3] fixed: reload issue --- src/ui/views/Dashboard/Header.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/views/Dashboard/Header.tsx b/src/ui/views/Dashboard/Header.tsx index f4dcadec..b2cbabf1 100644 --- a/src/ui/views/Dashboard/Header.tsx +++ b/src/ui/views/Dashboard/Header.tsx @@ -346,6 +346,7 @@ const Header = ({ loading }) => { // Navigate if needed history.push('/dashboard'); + window.location.reload(); }; const transactionHandler = (request) => { From f14faa2f18936d938f252c5ec2ec77a989dd440a Mon Sep 17 00:00:00 2001 From: zzggo Date: Fri, 15 Nov 2024 18:06:25 +1100 Subject: [PATCH 2/3] fixed: get evm tokenlist for sending ft --- src/background/service/openapi.ts | 19 ++++++++++++++++++- src/ui/views/Send/SendEth/index.tsx | 15 ++++++++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/background/service/openapi.ts b/src/background/service/openapi.ts index 4a344a94..b44831a6 100644 --- a/src/background/service/openapi.ts +++ b/src/background/service/openapi.ts @@ -1313,7 +1313,7 @@ class OpenApiService { if (!network) { network = await userWalletService.getNetwork(); } - const tokens = await this.getTokenListFromGithub(network); + const tokens = await this.getEvmListFromGithub(network); // const coins = await remoteFetch.flowCoins(); return tokens.find((item) => item.symbol.toLowerCase() === name.toLowerCase()); }; @@ -1531,6 +1531,23 @@ class OpenApiService { return tokens; }; + getEvmListFromGithub = async (network) => { + const chainType = 'evm'; + + const gitToken = await storage.getExpiry(`GitTokenList${network}${chainType}`); + if (gitToken) return gitToken; + + const tokens = await this.fetchGitTokenList(network, chainType, chainType); + + if (chainType === 'evm') { + const evmCustomToken = (await storage.get(`${network}evmCustomToken`)) || []; + this.mergeCustomTokens(tokens, evmCustomToken); + } + + storage.setExpiry(`GitTokenList${network}${chainType}`, tokens, 600000); + return tokens; + }; + refreshEvmGitToken = async (network) => { const chainType = 'evm'; let gitToken = await storage.getExpiry(`GitTokenList${network}${chainType}`); diff --git a/src/ui/views/Send/SendEth/index.tsx b/src/ui/views/Send/SendEth/index.tsx index 571401c3..847ba546 100644 --- a/src/ui/views/Send/SendEth/index.tsx +++ b/src/ui/views/Send/SendEth/index.tsx @@ -75,12 +75,17 @@ const SendEth = () => { const web3Instance = new Web3(provider); setWeb3(web3Instance); let contractAddress = '0x7cd84a6b988859202cbb3e92830fff28813b9341'; - if (token !== 'flow') { - const tokenInfo = await usewallet.openapi.getEvmTokenInfo(token); - contractAddress = tokenInfo!.address; + try { + if (token !== 'flow') { + const tokenInfo = await usewallet.openapi.getEvmTokenInfo(token); + contractAddress = tokenInfo!.address; + } + + const contractInstance = new web3Instance.eth.Contract(erc20ABI, contractAddress); + setErc20Contract(contractInstance); + } catch (error) { + console.error('Error creating the web3 contract instance:', error); } - const contractInstance = new web3Instance.eth.Contract(erc20ABI, contractAddress); - setErc20Contract(contractInstance); setNetwork(network); setCurrentCoin(token); // userWallet From 9540637ea6ea724276bfc0be08dc31ab98cbba2a Mon Sep 17 00:00:00 2001 From: zzggo Date: Fri, 15 Nov 2024 18:08:12 +1100 Subject: [PATCH 3/3] fixed: update eslin ignore --- src/ui/views/Dashboard/Header.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/views/Dashboard/Header.tsx b/src/ui/views/Dashboard/Header.tsx index b2cbabf1..1ee323c4 100644 --- a/src/ui/views/Dashboard/Header.tsx +++ b/src/ui/views/Dashboard/Header.tsx @@ -346,6 +346,7 @@ const Header = ({ loading }) => { // Navigate if needed history.push('/dashboard'); + //eslint-disable-next-line no-restricted-globals window.location.reload(); };