mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-01 18:07:44 +00:00
73 lines
2.1 KiB
Dart
73 lines
2.1 KiB
Dart
import 'package:cake_wallet/entities/wallet_type.dart';
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
|
import 'package:cake_wallet/entities/enumerable_item.dart';
|
|
|
|
class TransactionPriority extends EnumerableItem<int> with Serializable<int> {
|
|
const TransactionPriority({String title, int raw})
|
|
: super(title: title, raw: raw);
|
|
|
|
static const all = [
|
|
TransactionPriority.slow,
|
|
TransactionPriority.regular,
|
|
TransactionPriority.medium,
|
|
TransactionPriority.fast,
|
|
TransactionPriority.fastest
|
|
];
|
|
static const slow = TransactionPriority(title: 'Slow', raw: 0);
|
|
static const regular = TransactionPriority(title: 'Regular', raw: 1);
|
|
static const medium = TransactionPriority(title: 'Medium', raw: 2);
|
|
static const fast = TransactionPriority(title: 'Fast', raw: 3);
|
|
static const fastest = TransactionPriority(title: 'Fastest', raw: 4);
|
|
static const standart = slow;
|
|
|
|
|
|
static List<TransactionPriority> forWalletType(WalletType type) {
|
|
switch (type) {
|
|
case WalletType.monero:
|
|
return TransactionPriority.all;
|
|
case WalletType.bitcoin:
|
|
return [
|
|
TransactionPriority.slow,
|
|
TransactionPriority.regular,
|
|
TransactionPriority.fast
|
|
];
|
|
default:
|
|
return [];
|
|
}
|
|
}
|
|
|
|
static TransactionPriority deserialize({int raw}) {
|
|
switch (raw) {
|
|
case 0:
|
|
return slow;
|
|
case 1:
|
|
return regular;
|
|
case 2:
|
|
return medium;
|
|
case 3:
|
|
return fast;
|
|
case 4:
|
|
return fastest;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
switch (this) {
|
|
case TransactionPriority.slow:
|
|
return S.current.transaction_priority_slow;
|
|
case TransactionPriority.regular:
|
|
return S.current.transaction_priority_regular;
|
|
case TransactionPriority.medium:
|
|
return S.current.transaction_priority_medium;
|
|
case TransactionPriority.fast:
|
|
return S.current.transaction_priority_fast;
|
|
case TransactionPriority.fastest:
|
|
return S.current.transaction_priority_fastest;
|
|
default:
|
|
return '';
|
|
}
|
|
}
|
|
}
|