Skip to content

Commit

Permalink
fix: logic fix
Browse files Browse the repository at this point in the history
Signed-off-by: 王山栋 <[email protected]>
  • Loading branch information
ezailWang committed Dec 24, 2024
1 parent ccdd950 commit ec463ed
Showing 1 changed file with 7 additions and 51 deletions.
58 changes: 7 additions & 51 deletions packages/kit/src/views/Swap/hooks/useSwapBuiltTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
EProtocolOfExchange,
ESwapApproveTransactionStatus,
ESwapDirectionType,
SwapBuildUseMultiplePopoversNetworkIds,
} from '@onekeyhq/shared/types/swap/types';
import type { ISendTxOnSuccessData } from '@onekeyhq/shared/types/tx';

Expand Down Expand Up @@ -579,57 +578,14 @@ export function useSwapBuildTx() {
const createBuildTxRes = await createBuildTx();
if (createBuildTxRes) {
await navigationToSendConfirm({
approvesInfo: [approvesInfo[0]],
isInternalSwap: true,
onSuccess: async (data: ISendTxOnSuccessData[]) => {
if (approvesInfo.length > 1) {
await navigationToSendConfirm({
approvesInfo: [approvesInfo[1]],
// tron network does not support use pre fee info
feeInfo: SwapBuildUseMultiplePopoversNetworkIds.includes(
fromToken.networkId,
)
? undefined
: data?.[0]?.feeInfo,
isInternalSwap: true,
onSuccess: async (dataRes: ISendTxOnSuccessData[]) => {
await navigationToSendConfirm({
transfersInfo: createBuildTxRes.transferInfo
? [createBuildTxRes.transferInfo]
: undefined,
encodedTx: createBuildTxRes.encodedTx,
feeInfo:
SwapBuildUseMultiplePopoversNetworkIds.includes(
fromToken.networkId,
)
? undefined
: dataRes?.[0]?.feeInfo,
swapInfo: createBuildTxRes.swapInfo,
isInternalSwap: true,
onSuccess: handleBuildTxSuccess,
onCancel: cancelBuildTx,
});
},
onCancel: cancelBuildTx,
});
} else {
await navigationToSendConfirm({
transfersInfo: createBuildTxRes.transferInfo
? [createBuildTxRes.transferInfo]
: undefined,
encodedTx: createBuildTxRes.encodedTx,
swapInfo: createBuildTxRes.swapInfo,
feeInfo: SwapBuildUseMultiplePopoversNetworkIds.includes(
fromToken.networkId,
)
? undefined
: data?.[0]?.feeInfo,
isInternalSwap: true,
onSuccess: handleBuildTxSuccess,
onCancel: cancelBuildTx,
});
}
},
transfersInfo: createBuildTxRes.transferInfo
? [createBuildTxRes.transferInfo]
: undefined,
encodedTx: createBuildTxRes.encodedTx,
swapInfo: createBuildTxRes.swapInfo,
approvesInfo,
onSuccess: handleBuildTxSuccess,
onCancel: cancelBuildTx,
});

Expand Down

0 comments on commit ec463ed

Please sign in to comment.