Use new ethers.js NonceManager to handle transaction nonces

So far we have failed to globally handle the transaction nonces.
The new ethers.js v5 comes with a NonceManager that helps us handling
transaction nonces and automatically increases the nonce for each
transaction.
This commit is contained in:
2020-06-27 18:24:44 +02:00
parent 35f6acc150
commit b7ff55929c
4 changed files with 522 additions and 37 deletions

View File

@@ -2,6 +2,7 @@ const fs = require('fs');
const util = require('util');
const fetch = require('node-fetch');
const ethers = require('ethers');
const NonceManager = require('@ethersproject/experimental').NonceManager;
const Kredits = require('kredits-contracts');
const walletPath = process.env.KREDITS_WALLET_PATH || './wallet.json';
@@ -43,7 +44,7 @@ module.exports = async function(robot) {
} else {
ethProvider = new ethers.getDefaultProvider('rinkeby');
}
const signer = wallet.connect(ethProvider);
const signer = new NonceManager(wallet.connect(ethProvider));
//
// Kredits contracts setup