add payout address item to confirmation screen

This commit is contained in:
Serhii 2023-01-16 17:27:49 +02:00
parent 7f37bd3d59
commit b4249f21a9
5 changed files with 22 additions and 3 deletions

View file

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

View file

@ -150,6 +150,7 @@ class SideShiftExchangeProvider extends ExchangeProvider {
refundAddress: settleAddress, refundAddress: settleAddress,
state: TradeState.created, state: TradeState.created,
amount: _request.depositAmount, amount: _request.depositAmount,
payoutAddress: settleAddress,
createdAt: DateTime.now(), createdAt: DateTime.now(),
); );
} }
@ -244,6 +245,7 @@ class SideShiftExchangeProvider extends ExchangeProvider {
final inputAddress = responseJSON['depositAddress']['address'] as String; final inputAddress = responseJSON['depositAddress']['address'] as String;
final expectedSendAmount = responseJSON['depositAmount'].toString(); final expectedSendAmount = responseJSON['depositAmount'].toString();
final deposits = responseJSON['deposits'] as List?; final deposits = responseJSON['deposits'] as List?;
final settleAddress = responseJSON['settleAddress']['address'] as String;
TradeState? state; TradeState? state;
String? status; String? status;
@ -264,6 +266,7 @@ class SideShiftExchangeProvider extends ExchangeProvider {
amount: expectedSendAmount, amount: expectedSendAmount,
state: state, state: state,
expiredAt: expiredAt, 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 responseJSON = json.decode(response.body) as Map<String, dynamic>;
final id = responseJSON['id'] as String; final id = responseJSON['id'] as String;
final inputAddress = responseJSON['address_from'] 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 settleAddress = responseJSON['user_refund_address'] as String;
final extraId = responseJSON['extra_id_from'] as String?; final extraId = responseJSON['extra_id_from'] as String?;
return Trade( return Trade(
@ -120,6 +121,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
extraId: extraId, extraId: extraId,
state: TradeState.created, state: TradeState.created,
amount: _request.amount, amount: _request.amount,
payoutAddress: payoutAddress,
createdAt: DateTime.now(), createdAt: DateTime.now(),
); );
} }
@ -189,6 +191,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
final expectedSendAmount = responseJSON['expected_amount'].toString(); final expectedSendAmount = responseJSON['expected_amount'].toString();
final extraId = responseJSON['extra_id_from'] as String?; final extraId = responseJSON['extra_id_from'] as String?;
final status = responseJSON['status'] as String; final status = responseJSON['status'] as String;
final payoutAddress = responseJSON['address_to'] as String;
final state = TradeState.deserialize(raw: status); final state = TradeState.deserialize(raw: status);
return Trade( return Trade(
@ -200,6 +203,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
inputAddress: inputAddress, inputAddress: inputAddress,
amount: expectedSendAmount, amount: expectedSendAmount,
state: state, state: state,
payoutAddress: payoutAddress,
); );
} }

View file

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

View file

@ -146,6 +146,10 @@ abstract class ExchangeTradeViewModelBase with Store {
title: S.current.send_to_this_address('${trade.from} ${trade.from.tag ?? ''}') + ':', title: S.current.send_to_this_address('${trade.from} ${trade.from.tag ?? ''}') + ':',
data: trade.inputAddress ?? '', data: trade.inputAddress ?? '',
isCopied: true), isCopied: true),
ExchangeTradeItem(
title: S.current.arrive_in_this_address('${trade.to} ${trade.to.tag ?? ''}') + ':',
data: trade.payoutAddress ?? '',
isCopied: true),
]); ]);
} }
} }