Rename priority value to tip

This commit is contained in:
OmarHatem 2023-01-12 15:53:20 +02:00
parent a96f91fbee
commit 9c160e94eb
2 changed files with 6 additions and 6 deletions

View file

@ -30,7 +30,7 @@ class EthereumClient {
Future<List<int>> getEstimatedGasForPriorities() async {
final result = await Future.wait(EthereumTransactionPriority.all.map((priority) =>
_client.estimateGas(
maxPriorityFeePerGas: EtherAmount.fromUnitAndValue(EtherUnit.gwei, priority.value))));
maxPriorityFeePerGas: EtherAmount.fromUnitAndValue(EtherUnit.gwei, priority.tip))));
return result.map((e) => e.toInt()).toList();
}

View file

@ -1,18 +1,18 @@
import 'package:cw_core/transaction_priority.dart';
class EthereumTransactionPriority extends TransactionPriority {
final int value;
final int tip;
const EthereumTransactionPriority({required String title, required int raw, required this.value})
const EthereumTransactionPriority({required String title, required int raw, required this.tip})
: super(title: title, raw: raw);
static const List<EthereumTransactionPriority> all = [fast, medium, slow];
static const EthereumTransactionPriority slow =
EthereumTransactionPriority(title: 'Slow', raw: 0, value: 2);
EthereumTransactionPriority(title: 'Slow', raw: 0, tip: 2);
static const EthereumTransactionPriority medium =
EthereumTransactionPriority(title: 'Medium', raw: 1, value: 5);
EthereumTransactionPriority(title: 'Medium', raw: 1, tip: 5);
static const EthereumTransactionPriority fast =
EthereumTransactionPriority(title: 'Fast', raw: 2, value: 10);
EthereumTransactionPriority(title: 'Fast', raw: 2, tip: 10);
static EthereumTransactionPriority deserialize({required int raw}) {
switch (raw) {