跳到主要内容

将 EOA 作为 Master Key

Master key 是签名消息和交易的 singer,需要从 ethers.js 继承 Signer

从 MetaMask 初始化 singer

const provider = new ethers.providers.Web3Provider(window.ethereum);

// Prompt user for account connections
await provider.send("eth_requestAccounts", []);

const signer = provider.getSigner();