@@ -534,16 +534,20 @@ export const IBCSwapPage: FunctionComponent = observer(() => {
534534 const isSwap = swapConfigs . amountConfig . type === "swap" ;
535535
536536 /**
537- * One-click swap is disabled when:
538- * 1. Requires multiple transactions
539- * 2. Hardware wallet
540- * 3. EVM gas simulation outcome is APPROVAL_ONLY_SIMULATED (approve tx only simulated, not swap tx)
537+ * One-click swap is enabled only when:
538+ * 1. Single transaction (or erc20 approval + swap bundle with bundle tx simulation)
539+ * 2. Not a hardware wallet
540+ * 3. EVM gas simulation is not APPROVAL_ONLY_SIMULATED
541541 */
542- const oneClickSwapDisabled =
543- swapConfigs . amountConfig . requiresMultipleTxs ||
544- isHardwareWallet ||
545- gasSimulator . evmSimulationOutcome ===
546- EvmGasSimulationOutcome . APPROVAL_ONLY_SIMULATED ;
542+ const evmOutcome = gasSimulator . evmSimulationOutcome ;
543+ const oneClickSwapEnabled =
544+ // single tx path
545+ ! swapConfigs . amountConfig . requiresMultipleTxs &&
546+ // no hardware wallet
547+ ! isHardwareWallet &&
548+ // wait until simulation result is available, and it must not be approval-only
549+ evmOutcome != null &&
550+ evmOutcome !== EvmGasSimulationOutcome . APPROVAL_ONLY_SIMULATED ;
547551
548552 const { showUSDNWarning, showCelestiaWarning } = getSwapWarnings (
549553 swapConfigs . amountConfig . currency ,
@@ -1897,9 +1901,10 @@ export const IBCSwapPage: FunctionComponent = observer(() => {
18971901
18981902 < Gutter size = "0.75rem" />
18991903
1900- { oneClickSwapDisabled ? (
1901- < Button
1904+ { oneClickSwapEnabled ? (
1905+ < HoldButton
19021906 type = "submit"
1907+ holdDurationMs = { 1500 }
19031908 disabled = {
19041909 interactionBlocked ||
19051910 showUSDNWarning ||
@@ -1910,20 +1915,24 @@ export const IBCSwapPage: FunctionComponent = observer(() => {
19101915 shouldTopUp && remainingText
19111916 ? remainingText
19121917 : intl . formatMessage ( {
1913- id : "page.ibc-swap.title.swap " ,
1918+ id : "page.ibc-swap.button.hold-to-approve " ,
19141919 } )
19151920 }
1921+ holdingText = { intl . formatMessage ( {
1922+ id : "page.ibc-swap.button.keep-holding" ,
1923+ } ) }
19161924 color = "primary"
19171925 size = "large"
19181926 isLoading = {
19191927 uiConfigStore . ibcSwapConfig . isSwapLoading ||
19201928 accountStore . getAccount ( inChainId ) . isSendingMsg === "ibc-swap"
19211929 }
1930+ onHoldStart = { ( ) => setIsButtonHolding ( true ) }
1931+ onHoldEnd = { ( ) => setIsButtonHolding ( false ) }
19221932 />
19231933 ) : (
1924- < HoldButton
1934+ < Button
19251935 type = "submit"
1926- holdDurationMs = { 1500 }
19271936 disabled = {
19281937 interactionBlocked ||
19291938 showUSDNWarning ||
@@ -1934,20 +1943,15 @@ export const IBCSwapPage: FunctionComponent = observer(() => {
19341943 shouldTopUp && remainingText
19351944 ? remainingText
19361945 : intl . formatMessage ( {
1937- id : "page.ibc-swap.button.hold-to-approve " ,
1946+ id : "page.ibc-swap.title.swap " ,
19381947 } )
19391948 }
1940- holdingText = { intl . formatMessage ( {
1941- id : "page.ibc-swap.button.keep-holding" ,
1942- } ) }
19431949 color = "primary"
19441950 size = "large"
19451951 isLoading = {
19461952 uiConfigStore . ibcSwapConfig . isSwapLoading ||
19471953 accountStore . getAccount ( inChainId ) . isSendingMsg === "ibc-swap"
19481954 }
1949- onHoldStart = { ( ) => setIsButtonHolding ( true ) }
1950- onHoldEnd = { ( ) => setIsButtonHolding ( false ) }
19511955 />
19521956 ) }
19531957
0 commit comments