From 0fb27e7c4891ed72dcc3e85e4d82a9de72ad3f54 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Thu, 2 Jun 2022 22:27:32 +0800 Subject: [PATCH] Also apply timeout msg to `wallet_send` --- ui/redux/actions/wallet.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/ui/redux/actions/wallet.js b/ui/redux/actions/wallet.js index 8168adf39..134b5199e 100644 --- a/ui/redux/actions/wallet.js +++ b/ui/redux/actions/wallet.js @@ -317,13 +317,27 @@ export function doSendDraftTransaction(address, amount) { type: ACTIONS.SEND_TRANSACTION_FAILED, data: { error: error.message }, }); - dispatch( - doToast({ - message: __('Transaction failed'), - subMessage: resolveApiMessage(error?.message), - isError: true, - }) - ); + + const errMsg = typeof error === 'object' ? error.message : error; + if (errMsg.endsWith(ERRORS.SDK_FETCH_TIMEOUT)) { + dispatch( + doOpenModal(MODALS.CONFIRM, { + title: __('Transaction failed'), + body: + 'The transaction timed out, but may have been completed. Please wait a few minutes, then check your wallet transactions before attempting to retry.', + onConfirm: (closeModal) => closeModal(), + hideCancel: true, + }) + ); + } else { + dispatch( + doToast({ + message: __('Transaction failed'), + subMessage: resolveApiMessage(error?.message), + isError: true, + }) + ); + } }; Lbry.wallet_send({