simpleswap api call parse fix as well as ui trade exchange name fixes

This commit is contained in:
julian 2022-10-04 16:10:50 -06:00
parent a37b518f7e
commit 1c0e023fca
10 changed files with 45 additions and 39 deletions

View file

@ -207,7 +207,7 @@ class _ConfirmChangeNowSendViewState
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
"ChangeNOW address",
"${trade.exchangeName} address",
style: STextStyles.smallMed12(context),
),
const SizedBox(

View file

@ -70,7 +70,7 @@ class _ExchangeLoadingOverlayViewState
.overlay
.withOpacity(0.7),
child: const CustomLoadingOverlay(
message: "Loading ChangeNOW data", eventBus: null),
message: "Loading Exchange data", eventBus: null),
),
if ((_statusEst == ChangeNowLoadStatus.failed ||
_statusFixed == ChangeNowLoadStatus.failed) &&
@ -85,9 +85,9 @@ class _ExchangeLoadingOverlayViewState
mainAxisAlignment: MainAxisAlignment.end,
children: [
StackDialog(
title: "Failed to fetch ChangeNow data",
title: "Failed to fetch Exchange data",
message:
"ChangeNOW requires a working internet connection. Tap OK to try fetching again.",
"Exchange requires a working internet connection. Tap OK to try fetching again.",
rightButton: TextButton(
style: Theme.of(context)
.extension<StackColors>()!

View file

@ -158,7 +158,7 @@ class _Step4ViewState extends ConsumerState<Step4View> {
height: 8,
),
Text(
"Send ${model.sendTicker.toUpperCase()} to the address below. Once it is received, ChangeNOW will send the ${model.receiveTicker.toUpperCase()} to the recipient address you provided. You can find this trade details and check its status in the list of trades.",
"Send ${model.sendTicker.toUpperCase()} to the address below. Once it is received, ${model.trade!.exchangeName} will send the ${model.receiveTicker.toUpperCase()} to the recipient address you provided. You can find this trade details and check its status in the list of trades.",
style: STextStyles.itemSubtitle(context),
),
const SizedBox(

View file

@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/pages/exchange_view/exchange_form.dart';
import 'package:stackwallet/pages/exchange_view/trade_details_view.dart';
import 'package:stackwallet/providers/exchange/trade_sent_from_stack_lookup_provider.dart';
import 'package:stackwallet/providers/global/trades_service_provider.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/utilities/constants.dart';

View file

@ -15,7 +15,9 @@ import 'package:stackwallet/pages/wallet_view/transaction_views/edit_note_view.d
import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart';
import 'package:stackwallet/providers/global/trades_service_provider.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart';
import 'package:stackwallet/services/exchange/exchange.dart';
import 'package:stackwallet/services/exchange/simpleswap/simpleswap_exchange.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
@ -331,7 +333,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"ChangeNOW address",
"${trade.exchangeName} address",
style: STextStyles.itemSubtitle(context),
),
const SizedBox(
@ -674,16 +676,10 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
"Exchange",
style: STextStyles.itemSubtitle(context),
),
// Flexible(
// child: FittedBox(
// fit: BoxFit.scaleDown,
// child:
SelectableText(
"ChangeNOW",
trade.exchangeName,
style: STextStyles.itemSubtitle12(context),
),
// ),
// ),
],
),
),
@ -744,20 +740,31 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
const SizedBox(
height: 4,
),
GestureDetector(
onTap: () {
final url =
"https://changenow.io/exchange/txs/${trade.tradeId}";
launchUrl(
Uri.parse(url),
mode: LaunchMode.externalApplication,
);
},
child: Text(
"https://changenow.io/exchange/txs/${trade.tradeId}",
style: STextStyles.link2(context),
),
),
Builder(builder: (context) {
late final String url;
switch (trade.exchangeName) {
case ChangeNowExchange.exchangeName:
url =
"https://changenow.io/exchange/txs/${trade.tradeId}";
break;
case SimpleSwapExchange.exchangeName:
url =
"https://simpleswap.io/exchange?id=${trade.tradeId}";
break;
}
return GestureDetector(
onTap: () {
launchUrl(
Uri.parse(url),
mode: LaunchMode.externalApplication,
);
},
child: Text(
url,
style: STextStyles.link2(context),
),
);
}),
],
),
),

View file

@ -24,7 +24,7 @@ class _HomeViewButtonBarState extends ConsumerState<HomeViewButtonBar> {
context: context,
barrierDismissible: true,
builder: (_) => StackDialog(
title: "ChangeNOW API Call Failed",
title: "Exchange API Call Failed",
message: message,
),
),

View file

@ -389,7 +389,7 @@ class _StackRestoreProgressViewState
height: 20,
child: _getIconForState(state),
),
title: "ChangeNOW history",
title: "Exchange history",
subTitle: state == StackRestoringStatus.failed
? Text(
"Something went wrong",

View file

@ -235,14 +235,14 @@ class _WalletViewState extends ConsumerState<WalletView> {
await showDialog<void>(
context: context,
builder: (_) => const StackOkDialog(
title: "ChangeNOW not available for Epic Cash",
title: "Exchange not available for Epic Cash",
),
);
} else if (coin.name.endsWith("TestNet")) {
await showDialog<void>(
context: context,
builder: (_) => const StackOkDialog(
title: "ChangeNOW not available for test net coins",
title: "Exchange not available for test net coins",
),
);
} else {

View file

@ -15,7 +15,7 @@ class ExchangeDataLoadingService {
loadSimpleswapFloatingRateCurrencies(ref),
]);
} catch (e, s) {
Logging.instance.log("ChangeNowLoadingService.loadAll failed: $e\n$s",
Logging.instance.log("ExchangeDataLoadingService.loadAll failed: $e\n$s",
level: LogLevel.Error);
}
}

View file

@ -112,14 +112,14 @@ class SimpleSwapAPI {
payInAmount: json["amount_from"] as String,
payInAddress: json["address_from"] as String,
payInNetwork: "",
payInExtraId: json["extra_id_payIn"] as String,
payInTxid: json["tx_from"] as String,
payInExtraId: json["extra_id_from"] as String? ?? "",
payInTxid: json["tx_from"] as String? ?? "",
payOutCurrency: json["currency_to"] as String,
payOutAmount: json["amount_to"] as String,
payOutAddress: json["address_to"] as String,
payOutNetwork: "",
payOutExtraId: json["extra_id_to"] as String? ?? "",
payOutTxid: json["tx_to"] as String,
payOutTxid: json["tx_to"] as String? ?? "",
refundAddress: json["user_refund_address"] as String,
refundExtraId: json["user_refund_extra_id"] as String,
status: json["status"] as String,
@ -360,14 +360,14 @@ class SimpleSwapAPI {
payInAmount: json["amount_from"] as String,
payInAddress: json["address_from"] as String,
payInNetwork: "",
payInExtraId: json["extra_id_payIn"] as String,
payInTxid: json["tx_from"] as String,
payInExtraId: json["extra_id_from"] as String? ?? "",
payInTxid: json["tx_from"] as String? ?? "",
payOutCurrency: json["currency_to"] as String,
payOutAmount: json["amount_to"] as String,
payOutAddress: json["address_to"] as String,
payOutNetwork: "",
payOutExtraId: json["extra_id_to"] as String? ?? "",
payOutTxid: json["tx_to"] as String,
payOutTxid: json["tx_to"] as String? ?? "",
refundAddress: json["user_refund_address"] as String,
refundExtraId: json["user_refund_extra_id"] as String,
status: json["status"] as String,