fix: Chainflip swap status update (#2775)

This commit is contained in:
Serhii
2025-12-29 20:04:03 +01:00
committed by GitHub
parent 95dc0313ff
commit 40abcef6f3
@@ -202,7 +202,7 @@ class ChainflipExchangeProvider extends ExchangeProvider {
final swapResponse = await _openDepositChannel(swapParams);
final id = '${swapResponse['issuedBlock']}-${swapResponse['network'].toString().toUpperCase()}-${swapResponse['channelId']}';
final id = '${swapResponse['issuedBlock']}-${swapResponse['network'].toString()}-${swapResponse['channelId']}';
ExchangeProviderLogger.logSuccess(
provider: description,
@@ -268,11 +268,13 @@ class ChainflipExchangeProvider extends ExchangeProvider {
Future<Trade> findTradeById({required String id}) async {
try {
final channelParts = id.split('-');
final network = channelParts[1];
final normalizedNetwork = _normalizeNetworkName(network);
final statusParams = {
'apiKey': _affiliateKey,
'issuedBlock': channelParts[0],
'network': channelParts[1],
'network': normalizedNetwork,
'channelId': channelParts[2]
};
@@ -334,6 +336,18 @@ class ChainflipExchangeProvider extends ExchangeProvider {
return '$title.$tag';
}
String _normalizeNetworkName (String name) {
final networkName = switch (name) {
'BITCOIN' => 'Bitcoin',
'ETHEREUM' => 'Ethereum',
'SOLANA' => 'Solana',
_ => name
};
return networkName;
}
CryptoCurrency? _toCurrency(String name) {
final currency = switch (name) {
'btc.btc' => CryptoCurrency.btc,