fix: extra ID for Trocador swap (#2307)

This commit is contained in:
Serhii 2025-06-16 17:52:15 +03:00 committed by GitHub
parent a96b493b60
commit 4fb2fc47ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 40 additions and 14 deletions

View file

@ -230,6 +230,7 @@ class TrocadorExchangeProvider extends ExchangeProvider {
final providerName = responseJSON['provider'] as String;
final amount = responseJSON['amount_from']?.toString();
final receiveAmount = responseJSON['amount_to']?.toString();
final addressProviderMemo = responseJSON['address_provider_memo'] as String?;
return Trade(
id: id,
@ -247,6 +248,7 @@ class TrocadorExchangeProvider extends ExchangeProvider {
receiveAmount: receiveAmount ?? request.toAmount,
payoutAddress: payoutAddress,
isSendAll: isSendAll,
extraId: addressProviderMemo,
);
}

View file

@ -96,11 +96,12 @@ abstract class ExchangeTradeViewModelBase with Store {
bool isSendable;
@computed
String get extraInfo => trade.from == CryptoCurrency.xlm
? '\n\n' + S.current.xlm_extra_info
: trade.from == CryptoCurrency.xrp
? '\n\n' + S.current.xrp_extra_info
: '';
String get extraInfo => switch (trade.from) {
CryptoCurrency.xlm => '\n\n' + S.current.xlm_extra_info,
CryptoCurrency.xrp => '\n\n' + S.current.xrp_extra_info,
CryptoCurrency.ton => '\n\n' + S.current.ton_extra_info,
_ => ''
};
@computed
String get pendingTransactionFiatAmountValueFormatted => sendViewModel.isFiatDisabled
@ -203,12 +204,12 @@ abstract class ExchangeTradeViewModelBase with Store {
]);
if (trade.extraId != null) {
final shouldAddExtraId = trade.from == CryptoCurrency.xrp || trade.from == CryptoCurrency.xlm;
final shouldAddExtraId = trade.from == CryptoCurrency.xrp || trade.from == CryptoCurrency.xlm || trade.from == CryptoCurrency.ton;
if (shouldAddExtraId) {
final title = trade.from == CryptoCurrency.xrp
? S.current.destination_tag
: trade.from == CryptoCurrency.xlm
: trade.from == CryptoCurrency.xlm || trade.from == CryptoCurrency.ton
? S.current.memo
: S.current.extra_id;
@ -217,13 +218,8 @@ abstract class ExchangeTradeViewModelBase with Store {
title: title,
data: '${trade.extraId}',
isCopied: true,
isReceiveDetail: (trade.from == CryptoCurrency.xrp || trade.from == CryptoCurrency.xlm)
? false
: true,
isExternalSendDetail:
(trade.from == CryptoCurrency.xrp || trade.from == CryptoCurrency.xlm)
? true
: false,
isReceiveDetail: !shouldAddExtraId,
isExternalSendDetail: shouldAddExtraId
),
);
}