WTFAcademy / WTF-Ethers

我最近在重新学ethers.js,巩固一下细节,也写一个“WTF Ethers.js极简入门”,供小白们使用,每周更新1-3讲。Now supports English! 官网: https://wtf.academy
https://wtf.academy
Other
3.03k stars 489 forks source link

ethersJS V6版本中,已經不支持getTransactionCount方法 #136

Open Nosll opened 7 months ago

Nosll commented 7 months ago

const wallet = new ethers.Wallet(privateKey, Provider) const tx = wallet.getTransactionCount()

const wallet2Mnemonic = Wallet.fromMnemonic(mnemonic) const wallet2 = wallet2Mnemonic.connect(Provider) const tx2 = wallet.getTransactionCount()

以上兩種方法皆會返還以下錯誤: TypeError: wallet.getTransactionCount is not a function

需要將 getTransactionCount() 替換成 getNonce()