getFeeEstimates method
Returns fee rates by confirmation target, in satoshis per virtual byte.
Implementation
@override
Future<List<BtcFeeEstimate>> getFeeEstimates([BtcNetwork? network]) async {
Future<List<BtcFeeEstimate>> instrumentationOperation() async {
final operationScope = _state.flowScope.capture(replace: false);
await operationScope.ready();
operationScope.check();
final configured = _btcService.getNetworks((_state.projectSettings?.networks?.map((networkGroup) => (networkGroup.chainName == "bitcoin" ? networkGroup.networks?.map((networkConfiguration) => NetworkData(chain: "BTC", networkId: networkConfiguration.networkId, name: networkConfiguration.name, displayName: (networkConfiguration.vanityName == "" ? networkConfiguration.name : (networkConfiguration.vanityName ?? networkConfiguration.name)), rpcUrls: NetworkRpcUrls(http: [...(networkConfiguration.privateCustomerRpcUrls ?? <String>[]), ...networkConfiguration.rpcUrls]), blockExplorerUrls: (networkConfiguration.blockExplorerUrls ?? <String>[]), iconUrl: firstOrNull(networkConfiguration.iconUrls), nativeCurrency: networkConfiguration.nativeCurrency, cluster: networkConfiguration.cluster, genesisHash: networkConfiguration.genesisHash, testnet: (networkConfiguration.testnet ?? false))).toList() ?? const [] : <NetworkData>[])).toList() ?? const []).expand((items) => items).toList(), (_btcState.btcNetworks ?? <BtcNetwork>[]));
operationScope.check();
final resolvedNetwork = (network ?? firstOrNull(configured));
if (resolvedNetwork == null) {
throw DynamicStateException("no Bitcoin networks configured; enable a dashboard network or provide one with useBtc");
}
operationScope.check();
final result = await _btcService.getFeeEstimates(resolvedNetwork);
operationScope.check();
return result;
}
return await _api.instrumentation.runAsync("btc.getFeeEstimates", instrumentationOperation);
}