mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-26 04:26:00 +00:00
Update exchange_trade_view_model.dart
This commit is contained in:
parent
790799bc36
commit
1aa077cd68
1 changed files with 7 additions and 3 deletions
|
@ -4,6 +4,7 @@ import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||||
import 'package:cake_wallet/exchange/provider/changenow_exchange_provider.dart';
|
import 'package:cake_wallet/exchange/provider/changenow_exchange_provider.dart';
|
||||||
import 'package:cake_wallet/exchange/provider/exchange_provider.dart';
|
import 'package:cake_wallet/exchange/provider/exchange_provider.dart';
|
||||||
import 'package:cake_wallet/exchange/provider/exolix_exchange_provider.dart';
|
import 'package:cake_wallet/exchange/provider/exolix_exchange_provider.dart';
|
||||||
|
import 'package:cake_wallet/exchange/provider/mayachain_exchange.provider.dart';
|
||||||
import 'package:cake_wallet/exchange/provider/quantex_exchange_provider.dart';
|
import 'package:cake_wallet/exchange/provider/quantex_exchange_provider.dart';
|
||||||
import 'package:cake_wallet/exchange/provider/sideshift_exchange_provider.dart';
|
import 'package:cake_wallet/exchange/provider/sideshift_exchange_provider.dart';
|
||||||
import 'package:cake_wallet/exchange/provider/simpleswap_exchange_provider.dart';
|
import 'package:cake_wallet/exchange/provider/simpleswap_exchange_provider.dart';
|
||||||
|
@ -58,6 +59,9 @@ abstract class ExchangeTradeViewModelBase with Store {
|
||||||
case ExchangeProviderDescription.thorChain:
|
case ExchangeProviderDescription.thorChain:
|
||||||
_provider = ThorChainExchangeProvider(tradesStore: trades);
|
_provider = ThorChainExchangeProvider(tradesStore: trades);
|
||||||
break;
|
break;
|
||||||
|
case ExchangeProviderDescription.mayaChain:
|
||||||
|
_provider = MayaChainExchangeProvider(tradesStore: trades);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateItems();
|
_updateItems();
|
||||||
|
@ -111,11 +115,11 @@ abstract class ExchangeTradeViewModelBase with Store {
|
||||||
final output = sendViewModel.outputs.first;
|
final output = sendViewModel.outputs.first;
|
||||||
output.address = trade.inputAddress ?? '';
|
output.address = trade.inputAddress ?? '';
|
||||||
output.setCryptoAmount(trade.amount);
|
output.setCryptoAmount(trade.amount);
|
||||||
if (_provider is ThorChainExchangeProvider) output.memo = trade.memo;
|
if (_provider is ThorChainExchangeProvider || _provider is MayaChainExchangeProvider) output.memo = trade.memo;
|
||||||
if (trade.isSendAll == true) output.sendAll = true;
|
if (trade.isSendAll == true) output.sendAll = true;
|
||||||
sendViewModel.selectedCryptoCurrency = trade.from;
|
sendViewModel.selectedCryptoCurrency = trade.from;
|
||||||
final pendingTransaction = await sendViewModel.createTransaction(provider: _provider);
|
final pendingTransaction = await sendViewModel.createTransaction(provider: _provider);
|
||||||
if (_provider is ThorChainExchangeProvider) {
|
if (_provider is ThorChainExchangeProvider || _provider is MayaChainExchangeProvider) {
|
||||||
trade.id = pendingTransaction?.id ?? '';
|
trade.id = pendingTransaction?.id ?? '';
|
||||||
trades.add(trade);
|
trades.add(trade);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +153,7 @@ abstract class ExchangeTradeViewModelBase with Store {
|
||||||
final tagTo = tradesStore.trade!.to.tag != null ? '${tradesStore.trade!.to.tag}' + ' ' : '';
|
final tagTo = tradesStore.trade!.to.tag != null ? '${tradesStore.trade!.to.tag}' + ' ' : '';
|
||||||
items.clear();
|
items.clear();
|
||||||
|
|
||||||
if (trade.provider != ExchangeProviderDescription.thorChain)
|
if (trade.provider != ExchangeProviderDescription.thorChain && trade.provider != ExchangeProviderDescription.mayaChain)
|
||||||
items.add(
|
items.add(
|
||||||
ExchangeTradeItem(
|
ExchangeTradeItem(
|
||||||
title: "${trade.provider.title} ${S.current.id}",
|
title: "${trade.provider.title} ${S.current.id}",
|
||||||
|
|
Loading…
Reference in a new issue