Files
breez-sdk-liquid/packages/flutter/example/lib/utils/config.dart
Erdem Yerebasmaz 639ef0cca5 [Flutter] Fix relative path of packages (#353)
* Fix relative path on melos.yaml

* Mention current version on CHANGELOG.md

* Remove symlink for apache license

* Address typos & relative path issues on README.md

* Ignore Flutter example app on Melos.yaml

* Remove obsolete param from Config on example app

* Do not treat info messages as critical

* Update README of Dart/Flutter packages

Revert changes on topmost README

* Update pubspec.lock

* Make dart output directory if it does not exists

* Replace continue-on-error

Resume even if previous step fails, this approach displays errors on CI summary.

* Install Protoc as part of CI workflow

* Added init-sdk as part of just bootstrap recipe which installs protobuf
* Pinned freezed to <=2.5.2
2024-07-02 17:08:38 +03:00

36 lines
1.2 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? workingDir,
LiquidNetwork? network,
BigInt? paymentTimeoutSec,
double? zeroConfMinFeeRate,
}) {
return Config(
liquidElectrumUrl: liquidElectrumUrl ?? this.liquidElectrumUrl,
bitcoinElectrumUrl: bitcoinElectrumUrl ?? this.bitcoinElectrumUrl,
workingDir: workingDir ?? this.workingDir,
network: network ?? this.network,
paymentTimeoutSec: paymentTimeoutSec ?? this.paymentTimeoutSec,
zeroConfMinFeeRate: zeroConfMinFeeRate ?? this.zeroConfMinFeeRate,
);
}
}