From 44ee6dfc5634f73b63cec53b53d13b9cf147d235 Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Mon, 25 Sep 2023 14:49:31 +0800 Subject: [PATCH 1/6] fix: Fix styles when desc or symbol is overlong --- .../src/components/SUDTAccountPile/sUDTAccountPile.module.scss | 1 + packages/neuron-ui/src/components/UANDisplay/index.module.scss | 1 + packages/neuron-ui/src/widgets/SUDTAvatar/sUDTAvatar.module.scss | 1 + 3 files changed, 3 insertions(+) diff --git a/packages/neuron-ui/src/components/SUDTAccountPile/sUDTAccountPile.module.scss b/packages/neuron-ui/src/components/SUDTAccountPile/sUDTAccountPile.module.scss index 9d83c4e1f5..e3ed5b6ce9 100644 --- a/packages/neuron-ui/src/components/SUDTAccountPile/sUDTAccountPile.module.scss +++ b/packages/neuron-ui/src/components/SUDTAccountPile/sUDTAccountPile.module.scss @@ -9,6 +9,7 @@ .info { flex: 1; + max-width: calc(100% - 48px); .baseInfo { cursor: pointer; } diff --git a/packages/neuron-ui/src/components/UANDisplay/index.module.scss b/packages/neuron-ui/src/components/UANDisplay/index.module.scss index 60c32c9cb1..af45313343 100644 --- a/packages/neuron-ui/src/components/UANDisplay/index.module.scss +++ b/packages/neuron-ui/src/components/UANDisplay/index.module.scss @@ -15,6 +15,7 @@ @include tooltip; white-space: nowrap; display: inline-flex; + max-width: 200px; & > span { @include text-overflow-ellipsis; diff --git a/packages/neuron-ui/src/widgets/SUDTAvatar/sUDTAvatar.module.scss b/packages/neuron-ui/src/widgets/SUDTAvatar/sUDTAvatar.module.scss index a7796d090d..7227f0d90c 100644 --- a/packages/neuron-ui/src/widgets/SUDTAvatar/sUDTAvatar.module.scss +++ b/packages/neuron-ui/src/widgets/SUDTAvatar/sUDTAvatar.module.scss @@ -8,6 +8,7 @@ background-color: var(--table-head-border-color); font-size: 20px; text-transform: uppercase; + flex-shrink: 0; img { width: 24px; From a783599d95ae38fd3004d0bcc5a37d1e324f18f3 Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Mon, 25 Sep 2023 15:03:29 +0800 Subject: [PATCH 2/6] fix: Use difference functions for back and close dialog --- .../SUDTMigrateToExistAccountDialog/index.tsx | 12 +++++++----- .../SUDTMigrateToNewAccountDialog/index.tsx | 12 +++++++----- .../src/components/SpecialAssetList/index.tsx | 12 ++++++++++-- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/packages/neuron-ui/src/components/SUDTMigrateToExistAccountDialog/index.tsx b/packages/neuron-ui/src/components/SUDTMigrateToExistAccountDialog/index.tsx index bf7707b576..63d430733f 100644 --- a/packages/neuron-ui/src/components/SUDTMigrateToExistAccountDialog/index.tsx +++ b/packages/neuron-ui/src/components/SUDTMigrateToExistAccountDialog/index.tsx @@ -17,7 +17,8 @@ const SUDTMigrateToExistAccountDialog = ({ isMainnet, walletID, isLightClient, - onCancel, + onCloseDialog, + onBack, onSuccess, }: { cell: SpecialAssetCell @@ -26,7 +27,8 @@ const SUDTMigrateToExistAccountDialog = ({ isMainnet: boolean walletID: string isLightClient: boolean - onCancel: () => void + onCloseDialog: () => void + onBack: () => void onSuccess: (text: string) => void }) => { const [t] = useTranslation() @@ -56,7 +58,7 @@ const SUDTMigrateToExistAccountDialog = ({ outPoint: cell.outPoint, acpAddress: address, }).then(res => { - onCancel() + onCloseDialog() if (isSuccessResponse(res)) { if (res.result) { dispatch({ @@ -87,14 +89,14 @@ const SUDTMigrateToExistAccountDialog = ({ }) } }) - }, [cell.outPoint, address, t, onCancel, dispatch, walletID]) + }, [cell.outPoint, address, t, onCloseDialog, dispatch, walletID]) return ( void + onCloseDialog: () => void + onBack: () => void onSuccess: (text: string) => void }) => { const [t] = useTranslation() @@ -51,7 +53,7 @@ const SUDTMigrateToNewAccountDialog = ({ generateSudtMigrateAcpTx({ outPoint: cell.outPoint, }).then(res => { - onCancel() + onCloseDialog() if (isSuccessResponse(res)) { if (res.result) { dispatch({ @@ -91,7 +93,7 @@ const SUDTMigrateToNewAccountDialog = ({ }) } }) - }, [cell, t, onCancel, walletID, tokenInfo, dispatch, sudtAmount]) + }, [cell, t, onCloseDialog, walletID, tokenInfo, dispatch, sudtAmount]) const renderList = fields.map(field => { return field.key === 'balance' ? ( @@ -123,7 +125,7 @@ const SUDTMigrateToNewAccountDialog = ({ className={styles.container} show title={t('migrate-sudt.turn-into-new-account.title')} - onCancel={onCancel} + onCancel={onBack} cancelText={t('migrate-sudt.cancel')} confirmText={t('migrate-sudt.confirm')} onConfirm={onSubmit} diff --git a/packages/neuron-ui/src/components/SpecialAssetList/index.tsx b/packages/neuron-ui/src/components/SpecialAssetList/index.tsx index beef7382d8..9b4c804427 100644 --- a/packages/neuron-ui/src/components/SpecialAssetList/index.tsx +++ b/packages/neuron-ui/src/components/SpecialAssetList/index.tsx @@ -121,6 +121,12 @@ const SpecialAssetList = () => { ) const onCloseDialog = useCallback(() => { + setIsExistAccountDialogOpen(false) + setIsNewAccountDialogOpen(false) + setIsMigrateDialogOpen(false) + }, [setIsNewAccountDialogOpen, setIsExistAccountDialogOpen, setIsMigrateDialogOpen]) + + const onBack = useCallback(() => { setIsExistAccountDialogOpen(false) setIsNewAccountDialogOpen(false) setIsMigrateDialogOpen(true) @@ -522,7 +528,8 @@ const SpecialAssetList = () => { sUDTAccounts={sUDTAccounts} walletID={id} tokenInfo={migrateTokenInfo} - onCancel={onCloseDialog} + onCloseDialog={onCloseDialog} + onBack={onBack} onSuccess={handleActionSuccess} /> ) : null} @@ -534,7 +541,8 @@ const SpecialAssetList = () => { sUDTAccounts={sUDTAccounts} isMainnet={isMainnet} walletID={id} - onCancel={onCloseDialog} + onCloseDialog={onCloseDialog} + onBack={onBack} isLightClient={isLightClient} onSuccess={handleActionSuccess} /> From 045d09b43d9ee40f08037e9b39df1b9dc6d40443 Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Mon, 25 Sep 2023 15:41:32 +0800 Subject: [PATCH 3/6] fix: Show the error dialog when send transaction and reset deposit value when the dialog opens. --- .../src/components/DepositDialog/hooks.ts | 8 +++++++- .../src/components/DepositDialog/index.tsx | 6 ++++-- .../src/components/History/RowExtend.tsx | 2 +- .../states/stateProvider/actionCreators/sudt.ts | 4 ++-- .../stateProvider/actionCreators/wallets.ts | 2 +- packages/neuron-ui/src/utils/baseActions.ts | 15 +++++++-------- 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/packages/neuron-ui/src/components/DepositDialog/hooks.ts b/packages/neuron-ui/src/components/DepositDialog/hooks.ts index 7de0832cda..2a28144db6 100644 --- a/packages/neuron-ui/src/components/DepositDialog/hooks.ts +++ b/packages/neuron-ui/src/components/DepositDialog/hooks.ts @@ -170,7 +170,7 @@ function calculatePercent(amount: string, total: string) { return +((BigInt(PERCENT_100) * BigInt(amount)) / BigInt(total)).toString() } -export const useDepositValue = (balance: string) => { +export const useDepositValue = (balance: string, showDepositDialog: boolean) => { const [depositValue, setDepositValue] = useState(`${MIN_DEPOSIT_AMOUNT}`) const [slidePercent, setSlidePercent] = useState( calculatePercent(CKBToShannonFormatter(`${MIN_DEPOSIT_AMOUNT}`), balance) @@ -209,6 +209,12 @@ export const useDepositValue = (balance: string) => { setDepositValue(`${MIN_DEPOSIT_AMOUNT}`) setSlidePercent(calculatePercent(CKBToShannonFormatter(`${MIN_DEPOSIT_AMOUNT}`), balance)) }, [balance]) + useEffect(() => { + if (showDepositDialog) { + resetDepositValue() + } + // ignore resetDepositValue changed, only showDepositDialog from false -> true reset + }, [showDepositDialog]) return { onChangeDepositValue, setDepositValue, diff --git a/packages/neuron-ui/src/components/DepositDialog/index.tsx b/packages/neuron-ui/src/components/DepositDialog/index.tsx index 0db3f53696..d6a13e64d9 100644 --- a/packages/neuron-ui/src/components/DepositDialog/index.tsx +++ b/packages/neuron-ui/src/components/DepositDialog/index.tsx @@ -57,8 +57,10 @@ const DepositDialog = ({ const [t] = useTranslation() const disabled = !isTxGenerated const { isBalanceReserved, onIsBalanceReservedChange, setIsBalanceReserved } = useBalanceReserved() - const { depositValue, onChangeDepositValue, slidePercent, onSliderChange, resetDepositValue } = - useDepositValue(balance) + const { depositValue, onChangeDepositValue, slidePercent, onSliderChange, resetDepositValue } = useDepositValue( + balance, + show + ) const { errorMessage, maxDepositValue } = useGenerateDaoDepositTx({ walletID, isBalanceReserved, diff --git a/packages/neuron-ui/src/components/History/RowExtend.tsx b/packages/neuron-ui/src/components/History/RowExtend.tsx index ecdfc253a1..40e926ec9c 100644 --- a/packages/neuron-ui/src/components/History/RowExtend.tsx +++ b/packages/neuron-ui/src/components/History/RowExtend.tsx @@ -51,7 +51,7 @@ const RowExtend = ({ column, columns, isMainnet, id, bestBlockNumber }: RowExten ) const { blockNumber, hash, description } = column - const confirmations = 1 + bestBlockNumber - +blockNumber + const confirmations = blockNumber ? 1 + bestBlockNumber - +blockNumber : 0 const confirmationsLabel = confirmations > 1000 ? '1,000+' : localNumberFormatter(confirmations) const isSelected = localDescription.key === column.hash const onCopy = useCallback(() => { diff --git a/packages/neuron-ui/src/states/stateProvider/actionCreators/sudt.ts b/packages/neuron-ui/src/states/stateProvider/actionCreators/sudt.ts index 49ad1e6ffa..20d22d46da 100644 --- a/packages/neuron-ui/src/states/stateProvider/actionCreators/sudt.ts +++ b/packages/neuron-ui/src/states/stateProvider/actionCreators/sudt.ts @@ -10,10 +10,10 @@ import { addNotification } from './app' export const sendCreateSUDTAccountTransaction = (params: Controller.SendCreateSUDTAccountTransaction.Params) => async (dispatch: StateDispatch) => - sendTxBaseAction(sendCreateAccountTx, params, dispatch, addNotification) + sendTxBaseAction(sendCreateAccountTx, params, dispatch) export const sendSUDTTransaction = (params: Controller.SendSUDTTransaction.Params) => async (dispatch: StateDispatch) => - sendTxBaseAction(sendSUDTTx, params, dispatch, addNotification) + sendTxBaseAction(sendSUDTTx, params, dispatch) export const migrateAcp = (params: Controller.MigrateAcp.Params) => async (dispatch: StateDispatch) => { dispatch({ diff --git a/packages/neuron-ui/src/states/stateProvider/actionCreators/wallets.ts b/packages/neuron-ui/src/states/stateProvider/actionCreators/wallets.ts index 944828d9c7..550df7d00b 100644 --- a/packages/neuron-ui/src/states/stateProvider/actionCreators/wallets.ts +++ b/packages/neuron-ui/src/states/stateProvider/actionCreators/wallets.ts @@ -74,7 +74,7 @@ export const setCurrentWallet = (id: string) => (dispatch: StateDispatch) => { } export const sendTransaction = (params: Controller.SendTransactionParams) => async (dispatch: StateDispatch) => - sendTxBaseAction(sendTx, params, dispatch, addNotification) + sendTxBaseAction(sendTx, params, dispatch) export const updateAddressListAndBalance = (params: Controller.GetAddressesByWalletIDParams) => (dispatch: StateDispatch) => { diff --git a/packages/neuron-ui/src/utils/baseActions.ts b/packages/neuron-ui/src/utils/baseActions.ts index f922e29a27..3357f2b2bc 100644 --- a/packages/neuron-ui/src/utils/baseActions.ts +++ b/packages/neuron-ui/src/utils/baseActions.ts @@ -1,20 +1,19 @@ -import { AppActions } from 'states' +import { AppActions, showGlobalAlertDialog } from 'states' import { isSuccessResponse } from './is' import { ErrorCode, ResponseCode } from './enums' -export const sendTxBaseAction = async (sendMethod: any, params: any, dispatch: any, addNotification: any) => { +export const sendTxBaseAction = async (sendMethod: any, params: any, dispatch: any) => { dispatch({ type: AppActions.UpdateLoadings, payload: { sending: true } }) try { const res = await sendMethod(params) if (isSuccessResponse(res)) { dispatch({ type: AppActions.DismissPasswordRequest }) } else if (res.status !== ErrorCode.PasswordIncorrect && res.status !== ErrorCode.SignTransactionFailed) { - addNotification({ - type: 'alert', - timestamp: +new Date(), - code: res.status, - content: typeof res.message === 'string' ? res.message : res.message.content, - meta: typeof res.message === 'string' ? undefined : res.message.meta, + showGlobalAlertDialog({ + type: 'failed', + title: typeof res.message === 'string' ? res.message : res.message.content, + message: typeof res.message === 'string' ? undefined : res.message.meta, + action: 'ok', })(dispatch) dispatch({ type: AppActions.DismissPasswordRequest }) } From a97012f65fcf6430f3da6bff4e58b14ee7fd125f Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Tue, 26 Sep 2023 17:07:48 +0800 Subject: [PATCH 4/6] fix: Fix overflow text style --- packages/neuron-ui/src/components/History/index.tsx | 13 +++++++++---- .../SUDTAccountList/sUDTAccountList.module.scss | 2 +- .../src/components/SUDTReceiveDialog/index.tsx | 2 +- .../SUDTReceiveDialog/sUDTReceiveDialog.module.scss | 12 ++++++++---- .../src/components/UANDisplay/index.module.scss | 3 ++- packages/neuron-ui/src/locales/zh.json | 4 +++- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/packages/neuron-ui/src/components/History/index.tsx b/packages/neuron-ui/src/components/History/index.tsx index 0961de1588..186039cb10 100644 --- a/packages/neuron-ui/src/components/History/index.tsx +++ b/packages/neuron-ui/src/components/History/index.tsx @@ -1,6 +1,6 @@ import React, { useState, useCallback } from 'react' import { useNavigate, useLocation } from 'react-router-dom' -import { useTranslation } from 'react-i18next' +import { Trans, useTranslation } from 'react-i18next' import Pagination from 'widgets/Pagination' import SUDTAvatar from 'widgets/SUDTAvatar' import Button from 'widgets/Button' @@ -11,7 +11,7 @@ import { Download, Search, ArrowNext } from 'widgets/Icons/icon' import PageContainer from 'components/PageContainer' import TransactionStatusWrap from 'components/TransactionStatusWrap' import FormattedTokenAmount from 'components/FormattedTokenAmount' -import { getDisplayName, isTonkenInfoStandardUAN } from 'components/UANDisplay' +import { UANTokenName, isTonkenInfoStandardUAN } from 'components/UANDisplay' import { useState as useGlobalState, useDispatch } from 'states' import { exportTransactions } from 'services/remote' @@ -76,7 +76,7 @@ const History = () => { const handleTransactionInfo = (tx: State.Transaction) => { let name = '--' let amount = '--' - let typeLabel = '--' + let typeLabel: React.ReactNode = '--' let sudtAmount = '' let showWithUANFormatter = false @@ -92,7 +92,12 @@ const History = () => { if (['create', 'destroy'].includes(tx.type)) { // create/destroy an account showWithUANFormatter = isTonkenInfoStandardUAN(tx.sudtInfo.sUDT.tokenName, tx.sudtInfo.sUDT.symbol) - typeLabel = `${t(`history.${tx.type}`, { name: getDisplayName(name, tx.sudtInfo.sUDT.symbol) })}` + typeLabel = ( + ]} + /> + ) } else { // send/receive to/from an account const type = +tx.sudtInfo.amount <= 0 ? 'send' : 'receive' diff --git a/packages/neuron-ui/src/components/SUDTAccountList/sUDTAccountList.module.scss b/packages/neuron-ui/src/components/SUDTAccountList/sUDTAccountList.module.scss index 0065fa4eb6..c0846d6065 100644 --- a/packages/neuron-ui/src/components/SUDTAccountList/sUDTAccountList.module.scss +++ b/packages/neuron-ui/src/components/SUDTAccountList/sUDTAccountList.module.scss @@ -57,7 +57,7 @@ container-type: inline-size; @container (max-width: 968px) { .list { - grid-template-columns: repeat(3, auto); + grid-template-columns: repeat(3, 33%); } } } diff --git a/packages/neuron-ui/src/components/SUDTReceiveDialog/index.tsx b/packages/neuron-ui/src/components/SUDTReceiveDialog/index.tsx index aa453038ac..ac2dddda05 100644 --- a/packages/neuron-ui/src/components/SUDTReceiveDialog/index.tsx +++ b/packages/neuron-ui/src/components/SUDTReceiveDialog/index.tsx @@ -68,7 +68,7 @@ const SUDTReceiveDialog = ({ data, onClose }: { data: DataProps; onClose?: () => >
- {t('s-udt.receive.notation', { symbol: getDisplaySymbol(tokenName || '', symbol || '') })} + {t('s-udt.receive.notation', { symbol: getDisplaySymbol(tokenName || '', symbol || '') })}
diff --git a/packages/neuron-ui/src/components/SUDTReceiveDialog/sUDTReceiveDialog.module.scss b/packages/neuron-ui/src/components/SUDTReceiveDialog/sUDTReceiveDialog.module.scss index 2b494457fc..0c8359a35e 100644 --- a/packages/neuron-ui/src/components/SUDTReceiveDialog/sUDTReceiveDialog.module.scss +++ b/packages/neuron-ui/src/components/SUDTReceiveDialog/sUDTReceiveDialog.module.scss @@ -24,6 +24,7 @@ border-radius: 16px; column-gap: 16px; .right { + max-width: calc(100% - 48px); .accountName { font-weight: 500; font-size: 14px; @@ -43,9 +44,6 @@ } .notification { - font-weight: 500; - font-size: 12px; - line-height: 32px; height: 32px; text-align: center; color: var(--notice-text-color); @@ -53,13 +51,19 @@ justify-content: center; align-items: center; word-break: break-word; - margin: 0; + margin: 0 4px; background-color: var(--warn-background-color); svg { margin-right: 4px; flex-shrink: 0; } + & > span { + font-weight: 500; + font-size: 12px; + line-height: 32px; + @include text-overflow-ellipsis; + } .symbol { display: inline-flex; margin: 0 2px; diff --git a/packages/neuron-ui/src/components/UANDisplay/index.module.scss b/packages/neuron-ui/src/components/UANDisplay/index.module.scss index af45313343..b41d961ad5 100644 --- a/packages/neuron-ui/src/components/UANDisplay/index.module.scss +++ b/packages/neuron-ui/src/components/UANDisplay/index.module.scss @@ -4,6 +4,7 @@ @include tooltip; white-space: nowrap; display: inline-flex; + max-width: calc(100px + (100vw - 1200px) / 2); & > span { @include text-overflow-ellipsis; @@ -15,7 +16,7 @@ @include tooltip; white-space: nowrap; display: inline-flex; - max-width: 200px; + max-width: calc(180px + (100vw - 1200px) / 2); & > span { @include text-overflow-ellipsis; diff --git a/packages/neuron-ui/src/locales/zh.json b/packages/neuron-ui/src/locales/zh.json index 6da6cc615e..d9f7b3f354 100644 --- a/packages/neuron-ui/src/locales/zh.json +++ b/packages/neuron-ui/src/locales/zh.json @@ -305,7 +305,9 @@ "copy-balance": "复制余额", "copy-address": "复制地址", "create": "创建 {{name}} 资产账户", - "destroy": "销毁 {{name}} 资产账户" + "destroy": "销毁 {{name}} 资产账户", + "createSUDT": "创建 <0> 资产账户", + "destroySUDT": "销毁 <0> 资产账户" }, "transaction": { "window-title": "交易: {{hash}}", From f5c718881660db72e665cf59d7d5d218ca5147ce Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Wed, 27 Sep 2023 09:42:23 +0800 Subject: [PATCH 5/6] fix: Adapt form submit event --- .../src/components/DepositDialog/index.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/neuron-ui/src/components/DepositDialog/index.tsx b/packages/neuron-ui/src/components/DepositDialog/index.tsx index d6a13e64d9..fd4125033f 100644 --- a/packages/neuron-ui/src/components/DepositDialog/index.tsx +++ b/packages/neuron-ui/src/components/DepositDialog/index.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useCallback } from 'react' import { Slider } from 'office-ui-fabric-react' import { Trans, useTranslation } from 'react-i18next' import TextField from 'widgets/TextField' @@ -71,6 +71,16 @@ const DepositDialog = ({ }) const onConfirm = useOnDepositDialogSubmit({ onCloseDepositDialog, walletID }) const onCancel = useOnDepositDialogCancel({ onCloseDepositDialog, resetDepositValue, setIsBalanceReserved }) + const onSubmit = useCallback( + (e: React.FormEvent) => { + e.preventDefault() + if (disabled) { + return + } + onConfirm() + }, + [disabled, onConfirm] + ) return ( ) : ( -
+ From 593a776c8b809c6d98a88691360994b3aa4a1a45 Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Wed, 27 Sep 2023 15:10:33 +0800 Subject: [PATCH 6/6] fix: When get transaction error ignore update transaction --- .../block-sync-renderer/tx-status-listener.ts | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/packages/neuron-wallet/src/block-sync-renderer/tx-status-listener.ts b/packages/neuron-wallet/src/block-sync-renderer/tx-status-listener.ts index ae10bb37f5..1af3660c26 100644 --- a/packages/neuron-wallet/src/block-sync-renderer/tx-status-listener.ts +++ b/packages/neuron-wallet/src/block-sync-renderer/tx-status-listener.ts @@ -3,11 +3,18 @@ import { CONNECTION_NOT_FOUND_NAME } from '../database/chain/ormconfig' import { FailedTransaction, TransactionPersistor } from '../services/tx' import RpcService from '../services/rpc-service' import NetworksService from '../services/networks' -import { TransactionStatus } from '../models/chain/transaction' +import Transaction, { TransactionStatus } from '../models/chain/transaction' import TransactionWithStatus from '../models/chain/transaction-with-status' import logger from '../utils/logger' import { interval } from 'rxjs' +type TransactionDetail = { + hash: string + tx: Transaction | undefined + status: TransactionStatus + blockHash: string | null +} + const getTransactionStatus = async (hash: string) => { const url: string = NetworksService.getInstance().getCurrent().remote const rpcService = new RpcService(url) @@ -42,18 +49,26 @@ const trackingStatus = async () => { const pendingHashes = pendingTransactions.map(tx => tx.hash) const txs = await Promise.all( pendingHashes.map(async hash => { - const txWithStatus = await getTransactionStatus(hash) - return { - hash, - tx: txWithStatus.tx, - status: txWithStatus.status, - blockHash: txWithStatus.blockHash, + try { + const txWithStatus = await getTransactionStatus(hash) + return { + hash, + tx: txWithStatus.tx, + status: txWithStatus.status, + blockHash: txWithStatus.blockHash, + } + } catch (error) { + // ignore error, get failed skip current update } }) ) - const failedTxs = txs.filter(tx => tx.status === TransactionStatus.Failed) - const successTxs = txs.filter(tx => tx.status === TransactionStatus.Success) + const failedTxs = txs.filter( + (tx): tx is TransactionDetail & { status: TransactionStatus.Failed } => tx?.status === TransactionStatus.Failed + ) + const successTxs = txs.filter( + (tx): tx is TransactionDetail & { status: TransactionStatus.Success } => tx?.status === TransactionStatus.Success + ) if (failedTxs.length) { await FailedTransaction.updateFailedTxs(failedTxs.map(tx => tx.hash))