Problem
TRON TRC20 tokens (e.g., USDT, USDC on TRON) are classified under CURRENCY.ERC20 and differentiated only by their network field being tron or nile. This causes:
- Broken request creation: After request-token-list#27 correctly set Tron currency type to
TRC20, the SDK's CurrencyManager rejects it because it doesn't handle that type. A bandaid override was applied in the Request API to unblock usage.
- Semantic inaccuracy: TRC20 is a TRON-native standard, not ERC20.
- Scattered special-case handling: Multiple files check
network === 'tron' || network === 'nile' within ERC20 code paths.
- Confusion for integrators: "ERC20 on TRON" really means TRC20.
TronChains.ts incorrectly registers TRON chains under CURRENCY.ETH.
Impact
Tron request creation is currently broken without the API-level bandaid. The SDK stores incorrect currency types (ERC20 instead of TRC20) in the API database and Protocol (IPFS), which will cause issues when Tron is re-enabled on the frontend.
Proposed Solution
Introduce CURRENCY.TRC20 as a first-class currency type across the SDK packages:
- Core Types (
packages/types) — Add TRC20 to CURRENCY enum, add TRC20Currency/TRC20CurrencyInput types, add TRC20_FEE_PROXY_CONTRACT payment network ID, remove TronChainName from ERC20Currency.network
- Currency Management (
packages/currency) — Create TRC20 token list module, fix TronChains.ts to use CURRENCY.TRC20, update CurrencyManager to handle TRC20 in fromAddress, fromStorageCurrency, toStorageCurrency, validateAddress, getDefaultList
- Advanced Logic (
packages/advanced-logic) — Create Trc20FeeProxyPaymentNetwork extension, remove TRON-specific logic from ERC20 extension, register TRC20 extension in AdvancedLogic
- Payment Detection (
packages/payment-detection) — Add TRC20 section in PaymentNetworkFactory, remove TRON entries from ERC20 section, update TronFeeProxyPaymentDetector to use new TRC20 payment network ID
- Payment Processing (
packages/payment-processor) — Add TRC20 guards, update trc20-fee-proxy.ts validation
- Request Client (
packages/request-client.js) — Verify end-to-end with new CURRENCY.TRC20 type
- Testing — Unit tests for each package + integration test for create/pay/detect flow
Full implementation plan: https://www.notion.so/requestnetwork/Implementation-Steps-Native-TRC20-Currency-Type-for-TRON-3279821d9d8f80ebb7eaec66fa0dd92e
Considerations
- Backward compatibility: Existing requests stored with
ERC20 type for Tron tokens will need to still be readable. fromStorageCurrency should handle both old ERC20 and new TRC20 records for Tron networks.
- API bandaid: The Request API currently overrides the token list to use ERC20 for Tron. This bandaid should be removed once this SDK fix is merged.
- Frontend: Tron is disabled on the Dashboard frontend. It should not be re-enabled until this fix lands, otherwise new requests will have incorrect currency types in storage.
- The changes are well-scoped and understood. Testing is the most time-consuming part — the SDK has decent test coverage that should help.
Problem
TRON TRC20 tokens (e.g., USDT, USDC on TRON) are classified under
CURRENCY.ERC20and differentiated only by theirnetworkfield beingtronornile. This causes:TRC20, the SDK's CurrencyManager rejects it because it doesn't handle that type. A bandaid override was applied in the Request API to unblock usage.network === 'tron' || network === 'nile'within ERC20 code paths.TronChains.tsincorrectly registers TRON chains underCURRENCY.ETH.Impact
Tron request creation is currently broken without the API-level bandaid. The SDK stores incorrect currency types (
ERC20instead ofTRC20) in the API database and Protocol (IPFS), which will cause issues when Tron is re-enabled on the frontend.Proposed Solution
Introduce
CURRENCY.TRC20as a first-class currency type across the SDK packages:packages/types) — AddTRC20toCURRENCYenum, addTRC20Currency/TRC20CurrencyInputtypes, addTRC20_FEE_PROXY_CONTRACTpayment network ID, removeTronChainNamefromERC20Currency.networkpackages/currency) — Create TRC20 token list module, fixTronChains.tsto useCURRENCY.TRC20, updateCurrencyManagerto handle TRC20 infromAddress,fromStorageCurrency,toStorageCurrency,validateAddress,getDefaultListpackages/advanced-logic) — CreateTrc20FeeProxyPaymentNetworkextension, remove TRON-specific logic from ERC20 extension, register TRC20 extension inAdvancedLogicpackages/payment-detection) — AddTRC20section inPaymentNetworkFactory, remove TRON entries from ERC20 section, updateTronFeeProxyPaymentDetectorto use new TRC20 payment network IDpackages/payment-processor) — Add TRC20 guards, updatetrc20-fee-proxy.tsvalidationpackages/request-client.js) — Verify end-to-end with newCURRENCY.TRC20typeFull implementation plan: https://www.notion.so/requestnetwork/Implementation-Steps-Native-TRC20-Currency-Type-for-TRON-3279821d9d8f80ebb7eaec66fa0dd92e
Considerations
ERC20type for Tron tokens will need to still be readable.fromStorageCurrencyshould handle both oldERC20and newTRC20records for Tron networks.