cake_wallet/lib/exchange/exchange_provider_description.dart
Konstantin Ullrich cef3029f6f
Cw 473 exchange refactoring (#1126)
* CW-473 Remove deprecated Exchanges

* CW-473 Clean up Exchange Code

* CW-473 Add Decimals to Crypto Enums

* CW-473 Fix minor merge error

* CW-473 Fix minor merge error

* CW-473 Fix FAQ Locals

* CW-473 Apply requested changes

* CW-473 Show Error if Exchange Provider is not supported anymore

* CW-473 Implement Requested Changes
2023-10-25 23:58:25 +03:00

50 lines
1.8 KiB
Dart

import 'package:cw_core/enumerable_item.dart';
class ExchangeProviderDescription extends EnumerableItem<int> with Serializable<int> {
const ExchangeProviderDescription(
{required String title, required int raw, required this.image, this.horizontalLogo = false})
: 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 const trocador =
ExchangeProviderDescription(title: 'Trocador', raw: 5, image: 'assets/images/trocador.png');
static const exolix =
ExchangeProviderDescription(title: 'Exolix', raw: 6, image: 'assets/images/exolix.png');
static const all = ExchangeProviderDescription(title: 'All trades', raw: 7, image: '');
static ExchangeProviderDescription deserialize({required int raw}) {
switch (raw) {
case 0:
return xmrto;
case 1:
return changeNow;
case 2:
return morphToken;
case 3:
return sideShift;
case 4:
return simpleSwap;
case 5:
return trocador;
case 6:
return exolix;
case 7:
return all;
default:
throw Exception('Unexpected token: $raw for ExchangeProviderDescription deserialize');
}
}
}