mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
feat(exchange): add TRX and USDT-on-Tron to Chainflip (#3341)
Chainflip added Tron support with asset ids trx.tron and usdt.tron. Enable both for swaps in the Chainflip provider. Tron needs explicit handling because Chainflip's network slug is 'tron', while Cake uses the 'TRX' tag (and null for native TRX), so the generic title.tag normalization can't produce the right ids: - _supported: add trx, usdttrc20 - _normalizeCurrency: map trx -> trx.tron, usdttrc20 -> usdt.tron - _normalizeNetworkName: TRON -> Tron (status lookup in findTradeById) - _toCurrency: reverse-map trx.tron/usdt.tron for trade resolution Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
da9f0d62ee
commit
c9e0ac85d4
@@ -29,6 +29,8 @@ class ChainflipExchangeProvider extends ExchangeProvider {
|
||||
CryptoCurrency.arbEth,
|
||||
CryptoCurrency.usdcArb,
|
||||
CryptoCurrency.usdtArb,
|
||||
CryptoCurrency.trx,
|
||||
CryptoCurrency.usdttrc20,
|
||||
];
|
||||
|
||||
static const _baseURL = 'chainflip-broker.io';
|
||||
@@ -315,6 +317,11 @@ class ChainflipExchangeProvider extends ExchangeProvider {
|
||||
}
|
||||
|
||||
String _normalizeCurrency(CryptoCurrency currency) {
|
||||
// Chainflip uses 'tron' as the network slug, but Cake uses tag 'TRX' (and null
|
||||
// for native TRX), so these can't go through the generic title.tag logic below.
|
||||
if (currency == CryptoCurrency.trx) return 'trx.tron';
|
||||
if (currency == CryptoCurrency.usdttrc20) return 'usdt.tron';
|
||||
|
||||
final tag = currency.tag?.toLowerCase();
|
||||
final title = currency.title.toLowerCase();
|
||||
|
||||
@@ -330,6 +337,7 @@ class ChainflipExchangeProvider extends ExchangeProvider {
|
||||
'ETHEREUM' => 'Ethereum',
|
||||
'ARBITRUM' => 'Arbitrum',
|
||||
'SOLANA' => 'Solana',
|
||||
'TRON' => 'Tron',
|
||||
_ => name
|
||||
};
|
||||
|
||||
@@ -350,6 +358,8 @@ class ChainflipExchangeProvider extends ExchangeProvider {
|
||||
'eth.arb' => CryptoCurrency.arbEth,
|
||||
'usdc.arb' => CryptoCurrency.usdcArb,
|
||||
'usdt.arb' => CryptoCurrency.usdtArb,
|
||||
'trx.tron' => CryptoCurrency.trx,
|
||||
'usdt.tron' => CryptoCurrency.usdttrc20,
|
||||
_ => null
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user