Skip to content

feat: add nonce to txOverrides#59

Merged
dutterbutter merged 3 commits intomainfrom
vi/add-nonce-to-tx-overrides
Feb 13, 2026
Merged

feat: add nonce to txOverrides#59
dutterbutter merged 3 commits intomainfrom
vi/add-nonce-to-tx-overrides

Conversation

@vasyl-ivanchuk
Copy link
Contributor

What 💻

Add optional nonce field to TxOverrides to give callers control over nonce resolution in deposits and withdrawals. When nonce is a number, it's used as the starting nonce directly (skipping getTransactionCount). When nonce is 'latest' or 'pending', getTransactionCount is called with that block tag, allowing callers to choose between confirmed vs pending nonce.

Why ✋

The SDK currently hardcodes the block tag used for getTransactionCount ('latest' for deposits, 'pending' for withdrawals) and provides no way to supply a known nonce. This is limiting for integrators who need to control whether the nonce accounts for pending transactions or only confirmed ones. For example: watchdog project intentionally uses latest nonce for withdrawals.

@github-actions
Copy link

ci-run-tests LCOV of commit 44ac729 during ci-run-tests #171

Summary coverage rate:
  lines......: 86.8% (12656 of 14578 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate:
                                                                    |Lines       |Functions  |Branches    
  Filename                                                          |Rate     Num|Rate    Num|Rate     Num
  ========================================================================================================
  src/adapters/ethers/resources/deposits/context.ts                 | 0.0%     44|    -     0|    -      0
  src/adapters/ethers/resources/deposits/index.ts                   | 0.0%    178|    -     0|    -      0
  src/adapters/ethers/resources/deposits/services/gas.ts            | 0.0%     46|    -     0|    -      0
  src/adapters/ethers/resources/withdrawals/context.ts              | 0.0%     43|    -     0|    -      0
  src/adapters/ethers/resources/withdrawals/index.ts                | 0.0%    240|    -     0|    -      0
  src/adapters/viem/resources/deposits/context.ts                   | 0.0%     44|    -     0|    -      0
  src/adapters/viem/resources/deposits/index.ts                     | 0.0%    221|    -     0|    -      0
  src/adapters/viem/resources/deposits/services/gas.ts              | 0.0%     47|    -     0|    -      0
  src/adapters/viem/resources/withdrawals/context.ts                | 0.0%     42|    -     0|    -      0
  src/adapters/viem/resources/withdrawals/index.ts                  | 0.0%    274|    -     0|    -      0
  src/core/types/fees.ts                                            |    -      0|    -     0|    -      0

Full coverage report

@dutterbutter
Copy link
Contributor

@vasyl-ivanchuk resolved the CI issues.

Re: the "getTransactionCount ('latest' for deposits, 'pending' for withdrawals)"

This is non-intentional and likely an oversight on my part. It should be updated to rely entirely on NonceManager to handle it rather than manually setting nonce as we are doing now.

@vasyl-ivanchuk
Copy link
Contributor Author

@vasyl-ivanchuk resolved the CI issues.

Re: the "getTransactionCount ('latest' for deposits, 'pending' for withdrawals)"

This is non-intentional and likely an oversight on my part. It should be updated to rely entirely on NonceManager to handle it rather than manually setting nonce as we are doing now.

@dutterbutter as far as I see, NonceManager uses pending BlockTag to get the nonce and doesn't provide any interface to change it.

There might be use cases where using the latest nonce is preferable. For instance, to override a transaction in the mempool. Watchdog uses latest for this exact reason.

@dutterbutter dutterbutter merged commit ae36c3f into main Feb 13, 2026
15 checks passed
@dutterbutter dutterbutter deleted the vi/add-nonce-to-tx-overrides branch February 13, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants