Go-Ethereum
ethers.Wallet.fromEncryptedWallet 不是函式
我有以下程式碼來創建我自己的錢包:
var ethers = require('ethers') let data = {"address":....} var password = "***"; var json = JSON.stringify(data); ethers.Wallet.provider = new ethers.providers.Web3Provider(web3.currentProvider); ethers.Wallet.fromEncryptedWallet(json, password).then(function (wallet) { console.log("Wallet address: " + wallet.address); });
但它不起作用,因為:
TypeError: ethers.Wallet.fromEncryptedWallet is not a function
我錯過了什麼嗎?
文件好像有問題
正確的函式是Wallet.fromEncryptedJson
從他們的單元測試
return Wallet.fromEncryptedJson(test.json, test.password).then(...