TP-Lab / tp-js-sdk

TokenPocket JS API for Dapp of ETH, IOST, TRON, COSMOS, SOLANA, EOS etc. (mobile only)
200 stars 61 forks source link

ios版TP钱包内dapp无法调起网络切换功能getWallet #15

Closed econiche closed 2 years ago

econiche commented 2 years ago

tp.getWallet({ switch: true }).then(res => { alert(res.data[0].blockchain) }

chendatony31 commented 2 years ago

tp.getWallet({ switch: true, walletTypes: ['eth'] }).then(res => { alert(res.data[0].blockchain) } try to add walletTypes

econiche commented 2 years ago

walletTypes
It can run after adding this parameter.
But because of the addition of this parameter, you can only see several networks pre-configured, I can't switch to custom networks. What should I do?

chendatony31 commented 2 years ago

If the custom network is an EVM compatible chain using wallet_switchEthereumChain instead: https://docs.metamask.io/guide/rpc-api.html#usage-with-wallet-switchethereumchain

econiche commented 2 years ago

Get it! Thanks.