mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
fee estimation
This commit is contained in:
parent
f43ae8788d
commit
621aff4796
2 changed files with 19 additions and 15 deletions
|
@ -2329,9 +2329,9 @@ class NamecoinWallet extends CoinServiceAPI
|
|||
}
|
||||
}
|
||||
|
||||
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
|
||||
return vSize * (feeRatePerKB / 1000).ceil();
|
||||
}
|
||||
// int estimateTxFee({required int vSize, required int feeRatePerKB}) {
|
||||
// return vSize * (feeRatePerKB / 1000).ceil();
|
||||
// }
|
||||
|
||||
/// The coinselection algorithm decides whether or not the user is eligible to make the transaction
|
||||
/// with [satoshiAmountToSend] and [selectedTxFeeRate]. If so, it will call buildTrasaction() and return
|
||||
|
@ -3405,14 +3405,14 @@ class NamecoinWallet extends CoinServiceAPI
|
|||
}
|
||||
|
||||
// TODO: Check if this is the correct formula for namecoin
|
||||
Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
|
||||
return Amount(
|
||||
rawValue: BigInt.from(
|
||||
((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() *
|
||||
(feeRatePerKB / 1000).ceil()),
|
||||
fractionDigits: coin.decimals,
|
||||
);
|
||||
}
|
||||
// Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
|
||||
// return Amount(
|
||||
// rawValue: BigInt.from(
|
||||
// ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() *
|
||||
// (feeRatePerKB / 1000).ceil()),
|
||||
// fractionDigits: coin.decimals,
|
||||
// );
|
||||
// }
|
||||
|
||||
Future<Amount> sweepAllEstimate(int feeRate) async {
|
||||
int available = 0;
|
||||
|
|
|
@ -53,14 +53,18 @@ class NamecoinWallet extends Bip39HDWallet
|
|||
|
||||
@override
|
||||
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
|
||||
// TODO: implement estimateTxFee
|
||||
throw UnimplementedError();
|
||||
return vSize * (feeRatePerKB / 1000).ceil();
|
||||
}
|
||||
|
||||
// TODO: [prio=low] Check if this is the correct formula for namecoin. ECF
|
||||
@override
|
||||
Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
|
||||
// TODO: implement roughFeeEstimate
|
||||
throw UnimplementedError();
|
||||
return Amount(
|
||||
rawValue: BigInt.from(
|
||||
((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() *
|
||||
(feeRatePerKB / 1000).ceil()),
|
||||
fractionDigits: cryptoCurrency.fractionDigits,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
Loading…
Reference in a new issue