diff --git a/.changeset/silver-laws-buy.md b/.changeset/silver-laws-buy.md new file mode 100644 index 0000000000..1f879aa0e9 --- /dev/null +++ b/.changeset/silver-laws-buy.md @@ -0,0 +1,24 @@ +--- +'@reown/appkit-core': patch +'@apps/demo': patch +'@apps/gallery': patch +'@apps/laboratory': patch +'@reown/appkit-adapter-ethers': patch +'@reown/appkit-adapter-ethers5': patch +'@reown/appkit-adapter-polkadot': patch +'@reown/appkit-adapter-solana': patch +'@reown/appkit-adapter-wagmi': patch +'@reown/appkit': patch +'@reown/appkit-utils': patch +'@reown/appkit-cdn': patch +'@reown/appkit-common': patch +'@reown/appkit-experimental': patch +'@reown/appkit-polyfills': patch +'@reown/appkit-scaffold-ui': patch +'@reown/appkit-siwe': patch +'@reown/appkit-siwx': patch +'@reown/appkit-ui': patch +'@reown/appkit-wallet': patch +--- + +Fixes swap gas availability check for smart accounts diff --git a/packages/core/src/controllers/SwapController.ts b/packages/core/src/controllers/SwapController.ts index e60d39f6c6..2126e3fdb5 100644 --- a/packages/core/src/controllers/SwapController.ts +++ b/packages/core/src/controllers/SwapController.ts @@ -815,19 +815,20 @@ export const SwapController = { state.myTokensWithBalance ) - // Smart Accounts may pay gas in any ERC20 token + let insufficientNetworkTokenForGas = true if ( AccountController.state.preferredAccountType === W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT ) { - return true + // Smart Accounts may pay gas in any ERC20 token + insufficientNetworkTokenForGas = false + } else { + insufficientNetworkTokenForGas = SwapCalculationUtil.isInsufficientNetworkTokenForGas( + state.networkBalanceInUSD, + state.gasPriceInUSD + ) } - const insufficientNetworkTokenForGas = SwapCalculationUtil.isInsufficientNetworkTokenForGas( - state.networkBalanceInUSD, - state.gasPriceInUSD - ) - return insufficientNetworkTokenForGas || isInsufficientSourceTokenForSwap },