Open wureny opened 2 months ago
//在ethers v5中,以下代码可以成功运行 const wallet = new ethers.Wallet(Buffer.from(privateKey, 'hex')); console.log(wallet.address) //在ethers v6中,上述代码会出现报错,显示“invalid private key” //可以直接传入hex字符串,会自动转换为uint8array const wallet = new ethers.Wallet(privateKey); console.log(wallet.address)
v6真的更新了好多, 好多常见的方法都改名了,