Skip to content

Commit

Permalink
feat: delay send transaction in native env (#3595)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwoktung authored Sep 25, 2023
1 parent 45f6493 commit d9a91ad
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions packages/kit/src/views/Swap/hooks/useSwapSend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
ISignedTxPro,
} from '@onekeyhq/engine/src/vaults/types';
import debugLogger from '@onekeyhq/shared/src/logger/debugLogger';
import platformEnv from '@onekeyhq/shared/src/platformEnv';

import backgroundApiProxy from '../../../background/instance/backgroundApiProxy';
import useAppNavigation from '../../../hooks/useAppNavigation';
Expand Down Expand Up @@ -106,30 +107,33 @@ export function useSwapSend() {
onFail?.(e as Error);
}
} else {
navigation.navigate(RootRoutes.Modal, {
screen: ModalRoutes.Send,
params: {
screen: SendModalRoutes.SendConfirm,
const delay = platformEnv.isNative ? 10 : 100;
setTimeout(() => {
navigation.navigate(RootRoutes.Modal, {
screen: ModalRoutes.Send,
params: {
accountId,
networkId,
payloadInfo,
feeInfoEditable: true,
feeInfoUseFeeInTx: false,
encodedTx,
prepaidFee,
hideSendFeedbackReceipt: !showSendFeedbackReceipt,
onDetail,
onFail,
onSuccess: (result, data) => {
onSuccess?.({
result,
decodedTx: data?.decodedTx ?? undefined,
});
screen: SendModalRoutes.SendConfirm,
params: {
accountId,
networkId,
payloadInfo,
feeInfoEditable: true,
feeInfoUseFeeInTx: false,
encodedTx,
prepaidFee,
hideSendFeedbackReceipt: !showSendFeedbackReceipt,
onDetail,
onFail,
onSuccess: (result, data) => {
onSuccess?.({
result,
decodedTx: data?.decodedTx ?? undefined,
});
},
},
},
},
});
});
}, delay);
}
},
[validationSetting, navigation],
Expand Down

0 comments on commit d9a91ad

Please sign in to comment.