Closed dingcxx closed 1 year ago
Thanks for reporting this.
Do you know which version of DePay widgets is used in the video?
I quickly confirmed in metamask that network switching works, and it does:
https://user-images.githubusercontent.com/851393/231747058-6937f5de-0794-49dc-a538-28c62711f332.MP4
Here are the standards we are using to
await window.ethereum.request({ method: 'eth_chainId' })
make sure this returns 0x89
for polygon.
If we detect the wallet is not connected to polygon, we initiate network switch:
window.ethereum.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0x89' }] })
make sure subsequent requests for
await window.ethereum.request({ method: 'eth_chainId' })
return 0x89
after switching to Polygon.
Thanks for reporting this.
Do you know which version of DePay widgets is used in the video?
In our yarn.lock file, we are using version 10.2.8 of @depay/widgets. Due to the use of continuous integration, it is uncertain whether or not it will be updated.
I quickly confirmed in metamask that network switching works, and it does:
Here are the standards we are using to
Detect currently connected network
await window.ethereum.request({ method: 'eth_chainId' })
make sure this returns
0x89
for polygon.Switch to the intended network
If we detect the wallet is not connected to polygon, we initiate network switch:
window.ethereum.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0x89' }] })
make sure subsequent requests for
await window.ethereum.request({ method: 'eth_chainId' })
return
0x89
after switching to Polygon.
This operation has been completed by a third party, and I have informed them to try it out. thank you
We have discovered an issue when switch networks during the payment. When entering the dapp, the selected wallet is ETH, but during payment, Polygon is chosen as the payment method. After successfully switching, an error message appears indicating a network error. Please refer to the video and pictures below for more details.
https://user-images.githubusercontent.com/117795329/231738584-6147686d-fc42-48af-a71c-32edc817b4e6.MP4