Skip to content

feat: add Tron payment detection support - #1689

Merged
rodrigopavezi merged 4 commits into
masterfrom
feat/tron-payment-detection
Feb 12, 2026
Merged

feat: add Tron payment detection support#1689
rodrigopavezi merged 4 commits into
masterfrom
feat/tron-payment-detection

Conversation

@rodrigopavezi

@rodrigopavezirodrigopavezi commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

Description of the changes

Added support for TRON blockchain payment detection in the Request Network. This implementation includes:

  • Created a TRON-specific ERC20 fee proxy payment detector (TronERC20FeeProxyPaymentDetector)
  • Added a TRON info retriever (TronInfoRetriever) to fetch payment events from TRON subgraphs
  • Integrated GraphQL queries for TRON payments with support for both mainnet and Nile testnet
  • Updated TheGraph client to support TRON chains
  • Added codegen configuration for TRON GraphQL schema
  • Registered TRON payment detectors in the payment network factory
  • Added comprehensive unit tests for the new TRON components

The implementation follows the same pattern as other blockchain integrations while accounting for TRON-specific requirements.


Closes RequestNetwork/private-issues#227

@coderabbitai

coderabbitaiBot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/tron-payment-detection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR adds comprehensive support for TRON blockchain payment detection to the Request Network. The implementation follows the established architectural patterns used for EVM and NEAR chains.

Key Changes:

  • Created TronERC20FeeProxyPaymentDetector that extends the base ERC20 fee proxy detector for TRON-specific payment detection
  • Implemented TronInfoRetriever to fetch payment events from TRON subgraphs using GraphQL queries
  • Integrated TRON support into TheGraphClient with dedicated SDK (getTronSdk) and subgraph URLs for both mainnet and Nile testnet
  • Registered TRON payment detectors in the PaymentNetworkFactory for both tron and nile network chains
  • Added GraphQL queries supporting both token-filtered and any-token payment retrieval
  • Configured GraphQL code generation pipeline for TRON schema
  • Included comprehensive unit tests achieving good coverage of core functionality

Implementation Quality:
The code follows consistent patterns from existing NEAR/EVM implementations, properly handles network validation, error cases, and edge conditions. The test coverage validates deployment information, network validation, and event extraction flows.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation follows established patterns from NEAR/EVM integrations, includes comprehensive unit tests, proper error handling, and network validation. The code is well-structured, maintainable, and integrates cleanly with existing architecture.
  • No files require special attention

Important Files Changed

FilenameOverview
packages/payment-detection/src/tron/tron-fee-proxy-detector.tsNew TRON ERC20 fee proxy payment detector following established patterns from EVM/NEAR detectors
packages/payment-detection/src/tron/tron-info-retriever.tsTheGraph-based info retriever for TRON payments with proper event mapping
packages/payment-detection/src/thegraph/client.tsAdded TRON chain support with dedicated SDK and subgraph URLs for mainnet and Nile testnet
packages/payment-detection/src/payment-network-factory.tsRegistered TRON ERC20 fee proxy detector for both tron and nile networks
packages/payment-detection/src/thegraph/queries/tron/GetTronPayments.graphqlGraphQL queries for TRON payment events with and without token filtering

Sequence Diagram

sequenceDiagram
participant Client
participant Factory as PaymentNetworkFactory
participant Detector as TronERC20FeeProxyPaymentDetector
participant Retriever as TronInfoRetriever
participant GraphQL as TheGraphClient<TronChain>
participant Subgraph as TRON Subgraph
Client->>Factory: getPaymentNetworkFromRequest(request)
Factory->>Factory: Identify TRON chain (tron/nile)
Factory->>Detector: new TronERC20FeeProxyPaymentDetector({network, getSubgraphClient})
Factory-->>Client: Return detector instance
Client->>Detector: extractEvents(eventName, toAddress, paymentReference, currency, chain)
Detector->>Detector: Validate TRON chain support
Detector->>Detector: Validate network matches detector network
Detector->>Detector: getDeploymentInformation(chain)
Note over Detector: Gets proxy contract address & creation block
Detector->>Detector: getSubgraphClient(chain)
Note over Detector: Returns TheGraphClient for tron/nile
Detector->>Retriever: new TronInfoRetriever(subgraphClient)
Detector->>Retriever: getTransferEvents({paymentReference, toAddress, contractAddress, acceptedTokens})
Retriever->>Retriever: Hash payment reference with keccak256
alt Single token filter
Retriever->>GraphQL: GetTronPayments(reference, to, tokenAddress, contractAddress)
else No token filter
Retriever->>GraphQL: GetTronPaymentsAnyToken(reference, to, contractAddress)
end
GraphQL->>Subgraph: Query payment events
Subgraph-->>GraphQL: Return payments array
GraphQL-->>Retriever: Return payments
Retriever->>Retriever: Map payments to event format
Note over Retriever: Convert amount, feeAmount to strings<br/>Add txHash, block, timestamp
Retriever-->>Detector: Return {paymentEvents}
Detector-->>Client: Return payment events
Loading

@greptile-appsgreptile-appsBot 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.

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch from 853297e to 5bb6ef7CompareJanuary 27, 2026 01:49
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch from 5bb6ef7 to 3c7d77fCompareJanuary 27, 2026 01:53
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch 2 times, most recently from 816af51 to fc1128cCompareJanuary 27, 2026 01:58
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch from fc1128c to cf070e9CompareJanuary 27, 2026 02:02
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch 2 times, most recently from 62f2685 to 3bf2428CompareJanuary 27, 2026 02:25
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-currency branch 2 times, most recently from d515038 to 6e1a893CompareJanuary 27, 2026 02:34
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch from 3bf2428 to f06892cCompareJanuary 27, 2026 02:34
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch from f06892c to 8456f0aCompareJanuary 27, 2026 02:39
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch 2 times, most recently from 720a911 to 9c63452CompareJanuary 27, 2026 08:43

@MantisCloneMantisClone 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.

Looks good to me so far.

Reviewed with Claude Code Opus 4.5

@MantisClone
MantisClone self-requested a review February 10, 2026 15:10

@MantisCloneMantisClone 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.

LGTM — good test coverage for the detector and info retriever. Follows existing patterns well.

@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch from cecfc7e to 6c8cb20CompareFebruary 11, 2026 13:29
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch 2 times, most recently from 938afca to c8c4b67CompareFebruary 11, 2026 14:39
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch from c8c4b67 to 1408a38CompareFebruary 11, 2026 14:48
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch from 1408a38 to 559e872CompareFebruary 11, 2026 14:53
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch from 559e872 to 96f878eCompareFebruary 11, 2026 16:40
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-currency branch 2 times, most recently from 934ffe1 to 2f3f7aeCompareFebruary 11, 2026 16:42
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch from 96f878e to 35cc88dCompareFebruary 11, 2026 16:42
@rodrigopaveziGraphite App

rodrigopavezi commented Feb 12, 2026

Copy link
Copy Markdown
ContributorAuthor

Merge activity

  • Feb 12, 1:06 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Feb 12, 1:13 PM UTC: Graphite rebased this pull request as part of a merge.
  • Feb 12, 1:13 PM UTC: @rodrigopavezi merged this pull request with Graphite.

@rodrigopavezi
rodrigopavezi changed the base branch from feat/tron-currency to graphite-base/1689February 12, 2026 13:10
@rodrigopavezi
rodrigopavezi changed the base branch from graphite-base/1689 to masterFebruary 12, 2026 13:11
- Add TronFeeProxyDetector for detecting Tron payments
- Add TronInfoRetriever for fetching payment data from TheGraph
- Add GraphQL queries for Tron payments
- Integrate Tron detector into payment network factory
- Add unit tests for detector and retriever
- Add schema.graphql to payment-detection package for TRON types
- Update codegen-tron.yml to use local schema instead of substreams
- Remove conditional codegen script (schema is now always available)
- Fix TronERC20FeeProxyPaymentDetector static method signature
- Add explicit type annotation in tron-info-retriever
- Add contractVersion to getDeploymentInformation return type
- Update getTheGraphInfoRetriever to accept TronChainName clients
@rodrigopavezi
rodrigopaveziforce-pushed the feat/tron-payment-detection branch from 35cc88d to 5fd4cfeCompareFebruary 12, 2026 13:12
@rodrigopavezi
rodrigopavezi merged commit fe06d59 into masterFeb 12, 2026
1 of 3 checks passed
@rodrigopavezi
rodrigopavezi deleted the feat/tron-payment-detection branch February 12, 2026 13:13
@rodrigopavezirodrigopavezi mentioned this pull request Feb 16, 2026
Sign up for freeto 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

@rodrigopavezi@MantisClone@aimen74