Skip to content

NonceManager.incrementTransactionCount(0) bug #3062

@olehmisar

Description

@olehmisar

Ethers Version

5.6.8

Search Terms

nonce manager, increment nonce

Describe the Problem

nonceManager.incrementTransactionCount(0) increments nonce by 1.

The bug is on this line https://github.com/ethers-io/ethers.js/blob/master/packages/experimental/src.ts/nonce-manager.ts#L49

It should be changed to:

this._deltaCount += (count ?? 1);

Code Snippet

import { NonceManager } from "@ethersproject/experimental"
import { VoidSigner } from "ethers"

;(async () => {
    const manager = new NonceManager(new VoidSigner(''))
    manager.setTransactionCount(10)
    console.log(await manager.getTransactionCount('pending')) // 10
    manager.incrementTransactionCount(0)
    console.log(await manager.getTransactionCount('pending')) // 11
})()

Contract ABI

No response

Errors

No response

Environment

No response

Environment (Other)

No response

Metadata

Metadata

Assignees

Labels

bugVerified to be an issue.fixed/completeThis Bug is fixed or Enhancement is complete and published.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions