区块链dapp 开发详解(VUE3.0)
1、安装metamask 插件。
2、使用封装的工具包: wagmi .
3、 wagmi 操作手册地址:connect | Wagmi
4、注意事项:
因为最初是react 版本,所以在VUE版的官方文档有很多地方在 import 用的是 wagmi,需要改为 @wagmi/vue 。
连接成功后打印的内容如下:
Address: 0x1056889897c8a1Bb388f1c8272eb87dCBFA2a7DD
Connected to WalletConnect Connector.
chain { "id": 1, "name": "Ethereum", "nativeCurrency": { "name": "Ether", "symbol": "ETH", "decimals": 18 }, "rpcUrls": { "default": { "http": [ "https://cloudflare-eth.com" ] } }, "blockExplorers": { "default": { "name": "Etherscan", "url": "https://etherscan.io", "apiUrl": "https://api.etherscan.io/api" } }, "contracts": { "ensRegistry": { "address": "0x00000000000D2E074eC69A0dFb2997BA6C7d2e1e" }, "ensUniversalResolver": { "address": "0xce01f8eee7E479D928F8919abD53E553a36CeF67", "blockCreated": 19258213 }, "multicall3": { "address": "0xca11bde05988b3631167028862be2a173976ca11", "blockCreated": 14353601 } } }
chainId 1
Balance: 0 ETH
原文地址:https://blog.csdn.net/m0_37588079/article/details/144354791
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!