Repository navigation
Fix TransactionStateInfo: populate all fields that have data, document per-state contract, observe CancellationToken - #17
Merged
Conversation
- Add TransactionReceipt? Receipt to TransactionStateInfo - Add BigInteger? Value (wei amount) to TransactionStateInfo - Add BigInteger? Gas (gas limit) to TransactionStateInfo - Update Nonce XML doc to clarify it is sourced from the transaction object - TransactionStatusService: for confirmed txs also fetch the transaction to populate Nonce, Value, Gas (fields absent from TransactionReceipt) - Tests: assert Receipt, Nonce, Value, Gas on confirmed-state results; add test for graceful null handling when transaction data is unavailable Agent-Logs-Url: https://github.com/Tricksfor-Organization/BlockChainTools/sessions/b1b0a706-e15f-4776-8aa0-d9e1adf38d8d Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update ITransactionStatusService to return state and properties
Enrich TransactionStateInfo with Receipt and transaction-only properties for confirmed transactions
Mar 28, 2026
- Drop ConfirmedNonce = null, ReceiptStatus = null, BlockNumber = null, Nonce = null from every object initializer where they add no value; nullable properties default to null in C# - Sharpen ConfirmedNonce XML doc: explicitly states it is only populated for the Replaced state, null for all other states - Remove redundant Nonce/Value/Gas = null from the pruned-transaction test setup for consistency Agent-Logs-Url: https://github.com/Tricksfor-Organization/BlockChainTools/sessions/bcf678a3-75e5-4dd3-9b9b-fce8cd71a977 Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
The transaction object is already fetched from the node for both states but Value and Gas were left unpopulated. Now every state with available transaction data (ConfirmedSuccess, ConfirmedReverted, Pending, Replaced) fills Value and Gas; only StalePending leaves them null. Update XML docs and tests accordingly. Agent-Logs-Url: https://github.com/Tricksfor-Organization/BlockChainTools/sessions/bcf678a3-75e5-4dd3-9b9b-fce8cd71a977 Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Copilot
AI
changed the title
Enrich TransactionStateInfo with Receipt and transaction-only properties for confirmed transactions
Fill Value and Gas for all states where transaction data is available
Mar 28, 2026
Phelecks
marked this pull request as ready for review
March 28, 2026 22:36
…ulation table Replace the minimal single-if example with a full switch covering all 5 states, demonstrating every populated field per state. Add a Markdown table showing exactly which properties are set for each TransactionState, and a short prose summary explaining the rules. Agent-Logs-Url: https://github.com/Tricksfor-Organization/BlockChainTools/sessions/18d9ec2b-f293-4298-8547-d7924195aa7d Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Copilot
AI
changed the title
Fill Value and Gas for all states where transaction data is available
Fix TransactionStateInfo: populate all fields that have data, document per-state contract
Mar 28, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the transaction-state query surface so TransactionStateInfo consistently includes Value and Gas (and now also Nonce for confirmed states) whenever node transaction data is available, and clarifies the DTO’s XML documentation accordingly.
Changes:
- Populate
Nonce,Value, andGasfrom the fetched transaction forConfirmed*states (when receipt exists) and forPending/Replaced. - Remove redundant explicit
= nullassignments inTransactionStatusServicereturn objects. - Expand
TransactionStateInfodocs and addReceiptto carry the full receipt for confirmed states.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/BlockChainTools/Services/TransactionStatusService.cs |
Fills Nonce/Value/Gas from transaction data in additional state paths and simplifies object initialization. |
src/BlockChainTools/DataTransferObjects/TransactionStateInfo.cs |
Adds Receipt and documents when ConfirmedNonce, Value, and Gas are expected to be populated. |
tests/BlockChainTools.Tests/TransactionStatusServiceTests.cs |
Updates/extends assertions to include Receipt/Value/Gas fields. |
…stub IClient RPC responses Replace interface-level mocking (Substitute.For<ITransactionStatusService>) with direct instantiation of TransactionStatusService and NSubstitute stubs on IClient (keyed on eth_getTransaction* method names). All 6 tests now exercise the real service logic including receipt/tx fetch paths, Replaced vs Pending nonce comparison, and the pruned-transaction null-fallback case. Agent-Logs-Url: https://github.com/Tricksfor-Organization/BlockChainTools/sessions/ff398c7f-10f8-434d-85a4-2853ff8b65b7 Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
…ationRequested before each RPC call Nethereum's SendRequestAsync does not accept a CancellationToken, so add explicit cancellationToken.ThrowIfCancellationRequested() before each of the 4 awaited RPC calls (GetTransactionReceipt, GetTransactionByHash x2, GetTransactionCount). Also adds a test verifying OperationCanceledException is thrown for pre-cancelled tokens. Agent-Logs-Url: https://github.com/Tricksfor-Organization/BlockChainTools/sessions/b484f146-89c6-487f-83a5-e2f370307c2c Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Copilot
AI
changed the title
Fix TransactionStateInfo: populate all fields that have data, document per-state contract
Fix TransactionStateInfo: populate all fields that have data, document per-state contract, observe CancellationToken
Mar 28, 2026
|
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.


ConfirmedNonceappeared useless because every return path set it tonull— obscuring that it is meaningfully set for theReplacedstate. Broader audit revealedValueandGaswere also left unpopulated forPendingandReplacedeven though the transaction object was already fetched. TheCancellationTokenparameter was also accepted but never observed, making callers unable to cancel long-running status checks.Changes
TransactionStatusService— populateValueandGasfrom the already-fetchedtransactioninPendingandReplacedpaths; drop all redundant explicit= nullassignments; addcancellationToken.ThrowIfCancellationRequested()before each of the 4 awaited RPC calls (GetTransactionReceipt,GetTransactionByHash×2,GetTransactionCount) since Nethereum'sSendRequestAsyncdoes not accept aCancellationTokenTransactionStateInfo— sharpen XML docs:ConfirmedNonceexplicitly statesReplaced-only;Value/Gasstate they are null only forStalePendingREADME— replace the single-ifexample with a fullswitchacross all 5 states showing every available field, plus a reference table:Receipt/ReceiptStatus/BlockNumberNonce/Value/GasConfirmedNonceStalePendingcarries onlyState+TransactionHash— the node no longer holds the transaction.TransactionStatusServiceTests— rewrote all tests to instantiateTransactionStatusServicedirectly and stub the underlyingIClientJSON-RPC responses (keyed oneth_getTransactionReceipt,eth_getTransactionByHash,eth_getTransactionCountmethod names via NSubstitute). Tests now exercise real service logic including the receipt/tx fetch paths,Replacedvs.Pendingnonce comparison, and the pruned-transaction null-fallback case. Added a cancellation test verifyingOperationCanceledExceptionis thrown when a pre-cancelled token is passed.📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.