//连接phantom钱包 async connectWallet(){ // console.log('"window.solana.isPhantom :',window.solana.isPhantom); try { //{ onlyIfTrusted: true }是 onlyIfTrusted 的参数,可以去掉 const resp = await window.solana.connect(); resp.publicKey.toString(); //连接了solana钱包,得到了钱包地址 console.log('resp.publicKey.toString() :',resp.publicKey.toString()); this.getTokenByAccount(resp.publicKey.toString()); } catch (err) { console.log('connectWallet err :',err); } }
02-18
12-29
1596
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-08
2万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)