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

页面都加载完成了,但是window.ethereum还是undefined #29

Closed zs2837200655 closed 2 years ago

zs2837200655 commented 2 years ago

页面都加载完成了,但是window.ethereum还是undefined

chendatony31 commented 2 years ago

页面有什么特殊的么?tp里eth的dapp都是用的ethereum对象

zs2837200655 commented 2 years ago

页面有什么特殊的么?tp里eth的dapp都是用的ethereum对象

用的是bsc 测试网,这个有没有什么影响

chendatony31 commented 2 years ago

没有影响 你试试这个demo 能不能连接上 https://github.com/MetaMask/test-dapp

zs2837200655 commented 2 years ago

没有影响 你试试这个demo 能不能连接上 https://github.com/MetaMask/test-dapp

这个项目在tp 浏览器里面 提示 you are on the Ethereum Mainnet

zs2837200655 commented 2 years ago

没有影响 你试试这个demo 能不能连接上 https://github.com/MetaMask/test-dapp

这个可以正常连接上

chendatony31 commented 2 years ago

你看下 你们代码有啥不一样?应该都是读ethereum对象

zs2837200655 commented 2 years ago

你看下 你们代码有啥不一样?应该都是读ethereum对象

调用的方法都一样,但是就是没有ethereum这个

zs2837200655 commented 2 years ago

你看下 你们代码有啥不一样?应该都是读ethereum对象

ethersProvider = new ethers.providers.Web3Provider(window.ethereum, 'any'); 第一句代码都执行不了,因为window.ethereum 是undefined