stack_wallet/lib/wallets/wallet/wallet_mixin_interfaces/rbf_interface.dart
2024-06-20 10:39:22 -06:00

23 lines
613 B
Dart

import '../../crypto_currency/interfaces/electrumx_currency_interface.dart';
import 'electrumx_interface.dart';
typedef TxSize = ({int real, int virtual});
mixin RbfInterface<T extends ElectrumXCurrencyInterface>
on ElectrumXInterface<T> {
// TODO actually save the size
Future<TxSize?> getVSize(String txid) async {
final tx = await electrumXCachedClient.getTransaction(
txHash: txid,
cryptoCurrency: cryptoCurrency,
);
try {
return (real: tx["size"] as int, virtual: tx["vsize"] as int);
} catch (_) {
return null;
}
}
// TODO more RBF specific logic
}