stack_wallet/lib/wallets/wallet/wallet_mixin_interfaces/rbf_interface.dart

24 lines
613 B
Dart
Raw Normal View History

2024-06-15 17:36:53 +00:00
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
}