Files
breez-sdk-liquid/packages/flutter/example/lib/utils/config.dart
Ross Savage 0da35259fe Allow custom pay_onchain claim fees (#391)
* Allow optional fee rate for pay onchain BTC claim

* Add recommended_fees method

* Fix example Config

* Address review comments
2024-07-15 17:38:10 +02:00

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,
);
}
}