Skip to content

Underlying network changed from Swap Transaction Approver #325

Open
@Rizwankmc

Description

@Rizwankmc

Describe the bug

hey I'm using the reown library with the [email protected] there versions are -

"@reown/appkit": "^1.6.4", "@reown/appkit-adapter-ethers5": "^1.6.4", "@reown/appkit-wallet-button": "^1.6.4", "ethers": "5.7.2

I have setup the reown configuration and for wallet connect, transaction approve everything works fine. but for the Swap there is an issue. I have tried both -

open Swap modal using the hook -

const {open} = useAppKit(); open({view: 'Swap'});

and with the web component -

but nothing works throw error when approving the transaction.

Error -
{ "eventId": "417be89e-479c-49cb-b04e-0a701db799e9", "url": "http://localhost:3000/profile", "domain": "localhost", "timestamp": 1742794385305, "props": { "type": "track", "event": "SWAP_APPROVAL_ERROR", "properties": { "message": "underlying network changed (event=\"changed\", network={\"chainId\":null,\"name\":\"unknown\"}, detectedNetwork={\"name\":\"matic\",\"chainId\":137,\"ensAddress\":null}, code=NETWORK_ERROR, version=providers/5.7.2)", "network": "eip155:137", "swapFromToken": "USDT", "swapToToken": "POL", "swapFromAmount": "1.26779600000000000000", "swapToAmount": "5.806559", "isSmartAccount": false } } }

My default and only Support network is - Polygon mainnet,

here is the configuration -

`import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.jsx'
import { BrowserRouter as Router } from "react-router-dom"
import * as serviceWorker from "./serviceWorker";
import { createAppKit } from '@reown/appkit/react'
import { Ethers5Adapter } from '@reown/appkit-adapter-ethers5'
import { polygon } from '@reown/appkit/networks'

// 1. Get projectId
const projectId = ''

// 2. Create a metadata object - optional
const metadata = {
name: 'Name',
description: 'De-Fi gaming app',
url: ', // origin must match your domain & subdomain
icons: ['']
}

// 3. Create the AppKit instance
createAppKit({
adapters: [new Ethers5Adapter()],
featuredWalletIds:[
'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96',
'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa',
'4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0'
],
defaultNetwork: polygon,
metadata: metadata,
networks: [polygon],
projectId,
enableCoinbase:true,
coinbasePreference:'eoaOnly',
features: {
analytics: true, // Optional - defaults to your Cloud configuration
connectMethodsOrder:['wallet'],
email:false,
},
enforceNetwork: true,
autoSwitchNetwork: true
})

const root = createRoot(document.getElementById('root'));
root.render(

);

serviceWorker.register();
`

Please check this issue and help me to get it resolve I have tried everything I could to get it working but it seems its not working.

Note - How can I make sure to set the toToken to POL for default??

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions