web3.js连接metamask钱包示例代码

代码语言:html

所属分类:其他

代码描述:web3.js连接metamask钱包示例代码

代码标签: web3.js 连接 metamask 钱包 示例 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

  
  
  
<style>
body{
  background-color: #222;
}
</style>


</head>

<body >
  
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/web3.min.js"></script>
      <script>
window.addEventListener("load", function () {
  // Checking if Web3 has been injected by the browser (Mist/MetaMask)
  if (typeof web3 !== "undefined") {
    // Use Mist/MetaMask's provider
    window.web3 = new Web3(web3.currentProvider);
  } else {
    console.log("No web3? You should consider trying MetaMask!");
    // fallback - use your fallb.........完整代码请登录后点击上方下载按钮下载查看

网友评论0