mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 18:44:31 +00:00
fee estimation
This commit is contained in:
parent
f43ae8788d
commit
d08b5c9b22
2 changed files with 18 additions and 15 deletions
|
@ -2495,9 +2495,9 @@ class ParticlWallet extends CoinServiceAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
|
// int estimateTxFee({required int vSize, required int feeRatePerKB}) {
|
||||||
return vSize * (feeRatePerKB / 1000).ceil();
|
// return vSize * (feeRatePerKB / 1000).ceil();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// The coinselection algorithm decides whether or not the user is eligible to make the transaction
|
/// 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
|
/// with [satoshiAmountToSend] and [selectedTxFeeRate]. If so, it will call buildTrasaction() and return
|
||||||
|
@ -3463,14 +3463,14 @@ class ParticlWallet extends CoinServiceAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
|
// Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
|
||||||
return Amount(
|
// return Amount(
|
||||||
rawValue: BigInt.from(
|
// rawValue: BigInt.from(
|
||||||
((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() *
|
// ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() *
|
||||||
(feeRatePerKB / 1000).ceil()),
|
// (feeRatePerKB / 1000).ceil()),
|
||||||
fractionDigits: coin.decimals,
|
// fractionDigits: coin.decimals,
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
Future<Amount> sweepAllEstimate(int feeRate) async {
|
Future<Amount> sweepAllEstimate(int feeRate) async {
|
||||||
int available = 0;
|
int available = 0;
|
||||||
|
|
|
@ -53,14 +53,17 @@ class ParticlWallet extends Bip39HDWallet
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
|
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
|
||||||
// TODO: implement estimateTxFee
|
return vSize * (feeRatePerKB / 1000).ceil();
|
||||||
throw UnimplementedError();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
|
Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
|
||||||
// TODO: implement roughFeeEstimate
|
return Amount(
|
||||||
throw UnimplementedError();
|
rawValue: BigInt.from(
|
||||||
|
((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() *
|
||||||
|
(feeRatePerKB / 1000).ceil()),
|
||||||
|
fractionDigits: cryptoCurrency.fractionDigits,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
Loading…
Reference in a new issue