feat(txn_utils): add custom nonce support#108
Merged
Conversation
- Allow passing custom nonce via tx_options parameter - Add validation to ensure nonce is a non-negative integer - Fallback to web3.eth.get_transaction_count() when nonce not provided - Add comprehensive unit tests for nonce handling This enables advanced transaction management scenarios like: - Transaction replacement with same nonce - Manual nonce management for high-throughput applications - Filling nonce gaps from failed transactions
bonnie57
reviewed
Aug 11, 2025
Contributor
bonnie57
left a comment
There was a problem hiding this comment.
Could you add an integration test to ensure everything is working correctly?
Member
Author
> Could you add an integration test to ensure everything is working correctly?
added in 8915cd6 |
a1052db to
8915cd6
Compare
bonnie57
approved these changes
Aug 11, 2025
Contributor
bonnie57
left a comment
There was a problem hiding this comment.
LGTM
Minor thing: The integration tests don't need the story_client object. Please remove the story_client argument and fixture.
Member
Author
Good catch, resolved in 28ac44a |
lucas2brh
approved these changes
Aug 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
This PR adds support for custom nonce management in the transaction utilities, allowing users to optionally specify a nonce value via the
tx_optionsparameter. The implementation maintains full backward compatibility by automatically fetching the nonce from the blockchain when not provided, while adding proper validation to ensure nonce values are non-negative integers.Changes
build_and_send_transaction()to accept optionalnonceintx_optionsweb3.eth.get_transaction_count()when nonce not providedtransaction_utilsUse Cases
This change enables:
Testing
All 11 unit tests pass covering:
Example Usage