Skip to content

Add transaction state detection and network health check services - #15

Merged
Phelecks merged 7 commits into
mainfrom
copilot/add-transaction-state-detection
Mar 22, 2026
Merged

Phelecks merged 7 commits into
mainfrom
copilot/add-transaction-state-detection

Conversation

Copilot AI commented Mar 22, 2026 •

Copy link
Copy Markdown
Contributor
  • Remove TransactionState.Broadcasted from enum (done in previous session)
  • Refactor CheckNetworkHealthAsync cognitive complexity with EvaluateBlockFreshness helper (done in previous session)
  • Replace GetBlockWithTransactionsByNumber with lighter GetBlockWithTransactionsHashesByNumber in NetworkHealthService (only block number + timestamp needed for health check)
  • Build and test — 0 warnings, 0 errors, 24/24 tests pass
  • Code review — no issues
  • CodeQL — 0 alerts

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

- Add TransactionState enum (Broadcasted, Pending, ConfirmedSuccess, ConfirmedReverted, Replaced, StalePending)
- Add TransactionStateInfo DTO with state and metadata
- Add ITransactionStatusService interface with GetTransactionStateAsync
- Add TransactionStatusService using receipt polling and mempool/nonce checks
- Add NetworkHealthInfo DTO for health check results
- Add INetworkHealthService interface with CheckNetworkHealthAsync
- Add NetworkHealthService checking block freshness, gas price, chain ID
- Register new services in Configuration.cs
- Add unit tests for both new services (12 new tests)

Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tricksfor-Organization/BlockChainTools/sessions/33c42eb9-2ed0-4d7f-a7ce-51a18903f68c
Copilot AI changed the title [WIP] Add transaction state detection and blockchain network status Add transaction state detection and network health check services Mar 22, 2026
Copilot AI requested a review from Phelecks March 22, 2026 12:27
Copilot AI and others added 2 commits March 22, 2026 13:21
… NuGet packages, update READMEs

- Change INetworkHealthService parameter from BigInteger? to Chain?
- Upgrade Nethereum.* 5.8.0 → 6.0.4
- Upgrade Microsoft.Extensions.DependencyInjection 10.0.1 → 10.0.5
- Upgrade NUnit 4.4.0 → 4.5.1, NUnit3TestAdapter 6.1.0 → 6.2.0
- Upgrade Microsoft.NET.Test.Sdk 18.0.1 → 18.3.0
- Upgrade Testcontainers 4.10.0 → 4.11.0
- Upgrade Aspire.StackExchange.Redis.DistributedCaching 13.1.0 → 13.1.3
- Update both README.md files with new services and correct dependency versions

Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tricksfor-Organization/BlockChainTools/sessions/24dee835-ccb3-4b1c-b35e-2092ffefd0c1
@Phelecks
Phelecks marked this pull request as ready for review March 22, 2026 13:50
Copilot AI review requested due to automatic review settings March 22, 2026 13:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds two new diagnostic services to BlockChainTools—transaction lifecycle state detection and RPC/network health checking—along with DI registration, DTOs, tests, documentation updates, and dependency upgrades.

Changes:

  • Introduces ITransactionStatusService/TransactionStatusService + TransactionState/TransactionStateInfo for receipt/mempool/nonce-based transaction state detection.
  • Introduces INetworkHealthService/NetworkHealthService + NetworkHealthInfo for latest block freshness, gas price, and optional chain ID validation.
  • Updates DI wiring, READMEs, and central NuGet package versions.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/BlockChainTools/Services/TransactionStatusService.cs Implements transaction state detection logic
src/BlockChainTools/Interfaces/ITransactionStatusService.cs Adds public contract for transaction state detection
src/BlockChainTools/DataTransferObjects/TransactionState.cs Defines transaction lifecycle enum
src/BlockChainTools/DataTransferObjects/TransactionStateInfo.cs DTO returned by transaction state detection
src/BlockChainTools/Services/NetworkHealthService.cs Implements network/RPC health checks
src/BlockChainTools/Interfaces/INetworkHealthService.cs Adds public contract for network health checks
src/BlockChainTools/DataTransferObjects/NetworkHealthInfo.cs DTO returned by network health check
src/BlockChainTools/Configuration.cs Registers new services in DI
tests/BlockChainTools.Tests/TransactionStatusServiceTests.cs Adds tests for transaction status service
tests/BlockChainTools.Tests/NetworkHealthServiceTests.cs Adds tests for network health service
src/BlockChainTools/README.md Documents new services in package README
README.md Adds usage docs/examples + dependency version updates
Directory.Packages.props Central package version upgrades

…kHealthAsync to reduce cognitive complexity

- Remove Broadcasted from TransactionState enum (never returned by GetTransactionStateAsync)
- Remove Broadcasted test case
- Extract EvaluateBlockFreshness helper; inline Chain cast to eliminate ternary
- Update README to reflect actual returned states

Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tricksfor-Organization/BlockChainTools/sessions/1d8b147d-a32f-4525-84c8-d0ff31b40763
The health check only needs block number and timestamp, not full transaction
objects. GetBlockWithTransactionsHashesByNumber returns only tx hashes,
reducing RPC payload size and latency on high-throughput networks.

Co-authored-by: Phelecks <47243363+Phelecks@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tricksfor-Organization/BlockChainTools/sessions/6c6da43a-8e70-4bfa-8cd3-c11c93a6c907
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@Phelecks
Phelecks merged commit 0b75b97 into main Mar 22, 2026
6 of 7 checks passed
@Phelecks
Phelecks deleted the copilot/add-transaction-state-detection branch March 22, 2026 15:04
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.

3 participants