Skip to content

Commit 5897325

Browse files
committed
feat: add Tron chain definitions for currency package
- Add Tron mainnet and Nile testnet chain configurations - Add TronChains types and exports - Update currency-types with Tron chain support
1 parent 9d65635 commit 5897325

File tree

7 files changed

+58
-4
lines changed

7 files changed

+58
-4
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const chainId = 'nile';
2+
3+
// Nile is Tron's test network
4+
export const testnet = true;
5+
6+
// Test tokens on Nile testnet
7+
// Note: These are testnet token addresses, not mainnet
8+
export const currencies = {
9+
// Add testnet token addresses as needed
10+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
11
export const chainId = 'tron';
2+
3+
// Tron mainnet configuration
4+
export const testnet = false;
5+
6+
// Common TRC20 tokens on Tron
7+
export const currencies = {
8+
// USDT-TRC20 - the most widely used stablecoin on Tron
9+
TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t: {
10+
name: 'Tether USD',
11+
symbol: 'USDT',
12+
decimals: 6,
13+
},
14+
// USDC on Tron
15+
TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8: {
16+
name: 'USD Coin',
17+
symbol: 'USDC',
18+
decimals: 6,
19+
},
20+
};

packages/currency/src/chains/declarative/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { CurrencyTypes } from '@requestnetwork/types';
22

33
import * as TronDefinition from './data/tron';
4+
import * as NileDefinition from './data/nile';
45
import * as SolanaDefinition from './data/solana';
56
import * as StarknetDefinition from './data/starknet';
67
import * as TonDefinition from './data/ton';
@@ -11,6 +12,7 @@ export type DeclarativeChain = CurrencyTypes.Chain;
1112

1213
export const chains: Record<CurrencyTypes.DeclarativeChainName, DeclarativeChain> = {
1314
tron: TronDefinition,
15+
nile: NileDefinition,
1416
solana: SolanaDefinition,
1517
starknet: StarknetDefinition,
1618
ton: TonDefinition,
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import BtcChains from './btc/BtcChains';
22
import EvmChains from './evm/EvmChains';
33
import NearChains from './near/NearChains';
4+
import TronChains from './tron/TronChains';
45
import DeclarativeChains from './declarative/DeclarativeChains';
56
import { isSameChain } from './utils';
67

7-
export { BtcChains, EvmChains, NearChains, DeclarativeChains, isSameChain };
8+
export { BtcChains, EvmChains, NearChains, TronChains, DeclarativeChains, isSameChain };
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { ChainsAbstract } from '../ChainsAbstract';
2+
import { CurrencyTypes, RequestLogicTypes } from '@requestnetwork/types';
3+
import { TronChain, chains } from './index';
4+
5+
class TronChains extends ChainsAbstract<CurrencyTypes.TronChainName, TronChain, string> {}
6+
export default new TronChains(chains, RequestLogicTypes.CURRENCY.ETH);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { CurrencyTypes } from '@requestnetwork/types';
2+
3+
import * as TronDefinition from '../declarative/data/tron';
4+
import * as NileDefinition from '../declarative/data/nile';
5+
6+
export type TronChain = CurrencyTypes.Chain;
7+
8+
export const chains: Record<CurrencyTypes.TronChainName, TronChain> = {
9+
tron: TronDefinition,
10+
nile: NileDefinition,
11+
};

packages/types/src/currency-types.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ export type BtcChainName = 'mainnet' | 'testnet';
4343
/**
4444
* List of supported Declarative chains
4545
*/
46-
export type DeclarativeChainName = 'tron' | 'solana' | 'ton' | 'starknet' | 'aleo' | 'sui';
46+
export type DeclarativeChainName = 'tron' | 'nile' | 'solana' | 'ton' | 'starknet' | 'aleo' | 'sui';
47+
48+
/**
49+
* List of supported Tron chains (mainnet and testnets)
50+
*/
51+
export type TronChainName = 'tron' | 'nile';
4752

4853
/**
4954
* List of supported NEAR chains
@@ -54,9 +59,9 @@ export type NearChainName = 'aurora' | 'aurora-testnet' | 'near' | 'near-testnet
5459
export type ChainName = EvmChainName | BtcChainName | NearChainName | DeclarativeChainName;
5560

5661
/**
57-
* Virtual machin chains, where payment proxy contracts can be deployed
62+
* Virtual machine chains, where payment proxy contracts can be deployed
5863
*/
59-
export type VMChainName = EvmChainName | NearChainName;
64+
export type VMChainName = EvmChainName | NearChainName | TronChainName;
6065

6166
/**
6267
* Common types used in token configuration files

0 commit comments

Comments
 (0)