Skip to content

Commit 2d1ffbc

Browse files
committed
feat: integrate TronInfoRetriever into ERC20FeeProxyPaymentDetector
- Update ERC20FeeProxyPaymentDetector to support TronChainName by adding TronInfoRetriever. - Enhance the getTheGraphInfoRetriever method to handle Tron payment chains.
1 parent 99722a4 commit 2d1ffbc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/payment-detection/src/erc20/fee-proxy-contract.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
PaymentTypes,
66
RequestLogicTypes,
77
} from '@requestnetwork/types';
8-
import { EvmChains, NearChains, isSameChain } from '@requestnetwork/currency';
8+
import { EvmChains, NearChains, TronChains, isSameChain } from '@requestnetwork/currency';
99
import ProxyInfoRetriever from './proxy-info-retriever';
1010

1111
import { loadCurrencyFromContract } from './currency';
@@ -14,6 +14,7 @@ import { makeGetDeploymentInformation } from '../utils';
1414
import { TheGraphClient, TheGraphInfoRetriever } from '../thegraph';
1515
import { ReferenceBasedDetectorOptions, TGetSubGraphClient } from '../types';
1616
import { NearInfoRetriever } from '../near';
17+
import { TronInfoRetriever } from '../tron';
1718
import { NetworkNotSupported } from '../balance-error';
1819

1920
const PROXY_CONTRACT_ADDRESS_MAP = {
@@ -165,11 +166,13 @@ export class ERC20FeeProxyPaymentDetector<
165166
| TheGraphClient
166167
| TheGraphClient<CurrencyTypes.NearChainName>
167168
| TheGraphClient<CurrencyTypes.TronChainName>,
168-
): TheGraphInfoRetriever | NearInfoRetriever {
169+
): TheGraphInfoRetriever | NearInfoRetriever | TronInfoRetriever {
169170
const graphInfoRetriever = EvmChains.isChainSupported(paymentChain)
170171
? new TheGraphInfoRetriever(subgraphClient as TheGraphClient, this.currencyManager)
171172
: NearChains.isChainSupported(paymentChain) && this.network
172173
? new NearInfoRetriever(subgraphClient as TheGraphClient<CurrencyTypes.NearChainName>)
174+
: TronChains.isChainSupported(paymentChain)
175+
? new TronInfoRetriever(subgraphClient as TheGraphClient<CurrencyTypes.TronChainName>)
173176
: undefined;
174177
if (!graphInfoRetriever) {
175178
throw new Error(

0 commit comments

Comments
 (0)