mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2025-12-19 15:04:24 +01:00
* Allow optional fee rate for pay onchain BTC claim * Add recommended_fees method * Fix example Config * Address review comments
38 lines
1.3 KiB
Dart
38 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_breez_liquid/flutter_breez_liquid.dart';
|
|
import 'package:path_provider/path_provider.dart';
|
|
|
|
Future<Config> getConfig({
|
|
LiquidNetwork network = LiquidNetwork.mainnet,
|
|
}) async {
|
|
debugPrint("Getting default SDK config for network: $network");
|
|
final defaultConf = defaultConfig(network: network);
|
|
debugPrint("Getting SDK config");
|
|
final workingDir = await getApplicationDocumentsDirectory();
|
|
return defaultConf.copyWith(
|
|
workingDir: workingDir.path,
|
|
);
|
|
}
|
|
|
|
extension ConfigCopyWith on Config {
|
|
Config copyWith({
|
|
String? liquidElectrumUrl,
|
|
String? bitcoinElectrumUrl,
|
|
String? mempoolspaceUrl,
|
|
String? workingDir,
|
|
LiquidNetwork? network,
|
|
BigInt? paymentTimeoutSec,
|
|
int? zeroConfMinFeeRateMsat,
|
|
}) {
|
|
return Config(
|
|
liquidElectrumUrl: liquidElectrumUrl ?? this.liquidElectrumUrl,
|
|
bitcoinElectrumUrl: bitcoinElectrumUrl ?? this.bitcoinElectrumUrl,
|
|
mempoolspaceUrl: mempoolspaceUrl ?? this.mempoolspaceUrl,
|
|
workingDir: workingDir ?? this.workingDir,
|
|
network: network ?? this.network,
|
|
paymentTimeoutSec: paymentTimeoutSec ?? this.paymentTimeoutSec,
|
|
zeroConfMinFeeRateMsat: zeroConfMinFeeRateMsat ?? this.zeroConfMinFeeRateMsat,
|
|
);
|
|
}
|
|
}
|