trustwallet / trust-web3-provider

Web3 javascript wrapper provider for iOS and Android platforms.
https://trustwallet.com
772 stars 429 forks source link

switch network with trust wallet provider in pancakeswap #391

Open Imdavyking opened 1 year ago

Imdavyking commented 1 year ago

this code base can not switch network in pancakeswap

window.ethereum.sendResponse($methodId, \"137\") window.ethereum.emitChainChanged("0x89") window.ethereum.setConfig({ ethereum:{ chainId: $chainId, rpcUrl: "$rpcUrl", address: "$address" } } )

hoanganhtuan95ptit commented 1 year ago

Looks like pancakeswap site doesn't support Polygon chain (137).

If you want to switch Chain, you need to call this function

window.ethereum.setConfig({
  ethereum:{
    chainId: $chainId,
    rpcUrl: "$rpcUrl",
    address: "$address"
  }
})

Then

window.ethereum.emitChainChanged($chainId)
Imdavyking commented 1 year ago

thank you very much

Alkhatri77 commented 8 months ago

this code base can not switch network in pancakeswap

window.ethereum.sendResponse($methodId, "137") window.ethereum.emitChainChanged("0x89") window.ethereum.setConfig({ ethereum:{ chainId: $chainId, rpcUrl: "$rpcUrl", address: "$address" } } )

Ali3219 commented 4 weeks ago

این پایه کد نمی تواند شبکه را در پنکیک سوئیچ کند window.ethereum.sendResponse($methodId, "137") window.ethereum.emitChainChanged("0x89") window.ethereum.setConfig({ethereum:{chainId: $chainId، rpcUrl: "$rpcUrl"، آدرس: "$ad " } } )