@@ -21,7 +21,6 @@ import {
2121} from "../../../../components/Drawer.js" ;
2222import { Spacer } from "../../../../components/Spacer.js" ;
2323import { Spinner } from "../../../../components/Spinner.js" ;
24- import { SwitchNetworkButton } from "../../../../components/SwitchNetwork.js" ;
2524import { Container } from "../../../../components/basic.js" ;
2625import { Button } from "../../../../components/buttons.js" ;
2726import { Text } from "../../../../components/text.js" ;
@@ -171,8 +170,6 @@ export function SwapScreenContent(props: {
171170 ( swapRequired && ! quoteQuery . data ) ||
172171 isNotEnoughBalance ||
173172 allowanceQuery . isLoading ;
174- const switchChainRequired =
175- props . payer . wallet . getChain ( ) ?. id !== fromChain ?. id ;
176173
177174 const errorMsg =
178175 ! quoteQuery . isLoading && quoteQuery . error
@@ -319,19 +316,6 @@ export function SwapScreenContent(props: {
319316 >
320317 Pay with another token
321318 </ Button >
322- ) : switchChainRequired &&
323- fromChain &&
324- ! quoteQuery . isLoading &&
325- ! allowanceQuery . isLoading &&
326- ! isNotEnoughBalance &&
327- ! quoteQuery . error ? (
328- < SwitchNetworkButton
329- variant = "accent"
330- fullWidth
331- switchChain = { async ( ) => {
332- await props . payer . wallet . switchChain ( fromChain ) ;
333- } }
334- />
335319 ) : (
336320 < Button
337321 variant = { disableContinue ? "outline" : "accent" }
@@ -340,6 +324,9 @@ export function SwapScreenContent(props: {
340324 disabled = { disableContinue }
341325 onClick = { async ( ) => {
342326 if ( ! disableContinue ) {
327+ if ( props . payer . wallet . getChain ( ) ?. id !== fromChain ?. id ) {
328+ await props . payer . wallet . switchChain ( fromChain ) ;
329+ }
343330 showSwapFlow ( ) ;
344331 trackPayEvent ( {
345332 event : "confirm_swap_quote" ,
0 commit comments