Merge pull request #732 from cake-tech/CW-247-Exchange-confirmation-screen-address-labels

CW-247 exchange confirmation screen address labels
This commit is contained in:
Omar Hatem 2023-01-30 21:24:32 +02:00 committed by GitHub
commit e42e3f8ba4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 91 additions and 39 deletions

View file

@ -143,6 +143,7 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
final inputAddress = responseJSON['payinAddress'] as String;
final refundAddress = responseJSON['refundAddress'] as String;
final extraId = responseJSON['payinExtraId'] as String?;
final payoutAddress = responseJSON['payoutAddress'] as String;
return Trade(
id: id,
@ -154,7 +155,8 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
extraId: extraId,
createdAt: DateTime.now(),
amount: responseJSON['fromAmount']?.toString() ?? _request.fromAmount,
state: TradeState.created);
state: TradeState.created,
payoutAddress: payoutAddress);
}
@override
@ -192,6 +194,7 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
final extraId = responseJSON['payinExtraId'] as String;
final outputTransaction = responseJSON['payoutHash'] as String;
final expiredAtRaw = responseJSON['validUntil'] as String;
final payoutAddress = responseJSON['payoutAddress'] as String;
final expiredAt = DateTime.tryParse(expiredAtRaw)?.toLocal();
return Trade(
@ -204,7 +207,8 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
state: state,
extraId: extraId,
expiredAt: expiredAt,
outputTransaction: outputTransaction);
outputTransaction: outputTransaction,
payoutAddress: payoutAddress);
}
@override

View file

@ -150,6 +150,7 @@ class SideShiftExchangeProvider extends ExchangeProvider {
refundAddress: settleAddress,
state: TradeState.created,
amount: _request.depositAmount,
payoutAddress: settleAddress,
createdAt: DateTime.now(),
);
}
@ -244,6 +245,7 @@ class SideShiftExchangeProvider extends ExchangeProvider {
final inputAddress = responseJSON['depositAddress']['address'] as String;
final expectedSendAmount = responseJSON['depositAmount'].toString();
final deposits = responseJSON['deposits'] as List?;
final settleAddress = responseJSON['settleAddress']['address'] as String;
TradeState? state;
String? status;
@ -264,6 +266,7 @@ class SideShiftExchangeProvider extends ExchangeProvider {
amount: expectedSendAmount,
state: state,
expiredAt: expiredAt,
payoutAddress: settleAddress
);
}

View file

@ -108,6 +108,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
final id = responseJSON['id'] as String;
final inputAddress = responseJSON['address_from'] as String;
final payoutAddress = responseJSON['address_to'] as String;
final settleAddress = responseJSON['user_refund_address'] as String;
final extraId = responseJSON['extra_id_from'] as String?;
return Trade(
@ -120,6 +121,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
extraId: extraId,
state: TradeState.created,
amount: _request.amount,
payoutAddress: payoutAddress,
createdAt: DateTime.now(),
);
}
@ -189,6 +191,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
final expectedSendAmount = responseJSON['expected_amount'].toString();
final extraId = responseJSON['extra_id_from'] as String?;
final status = responseJSON['status'] as String;
final payoutAddress = responseJSON['address_to'] as String;
final state = TradeState.deserialize(raw: status);
return Trade(
@ -200,6 +203,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
inputAddress: inputAddress,
amount: expectedSendAmount,
state: state,
payoutAddress: payoutAddress,
);
}

View file

@ -21,7 +21,8 @@ class Trade extends HiveObject {
this.extraId,
this.outputTransaction,
this.refundAddress,
this.walletId}) {
this.walletId,
this.payoutAddress}) {
if (provider != null) {
providerRaw = provider.raw;
}
@ -88,6 +89,9 @@ class Trade extends HiveObject {
@HiveField(12)
String? walletId;
@HiveField(13)
String? payoutAddress;
static Trade fromMap(Map<String, Object?> map) {
return Trade(
id: map['id'] as String,

View file

@ -18,19 +18,18 @@ import 'package:cake_wallet/generated/i18n.dart';
part 'exchange_trade_view_model.g.dart';
class ExchangeTradeViewModel = ExchangeTradeViewModelBase
with _$ExchangeTradeViewModel;
class ExchangeTradeViewModel = ExchangeTradeViewModelBase with _$ExchangeTradeViewModel;
abstract class ExchangeTradeViewModelBase with Store {
ExchangeTradeViewModelBase(
{required this.wallet,
required this.trades,
required this.tradesStore,
required this.sendViewModel})
: trade = tradesStore.trade!,
isSendable = tradesStore.trade!.from == wallet.currency ||
tradesStore.trade!.provider == ExchangeProviderDescription.xmrto,
items = ObservableList<ExchangeTradeItem>() {
required this.trades,
required this.tradesStore,
required this.sendViewModel})
: trade = tradesStore.trade!,
isSendable = tradesStore.trade!.from == wallet.currency ||
tradesStore.trade!.provider == ExchangeProviderDescription.xmrto,
items = ObservableList<ExchangeTradeItem>() {
switch (trade.provider) {
case ExchangeProviderDescription.xmrto:
_provider = XMRTOExchangeProvider();
@ -67,22 +66,20 @@ abstract class ExchangeTradeViewModelBase with Store {
@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
: '';
? '\n\n' + S.current.xlm_extra_info
: trade.from == CryptoCurrency.xrp
? '\n\n' + S.current.xrp_extra_info
: '';
@computed
String get pendingTransactionFiatAmountValueFormatted =>
sendViewModel.isFiatDisabled
? '' : sendViewModel.pendingTransactionFiatAmount
+ ' ' + sendViewModel.fiat.title;
String get pendingTransactionFiatAmountValueFormatted => sendViewModel.isFiatDisabled
? ''
: sendViewModel.pendingTransactionFiatAmount + ' ' + sendViewModel.fiat.title;
@computed
String get pendingTransactionFeeFiatAmountFormatted =>
sendViewModel.isFiatDisabled
? '' : sendViewModel.pendingTransactionFeeFiatAmount
+ ' ' + sendViewModel.fiat.title;
String get pendingTransactionFeeFiatAmountFormatted => sendViewModel.isFiatDisabled
? ''
: sendViewModel.pendingTransactionFeeFiatAmount + ' ' + sendViewModel.fiat.title;
@observable
ObservableList<ExchangeTradeItem> items;
@ -122,6 +119,8 @@ abstract class ExchangeTradeViewModelBase with Store {
}
void _updateItems() {
final tagFrom = trade.from.tag != null ? '${trade.from.tag}' + ' ' : '';
final tagTo = trade.to.tag != null ? '${trade.to.tag}' + ' ' : '';
items.clear();
items.add(ExchangeTradeItem(
title: "${trade.provider.title} ${S.current.id}", data: '${trade.id}', isCopied: true));
@ -130,22 +129,22 @@ abstract class ExchangeTradeViewModelBase with Store {
final title = trade.from == CryptoCurrency.xrp
? S.current.destination_tag
: trade.from == CryptoCurrency.xlm
? S.current.memo
: S.current.extra_id;
? S.current.memo
: S.current.extra_id;
items.add(ExchangeTradeItem(
title: title, data: '${trade.extraId}', isCopied: false));
items.add(ExchangeTradeItem(title: title, data: '${trade.extraId}', isCopied: false));
}
items.addAll([
ExchangeTradeItem(title: S.current.amount, data: '${trade.amount}', isCopied: false),
ExchangeTradeItem(
title: S.current.amount, data: '${trade.amount}', isCopied: false),
ExchangeTradeItem(
title: S.current.status, data: '${trade.state}', isCopied: false),
ExchangeTradeItem(
title: S.current.widgets_address + ':',
title: S.current.send_to_this_address('${trade.from}', tagFrom) + ':',
data: trade.inputAddress ?? '',
isCopied: true),
ExchangeTradeItem(
title: S.current.arrive_in_this_address('${trade.to}', tagTo) + ':',
data: trade.payoutAddress ?? '',
isCopied: true),
]);
}
}

View file

@ -678,5 +678,7 @@
"enabled":"ممكنة",
"tor_only":"Tor فقط",
"unmatched_currencies": "عملة محفظتك الحالية لا تتطابق مع عملة QR الممسوحة ضوئيًا",
"orbot_running_alert": "يرجى التأكد من تشغيل Orbot قبل الاتصال بهذه العقدة."
"orbot_running_alert": "يرجى التأكد من تشغيل Orbot قبل الاتصال بهذه العقدة.",
"send_to_this_address" : "أرسل ${currency} ${tag}إلى هذا العنوان",
"arrive_in_this_address" : "سيصل ${currency} ${tag}إلى هذا العنوان"
}

View file

@ -681,6 +681,8 @@
"orbot_running_alert": "Bitte stellen Sie sicher, dass Orbot läuft, bevor Sie sich mit diesem Knoten verbinden.",
"contact_list_contacts": "Kontakte",
"contact_list_wallets": "Meine Geldbörsen",
"send_to_this_address" : "Senden Sie ${currency} ${tag}an diese Adresse",
"arrive_in_this_address" : "${currency} ${tag}wird an dieser Adresse ankommen",
"do_not_send": "Nicht senden",
"error_dialog_content": "Hoppla, wir haben einen Fehler.\n\nBitte senden Sie den Absturzbericht an unser Support-Team, um die Anwendung zu verbessern."
}

View file

@ -681,6 +681,8 @@
"orbot_running_alert": "Please make sure Orbot is running prior to connecting to this node.",
"contact_list_contacts": "Contacts",
"contact_list_wallets": "My Wallets",
"send_to_this_address" : "Send ${currency} ${tag}to this address",
"arrive_in_this_address" : "${currency} ${tag}will arrive in this address",
"do_not_send": "Don't send",
"error_dialog_content": "Oops, we got some error.\n\nPlease send the crash report to our support team to make the application better."
}

View file

@ -681,6 +681,8 @@
"orbot_running_alert": "Asegúrese de que Orbot se esté ejecutando antes de conectarse a este nodo.",
"contact_list_contacts": "Contactos",
"contact_list_wallets": "Mis billeteras",
"send_to_this_address" : "Enviar ${currency} ${tag}a esta dirección",
"arrive_in_this_address" : "${currency} ${tag}llegará a esta dirección",
"do_not_send": "no enviar",
"error_dialog_content": "Vaya, tenemos un error.\n\nEnvíe el informe de bloqueo a nuestro equipo de soporte para mejorar la aplicación."
}

View file

@ -675,10 +675,12 @@
"disabled": "Désactivé",
"enabled": "Activé",
"tor_only": "Tor uniquement",
"orbot_running_alert": "Veuillez vous assurer qu'Orbot est en cours d'exécution avant de vous connecter à ce nœud.",
"unmatched_currencies": "La devise de votre portefeuille (wallet) actuel ne correspond pas à celle du QR code scanné",
"orbot_running_alert": "Veuillez vous assurer qu'Orbot est en cours d'exécution avant de vous connecter à ce nœud.",
"contact_list_contacts": "Contacts",
"contact_list_wallets": "Mes portefeuilles (wallets)",
"send_to_this_address" : "Envoyez ${currency} ${tag}à cette adresse",
"arrive_in_this_address" : "${currency} ${tag}arrivera à cette adresse",
"do_not_send": "N'envoyez pas",
"error_dialog_content": "Oups, nous avons eu une erreur.\n\nVeuillez envoyer le rapport de plantage à notre équipe d'assistance pour améliorer l'application."
}

View file

@ -677,10 +677,12 @@
"disabled": "अक्षम",
"enabled": "सक्रिय",
"tor_only": "Tor केवल",
"orbot_running_alert": "कृपया सुनिश्चित करें कि इस नोड से कनेक्ट करने से पहले Orbot चल रहा है।",
"unmatched_currencies": "आपके वर्तमान वॉलेट की मुद्रा स्कैन किए गए क्यूआर से मेल नहीं खाती" ,
"orbot_running_alert": "कृपया सुनिश्चित करें कि इस नोड से कनेक्ट करने से पहले Orbot चल रहा है।",
"contact_list_contacts": "संपर्क",
"contact_list_wallets": "मेरा बटुआ",
"send_to_this_address" : "इस पते पर ${currency} ${tag}भेजें",
"arrive_in_this_address" : "${currency} ${tag}इस पते पर पहुंचेंगे",
"do_not_send": "मत भेजो",
"error_dialog_content": "ओह, हमसे कुछ गड़बड़ी हुई है.\n\nएप्लिकेशन को बेहतर बनाने के लिए कृपया क्रैश रिपोर्ट हमारी सहायता टीम को भेजें।"
}

View file

@ -681,6 +681,8 @@
"orbot_running_alert": "Provjerite radi li Orbot prije spajanja na ovaj čvor.",
"contact_list_contacts": "Kontakti",
"contact_list_wallets": "Moji novčanici",
"send_to_this_address" : "Pošaljite ${currency} ${tag}na ovu adresu",
"arrive_in_this_address" : "${currency} ${tag}će stići na ovu adresu",
"do_not_send": "Ne šalji",
"error_dialog_content": "Ups, imamo grešku.\n\nPošaljite izvješće o padu našem timu za podršku kako bismo poboljšali aplikaciju."
}

View file

@ -681,6 +681,8 @@
"orbot_running_alert": "Assicurati che Orbot sia in esecuzione prima di connetterti a questo nodo.",
"contact_list_contacts": "Contatti",
"contact_list_wallets": "I miei portafogli",
"send_to_this_address" : "Invia ${currency} ${tag}a questo indirizzo",
"arrive_in_this_address" : "${currency} ${tag}arriverà a questo indirizzo",
"do_not_send": "Non inviare",
"error_dialog_content": "Ups, imamo grešku.\n\nPošaljite izvješće o padu našem timu za podršku kako bismo poboljšali aplikaciju."
}

View file

@ -681,6 +681,8 @@
"orbot_running_alert": "このードに接続する前に、Orbot が実行されていることを確認してください",
"contact_list_contacts": "連絡先",
"contact_list_wallets": "マイウォレット",
"send_to_this_address" : "${currency} ${tag}をこのアドレスに送金",
"arrive_in_this_address" : "${currency} ${tag}はこの住所に到着します",
"do_not_send": "送信しない",
"error_dialog_content": "Spiacenti, abbiamo riscontrato un errore.\n\nSi prega di inviare il rapporto sull'arresto anomalo al nostro team di supporto per migliorare l'applicazione."
}

View file

@ -681,6 +681,8 @@
"orbot_running_alert": "이 노드에 연결하기 전에 Orbot이 실행 중인지 확인하십시오.",
"contact_list_contacts": "콘택트 렌즈",
"contact_list_wallets": "내 지갑",
"send_to_this_address" : "이 주소로 ${currency} ${tag}송금",
"arrive_in_this_address" : "${currency} ${tag}이(가) 이 주소로 도착합니다",
"do_not_send": "보내지 마세요",
"error_dialog_content": "죄송합니다. 오류가 발생했습니다.\n\n응용 프로그램을 개선하려면 지원 팀에 충돌 보고서를 보내주십시오."
}

View file

@ -679,5 +679,7 @@
"tor_only" : "Tor သာ",
"unmatched_currencies" : "သင့်လက်ရှိပိုက်ဆံအိတ်၏ငွေကြေးသည် စကင်ဖတ်ထားသော QR နှင့် မကိုက်ညီပါ။",
"contact_list_contacts" : "အဆက်အသွယ်များ",
"contact_list_wallets" : "ကျွန်ုပ်၏ ပိုက်ဆံအိတ်များ"
"contact_list_wallets" : "ကျွန်ုပ်၏ ပိုက်ဆံအိတ်များ",
"send_to_this_address" : "ဤလိပ်စာသို့ ${currency} ${tag}သို့ ပို့ပါ။",
"arrive_in_this_address" : "${currency} ${tag}ဤလိပ်စာသို့ ရောက်ရှိပါမည်။"
}

View file

@ -681,6 +681,8 @@
"orbot_running_alert": "Zorg ervoor dat Orbot actief is voordat u verbinding maakt met dit knooppunt.",
"contact_list_contacts": "Contacten",
"contact_list_wallets": "Mijn portefeuilles",
"send_to_this_address" : "Stuur ${currency} ${tag}naar dit adres",
"arrive_in_this_address" : "${currency} ${tag}komt aan op dit adres",
"do_not_send": "Niet sturen",
"error_dialog_content": "Oeps, er is een fout opgetreden.\n\nStuur het crashrapport naar ons ondersteuningsteam om de applicatie te verbeteren."
}

View file

@ -675,12 +675,14 @@
"disable_fiat": "Wyłącz waluty FIAT",
"fiat_api": "API Walut FIAT",
"disabled": "Wyłączone",
"orbot_running_alert": "Upewnij się, że Orbot działa przed połączeniem z tym węzłem.",
"enabled": "Włączone",
"tor_only": "Tylko sieć Tor",
"unmatched_currencies": "Waluta Twojego obecnego portfela nie zgadza się z waluctą zeskanowanego kodu QR",
"orbot_running_alert": "Upewnij się, że Orbot działa przed połączeniem z tym węzłem.",
"contact_list_contacts": "Łączność",
"contact_list_wallets": "Moje portfele",
"send_to_this_address" : "Wyślij ${currency} ${tag}na ten adres",
"arrive_in_this_address" : "${currency} ${tag}dotrze na ten adres",
"do_not_send": "Nie wysyłaj",
"error_dialog_content": "Ups, wystąpił błąd.\n\nPrześlij raport o awarii do naszego zespołu wsparcia, aby ulepszyć aplikację."
}

View file

@ -680,6 +680,8 @@
"orbot_running_alert": "Certifique-se de que o Orbot esteja em execução antes de se conectar a este nó.",
"contact_list_contacts": "Contatos",
"contact_list_wallets": "minhas carteiras",
"send_to_this_address" : "Envie ${currency} ${tag}para este endereço",
"arrive_in_this_address" : "${currency} ${tag}chegará neste endereço",
"do_not_send": "não envie",
"error_dialog_content": "Ops, houve algum erro.\n\nPor favor, envie o relatório de falha para nossa equipe de suporte para melhorar o aplicativo."
}

View file

@ -681,6 +681,8 @@
"orbot_running_alert": "Перед подключением к этому узлу убедитесь, что Orbot запущен.",
"contact_list_contacts": "Контакты",
"contact_list_wallets": "Мои кошельки",
"send_to_this_address" : "Отправить ${currency} ${tag}на этот адрес",
"arrive_in_this_address" : "${currency} ${tag}придет на этот адрес",
"do_not_send": "Не отправлять",
"error_dialog_content": "Ой, у нас какая-то ошибка.\n\nПожалуйста, отправьте отчет о сбое в нашу службу поддержки, чтобы сделать приложение лучше."
}

View file

@ -679,6 +679,8 @@
"orbot_running_alert": "โปรดตรวจสอบว่า Orbot กำลังทำงานก่อนที่จะเชื่อมต่อกับโหนดนี้",
"contact_list_contacts": "ติดต่อ",
"contact_list_wallets": "กระเป๋าเงินของฉัน",
"send_to_this_address" : "ส่ง ${currency} ${tag}ไปยังที่อยู่นี้",
"arrive_in_this_address" : "${currency} ${tag}จะมาถึงที่อยู่นี้",
"do_not_send": "อย่าส่ง",
"error_dialog_content": "อ๊ะ เราพบข้อผิดพลาดบางอย่าง\n\nโปรดส่งรายงานข้อขัดข้องไปยังทีมสนับสนุนของเราเพื่อปรับปรุงแอปพลิเคชันให้ดียิ่งขึ้น"
}

View file

@ -679,5 +679,7 @@
"tor_only": "Yalnızca Tor",
"unmatched_currencies": "Mevcut cüzdanınızın para birimi taranan QR ile eşleşmiyor",
"contact_list_contacts": "Rehberim",
"contact_list_wallets": "Cüzdanlarım"
"contact_list_wallets": "Cüzdanlarım",
"send_to_this_address" : "Bu adrese ${currency} ${tag}gönder",
"arrive_in_this_address" : "${currency} ${tag}bu adrese ulaşacak"
}

View file

@ -680,6 +680,8 @@
"orbot_running_alert": "Перед підключенням до цього вузла переконайтеся, що Orbot запущено.",
"contact_list_contacts": "Контакти",
"contact_list_wallets": "Мої гаманці",
"send_to_this_address" : "Надіслати ${currency} ${tag}на цю адресу",
"arrive_in_this_address" : "${currency} ${tag}надійде на цю адресу",
"do_not_send": "Не надсилайте",
"error_dialog_content": "На жаль, ми отримали помилку.\n\nБудь ласка, надішліть звіт про збій нашій команді підтримки, щоб покращити додаток."
}

View file

@ -679,6 +679,8 @@
"orbot_running_alert": "请确保 Orbot 在连接到此节点之前正在运行。",
"contact_list_contacts": "联系人",
"contact_list_wallets": "我的钱包",
"send_to_this_address" : "发送 ${currency} ${tag}到这个地址",
"arrive_in_this_address" : "${currency} ${tag}将到达此地址",
"do_not_send": "不要发送",
"error_dialog_content": "糟糕,我们遇到了一些错误。\n\n请将崩溃报告发送给我们的支持团队以改进应用程序。"
}