cake_wallet/lib/exchange/exchange_provider_description.dart
Omar Hatem c50eeee58b
CW 68 exchange automatic rate selector (#472)
* Add 'Exchange provider picker'
Save user selections

* Save user's exchange providers selection

* Add text for selected providers availability

* Fix selected providers not updating

* Load limits based on highest maximum in the selected providers

* Change received and deposit amount to be the best value from the selected providers

* Add provider name next to Trade ID
Set selected provider based on amount calculated

* Grey out providers who doesn't support selected currency pair

* Fix disabled providers

* Add Provider logo in Confirm Screen

* Only choose a provider if it satisfies its limits

* Fix amount validation

* Fix typo in error message

* Add a queue of possible exchange providers sorted by the best rate to try next if one failed

* Fix string locale typo

* Add Localization for other languages

* Add Placeholder text when there are no providers selected

* Check Exchange provider availability before creating a trade

* Fix "Fixed Rate" changing unconditionally

* Enable "convert to" field regardless of the provider

* Remove "Choose one" from providers picker

* Merge Master

* Fix Conflicts with master

* Add missing isEnabled field in simple swap provider
2022-09-01 15:12:38 +01:00

39 lines
1.3 KiB
Dart

import 'package:cw_core/enumerable_item.dart';
class ExchangeProviderDescription extends EnumerableItem<int>
with Serializable<int> {
const ExchangeProviderDescription({String title, int raw, this.horizontalLogo = false, this.image})
: super(title: title, raw: raw);
final bool horizontalLogo;
final String image;
static const xmrto = ExchangeProviderDescription(title: 'XMR.TO', raw: 0, image: 'assets/images/xmrto.png');
static const changeNow =
ExchangeProviderDescription(title: 'ChangeNOW', raw: 1, image: 'assets/images/changenow.png');
static const morphToken =
ExchangeProviderDescription(title: 'MorphToken', raw: 2, image: 'assets/images/morph.png');
static const sideShift =
ExchangeProviderDescription(title: 'SideShift', raw: 3, image: 'assets/images/sideshift.png');
static const simpleSwap =
ExchangeProviderDescription(title: 'SimpleSwap', raw: 4, image: 'assets/images/simpleSwap.png');
static ExchangeProviderDescription deserialize({int raw}) {
switch (raw) {
case 0:
return xmrto;
case 1:
return changeNow;
case 2:
return morphToken;
case 3:
return sideShift;
case 4:
return simpleSwap;
default:
return null;
}
}
}