From 556c1fd6e055dc88eb08a908d6eb3ad7ea5a8062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Bo=C4=8Fa?= Date: Fri, 17 Jan 2025 10:47:23 +0100 Subject: [PATCH 1/4] feat(suite): added blockbook link to approval tx --- .../CoinmarketOfferExchangeSendApproval.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx b/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx index 8584a496c59..c30eeaa6972 100644 --- a/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx +++ b/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx @@ -23,9 +23,10 @@ import { CoinmarketTradeExchangeType } from 'src/types/coinmarket/coinmarket'; import { useCoinmarketFormContext } from 'src/hooks/wallet/coinmarket/form/useCoinmarketCommonForm'; import { useCoinmarketInfo } from 'src/hooks/wallet/coinmarket/useCoinmarketInfo'; import { useCoinmarketExchangeWatchSendApproval } from 'src/hooks/wallet/coinmarket/form/useCoinmarketExchangeWatchSendApproval'; -import { useDispatch } from 'src/hooks/suite'; +import { useDispatch, useSelector } from 'src/hooks/suite'; import { saveSelectedQuote } from 'src/actions/wallet/coinmarketExchangeActions'; -import { parseCryptoId } from 'src/utils/wallet/coinmarket/coinmarketUtils'; +import { cryptoIdToSymbol, parseCryptoId } from 'src/utils/wallet/coinmarket/coinmarketUtils'; +import { IOAddress } from 'src/components/suite/copy/IOAddress'; // add APPROVED means no approval request is necessary type ExtendedDexApprovalType = DexApprovalType | 'APPROVED'; @@ -51,6 +52,8 @@ export const CoinmarketOfferExchangeSendApproval = () => { selectedQuote?.status === 'CONFIRM' ? 'APPROVED' : 'MINIMAL', ); + const blockchainNetworks = useSelector(state => state.wallet.blockchain); + const { navigateToExchangeForm } = useCoinmarketNavigation(account); useCoinmarketExchangeWatchSendApproval({ @@ -70,6 +73,9 @@ export const CoinmarketOfferExchangeSendApproval = () => { if (!selectedQuote.send) return null; + const symbol = cryptoIdToSymbol(selectedQuote.send); + const blockchain = symbol && blockchainNetworks[symbol]; + const isToken = parseCryptoId(selectedQuote.send)?.contractAddress !== undefined; if (isFullApproval && approvalType === 'ZERO') { @@ -139,9 +145,13 @@ export const CoinmarketOfferExchangeSendApproval = () => { > {dexTx.to} - {selectedQuote.approvalSendTxHash && ( + {selectedQuote.approvalSendTxHash && blockchain && ( }> - {selectedQuote.approvalSendTxHash} + )} {selectedQuote.status === 'APPROVAL_PENDING' && ( From d1eb714b02e28a0b7351d55ec110a84829133319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Bo=C4=8Fa?= Date: Fri, 17 Jan 2025 11:41:28 +0100 Subject: [PATCH 2/4] fixup! feat(suite): added blockbook link to approval tx --- .../CoinmarketOfferExchangeSendApproval.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx b/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx index c30eeaa6972..804104ffe97 100644 --- a/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx +++ b/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx @@ -145,7 +145,7 @@ export const CoinmarketOfferExchangeSendApproval = () => { > {dexTx.to} - {selectedQuote.approvalSendTxHash && blockchain && ( + {selectedQuote.approvalSendTxHash && blockchain != null && ( }> Date: Fri, 17 Jan 2025 12:49:48 +0100 Subject: [PATCH 3/4] fixup! fixup! feat(suite): added blockbook link to approval tx --- .../CoinmarketOfferExchangeSendApproval.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx b/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx index 804104ffe97..c30eeaa6972 100644 --- a/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx +++ b/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx @@ -145,7 +145,7 @@ export const CoinmarketOfferExchangeSendApproval = () => { > {dexTx.to} - {selectedQuote.approvalSendTxHash && blockchain != null && ( + {selectedQuote.approvalSendTxHash && blockchain && ( }> Date: Fri, 17 Jan 2025 12:50:53 +0100 Subject: [PATCH 4/4] fixup! feat(suite): added blockbook link to approval tx --- .../CoinmarketOfferExchangeSendApproval.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx b/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx index c30eeaa6972..04f44df16a0 100644 --- a/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx +++ b/packages/suite/src/views/wallet/coinmarket/common/CoinmarketSelectedOffer/CoinmarketOfferExchange/CoinmarketOfferExchangeSendApproval.tsx @@ -52,7 +52,7 @@ export const CoinmarketOfferExchangeSendApproval = () => { selectedQuote?.status === 'CONFIRM' ? 'APPROVED' : 'MINIMAL', ); - const blockchainNetworks = useSelector(state => state.wallet.blockchain); + const blockchain = useSelector(state => state.wallet.blockchain); const { navigateToExchangeForm } = useCoinmarketNavigation(account); @@ -74,7 +74,7 @@ export const CoinmarketOfferExchangeSendApproval = () => { if (!selectedQuote.send) return null; const symbol = cryptoIdToSymbol(selectedQuote.send); - const blockchain = symbol && blockchainNetworks[symbol]; + const blockchainForSend = symbol && blockchain[symbol]; const isToken = parseCryptoId(selectedQuote.send)?.contractAddress !== undefined; @@ -145,12 +145,12 @@ export const CoinmarketOfferExchangeSendApproval = () => { > {dexTx.to} - {selectedQuote.approvalSendTxHash && blockchain && ( + {selectedQuote.approvalSendTxHash && blockchainForSend && ( }> )}