mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-25 05:58:42 +01:00
CWA-212 | created exchange template and exchange template store; added exchange cards to exchange template page; added exchange templates to exchange page; added provider icons to provider picker
This commit is contained in:
@@ -33,6 +33,10 @@ abstract class ExchangeStoreBase with Store {
|
||||
provider = initialProvider;
|
||||
depositCurrency = initialDepositCurrency;
|
||||
receiveCurrency = initialReceiveCurrency;
|
||||
depositAmount = '';
|
||||
receiveAmount = '';
|
||||
depositAddress = '';
|
||||
receiveAddress = '';
|
||||
limitsState = LimitsInitialState();
|
||||
tradeState = ExchangeTradeStateInitial();
|
||||
_cryptoNumberFormat = NumberFormat()..maximumFractionDigits = 12;
|
||||
@@ -63,6 +67,12 @@ abstract class ExchangeStoreBase with Store {
|
||||
@observable
|
||||
String receiveAmount;
|
||||
|
||||
@observable
|
||||
String depositAddress;
|
||||
|
||||
@observable
|
||||
String receiveAddress;
|
||||
|
||||
@observable
|
||||
bool isValid;
|
||||
|
||||
@@ -71,10 +81,6 @@ abstract class ExchangeStoreBase with Store {
|
||||
|
||||
Box<Trade> trades;
|
||||
|
||||
String depositAddress;
|
||||
|
||||
String receiveAddress;
|
||||
|
||||
WalletStore walletStore;
|
||||
|
||||
Limits limits;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import 'dart:async';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:cake_wallet/src/domain/exchange/exchange_template.dart';
|
||||
|
||||
part 'exchange_template_store.g.dart';
|
||||
|
||||
class ExchangeTemplateStore = ExchangeTemplateBase with _$ExchangeTemplateStore;
|
||||
|
||||
abstract class ExchangeTemplateBase with Store {
|
||||
ExchangeTemplateBase({this.templateSource}) {
|
||||
templates = ObservableList<ExchangeTemplate>();
|
||||
update();
|
||||
}
|
||||
|
||||
@observable
|
||||
ObservableList<ExchangeTemplate> templates;
|
||||
|
||||
Box<ExchangeTemplate> templateSource;
|
||||
|
||||
@action
|
||||
void update() =>
|
||||
templates.replaceRange(0, templates.length, templateSource.values.toList());
|
||||
|
||||
@action
|
||||
Future addTemplate({String amount, String depositCurrency, String receiveCurrency,
|
||||
String provider, String depositAddress, String receiveAddress}) async {
|
||||
final template = ExchangeTemplate(
|
||||
amount: amount,
|
||||
depositCurrency: depositCurrency,
|
||||
receiveCurrency: receiveCurrency,
|
||||
provider: provider,
|
||||
depositAddress: depositAddress,
|
||||
receiveAddress: receiveAddress);
|
||||
await templateSource.add(template);
|
||||
}
|
||||
|
||||
@action
|
||||
Future remove({ExchangeTemplate template}) async => await template.delete();
|
||||
}
|
||||
Reference in New Issue
Block a user