From fb35de9689d15fa163d7a1ab94e2ed75d6ce31f1 Mon Sep 17 00:00:00 2001 From: BitcoinZavior Date: Wed, 27 Mar 2024 17:54:00 -0400 Subject: [PATCH 1/6] check the precompiled binaries --- .github/workflows/precompile_binaries.yml | 48 + CHANGELOG.md | 40 +- README.md | 58 +- analysis_options.yaml | 16 +- android/CMakeLists.txt | 47 - android/build.gradle | 11 +- assets/release.config.txt | 2 - cargokit/.github/workflows/check_and_lint.yml | 26 + .../workflows/test_example_plugin_build.yml | 82 + cargokit/.gitignore | 4 + cargokit/LICENSE | 39 + cargokit/README | 8 + cargokit/build_pod.sh | 58 + cargokit/build_tool/README.md | 2 + cargokit/build_tool/analysis_options.yaml | 31 + cargokit/build_tool/bin/build_tool.dart | 5 + cargokit/build_tool/lib/build_tool.dart | 5 + .../lib/src/android_environment.dart | 192 + .../lib/src/artifacts_provider.dart | 263 + cargokit/build_tool/lib/src/build_cmake.dart | 37 + cargokit/build_tool/lib/src/build_gradle.dart | 46 + cargokit/build_tool/lib/src/build_pod.dart | 86 + cargokit/build_tool/lib/src/build_tool.dart | 268 + cargokit/build_tool/lib/src/builder.dart | 195 + cargokit/build_tool/lib/src/cargo.dart | 45 + cargokit/build_tool/lib/src/crate_hash.dart | 121 + cargokit/build_tool/lib/src/environment.dart | 65 + cargokit/build_tool/lib/src/logging.dart | 49 + cargokit/build_tool/lib/src/options.dart | 306 + .../lib/src/precompile_binaries.dart | 199 + cargokit/build_tool/lib/src/rustup.dart | 133 + cargokit/build_tool/lib/src/target.dart | 137 + cargokit/build_tool/lib/src/util.dart | 169 + .../build_tool/lib/src/verify_binaries.dart | 81 + cargokit/build_tool/pubspec.lock | 453 + cargokit/build_tool/pubspec.yaml | 30 + cargokit/build_tool/test/builder_test.dart | 28 + cargokit/build_tool/test/cargo_test.dart | 28 + cargokit/build_tool/test/options_test.dart | 75 + cargokit/build_tool/test/rustup_test.dart | 66 + cargokit/cmake/cargokit.cmake | 97 + cargokit/cmake/resolve_symlinks.ps1 | 27 + cargokit/docs/architecture.md | 104 + cargokit/docs/precompiled_binaries.md | 95 + cargokit/gradle/plugin.gradle | 166 + cargokit/run_build_tool.cmd | 91 + cargokit/run_build_tool.sh | 94 + cargokit_options.yaml | 2 + check_precompiled.sh | 11 + example/ios/Runner.xcodeproj/project.pbxproj | 18 + example/lib/bdk_library.dart | 67 +- example/lib/multi_sig_wallet.dart | 39 +- example/lib/simple_wallet.dart | 10 +- example/macos/Podfile | 2 +- example/macos/Podfile.lock | 7 +- example/test/bdk_flutter_unit_test.dart | 335 - flutter_rust_bridge.yaml | 5 + ios/Classes/bdk_flutter.c | 0 ios/Classes/bindings.h | 646 - ios/Classes/frb_generated.h | 1255 + ios/bdk_flutter.podspec | 84 +- lib/bdk_flutter.dart | 92 +- lib/src/generated/api/blockchain.dart | 324 + lib/src/generated/api/blockchain.freezed.dart | 986 + lib/src/generated/api/descriptor.dart | 227 + lib/src/generated/api/error.dart | 338 + lib/src/generated/api/error.freezed.dart | 25235 ++++++++++++++++ lib/src/generated/api/key.dart | 217 + lib/src/generated/api/psbt.dart | 91 + lib/src/generated/api/types.dart | 872 + lib/src/generated/api/types.freezed.dart | 1888 ++ lib/src/generated/api/wallet.dart | 214 + lib/src/generated/bindings.dart | 4918 --- lib/src/generated/bridge_definitions.dart | 1233 - .../generated/bridge_definitions.freezed.dart | 17645 ----------- lib/src/generated/frb_generated.dart | 6943 +++++ lib/src/generated/frb_generated.io.dart | 6595 ++++ lib/src/generated/frb_generated.web.dart | 3332 ++ lib/src/root.dart | 1269 +- lib/src/utils/custom_objects.dart | 7 - lib/src/utils/exceptions.dart | 23 +- lib/src/utils/loader.dart | 87 - lib/src/utils/utils.dart | 64 +- macos/Classes/EnforceBundling.swift | 4 - macos/Classes/bdk_flutter.c | 0 macos/Classes/bindings.h | 646 - macos/bdk_flutter.podspec | 84 +- makefile | 29 + pubspec.lock | 40 +- pubspec.yaml | 12 +- rust/Cargo.lock | 1375 +- rust/Cargo.toml | 11 +- rust/android.sh | 29 - rust/build.rs | 45 - rust/cargokit.yaml | 10 + rust/compress.sh | 11 - rust/copy.sh | 21 - rust/darwin.sh | 41 - rust/makefile | 57 - rust/src/{ => api}/blockchain.rs | 203 +- rust/src/api/descriptor.rs | 267 + rust/src/api/error.rs | 354 + rust/src/api/key.rs | 281 + rust/src/api/mod.rs | 7 + rust/src/api/psbt.rs | 74 + rust/src/api/types.rs | 824 + rust/src/api/wallet.rs | 272 + rust/src/bridge_generated.io.rs | 1585 - rust/src/bridge_generated.rs | 3676 --- rust/src/bridge_generated.web.rs | 623 - rust/src/descriptor.rs | 365 - rust/src/error.rs | 188 - rust/src/frb_generated.io.rs | 3878 +++ rust/src/frb_generated.rs | 5871 ++++ rust/src/frb_generated.web.rs | 2217 ++ rust/src/key.rs | 317 - rust/src/lib.rs | 11 +- rust/src/psbt.rs | 156 - rust/src/r_api.rs | 639 - rust/src/types.rs | 500 - rust/src/wallet.rs | 482 - rust/unittest.sh | 31 - test/bdk_flutter_test.dart | 90 +- test/bdk_flutter_test.mocks.dart | 1703 +- 124 files changed, 69688 insertions(+), 36650 deletions(-) create mode 100644 .github/workflows/precompile_binaries.yml delete mode 100644 android/CMakeLists.txt delete mode 100644 assets/release.config.txt create mode 100644 cargokit/.github/workflows/check_and_lint.yml create mode 100644 cargokit/.github/workflows/test_example_plugin_build.yml create mode 100644 cargokit/.gitignore create mode 100644 cargokit/LICENSE create mode 100644 cargokit/README create mode 100755 cargokit/build_pod.sh create mode 100644 cargokit/build_tool/README.md create mode 100644 cargokit/build_tool/analysis_options.yaml create mode 100644 cargokit/build_tool/bin/build_tool.dart create mode 100644 cargokit/build_tool/lib/build_tool.dart create mode 100644 cargokit/build_tool/lib/src/android_environment.dart create mode 100644 cargokit/build_tool/lib/src/artifacts_provider.dart create mode 100644 cargokit/build_tool/lib/src/build_cmake.dart create mode 100644 cargokit/build_tool/lib/src/build_gradle.dart create mode 100644 cargokit/build_tool/lib/src/build_pod.dart create mode 100644 cargokit/build_tool/lib/src/build_tool.dart create mode 100644 cargokit/build_tool/lib/src/builder.dart create mode 100644 cargokit/build_tool/lib/src/cargo.dart create mode 100644 cargokit/build_tool/lib/src/crate_hash.dart create mode 100644 cargokit/build_tool/lib/src/environment.dart create mode 100644 cargokit/build_tool/lib/src/logging.dart create mode 100644 cargokit/build_tool/lib/src/options.dart create mode 100644 cargokit/build_tool/lib/src/precompile_binaries.dart create mode 100644 cargokit/build_tool/lib/src/rustup.dart create mode 100644 cargokit/build_tool/lib/src/target.dart create mode 100644 cargokit/build_tool/lib/src/util.dart create mode 100644 cargokit/build_tool/lib/src/verify_binaries.dart create mode 100644 cargokit/build_tool/pubspec.lock create mode 100644 cargokit/build_tool/pubspec.yaml create mode 100644 cargokit/build_tool/test/builder_test.dart create mode 100644 cargokit/build_tool/test/cargo_test.dart create mode 100644 cargokit/build_tool/test/options_test.dart create mode 100644 cargokit/build_tool/test/rustup_test.dart create mode 100644 cargokit/cmake/cargokit.cmake create mode 100644 cargokit/cmake/resolve_symlinks.ps1 create mode 100644 cargokit/docs/architecture.md create mode 100644 cargokit/docs/precompiled_binaries.md create mode 100644 cargokit/gradle/plugin.gradle create mode 100644 cargokit/run_build_tool.cmd create mode 100755 cargokit/run_build_tool.sh create mode 100644 cargokit_options.yaml create mode 100644 check_precompiled.sh delete mode 100644 example/test/bdk_flutter_unit_test.dart create mode 100644 flutter_rust_bridge.yaml create mode 100644 ios/Classes/bdk_flutter.c delete mode 100644 ios/Classes/bindings.h create mode 100644 ios/Classes/frb_generated.h create mode 100644 lib/src/generated/api/blockchain.dart create mode 100644 lib/src/generated/api/blockchain.freezed.dart create mode 100644 lib/src/generated/api/descriptor.dart create mode 100644 lib/src/generated/api/error.dart create mode 100644 lib/src/generated/api/error.freezed.dart create mode 100644 lib/src/generated/api/key.dart create mode 100644 lib/src/generated/api/psbt.dart create mode 100644 lib/src/generated/api/types.dart create mode 100644 lib/src/generated/api/types.freezed.dart create mode 100644 lib/src/generated/api/wallet.dart delete mode 100644 lib/src/generated/bindings.dart delete mode 100644 lib/src/generated/bridge_definitions.dart delete mode 100644 lib/src/generated/bridge_definitions.freezed.dart create mode 100644 lib/src/generated/frb_generated.dart create mode 100644 lib/src/generated/frb_generated.io.dart create mode 100644 lib/src/generated/frb_generated.web.dart delete mode 100644 lib/src/utils/custom_objects.dart delete mode 100644 lib/src/utils/loader.dart delete mode 100644 macos/Classes/EnforceBundling.swift create mode 100644 macos/Classes/bdk_flutter.c delete mode 100644 macos/Classes/bindings.h create mode 100644 makefile delete mode 100644 rust/android.sh delete mode 100644 rust/build.rs create mode 100644 rust/cargokit.yaml delete mode 100644 rust/compress.sh delete mode 100644 rust/copy.sh delete mode 100644 rust/darwin.sh delete mode 100755 rust/makefile rename rust/src/{ => api}/blockchain.rs (52%) create mode 100644 rust/src/api/descriptor.rs create mode 100644 rust/src/api/error.rs create mode 100644 rust/src/api/key.rs create mode 100644 rust/src/api/mod.rs create mode 100644 rust/src/api/psbt.rs create mode 100644 rust/src/api/types.rs create mode 100644 rust/src/api/wallet.rs delete mode 100644 rust/src/bridge_generated.io.rs delete mode 100644 rust/src/bridge_generated.rs delete mode 100644 rust/src/bridge_generated.web.rs delete mode 100644 rust/src/descriptor.rs delete mode 100644 rust/src/error.rs create mode 100644 rust/src/frb_generated.io.rs create mode 100644 rust/src/frb_generated.rs create mode 100644 rust/src/frb_generated.web.rs delete mode 100644 rust/src/key.rs delete mode 100644 rust/src/psbt.rs delete mode 100644 rust/src/r_api.rs delete mode 100644 rust/src/types.rs delete mode 100644 rust/src/wallet.rs delete mode 100644 rust/unittest.sh diff --git a/.github/workflows/precompile_binaries.yml b/.github/workflows/precompile_binaries.yml new file mode 100644 index 00000000..183bb5e7 --- /dev/null +++ b/.github/workflows/precompile_binaries.yml @@ -0,0 +1,48 @@ +on: + push: + branches: [v0.31.0-dev, master] + +name: Precompile Binaries + +jobs: + Precompile: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-20.04 + - macOS-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Configure Cargo.toml optimizations + run: | + mkdir -p .cargo + echo "[profile.release]" >> .cargo/config.toml + echo "opt-level = 'z'" >> .cargo/config.toml + echo "lto = true" >> .cargo/config.toml + echo "codegen-units = 1" >> .cargo/config.toml + echo "panic = 'abort'" >> .cargo/config.toml + - uses: dart-lang/setup-dart@v1 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + - name: Precompile (with iOS) + if: (matrix.os == 'macOS-latest') + run: dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=LtbLightning/bdk-flutter + working-directory: cargokit/build_tool + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + PRIVATE_KEY: ${{ secrets.CARGOKIT_PRIVATE_KEY }} + - name: Precompile (with Android) + if: (matrix.os == 'ubuntu-20.04') + run: dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=LtbLightning/bdk-flutter --android-sdk-location=/usr/local/lib/android/sdk --android-ndk-version=24.0.8215888 --android-min-sdk-version=23 + working-directory: cargokit/build_tool + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + PRIVATE_KEY: ${{ secrets.CARGOKIT_PRIVATE_KEY }} diff --git a/CHANGELOG.md b/CHANGELOG.md index babe3951..b78db854 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,24 +1,34 @@ +[0.31.0-dev] +Updated Rust and Flutter dependencies. +#### APIs added +- Add sealed class `Auth` in `RpcConfig`. +- Made `PartiallySignedTransaction` class mutable. + +#### Changed +- Replace `AddressIndex`'s `new` with`increase`. +- Renamed `Address`'s create to `fromString`. +- txBuilder.finish returns a tuple. + +#### Fixed +- Functions hang indefinitely on iOs devices. +- Thread 'frb_workerpool' panicked. + ## [0.30.0] Updated Rust and Flutter dependencies. macOs support bug resolved - #### APIs added - Add BIP-86 descriptor template - ## [0.29.2] Support macOs and unit testing. - Updated flutter dependencies. ## [0.29.1] Updated Rust and Flutter dependencies. - Exposed strongly-typed exceptions. ## [0.29.0] Support Dart 3. - Updated Rust and Flutter dependencies. #### APIs added - Add `isMine` method to `Wallet`. @@ -41,7 +51,6 @@ Updated Rust and Flutter dependencies. ## [0.28.0] Updated Rust ( Bdk to latest version 0.28.0 ) and Flutter dependencies. - #### APIs added - Expose `Address` class's `payload` and `network` functions - Add `fromScript` constructor to `Address` class @@ -55,13 +64,11 @@ Updated Rust ( Bdk to latest version 0.28.0 ) and Flutter dependencies. ## [0.27.1] Updated Rust ( Bdk to latest version 0.27.1 ) and Flutter dependencies. - #### APIs added - New `Transaction` class that can be created from or serialized to consensus encoded bytes. - Add estimateFee(int Target) function for `Blockchain` - Add getInternalAddress() function for `Wallet` - Add AddressIndex.reset(int index) & AddressIndex.peek(int index) - #### APIs changed - partiallySignedTransaction.extractTx() returns a `Transaction` instead of a the transaction bytes. - blockchain.broadcast() takes a `Transaction` instead of a `PartiallySignedTransaction` @@ -78,13 +85,9 @@ Updated Rust ( Bdk to latest version 0.27.1 ) and Flutter dependencies. ## [0.3.0] Updated Rust ( Bdk to latest version 0.26.0 ) and Flutter dependencies. - #### APIs changed - - The descriptor and changeDescriptor arguments on the wallet constructor now take a `Descriptor` instead of a String. - #### APIs added - - Added RpcConfig, BlockchainConfig.rpc - Added Descriptor type with the following named constructors: - Default `create` constructor, that requires a descriptor in String format and a Network @@ -97,37 +100,24 @@ Updated Rust ( Bdk to latest version 0.26.0 ) and Flutter dependencies. - asString returns the public version of the output descriptor in String format - asPrivateString returns the private version of the output descriptor if available, otherwise, return the public version -### Fixed - -- Dependencies Upgraded - ## [0.2.3] - ### Fixed - - pub.dev analysis score ## [0.2.2] - ### Fixed - - pub.dev analysis score ## [0.2.1] - ### Fixed - - pub.dev static analysis warning - removing internal helper functions from public api ## [0.2.0] - Updated API to match bdk-ffi ## [0.1.4] - #### Functionality Added - - Generate Mnemonic method - Create Descriptors - Create Extended Key diff --git a/README.md b/README.md index 3439fecb..d30eea37 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ To use the `bdk_flutter` package in your project, add it as a dependency in your ```dart dependencies: - bdk_flutter: ^0.30.0 + bdk_flutter: ^0.31.0-dev ``` ### Examples @@ -51,15 +51,15 @@ import 'package:bdk_flutter/bdk_flutter.dart'; // .... -final mnemonic = await Mnemonic.create(WordCount.Words12); -final descriptorSecretKey = await DescriptorSecretKey.create( network: Network.Testnet, +final mnemonic = await Mnemonic.create(WordCount.words12); +final descriptorSecretKey = await DescriptorSecretKey.create( network: Network.testnet, mnemonic: mnemonic ); -final externalDescriptor = await Descriptor.newBip44( descriptorSecretKey: descriptorSecretKey, - network: Network.Testnet, - keychain: KeyChainKind.External ); -final internalDescriptor = await Descriptor.newBip44( descriptorSecretKey: descriptorSecretKey, - network: Network.Testnet, - keychain: KeyChainKind.Internal ); +final externalDescriptor = await Descriptor.newBip44( secretKey: descriptorSecretKey, + network: Network.testnet, + keychain: KeychainKind.externalChain ); +final internalDescriptor = await Descriptor.newBip44( secretKey: descriptorSecretKey, + network: Network.testnet, + keychain: KeyChainKind.internalChain ); final blockchain = await Blockchain.create( config: BlockchainConfig.electrum( config: ElectrumConfig( stopGap: 10, @@ -68,7 +68,7 @@ final blockchain = await Blockchain.create( config: BlockchainConfig.electrum( url: "ssl://electrum.blockstream.info:60002" ))); final wallet = await Wallet.create( descriptor: externalDescriptor, changeDescriptor: internalDescriptor, - network: Network.TESTNET, + network: Network.testnet, databaseConfig: const DatabaseConfig.memory() ); final _ = await wallet.sync( blockchain ); ``` @@ -80,15 +80,15 @@ import 'package:bdk_flutter/bdk_flutter.dart'; // .... -final mnemonic = await Mnemonic.create(WordCount.Words12); -final descriptorSecretKey = await DescriptorSecretKey.create( network: Network.Testnet, +final mnemonic = await Mnemonic.create(WordCount.words12); +final descriptorSecretKey = await DescriptorSecretKey.create( network: Network.testnet, mnemonic: mnemonic ); -final externalDescriptor = await Descriptor.newBip44( descriptorSecretKey: descriptorSecretKey, - network: Network.Testnet, - keychain: KeyChainKind.External ); +final externalDescriptor = await Descriptor.newBip44( secretKey: descriptorSecretKey, + network: Network.testnet, + keychain: KeychainKind.externalChain ); final externalPublicDescriptorStr = await externalDescriptor.asString(); final externalPublicDescriptor = await Descriptor.( descriptor: externalPublicDescriptorStr, - network: Network.Testnet); + network: Network.testnet); ``` ### Get the transaction details @@ -101,16 +101,16 @@ final bdkWallet = ..... // .... final txBuilder = TxBuilder(); -final address = await Address.create(address: "mv4rnyY3Su5gjcDNzbMLKBQkBicCtHUtFB"); +final address = await Address.fromString(s: "mv4rnyY3Su5gjcDNzbMLKBQkBicCtHUtFB", network: Network.testnet); -final script = await address.scriptPubKey(); -final feeRate = await estimateFeeRate(25); +final script = await address.scriptPubkey(); +final feeRate = await blockchain.estimateFee(target: 25); -final txBuilderResult = await txBuilder.feeRate( feeRate.asSatPerVb() ) +final (psbt, transactionDetails) = await txBuilder.feeRate( feeRate.satPerVb ) .addRecipient( script, 2000 ) .finish( bdkWallet ); -final serializedPsbt = await txBuilderResult.psbt.jsonSerialize(); +final serializedPsbt = await psbt.jsonSerialize(); final jsonObject = json.decode(serializedPsbt); final outputs = jsonObject['unsigned_tx']['output'] as List; final inputs = jsonObject['inputs'][0]['non_witness_utxo']['output'] as List; @@ -135,9 +135,9 @@ debugPrint("=========Outputs====="); import 'package:bdk_flutter/bdk_flutter.dart'; -final mnemonic = await Mnemonic.create(WordCount.Words12); +final mnemonic = await Mnemonic.create(WordCount.words12); final descriptorSecretKey = await DescriptorSecretKey.create( - network: Network.Testnet, mnemonic: mnemonic); + network: Network.testnet, mnemonic: mnemonic); // create external descriptor final derivationPath = await DerivationPath.create(path: "m/44h/1h/0h/0"); @@ -145,7 +145,7 @@ final descriptorPrivateKey = await descriptorSecretKey.derive(derivationPath); final Descriptor descriptorPrivate = await Descriptor.create( descriptor: "pkh(${descriptorPrivateKey.toString()})", - network: Network.Testnet, + network: Network.testnet, ); // create internal descriptor @@ -155,20 +155,20 @@ final descriptorPrivateKeyInt = await descriptorSecretKey.derive(derivationPathInt); final Descriptor descriptorPrivateInt = await Descriptor.create( descriptor: "pkh(${descriptorPrivateKeyInt.toString()})", - network: Network.Testnet, + network: Network.testnet, ); final bdkWallet = await Wallet.create( descriptor: descriptorPrivate, changeDescriptor: descriptorPrivateInt, - network: Network.Testnet, + network: Network.testnet, databaseConfig: const DatabaseConfig.memory(), ); final address = - await bdkWallet.getAddress(addressIndex: const AddressIndex()); + await bdkWallet.getAddress(addressIndex: const AddressIndex.increase()); final internalAddress = - await bdkWallet.getInternalAddress(addressIndex: const AddressIndex()); + await bdkWallet.getInternalAddress(addressIndex: const AddressIndex.increase()); ``` @@ -178,7 +178,7 @@ The latest API documentation is available [here](https://pub.dev/documentation/b ### Example Projects -- **\*BDK Flutter Demo App:** The [BDK Flutter Demo App](https://github.com/LtbLightning/bdk-flutter-demo-app) +- **\*BDK Flutter Demo App:** The [BDK Flutter Demo App](https://github.com/LtbLightning/bdk-flutter-quickstart) is a simple bitcoin app built in flutter to serve as a reference app to demonstrate `bdk-flutter` api usage. ### How to build diff --git a/analysis_options.yaml b/analysis_options.yaml index 1e1867b7..c2b7743f 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -15,7 +15,17 @@ linter: analyzer: exclude: - - lib/src/generated/bindings.dart - - lib/src/generated/bridge_definitions.dart - - lib/src/generated/bridge_definitions.freezed.dart + - lib/src/generated/frb_generated.dart + - lib/src/generated/frb_generated.io.dart + - lib/src/generated/frb_generated.dart + - lib/src/generated/api/types.freezed.dart + - lib/src/generated/api/types.dart + - lib/src/generated/api/descriptor.dart + - lib/src/generated/api/error.freezed.dart + - lib/src/generated/api/error.dart + - lib/src/generated/api/key.dart + - lib/src/generated/api/psbt.dart + - lib/src/generated/api/wallet.dart + - lib/src/generated/api/blockchain.freezed.dart - README.md + - cargokit/ diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt deleted file mode 100644 index cd77760d..00000000 --- a/android/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -cmake_minimum_required(VERSION 3.18.1) -project(bdk_flutter) -get_filename_component(CMAKE_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" DIRECTORY) -set(TEXT_FILE_PATH "${CMAKE_PARENT_DIR}/assets/release.config.txt") -file(STRINGS ${TEXT_FILE_PATH} lines) -foreach(line IN LISTS lines) - string(REGEX MATCH "TAG_VERSION=(.*)" _ ${line}) - if(CMAKE_MATCH_1) - set(TAG_VERSION ${CMAKE_MATCH_1}) - endif() - - string(REGEX MATCH "REPOSITORY_URL=(.*)" _ ${line}) - if(CMAKE_MATCH_1) - set(REPOSITORY_URL ${CMAKE_MATCH_1}) - endif() -endforeach() - - -set(LIB_NAME "bdk.${TAG_VERSION}") -set(URL "${REPOSITORY_URL}${TAG_VERSION}/${LIB_NAME}.zip") -set(OUTPUT_PATH "${CMAKE_PARENT_DIR}/${LIB_NAME}.zip") -if(NOT EXISTS "${CMAKE_PARENT_DIR}/${LIB_NAME}") - file(DOWNLOAD ${URL} ${OUTPUT_PATH} - STATUS DOWNLOAD_STATUS - SHOW_PROGRESS) - list(GET DOWNLOAD_STATUS 0 STATUS_CODE) - if(NOT STATUS_CODE EQUAL 0) - message(FATAL_ERROR "Download failed: ${DOWNLOAD_STATUS}") - endif() - if(WIN32) - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar xvf ${OUTPUT_PATH} - WORKING_DIRECTORY ${CMAKE_PARENT_DIR} - ) - else() - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar xvf ${OUTPUT_PATH} - WORKING_DIRECTORY ${CMAKE_PARENT_DIR} - ) - endif() - file(REMOVE_RECURSE "${CMAKE_PARENT_DIR}/__MACOSX" ) - file(REMOVE "${OUTPUT_PATH}" ) -endif() -if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs" ) - file(COPY "${CMAKE_PARENT_DIR}/${LIB_NAME}/jniLibs" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/src/main/" ) - file(REMOVE_RECURSE "${CMAKE_PARENT_DIR}/${LIB_NAME}/jniLibs") -endif() diff --git a/android/build.gradle b/android/build.gradle index a16fd31a..0a24818b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -43,14 +43,15 @@ android { defaultConfig { minSdkVersion 23 } - externalNativeBuild { - cmake { - path "CMakeLists.txt" - } - } } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.databinding:databinding-runtime:7.2.1' testImplementation 'junit:junit:4.13.2' } +apply from: "../cargokit/gradle/plugin.gradle" + +cargokit { + manifestDir = "../rust" + libname = "bdk_flutter" +} diff --git a/assets/release.config.txt b/assets/release.config.txt deleted file mode 100644 index b75e7fd5..00000000 --- a/assets/release.config.txt +++ /dev/null @@ -1,2 +0,0 @@ -TAG_VERSION=0.30.0 -REPOSITORY_URL=https://github.com/LtbLightning/bdk-flutter/releases/download/ \ No newline at end of file diff --git a/cargokit/.github/workflows/check_and_lint.yml b/cargokit/.github/workflows/check_and_lint.yml new file mode 100644 index 00000000..adec80e1 --- /dev/null +++ b/cargokit/.github/workflows/check_and_lint.yml @@ -0,0 +1,26 @@ +on: + pull_request: + push: + branches: + - main + +name: Check and Lint + +jobs: + Flutter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 #v2.7.0 + - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d #1.6.0 + - name: Pub Get + run: dart pub get --no-precompile + working-directory: build_tool + - name: Dart Format + run: dart format . --output=none --set-exit-if-changed + working-directory: build_tool + - name: Analyze + run: dart analyze + working-directory: build_tool + - name: Test + run: dart test + working-directory: build_tool diff --git a/cargokit/.github/workflows/test_example_plugin_build.yml b/cargokit/.github/workflows/test_example_plugin_build.yml new file mode 100644 index 00000000..bf36e862 --- /dev/null +++ b/cargokit/.github/workflows/test_example_plugin_build.yml @@ -0,0 +1,82 @@ +on: + pull_request: + push: + branches: + - main + +name: Test Example Plugin + +jobs: + Build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macOS-latest + - windows-latest + build_mode: + - debug + - profile + - release + env: + EXAMPLE_DIR: "a b/hello_rust_ffi_plugin/example" + CARGOKIT_VERBOSE: 1 + steps: + - name: Extract branch name + shell: bash + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + id: extract_branch + - name: Setup Repository + shell: bash + run: | + mkdir "a b" # Space is intentional + cd "a b" + git config --global user.email "you@example.com" + git config --global user.name "Your Name" + # "advanced" branch has extra iOS flavor and uses rust nightly for release builds + git clone -b advanced https://github.com/irondash/hello_rust_ffi_plugin + cd hello_rust_ffi_plugin + git subtree pull --prefix cargokit https://github.com/${{ github.event.pull_request.head.repo.full_name || github.repository }} ${{ steps.extract_branch.outputs.branch }} --squash + - uses: subosito/flutter-action@cc97e1648fff6ca5cc647fa67f47e70f7895510b # 2.11.0 + with: + channel: "stable" + - name: Install GTK + if: (matrix.os == 'ubuntu-latest') + run: sudo apt-get update && sudo apt-get install libgtk-3-dev + - name: Install ninja-build + if: (matrix.os == 'ubuntu-latest') + run: sudo apt-get update && sudo apt-get install ninja-build + - name: Build Linux (${{ matrix.build_mode }}) + if: matrix.os == 'ubuntu-latest' + shell: bash + working-directory: ${{ env.EXAMPLE_DIR }} + run: flutter build linux --${{ matrix.build_mode }} -v + - name: Build macOS (${{ matrix.build_mode }}) + if: matrix.os == 'macos-latest' + shell: bash + working-directory: ${{ env.EXAMPLE_DIR }} + run: flutter build macos --${{ matrix.build_mode }} -v + - name: Build iOS (${{ matrix.build_mode }}) + if: matrix.os == 'macos-latest' + shell: bash + working-directory: ${{ env.EXAMPLE_DIR }} + run: flutter build ios --${{ matrix.build_mode }} --no-codesign -v + - name: Build iOS (${{ matrix.build_mode }}) - flavor1 + if: matrix.os == 'macos-latest' + shell: bash + working-directory: ${{ env.EXAMPLE_DIR }} + run: flutter build ios --flavor flavor1 --${{ matrix.build_mode }} --no-codesign -v + - name: Build Windows (${{ matrix.build_mode }}) + if: matrix.os == 'windows-latest' + shell: bash + working-directory: ${{ env.EXAMPLE_DIR }} + run: flutter build windows --${{ matrix.build_mode }} -v + - name: Build Android (${{ matrix.build_mode }}) + shell: bash + working-directory: ${{ env.EXAMPLE_DIR }} + run: | + export JAVA_HOME=$JAVA_HOME_11_X64 + flutter build apk --${{ matrix.build_mode }} -v + diff --git a/cargokit/.gitignore b/cargokit/.gitignore new file mode 100644 index 00000000..cf7bb868 --- /dev/null +++ b/cargokit/.gitignore @@ -0,0 +1,4 @@ +target +.dart_tool +*.iml +!pubspec.lock diff --git a/cargokit/LICENSE b/cargokit/LICENSE new file mode 100644 index 00000000..54a7d589 --- /dev/null +++ b/cargokit/LICENSE @@ -0,0 +1,39 @@ +Copyright 2022 Matej Knopp + +================================================================================ + +MIT LICENSE + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +================================================================================ + +APACHE LICENSE, VERSION 2.0 + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + diff --git a/cargokit/README b/cargokit/README new file mode 100644 index 00000000..8ae4a073 --- /dev/null +++ b/cargokit/README @@ -0,0 +1,8 @@ +Experimental repository to provide glue for seamlessly integrating cargo build +with flutter plugins and packages. + +See https://matejknopp.com/post/flutter_plugin_in_rust_with_no_prebuilt_binaries/ +for a tutorial on how to use Cargokit. + +Example plugin available at https://github.com/irondash/hello_rust_ffi_plugin. + diff --git a/cargokit/build_pod.sh b/cargokit/build_pod.sh new file mode 100755 index 00000000..379b9c6d --- /dev/null +++ b/cargokit/build_pod.sh @@ -0,0 +1,58 @@ +#!/bin/sh +set -e + +BASEDIR=$(dirname "$0") + +# Workaround for https://github.com/dart-lang/pub/issues/4010 +BASEDIR=$(cd "$BASEDIR" ; pwd -P) + +# Remove XCode SDK from path. Otherwise this breaks tool compilation when building iOS project +NEW_PATH=`echo $PATH | tr ":" "\n" | grep -v "Contents/Developer/" | tr "\n" ":"` + +export PATH=${NEW_PATH%?} # remove trailing : + +env + +# Platform name (macosx, iphoneos, iphonesimulator) +export CARGOKIT_DARWIN_PLATFORM_NAME=$PLATFORM_NAME + +# Arctive architectures (arm64, armv7, x86_64), space separated. +export CARGOKIT_DARWIN_ARCHS=$ARCHS + +# Current build configuration (Debug, Release) +export CARGOKIT_CONFIGURATION=$CONFIGURATION + +# Path to directory containing Cargo.toml. +export CARGOKIT_MANIFEST_DIR=$PODS_TARGET_SRCROOT/$1 + +# Temporary directory for build artifacts. +export CARGOKIT_TARGET_TEMP_DIR=$TARGET_TEMP_DIR + +# Output directory for final artifacts. +export CARGOKIT_OUTPUT_DIR=$PODS_CONFIGURATION_BUILD_DIR/$PRODUCT_NAME + +# Directory to store built tool artifacts. +export CARGOKIT_TOOL_TEMP_DIR=$TARGET_TEMP_DIR/build_tool + +# Directory inside root project. Not necessarily the top level directory of root project. +export CARGOKIT_ROOT_PROJECT_DIR=$SRCROOT + +FLUTTER_EXPORT_BUILD_ENVIRONMENT=( + "$PODS_ROOT/../Flutter/ephemeral/flutter_export_environment.sh" # macOS + "$PODS_ROOT/../Flutter/flutter_export_environment.sh" # iOS +) + +for path in "${FLUTTER_EXPORT_BUILD_ENVIRONMENT[@]}" +do + if [[ -f "$path" ]]; then + source "$path" + fi +done + +"$BASEDIR/run_build_tool.sh" build-pod "$@" + +# Make a symlink from built framework to phony file, which will be used as input to +# build script. This should force rebuild (podspec currently doesn't support alwaysOutOfDate +# attribute on custom build phase) +ln -fs "$OBJROOT/XCBuildData/build.db" "${BUILT_PRODUCTS_DIR}/cargokit_phony" +ln -fs "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" "${BUILT_PRODUCTS_DIR}/cargokit_phony_out" diff --git a/cargokit/build_tool/README.md b/cargokit/build_tool/README.md new file mode 100644 index 00000000..3816eca3 --- /dev/null +++ b/cargokit/build_tool/README.md @@ -0,0 +1,2 @@ +A sample command-line application with an entrypoint in `bin/`, library code +in `lib/`, and example unit test in `test/`. diff --git a/cargokit/build_tool/analysis_options.yaml b/cargokit/build_tool/analysis_options.yaml new file mode 100644 index 00000000..a1aad5b3 --- /dev/null +++ b/cargokit/build_tool/analysis_options.yaml @@ -0,0 +1,31 @@ +# This file configures the static analysis results for your project (errors, +# warnings, and lints). +# +# This enables the 'recommended' set of lints from `package:lints`. +# This set helps identify many issues that may lead to problems when running +# or consuming Dart code, and enforces writing Dart using a single, idiomatic +# style and format. +# +# If you want a smaller set of lints you can change this to specify +# 'package:lints/core.yaml'. These are just the most critical lints +# (the recommended set includes the core lints). +# The core lints are also what is used by pub.dev for scoring packages. + +include: package:lints/recommended.yaml + +# Uncomment the following section to specify additional rules. + +linter: + rules: + - prefer_relative_imports + - directives_ordering + +# analyzer: +# exclude: +# - path/to/excluded/files/** + +# For more information about the core and recommended set of lints, see +# https://dart.dev/go/core-lints + +# For additional information about configuring this file, see +# https://dart.dev/guides/language/analysis-options diff --git a/cargokit/build_tool/bin/build_tool.dart b/cargokit/build_tool/bin/build_tool.dart new file mode 100644 index 00000000..f27ec75c --- /dev/null +++ b/cargokit/build_tool/bin/build_tool.dart @@ -0,0 +1,5 @@ +import 'package:build_tool/build_tool.dart' as build_tool; + +void main(List arguments) { + build_tool.runMain(arguments); +} diff --git a/cargokit/build_tool/lib/build_tool.dart b/cargokit/build_tool/lib/build_tool.dart new file mode 100644 index 00000000..b329c01a --- /dev/null +++ b/cargokit/build_tool/lib/build_tool.dart @@ -0,0 +1,5 @@ +import 'src/build_tool.dart' as build_tool; + +Future runMain(List args) async { + return build_tool.runMain(args); +} diff --git a/cargokit/build_tool/lib/src/android_environment.dart b/cargokit/build_tool/lib/src/android_environment.dart new file mode 100644 index 00000000..9342964b --- /dev/null +++ b/cargokit/build_tool/lib/src/android_environment.dart @@ -0,0 +1,192 @@ +import 'dart:io'; +import 'dart:isolate'; +import 'dart:math' as math; + +import 'package:collection/collection.dart'; +import 'package:path/path.dart' as path; +import 'package:version/version.dart'; + +import 'target.dart'; +import 'util.dart'; + +class AndroidEnvironment { + AndroidEnvironment({ + required this.sdkPath, + required this.ndkVersion, + required this.minSdkVersion, + required this.targetTempDir, + required this.target, + }); + + static void clangLinkerWrapper(List args) { + final clang = Platform.environment['_CARGOKIT_NDK_LINK_CLANG']; + if (clang == null) { + throw Exception( + "cargo-ndk rustc linker: didn't find _CARGOKIT_NDK_LINK_CLANG env var"); + } + final target = Platform.environment['_CARGOKIT_NDK_LINK_TARGET']; + if (target == null) { + throw Exception( + "cargo-ndk rustc linker: didn't find _CARGOKIT_NDK_LINK_TARGET env var"); + } + + runCommand(clang, [ + target, + ...args, + ]); + } + + /// Full path to Android SDK. + final String sdkPath; + + /// Full version of Android NDK. + final String ndkVersion; + + /// Minimum supported SDK version. + final int minSdkVersion; + + /// Target directory for build artifacts. + final String targetTempDir; + + /// Target being built. + final Target target; + + bool ndkIsInstalled() { + final ndkPath = path.join(sdkPath, 'ndk', ndkVersion); + final ndkPackageXml = File(path.join(ndkPath, 'package.xml')); + return ndkPackageXml.existsSync(); + } + + void installNdk({ + required String javaHome, + }) { + final sdkManagerExtension = Platform.isWindows ? '.bat' : ''; + final sdkManager = path.join( + sdkPath, + 'cmdline-tools', + 'latest', + 'bin', + 'sdkmanager$sdkManagerExtension', + ); + + log.info('Installing NDK $ndkVersion'); + runCommand(sdkManager, [ + '--install', + 'ndk;$ndkVersion', + ], environment: { + 'JAVA_HOME': javaHome, + }); + } + + Future> buildEnvironment() async { + final hostArch = Platform.isMacOS + ? "darwin-x86_64" + : (Platform.isLinux ? "linux-x86_64" : "windows-x86_64"); + + final ndkPath = path.join(sdkPath, 'ndk', ndkVersion); + final toolchainPath = path.join( + ndkPath, + 'toolchains', + 'llvm', + 'prebuilt', + hostArch, + 'bin', + ); + + final minSdkVersion = + math.max(target.androidMinSdkVersion!, this.minSdkVersion); + + final exe = Platform.isWindows ? '.exe' : ''; + + final arKey = 'AR_${target.rust}'; + final arValue = ['${target.rust}-ar', 'llvm-ar', 'llvm-ar.exe'] + .map((e) => path.join(toolchainPath, e)) + .firstWhereOrNull((element) => File(element).existsSync()); + if (arValue == null) { + throw Exception('Failed to find ar for $target in $toolchainPath'); + } + + final targetArg = '--target=${target.rust}$minSdkVersion'; + + final ccKey = 'CC_${target.rust}'; + final ccValue = path.join(toolchainPath, 'clang$exe'); + final cfFlagsKey = 'CFLAGS_${target.rust}'; + final cFlagsValue = targetArg; + + final cxxKey = 'CXX_${target.rust}'; + final cxxValue = path.join(toolchainPath, 'clang++$exe'); + final cxxFlagsKey = 'CXXFLAGS_${target.rust}'; + final cxxFlagsValue = targetArg; + + final linkerKey = + 'cargo_target_${target.rust.replaceAll('-', '_')}_linker'.toUpperCase(); + + final ranlibKey = 'RANLIB_${target.rust}'; + final ranlibValue = path.join(toolchainPath, 'llvm-ranlib$exe'); + + final ndkVersionParsed = Version.parse(ndkVersion); + final rustFlagsKey = 'CARGO_ENCODED_RUSTFLAGS'; + final rustFlagsValue = _libGccWorkaround(targetTempDir, ndkVersionParsed); + + final runRustTool = + Platform.isWindows ? 'run_build_tool.cmd' : 'run_build_tool.sh'; + + final packagePath = (await Isolate.resolvePackageUri( + Uri.parse('package:build_tool/buildtool.dart')))! + .toFilePath(); + final selfPath = path.canonicalize(path.join( + packagePath, + '..', + '..', + '..', + runRustTool, + )); + + // Make sure that run_build_tool is working properly even initially launched directly + // through dart run. + final toolTempDir = + Platform.environment['CARGOKIT_TOOL_TEMP_DIR'] ?? targetTempDir; + + return { + arKey: arValue, + ccKey: ccValue, + cfFlagsKey: cFlagsValue, + cxxKey: cxxValue, + cxxFlagsKey: cxxFlagsValue, + ranlibKey: ranlibValue, + rustFlagsKey: rustFlagsValue, + linkerKey: selfPath, + // Recognized by main() so we know when we're acting as a wrapper + '_CARGOKIT_NDK_LINK_TARGET': targetArg, + '_CARGOKIT_NDK_LINK_CLANG': ccValue, + 'CARGOKIT_TOOL_TEMP_DIR': toolTempDir, + }; + } + + // Workaround for libgcc missing in NDK23, inspired by cargo-ndk + String _libGccWorkaround(String buildDir, Version ndkVersion) { + final workaroundDir = path.join( + buildDir, + 'cargokit', + 'libgcc_workaround', + '${ndkVersion.major}', + ); + Directory(workaroundDir).createSync(recursive: true); + if (ndkVersion.major >= 23) { + File(path.join(workaroundDir, 'libgcc.a')) + .writeAsStringSync('INPUT(-lunwind)'); + } else { + // Other way around, untested, forward libgcc.a from libunwind once Rust + // gets updated for NDK23+. + File(path.join(workaroundDir, 'libunwind.a')) + .writeAsStringSync('INPUT(-lgcc)'); + } + + var rustFlags = Platform.environment['CARGO_ENCODED_RUSTFLAGS'] ?? ''; + if (rustFlags.isNotEmpty) { + rustFlags = '$rustFlags\x1f'; + } + rustFlags = '$rustFlags-L\x1f$workaroundDir'; + return rustFlags; + } +} diff --git a/cargokit/build_tool/lib/src/artifacts_provider.dart b/cargokit/build_tool/lib/src/artifacts_provider.dart new file mode 100644 index 00000000..ef655a9e --- /dev/null +++ b/cargokit/build_tool/lib/src/artifacts_provider.dart @@ -0,0 +1,263 @@ +import 'dart:io'; + +import 'package:ed25519_edwards/ed25519_edwards.dart'; +import 'package:http/http.dart'; +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as path; + +import 'builder.dart'; +import 'crate_hash.dart'; +import 'options.dart'; +import 'precompile_binaries.dart'; +import 'rustup.dart'; +import 'target.dart'; + +class Artifact { + /// File system location of the artifact. + final String path; + + /// Actual file name that the artifact should have in destination folder. + final String finalFileName; + + AritifactType get type { + if (finalFileName.endsWith('.dll') || + finalFileName.endsWith('.dll.lib') || + finalFileName.endsWith('.pdb') || + finalFileName.endsWith('.so') || + finalFileName.endsWith('.dylib')) { + return AritifactType.dylib; + } else if (finalFileName.endsWith('.lib') || finalFileName.endsWith('.a')) { + return AritifactType.staticlib; + } else { + throw Exception('Unknown artifact type for $finalFileName'); + } + } + + Artifact({ + required this.path, + required this.finalFileName, + }); +} + +final _log = Logger('artifacts_provider'); + +class ArtifactProvider { + ArtifactProvider({ + required this.environment, + required this.userOptions, + }); + + final BuildEnvironment environment; + final CargokitUserOptions userOptions; + + Future>> getArtifacts(List targets) async { + final result = await _getPrecompiledArtifacts(targets); + + final pendingTargets = List.of(targets); + pendingTargets.removeWhere((element) => result.containsKey(element)); + + if (pendingTargets.isEmpty) { + return result; + } + + final rustup = Rustup(); + for (final target in targets) { + final builder = RustBuilder(target: target, environment: environment); + builder.prepare(rustup); + _log.info('Building ${environment.crateInfo.packageName} for $target'); + final targetDir = await builder.build(); + // For local build accept both static and dynamic libraries. + final artifactNames = { + ...getArtifactNames( + target: target, + libraryName: environment.crateInfo.packageName, + aritifactType: AritifactType.dylib, + remote: false, + ), + ...getArtifactNames( + target: target, + libraryName: environment.crateInfo.packageName, + aritifactType: AritifactType.staticlib, + remote: false, + ) + }; + final artifacts = artifactNames + .map((artifactName) => Artifact( + path: path.join(targetDir, artifactName), + finalFileName: artifactName, + )) + .where((element) => File(element.path).existsSync()) + .toList(); + result[target] = artifacts; + } + return result; + } + + Future>> _getPrecompiledArtifacts( + List targets) async { + if (userOptions.usePrecompiledBinaries == false) { + _log.info('Precompiled binaries are disabled'); + return {}; + } + if (environment.crateOptions.precompiledBinaries == null) { + _log.fine('Precompiled binaries not enabled for this crate'); + return {}; + } + + final start = Stopwatch()..start(); + final crateHash = CrateHash.compute(environment.manifestDir, + tempStorage: environment.targetTempDir); + _log.fine( + 'Computed crate hash $crateHash in ${start.elapsedMilliseconds}ms'); + + final downloadedArtifactsDir = + path.join(environment.targetTempDir, 'precompiled', crateHash); + Directory(downloadedArtifactsDir).createSync(recursive: true); + + final res = >{}; + + for (final target in targets) { + final requiredArtifacts = getArtifactNames( + target: target, + libraryName: environment.crateInfo.packageName, + remote: true, + ); + final artifactsForTarget = []; + + for (final artifact in requiredArtifacts) { + final fileName = PrecompileBinaries.fileName(target, artifact); + final downloadedPath = path.join(downloadedArtifactsDir, fileName); + if (!File(downloadedPath).existsSync()) { + final signatureFileName = + PrecompileBinaries.signatureFileName(target, artifact); + await _tryDownloadArtifacts( + crateHash: crateHash, + fileName: fileName, + signatureFileName: signatureFileName, + finalPath: downloadedPath, + ); + } + if (File(downloadedPath).existsSync()) { + artifactsForTarget.add(Artifact( + path: downloadedPath, + finalFileName: artifact, + )); + } else { + break; + } + } + + // Only provide complete set of artifacts. + if (artifactsForTarget.length == requiredArtifacts.length) { + _log.fine('Found precompiled artifacts for $target'); + res[target] = artifactsForTarget; + } + } + + return res; + } + + static Future _get(Uri url, {Map? headers}) async { + int attempt = 0; + const maxAttempts = 10; + while (true) { + try { + return await get(url, headers: headers); + } on SocketException catch (e) { + // Try to detect reset by peer error and retry. + if (attempt++ < maxAttempts && + (e.osError?.errorCode == 54 || e.osError?.errorCode == 10054)) { + _log.severe( + 'Failed to download $url: $e, attempt $attempt of $maxAttempts, will retry...'); + await Future.delayed(Duration(seconds: 1)); + continue; + } else { + rethrow; + } + } + } + } + + Future _tryDownloadArtifacts({ + required String crateHash, + required String fileName, + required String signatureFileName, + required String finalPath, + }) async { + final precompiledBinaries = environment.crateOptions.precompiledBinaries!; + final prefix = precompiledBinaries.uriPrefix; + final url = Uri.parse('$prefix$crateHash/$fileName'); + final signatureUrl = Uri.parse('$prefix$crateHash/$signatureFileName'); + _log.fine('Downloading signature from $signatureUrl'); + final signature = await _get(signatureUrl); + if (signature.statusCode == 404) { + _log.warning( + 'Precompiled binaries not available for crate hash $crateHash ($fileName)'); + return; + } + if (signature.statusCode != 200) { + _log.severe( + 'Failed to download signature $signatureUrl: status ${signature.statusCode}'); + return; + } + _log.fine('Downloading binary from $url'); + final res = await _get(url); + if (res.statusCode != 200) { + _log.severe('Failed to download binary $url: status ${res.statusCode}'); + return; + } + if (verify( + precompiledBinaries.publicKey, res.bodyBytes, signature.bodyBytes)) { + File(finalPath).writeAsBytesSync(res.bodyBytes); + } else { + _log.shout('Signature verification failed! Ignoring binary.'); + } + } +} + +enum AritifactType { + staticlib, + dylib, +} + +AritifactType artifactTypeForTarget(Target target) { + if (target.darwinPlatform != null) { + return AritifactType.staticlib; + } else { + return AritifactType.dylib; + } +} + +List getArtifactNames({ + required Target target, + required String libraryName, + required bool remote, + AritifactType? aritifactType, +}) { + aritifactType ??= artifactTypeForTarget(target); + if (target.darwinArch != null) { + if (aritifactType == AritifactType.staticlib) { + return ['lib$libraryName.a']; + } else { + return ['lib$libraryName.dylib']; + } + } else if (target.rust.contains('-windows-')) { + if (aritifactType == AritifactType.staticlib) { + return ['$libraryName.lib']; + } else { + return [ + '$libraryName.dll', + '$libraryName.dll.lib', + if (!remote) '$libraryName.pdb' + ]; + } + } else if (target.rust.contains('-linux-')) { + if (aritifactType == AritifactType.staticlib) { + return ['lib$libraryName.a']; + } else { + return ['lib$libraryName.so']; + } + } else { + throw Exception("Unsupported target: ${target.rust}"); + } +} diff --git a/cargokit/build_tool/lib/src/build_cmake.dart b/cargokit/build_tool/lib/src/build_cmake.dart new file mode 100644 index 00000000..9154371e --- /dev/null +++ b/cargokit/build_tool/lib/src/build_cmake.dart @@ -0,0 +1,37 @@ +import 'dart:io'; + +import 'package:path/path.dart' as path; + +import 'artifacts_provider.dart'; +import 'builder.dart'; +import 'environment.dart'; +import 'options.dart'; +import 'target.dart'; + +class BuildCMake { + final CargokitUserOptions userOptions; + + BuildCMake({required this.userOptions}); + + Future build() async { + final targetPlatform = Environment.targetPlatform; + final target = Target.forFlutterName(Environment.targetPlatform); + if (target == null) { + throw Exception("Unknown target platform: $targetPlatform"); + } + + final environment = BuildEnvironment.fromEnvironment(isAndroid: false); + final provider = + ArtifactProvider(environment: environment, userOptions: userOptions); + final artifacts = await provider.getArtifacts([target]); + + final libs = artifacts[target]!; + + for (final lib in libs) { + if (lib.type == AritifactType.dylib) { + File(lib.path) + .copySync(path.join(Environment.outputDir, lib.finalFileName)); + } + } + } +} diff --git a/cargokit/build_tool/lib/src/build_gradle.dart b/cargokit/build_tool/lib/src/build_gradle.dart new file mode 100644 index 00000000..469c8b2d --- /dev/null +++ b/cargokit/build_tool/lib/src/build_gradle.dart @@ -0,0 +1,46 @@ +import 'dart:io'; + +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as path; + +import 'artifacts_provider.dart'; +import 'builder.dart'; +import 'environment.dart'; +import 'options.dart'; +import 'target.dart'; + +final log = Logger('build_gradle'); + +class BuildGradle { + BuildGradle({required this.userOptions}); + + final CargokitUserOptions userOptions; + + Future build() async { + final targets = Environment.targetPlatforms.map((arch) { + final target = Target.forFlutterName(arch); + if (target == null) { + throw Exception( + "Unknown darwin target or platform: $arch, ${Environment.darwinPlatformName}"); + } + return target; + }).toList(); + + final environment = BuildEnvironment.fromEnvironment(isAndroid: true); + final provider = + ArtifactProvider(environment: environment, userOptions: userOptions); + final artifacts = await provider.getArtifacts(targets); + + for (final target in targets) { + final libs = artifacts[target]!; + final outputDir = path.join(Environment.outputDir, target.android!); + Directory(outputDir).createSync(recursive: true); + + for (final lib in libs) { + if (lib.type == AritifactType.dylib) { + File(lib.path).copySync(path.join(outputDir, lib.finalFileName)); + } + } + } + } +} diff --git a/cargokit/build_tool/lib/src/build_pod.dart b/cargokit/build_tool/lib/src/build_pod.dart new file mode 100644 index 00000000..f01401e1 --- /dev/null +++ b/cargokit/build_tool/lib/src/build_pod.dart @@ -0,0 +1,86 @@ +import 'dart:io'; + +import 'package:path/path.dart' as path; + +import 'artifacts_provider.dart'; +import 'builder.dart'; +import 'environment.dart'; +import 'options.dart'; +import 'target.dart'; +import 'util.dart'; + +class BuildPod { + BuildPod({required this.userOptions}); + + final CargokitUserOptions userOptions; + + Future build() async { + final targets = Environment.darwinArchs.map((arch) { + final target = Target.forDarwin( + platformName: Environment.darwinPlatformName, darwinAarch: arch); + if (target == null) { + throw Exception( + "Unknown darwin target or platform: $arch, ${Environment.darwinPlatformName}"); + } + return target; + }).toList(); + + final environment = BuildEnvironment.fromEnvironment(isAndroid: false); + final provider = + ArtifactProvider(environment: environment, userOptions: userOptions); + final artifacts = await provider.getArtifacts(targets); + + void performLipo(String targetFile, Iterable sourceFiles) { + runCommand("lipo", [ + '-create', + ...sourceFiles, + '-output', + targetFile, + ]); + } + + final outputDir = Environment.outputDir; + + Directory(outputDir).createSync(recursive: true); + + final staticLibs = artifacts.values + .expand((element) => element) + .where((element) => element.type == AritifactType.staticlib) + .toList(); + final dynamicLibs = artifacts.values + .expand((element) => element) + .where((element) => element.type == AritifactType.dylib) + .toList(); + + final libName = environment.crateInfo.packageName; + + // If there is static lib, use it and link it with pod + if (staticLibs.isNotEmpty) { + final finalTargetFile = path.join(outputDir, "lib$libName.a"); + performLipo(finalTargetFile, staticLibs.map((e) => e.path)); + } else { + // Otherwise try to replace bundle dylib with our dylib + final bundlePaths = [ + '$libName.framework/Versions/A/$libName', + '$libName.framework/$libName', + ]; + + for (final bundlePath in bundlePaths) { + final targetFile = path.join(outputDir, bundlePath); + if (File(targetFile).existsSync()) { + performLipo(targetFile, dynamicLibs.map((e) => e.path)); + + // Replace absolute id with @rpath one so that it works properly + // when moved to Frameworks. + runCommand("install_name_tool", [ + '-id', + '@rpath/$bundlePath', + targetFile, + ]); + return; + } + } + throw Exception('Unable to find bundle for dynamic library'); + } + } +} diff --git a/cargokit/build_tool/lib/src/build_tool.dart b/cargokit/build_tool/lib/src/build_tool.dart new file mode 100644 index 00000000..1d9462af --- /dev/null +++ b/cargokit/build_tool/lib/src/build_tool.dart @@ -0,0 +1,268 @@ +import 'dart:io'; + +import 'package:args/command_runner.dart'; +import 'package:ed25519_edwards/ed25519_edwards.dart'; +import 'package:github/github.dart'; +import 'package:hex/hex.dart'; +import 'package:logging/logging.dart'; + +import 'android_environment.dart'; +import 'build_cmake.dart'; +import 'build_gradle.dart'; +import 'build_pod.dart'; +import 'logging.dart'; +import 'options.dart'; +import 'precompile_binaries.dart'; +import 'target.dart'; +import 'util.dart'; +import 'verify_binaries.dart'; + +final log = Logger('build_tool'); + +abstract class BuildCommand extends Command { + Future runBuildCommand(CargokitUserOptions options); + + @override + Future run() async { + final options = CargokitUserOptions.load(); + + if (options.verboseLogging || + Platform.environment['CARGOKIT_VERBOSE'] == '1') { + enableVerboseLogging(); + } + + await runBuildCommand(options); + } +} + +class BuildPodCommand extends BuildCommand { + @override + final name = 'build-pod'; + + @override + final description = 'Build cocoa pod library'; + + @override + Future runBuildCommand(CargokitUserOptions options) async { + final build = BuildPod(userOptions: options); + await build.build(); + } +} + +class BuildGradleCommand extends BuildCommand { + @override + final name = 'build-gradle'; + + @override + final description = 'Build android library'; + + @override + Future runBuildCommand(CargokitUserOptions options) async { + final build = BuildGradle(userOptions: options); + await build.build(); + } +} + +class BuildCMakeCommand extends BuildCommand { + @override + final name = 'build-cmake'; + + @override + final description = 'Build CMake library'; + + @override + Future runBuildCommand(CargokitUserOptions options) async { + final build = BuildCMake(userOptions: options); + await build.build(); + } +} + +class GenKeyCommand extends Command { + @override + final name = 'gen-key'; + + @override + final description = 'Generate key pair for signing precompiled binaries'; + + @override + void run() { + final kp = generateKey(); + final private = HEX.encode(kp.privateKey.bytes); + final public = HEX.encode(kp.publicKey.bytes); + print("Private Key: $private"); + print("Public Key: $public"); + } +} + +class PrecompileBinariesCommand extends Command { + PrecompileBinariesCommand() { + argParser + ..addOption( + 'repository', + mandatory: true, + help: 'Github repository slug in format owner/name', + ) + ..addOption( + 'manifest-dir', + mandatory: true, + help: 'Directory containing Cargo.toml', + ) + ..addMultiOption('target', + help: 'Rust target triple of artifact to build.\n' + 'Can be specified multiple times or omitted in which case\n' + 'all targets for current platform will be built.') + ..addOption( + 'android-sdk-location', + help: 'Location of Android SDK (if available)', + ) + ..addOption( + 'android-ndk-version', + help: 'Android NDK version (if available)', + ) + ..addOption( + 'android-min-sdk-version', + help: 'Android minimum rquired version (if available)', + ) + ..addOption( + 'temp-dir', + help: 'Directory to store temporary build artifacts', + ) + ..addFlag( + "verbose", + abbr: "v", + defaultsTo: false, + help: "Enable verbose logging", + ); + } + + @override + final name = 'precompile-binaries'; + + @override + final description = 'Prebuild and upload binaries\n' + 'Private key must be passed through PRIVATE_KEY environment variable. ' + 'Use gen_key through generate priave key.\n' + 'Github token must be passed as GITHUB_TOKEN environment variable.\n'; + + @override + Future run() async { + final verbose = argResults!['verbose'] as bool; + if (verbose) { + enableVerboseLogging(); + } + + final privateKeyString = Platform.environment['PRIVATE_KEY']; + if (privateKeyString == null) { + throw ArgumentError('Missing PRIVATE_KEY environment variable'); + } + final githubToken = Platform.environment['GITHUB_TOKEN']; + if (githubToken == null) { + throw ArgumentError('Missing GITHUB_TOKEN environment variable'); + } + final privateKey = HEX.decode(privateKeyString); + if (privateKey.length != 64) { + throw ArgumentError('Private key must be 64 bytes long'); + } + final manifestDir = argResults!['manifest-dir'] as String; + if (!Directory(manifestDir).existsSync()) { + throw ArgumentError('Manifest directory does not exist: $manifestDir'); + } + String? androidMinSdkVersionString = + argResults!['android-min-sdk-version'] as String?; + int? androidMinSdkVersion; + if (androidMinSdkVersionString != null) { + androidMinSdkVersion = int.tryParse(androidMinSdkVersionString); + if (androidMinSdkVersion == null) { + throw ArgumentError( + 'Invalid android-min-sdk-version: $androidMinSdkVersionString'); + } + } + final targetStrigns = argResults!['target'] as List; + final targets = targetStrigns.map((target) { + final res = Target.forRustTriple(target); + if (res == null) { + throw ArgumentError('Invalid target: $target'); + } + return res; + }).toList(growable: false); + final precompileBinaries = PrecompileBinaries( + privateKey: PrivateKey(privateKey), + githubToken: githubToken, + manifestDir: manifestDir, + repositorySlug: RepositorySlug.full(argResults!['repository'] as String), + targets: targets, + androidSdkLocation: argResults!['android-sdk-location'] as String?, + androidNdkVersion: argResults!['android-ndk-version'] as String?, + androidMinSdkVersion: androidMinSdkVersion, + tempDir: argResults!['temp-dir'] as String?, + ); + + await precompileBinaries.run(); + } +} + +class VerifyBinariesCommand extends Command { + VerifyBinariesCommand() { + argParser.addOption( + 'manifest-dir', + mandatory: true, + help: 'Directory containing Cargo.toml', + ); + } + + @override + final name = "verify-binaries"; + + @override + final description = 'Verifies published binaries\n' + 'Checks whether there is a binary published for each targets\n' + 'and checks the signature.'; + + @override + Future run() async { + final manifestDir = argResults!['manifest-dir'] as String; + final verifyBinaries = VerifyBinaries( + manifestDir: manifestDir, + ); + await verifyBinaries.run(); + } +} + +Future runMain(List args) async { + try { + // Init logging before options are loaded + initLogging(); + + if (Platform.environment['_CARGOKIT_NDK_LINK_TARGET'] != null) { + return AndroidEnvironment.clangLinkerWrapper(args); + } + + final runner = CommandRunner('build_tool', 'Cargokit built_tool') + ..addCommand(BuildPodCommand()) + ..addCommand(BuildGradleCommand()) + ..addCommand(BuildCMakeCommand()) + ..addCommand(GenKeyCommand()) + ..addCommand(PrecompileBinariesCommand()) + ..addCommand(VerifyBinariesCommand()); + + await runner.run(args); + } on ArgumentError catch (e) { + stderr.writeln(e.toString()); + exit(1); + } catch (e, s) { + log.severe(kDoubleSeparator); + log.severe('Cargokit BuildTool failed with error:'); + log.severe(kSeparator); + log.severe(e); + // This tells user to install Rust, there's no need to pollute the log with + // stack trace. + if (e is! RustupNotFoundException) { + log.severe(kSeparator); + log.severe(s); + log.severe(kSeparator); + log.severe('BuildTool arguments: $args'); + } + log.severe(kDoubleSeparator); + exit(1); + } +} diff --git a/cargokit/build_tool/lib/src/builder.dart b/cargokit/build_tool/lib/src/builder.dart new file mode 100644 index 00000000..570a5375 --- /dev/null +++ b/cargokit/build_tool/lib/src/builder.dart @@ -0,0 +1,195 @@ +import 'package:collection/collection.dart'; +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as path; + +import 'android_environment.dart'; +import 'cargo.dart'; +import 'environment.dart'; +import 'options.dart'; +import 'rustup.dart'; +import 'target.dart'; +import 'util.dart'; + +final _log = Logger('builder'); + +enum BuildConfiguration { + debug, + release, + profile, +} + +extension on BuildConfiguration { + bool get isDebug => this == BuildConfiguration.debug; + String get rustName => switch (this) { + BuildConfiguration.debug => 'debug', + BuildConfiguration.release => 'release', + BuildConfiguration.profile => 'release', + }; +} + +class BuildException implements Exception { + final String message; + + BuildException(this.message); + + @override + String toString() { + return 'BuildException: $message'; + } +} + +class BuildEnvironment { + final BuildConfiguration configuration; + final CargokitCrateOptions crateOptions; + final String targetTempDir; + final String manifestDir; + final CrateInfo crateInfo; + + final bool isAndroid; + final String? androidSdkPath; + final String? androidNdkVersion; + final int? androidMinSdkVersion; + final String? javaHome; + + BuildEnvironment({ + required this.configuration, + required this.crateOptions, + required this.targetTempDir, + required this.manifestDir, + required this.crateInfo, + required this.isAndroid, + this.androidSdkPath, + this.androidNdkVersion, + this.androidMinSdkVersion, + this.javaHome, + }); + + static BuildConfiguration parseBuildConfiguration(String value) { + // XCode configuration adds the flavor to configuration name. + final firstSegment = value.split('-').first; + final buildConfiguration = BuildConfiguration.values.firstWhereOrNull( + (e) => e.name == firstSegment, + ); + if (buildConfiguration == null) { + _log.warning('Unknown build configuraiton $value, will assume release'); + return BuildConfiguration.release; + } + return buildConfiguration; + } + + static BuildEnvironment fromEnvironment({ + required bool isAndroid, + }) { + final buildConfiguration = + parseBuildConfiguration(Environment.configuration); + final manifestDir = Environment.manifestDir; + final crateOptions = CargokitCrateOptions.load( + manifestDir: manifestDir, + ); + final crateInfo = CrateInfo.load(manifestDir); + return BuildEnvironment( + configuration: buildConfiguration, + crateOptions: crateOptions, + targetTempDir: Environment.targetTempDir, + manifestDir: manifestDir, + crateInfo: crateInfo, + isAndroid: isAndroid, + androidSdkPath: isAndroid ? Environment.sdkPath : null, + androidNdkVersion: isAndroid ? Environment.ndkVersion : null, + androidMinSdkVersion: + isAndroid ? int.parse(Environment.minSdkVersion) : null, + javaHome: isAndroid ? Environment.javaHome : null, + ); + } +} + +class RustBuilder { + final Target target; + final BuildEnvironment environment; + + RustBuilder({ + required this.target, + required this.environment, + }); + + void prepare( + Rustup rustup, + ) { + final toolchain = _toolchain; + if (rustup.installedTargets(toolchain) == null) { + rustup.installToolchain(toolchain); + } + if (toolchain == 'nightly') { + rustup.installRustSrcForNightly(); + } + if (!rustup.installedTargets(toolchain)!.contains(target.rust)) { + rustup.installTarget(target.rust, toolchain: toolchain); + } + } + + CargoBuildOptions? get _buildOptions => + environment.crateOptions.cargo[environment.configuration]; + + String get _toolchain => _buildOptions?.toolchain.name ?? 'stable'; + + /// Returns the path of directory containing build artifacts. + Future build() async { + final extraArgs = _buildOptions?.flags ?? []; + final manifestPath = path.join(environment.manifestDir, 'Cargo.toml'); + runCommand( + 'rustup', + [ + 'run', + _toolchain, + 'cargo', + 'build', + ...extraArgs, + '--manifest-path', + manifestPath, + '-p', + environment.crateInfo.packageName, + if (!environment.configuration.isDebug) '--release', + '--target', + target.rust, + '--target-dir', + environment.targetTempDir, + ], + environment: await _buildEnvironment(), + ); + return path.join( + environment.targetTempDir, + target.rust, + environment.configuration.rustName, + ); + } + + Future> _buildEnvironment() async { + if (target.android == null) { + return {}; + } else { + final sdkPath = environment.androidSdkPath; + final ndkVersion = environment.androidNdkVersion; + final minSdkVersion = environment.androidMinSdkVersion; + if (sdkPath == null) { + throw BuildException('androidSdkPath is not set'); + } + if (ndkVersion == null) { + throw BuildException('androidNdkVersion is not set'); + } + if (minSdkVersion == null) { + throw BuildException('androidMinSdkVersion is not set'); + } + final env = AndroidEnvironment( + sdkPath: sdkPath, + ndkVersion: ndkVersion, + minSdkVersion: minSdkVersion, + targetTempDir: environment.targetTempDir, + target: target, + ); + if (!env.ndkIsInstalled() && environment.javaHome != null) { + env.installNdk(javaHome: environment.javaHome!); + } + return env.buildEnvironment(); + } + } +} diff --git a/cargokit/build_tool/lib/src/cargo.dart b/cargokit/build_tool/lib/src/cargo.dart new file mode 100644 index 00000000..0d4483ff --- /dev/null +++ b/cargokit/build_tool/lib/src/cargo.dart @@ -0,0 +1,45 @@ +import 'dart:io'; + +import 'package:path/path.dart' as path; +import 'package:toml/toml.dart'; + +class ManifestException { + ManifestException(this.message, {required this.fileName}); + + final String? fileName; + final String message; + + @override + String toString() { + if (fileName != null) { + return 'Failed to parse package manifest at $fileName: $message'; + } else { + return 'Failed to parse package manifest: $message'; + } + } +} + +class CrateInfo { + CrateInfo({required this.packageName}); + + final String packageName; + + static CrateInfo parseManifest(String manifest, {final String? fileName}) { + final toml = TomlDocument.parse(manifest); + final package = toml.toMap()['package']; + if (package == null) { + throw ManifestException('Missing package section', fileName: fileName); + } + final name = package['name']; + if (name == null) { + throw ManifestException('Missing package name', fileName: fileName); + } + return CrateInfo(packageName: name); + } + + static CrateInfo load(String manifestDir) { + final manifestFile = File(path.join(manifestDir, 'Cargo.toml')); + final manifest = manifestFile.readAsStringSync(); + return parseManifest(manifest, fileName: manifestFile.path); + } +} diff --git a/cargokit/build_tool/lib/src/crate_hash.dart b/cargokit/build_tool/lib/src/crate_hash.dart new file mode 100644 index 00000000..e58c37ff --- /dev/null +++ b/cargokit/build_tool/lib/src/crate_hash.dart @@ -0,0 +1,121 @@ +import 'dart:convert'; +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:collection/collection.dart'; +import 'package:convert/convert.dart'; +import 'package:crypto/crypto.dart'; +import 'package:path/path.dart' as path; + +class CrateHash { + /// Computes a hash uniquely identifying crate content. This takes into account + /// content all all .rs files inside the src directory, as well as Cargo.toml, + /// Cargo.lock, build.rs and cargokit.yaml. + /// + /// If [tempStorage] is provided, computed hash is stored in a file in that directory + /// and reused on subsequent calls if the crate content hasn't changed. + static String compute(String manifestDir, {String? tempStorage}) { + return CrateHash._( + manifestDir: manifestDir, + tempStorage: tempStorage, + )._compute(); + } + + CrateHash._({ + required this.manifestDir, + required this.tempStorage, + }); + + String _compute() { + final files = getFiles(); + final tempStorage = this.tempStorage; + if (tempStorage != null) { + final quickHash = _computeQuickHash(files); + final quickHashFolder = Directory(path.join(tempStorage, 'crate_hash')); + quickHashFolder.createSync(recursive: true); + final quickHashFile = File(path.join(quickHashFolder.path, quickHash)); + if (quickHashFile.existsSync()) { + return quickHashFile.readAsStringSync(); + } + final hash = _computeHash(files); + quickHashFile.writeAsStringSync(hash); + return hash; + } else { + return _computeHash(files); + } + } + + /// Computes a quick hash based on files stat (without reading contents). This + /// is used to cache the real hash, which is slower to compute since it involves + /// reading every single file. + String _computeQuickHash(List files) { + final output = AccumulatorSink(); + final input = sha256.startChunkedConversion(output); + + final data = ByteData(8); + for (final file in files) { + input.add(utf8.encode(file.path)); + final stat = file.statSync(); + data.setUint64(0, stat.size); + input.add(data.buffer.asUint8List()); + data.setUint64(0, stat.modified.millisecondsSinceEpoch); + input.add(data.buffer.asUint8List()); + } + + input.close(); + return base64Url.encode(output.events.single.bytes); + } + + String _computeHash(List files) { + final output = AccumulatorSink(); + final input = sha256.startChunkedConversion(output); + + void addTextFile(File file) { + // text Files are hashed by lines in case we're dealing with github checkout + // that auto-converts line endings. + final splitter = LineSplitter(); + if (file.existsSync()) { + final data = file.readAsStringSync(); + final lines = splitter.convert(data); + for (final line in lines) { + input.add(utf8.encode(line)); + } + } + } + + for (final file in files) { + addTextFile(file); + } + + input.close(); + final res = output.events.single; + + // Truncate to 128bits. + final hash = res.bytes.sublist(0, 16); + return hex.encode(hash); + } + + List getFiles() { + final src = Directory(path.join(manifestDir, 'src')); + final files = src + .listSync(recursive: true, followLinks: false) + .whereType() + .toList(); + files.sortBy((element) => element.path); + void addFile(String relative) { + final file = File(path.join(manifestDir, relative)); + if (file.existsSync()) { + files.add(file); + } + } + + addFile('Cargo.toml'); + addFile('Cargo.lock'); + addFile('build.rs'); + addFile('cargokit.yaml'); + return files; + } + + final String manifestDir; + final String? tempStorage; +} diff --git a/cargokit/build_tool/lib/src/environment.dart b/cargokit/build_tool/lib/src/environment.dart new file mode 100644 index 00000000..1d267edb --- /dev/null +++ b/cargokit/build_tool/lib/src/environment.dart @@ -0,0 +1,65 @@ +import 'dart:io'; + +extension on String { + String resolveSymlink() => File(this).resolveSymbolicLinksSync(); +} + +class Environment { + /// Current build configuration (debug or release). + static String get configuration => + _getEnv("CARGOKIT_CONFIGURATION").toLowerCase(); + + static bool get isDebug => configuration == 'debug'; + static bool get isRelease => configuration == 'release'; + + /// Temporary directory where Rust build artifacts are placed. + static String get targetTempDir => _getEnv("CARGOKIT_TARGET_TEMP_DIR"); + + /// Final output directory where the build artifacts are placed. + static String get outputDir => _getEnvPath('CARGOKIT_OUTPUT_DIR'); + + /// Path to the crate manifest (containing Cargo.toml). + static String get manifestDir => _getEnvPath('CARGOKIT_MANIFEST_DIR'); + + /// Directory inside root project. Not necessarily root folder. Symlinks are + /// not resolved on purpose. + static String get rootProjectDir => _getEnv('CARGOKIT_ROOT_PROJECT_DIR'); + + // Pod + + /// Platform name (macosx, iphoneos, iphonesimulator). + static String get darwinPlatformName => + _getEnv("CARGOKIT_DARWIN_PLATFORM_NAME"); + + /// List of architectures to build for (arm64, armv7, x86_64). + static List get darwinArchs => + _getEnv("CARGOKIT_DARWIN_ARCHS").split(' '); + + // Gradle + static String get minSdkVersion => _getEnv("CARGOKIT_MIN_SDK_VERSION"); + static String get ndkVersion => _getEnv("CARGOKIT_NDK_VERSION"); + static String get sdkPath => _getEnvPath("CARGOKIT_SDK_DIR"); + static String get javaHome => _getEnvPath("CARGOKIT_JAVA_HOME"); + static List get targetPlatforms => + _getEnv("CARGOKIT_TARGET_PLATFORMS").split(','); + + // CMAKE + static String get targetPlatform => _getEnv("CARGOKIT_TARGET_PLATFORM"); + + static String _getEnv(String key) { + final res = Platform.environment[key]; + if (res == null) { + throw Exception("Missing environment variable $key"); + } + return res; + } + + static String _getEnvPath(String key) { + final res = _getEnv(key); + if (Directory(res).existsSync()) { + return res.resolveSymlink(); + } else { + return res; + } + } +} diff --git a/cargokit/build_tool/lib/src/logging.dart b/cargokit/build_tool/lib/src/logging.dart new file mode 100644 index 00000000..06392b99 --- /dev/null +++ b/cargokit/build_tool/lib/src/logging.dart @@ -0,0 +1,49 @@ +import 'dart:io'; + +import 'package:logging/logging.dart'; + +const String kSeparator = "--"; +const String kDoubleSeparator = "=="; + +bool _lastMessageWasSeparator = false; + +void _log(LogRecord rec) { + final prefix = '${rec.level.name}: '; + final out = rec.level == Level.SEVERE ? stderr : stdout; + if (rec.message == kSeparator) { + if (!_lastMessageWasSeparator) { + out.write(prefix); + out.writeln('-' * 80); + _lastMessageWasSeparator = true; + } + return; + } else if (rec.message == kDoubleSeparator) { + out.write(prefix); + out.writeln('=' * 80); + _lastMessageWasSeparator = true; + return; + } + out.write(prefix); + out.writeln(rec.message); + _lastMessageWasSeparator = false; +} + +void initLogging() { + Logger.root.level = Level.INFO; + Logger.root.onRecord.listen((LogRecord rec) { + final lines = rec.message.split('\n'); + for (final line in lines) { + if (line.isNotEmpty || lines.length == 1 || line != lines.last) { + _log(LogRecord( + rec.level, + line, + rec.loggerName, + )); + } + } + }); +} + +void enableVerboseLogging() { + Logger.root.level = Level.ALL; +} diff --git a/cargokit/build_tool/lib/src/options.dart b/cargokit/build_tool/lib/src/options.dart new file mode 100644 index 00000000..7937dcac --- /dev/null +++ b/cargokit/build_tool/lib/src/options.dart @@ -0,0 +1,306 @@ +import 'dart:io'; + +import 'package:collection/collection.dart'; +import 'package:ed25519_edwards/ed25519_edwards.dart'; +import 'package:hex/hex.dart'; +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as path; +import 'package:source_span/source_span.dart'; +import 'package:yaml/yaml.dart'; + +import 'builder.dart'; +import 'environment.dart'; +import 'rustup.dart'; + +final _log = Logger('options'); + +/// A class for exceptions that have source span information attached. +class SourceSpanException implements Exception { + // This is a getter so that subclasses can override it. + /// A message describing the exception. + String get message => _message; + final String _message; + + // This is a getter so that subclasses can override it. + /// The span associated with this exception. + /// + /// This may be `null` if the source location can't be determined. + SourceSpan? get span => _span; + final SourceSpan? _span; + + SourceSpanException(this._message, this._span); + + /// Returns a string representation of `this`. + /// + /// [color] may either be a [String], a [bool], or `null`. If it's a string, + /// it indicates an ANSI terminal color escape that should be used to + /// highlight the span's text. If it's `true`, it indicates that the text + /// should be highlighted using the default color. If it's `false` or `null`, + /// it indicates that the text shouldn't be highlighted. + @override + String toString({Object? color}) { + if (span == null) return message; + return 'Error on ${span!.message(message, color: color)}'; + } +} + +enum Toolchain { + stable, + beta, + nightly, +} + +class CargoBuildOptions { + final Toolchain toolchain; + final List flags; + + CargoBuildOptions({ + required this.toolchain, + required this.flags, + }); + + static Toolchain _toolchainFromNode(YamlNode node) { + if (node case YamlScalar(value: String name)) { + final toolchain = + Toolchain.values.firstWhereOrNull((element) => element.name == name); + if (toolchain != null) { + return toolchain; + } + } + throw SourceSpanException( + 'Unknown toolchain. Must be one of ${Toolchain.values.map((e) => e.name)}.', + node.span); + } + + static CargoBuildOptions parse(YamlNode node) { + if (node is! YamlMap) { + throw SourceSpanException('Cargo options must be a map', node.span); + } + Toolchain toolchain = Toolchain.stable; + List flags = []; + for (final MapEntry(:key, :value) in node.nodes.entries) { + if (key case YamlScalar(value: 'toolchain')) { + toolchain = _toolchainFromNode(value); + } else if (key case YamlScalar(value: 'extra_flags')) { + if (value case YamlList(nodes: List list)) { + if (list.every((element) { + if (element case YamlScalar(value: String _)) { + return true; + } + return false; + })) { + flags = list.map((e) => e.value as String).toList(); + continue; + } + } + throw SourceSpanException( + 'Extra flags must be a list of strings', value.span); + } else { + throw SourceSpanException( + 'Unknown cargo option type. Must be "toolchain" or "extra_flags".', + key.span); + } + } + return CargoBuildOptions(toolchain: toolchain, flags: flags); + } +} + +extension on YamlMap { + /// Map that extracts keys so that we can do map case check on them. + Map get valueMap => + nodes.map((key, value) => MapEntry(key.value, value)); +} + +class PrecompiledBinaries { + final String uriPrefix; + final PublicKey publicKey; + + PrecompiledBinaries({ + required this.uriPrefix, + required this.publicKey, + }); + + static PublicKey _publicKeyFromHex(String key, SourceSpan? span) { + final bytes = HEX.decode(key); + if (bytes.length != 32) { + throw SourceSpanException( + 'Invalid public key. Must be 32 bytes long.', span); + } + return PublicKey(bytes); + } + + static PrecompiledBinaries parse(YamlNode node) { + if (node case YamlMap(valueMap: Map map)) { + if (map + case { + 'url_prefix': YamlNode urlPrefixNode, + 'public_key': YamlNode publicKeyNode, + }) { + final urlPrefix = switch (urlPrefixNode) { + YamlScalar(value: String urlPrefix) => urlPrefix, + _ => throw SourceSpanException( + 'Invalid URL prefix value.', urlPrefixNode.span), + }; + final publicKey = switch (publicKeyNode) { + YamlScalar(value: String publicKey) => + _publicKeyFromHex(publicKey, publicKeyNode.span), + _ => throw SourceSpanException( + 'Invalid public key value.', publicKeyNode.span), + }; + return PrecompiledBinaries( + uriPrefix: urlPrefix, + publicKey: publicKey, + ); + } + } + throw SourceSpanException( + 'Invalid precompiled binaries value. ' + 'Expected Map with "url_prefix" and "public_key".', + node.span); + } +} + +/// Cargokit options specified for Rust crate. +class CargokitCrateOptions { + CargokitCrateOptions({ + this.cargo = const {}, + this.precompiledBinaries, + }); + + final Map cargo; + final PrecompiledBinaries? precompiledBinaries; + + static CargokitCrateOptions parse(YamlNode node) { + if (node is! YamlMap) { + throw SourceSpanException('Cargokit options must be a map', node.span); + } + final options = {}; + PrecompiledBinaries? precompiledBinaries; + + for (final entry in node.nodes.entries) { + if (entry + case MapEntry( + key: YamlScalar(value: 'cargo'), + value: YamlNode node, + )) { + if (node is! YamlMap) { + throw SourceSpanException('Cargo options must be a map', node.span); + } + for (final MapEntry(:YamlNode key, :value) in node.nodes.entries) { + if (key case YamlScalar(value: String name)) { + final configuration = BuildConfiguration.values + .firstWhereOrNull((element) => element.name == name); + if (configuration != null) { + options[configuration] = CargoBuildOptions.parse(value); + continue; + } + } + throw SourceSpanException( + 'Unknown build configuration. Must be one of ${BuildConfiguration.values.map((e) => e.name)}.', + key.span); + } + } else if (entry.key case YamlScalar(value: 'precompiled_binaries')) { + precompiledBinaries = PrecompiledBinaries.parse(entry.value); + } else { + throw SourceSpanException( + 'Unknown cargokit option type. Must be "cargo" or "precompiled_binaries".', + entry.key.span); + } + } + return CargokitCrateOptions( + cargo: options, + precompiledBinaries: precompiledBinaries, + ); + } + + static CargokitCrateOptions load({ + required String manifestDir, + }) { + final uri = Uri.file(path.join(manifestDir, "cargokit.yaml")); + final file = File.fromUri(uri); + if (file.existsSync()) { + final contents = loadYamlNode(file.readAsStringSync(), sourceUrl: uri); + return parse(contents); + } else { + return CargokitCrateOptions(); + } + } +} + +class CargokitUserOptions { + // When Rustup is installed always build locally unless user opts into + // using precompiled binaries. + static bool defaultUsePrecompiledBinaries() { + return Rustup.executablePath() == null; + } + + CargokitUserOptions({ + required this.usePrecompiledBinaries, + required this.verboseLogging, + }); + + CargokitUserOptions._() + : usePrecompiledBinaries = defaultUsePrecompiledBinaries(), + verboseLogging = false; + + static CargokitUserOptions parse(YamlNode node) { + if (node is! YamlMap) { + throw SourceSpanException('Cargokit options must be a map', node.span); + } + bool usePrecompiledBinaries = defaultUsePrecompiledBinaries(); + bool verboseLogging = false; + + for (final entry in node.nodes.entries) { + if (entry.key case YamlScalar(value: 'use_precompiled_binaries')) { + if (entry.value case YamlScalar(value: bool value)) { + usePrecompiledBinaries = value; + continue; + } + throw SourceSpanException( + 'Invalid value for "use_precompiled_binaries". Must be a boolean.', + entry.value.span); + } else if (entry.key case YamlScalar(value: 'verbose_logging')) { + if (entry.value case YamlScalar(value: bool value)) { + verboseLogging = value; + continue; + } + throw SourceSpanException( + 'Invalid value for "verbose_logging". Must be a boolean.', + entry.value.span); + } else { + throw SourceSpanException( + 'Unknown cargokit option type. Must be "use_precompiled_binaries" or "verbose_logging".', + entry.key.span); + } + } + return CargokitUserOptions( + usePrecompiledBinaries: usePrecompiledBinaries, + verboseLogging: verboseLogging, + ); + } + + static CargokitUserOptions load() { + String fileName = "cargokit_options.yaml"; + var userProjectDir = Directory(Environment.rootProjectDir); + + while (userProjectDir.parent.path != userProjectDir.path) { + final configFile = File(path.join(userProjectDir.path, fileName)); + if (configFile.existsSync()) { + final contents = loadYamlNode( + configFile.readAsStringSync(), + sourceUrl: configFile.uri, + ); + final res = parse(contents); + if (res.verboseLogging) { + _log.info('Found user options file at ${configFile.path}'); + } + return res; + } + userProjectDir = userProjectDir.parent; + } + return CargokitUserOptions._(); + } + + final bool usePrecompiledBinaries; + final bool verboseLogging; +} diff --git a/cargokit/build_tool/lib/src/precompile_binaries.dart b/cargokit/build_tool/lib/src/precompile_binaries.dart new file mode 100644 index 00000000..39ffafc4 --- /dev/null +++ b/cargokit/build_tool/lib/src/precompile_binaries.dart @@ -0,0 +1,199 @@ +import 'dart:io'; + +import 'package:ed25519_edwards/ed25519_edwards.dart'; +import 'package:github/github.dart'; +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as path; + +import 'artifacts_provider.dart'; +import 'builder.dart'; +import 'cargo.dart'; +import 'crate_hash.dart'; +import 'options.dart'; +import 'rustup.dart'; +import 'target.dart'; + +final _log = Logger('precompile_binaries'); + +class PrecompileBinaries { + PrecompileBinaries({ + required this.privateKey, + required this.githubToken, + required this.repositorySlug, + required this.manifestDir, + required this.targets, + this.androidSdkLocation, + this.androidNdkVersion, + this.androidMinSdkVersion, + this.tempDir, + }); + + final PrivateKey privateKey; + final String githubToken; + final RepositorySlug repositorySlug; + final String manifestDir; + final List targets; + final String? androidSdkLocation; + final String? androidNdkVersion; + final int? androidMinSdkVersion; + final String? tempDir; + + static String fileName(Target target, String name) { + return '${target.rust}_$name'; + } + + static String signatureFileName(Target target, String name) { + return '${target.rust}_$name.sig'; + } + + Future run() async { + final crateInfo = CrateInfo.load(manifestDir); + + final targets = List.of(this.targets); + if (targets.isEmpty) { + targets.addAll([ + ...Target.buildableTargets(), + if (androidSdkLocation != null) ...Target.androidTargets(), + ]); + } + + _log.info('Precompiling binaries for $targets'); + + final hash = CrateHash.compute(manifestDir); + _log.info('Computed crate hash: $hash'); + + final String tagName = 'precompiled_$hash'; + + final github = GitHub(auth: Authentication.withToken(githubToken)); + final repo = github.repositories; + final release = await _getOrCreateRelease( + repo: repo, + tagName: tagName, + packageName: crateInfo.packageName, + hash: hash, + ); + + final tempDir = this.tempDir != null + ? Directory(this.tempDir!) + : Directory.systemTemp.createTempSync('precompiled_'); + + tempDir.createSync(recursive: true); + + final crateOptions = CargokitCrateOptions.load( + manifestDir: manifestDir, + ); + + final buildEnvironment = BuildEnvironment( + configuration: BuildConfiguration.release, + crateOptions: crateOptions, + targetTempDir: tempDir.path, + manifestDir: manifestDir, + crateInfo: crateInfo, + isAndroid: androidSdkLocation != null, + androidSdkPath: androidSdkLocation, + androidNdkVersion: androidNdkVersion, + androidMinSdkVersion: androidMinSdkVersion, + ); + + final rustup = Rustup(); + + for (final target in targets) { + final artifactNames = getArtifactNames( + target: target, + libraryName: crateInfo.packageName, + remote: true, + ); + + if (artifactNames.every((name) { + final fileName = PrecompileBinaries.fileName(target, name); + return (release.assets ?? []).any((e) => e.name == fileName); + })) { + _log.info("All artifacts for $target already exist - skipping"); + continue; + } + + _log.info('Building for $target'); + + final builder = + RustBuilder(target: target, environment: buildEnvironment); + builder.prepare(rustup); + final res = await builder.build(); + + final assets = []; + for (final name in artifactNames) { + final file = File(path.join(res, name)); + if (!file.existsSync()) { + throw Exception('Missing artifact: ${file.path}'); + } + + final data = file.readAsBytesSync(); + final create = CreateReleaseAsset( + name: PrecompileBinaries.fileName(target, name), + contentType: "application/octet-stream", + assetData: data, + ); + final signature = sign(privateKey, data); + final signatureCreate = CreateReleaseAsset( + name: signatureFileName(target, name), + contentType: "application/octet-stream", + assetData: signature, + ); + bool verified = verify(public(privateKey), data, signature); + if (!verified) { + throw Exception('Signature verification failed'); + } + assets.add(create); + assets.add(signatureCreate); + } + _log.info('Uploading assets: ${assets.map((e) => e.name)}'); + for (final asset in assets) { + // This seems to be failing on CI so do it one by one + int retryCount = 0; + while (true) { + try { + await repo.uploadReleaseAssets(release, [asset]); + break; + } on Exception catch (e) { + if (retryCount == 10) { + rethrow; + } + ++retryCount; + _log.shout( + 'Upload failed (attempt $retryCount, will retry): ${e.toString()}'); + await Future.delayed(Duration(seconds: 2)); + } + } + } + } + + _log.info('Cleaning up'); + tempDir.deleteSync(recursive: true); + } + + Future _getOrCreateRelease({ + required RepositoriesService repo, + required String tagName, + required String packageName, + required String hash, + }) async { + Release release; + try { + _log.info('Fetching release $tagName'); + release = await repo.getReleaseByTagName(repositorySlug, tagName); + } on ReleaseNotFound { + _log.info('Release not found - creating release $tagName'); + release = await repo.createRelease( + repositorySlug, + CreateRelease.from( + tagName: tagName, + name: 'Precompiled binaries ${hash.substring(0, 8)}', + targetCommitish: null, + isDraft: false, + isPrerelease: false, + body: 'Precompiled binaries for crate $packageName, ' + 'crate hash $hash.', + )); + } + return release; + } +} diff --git a/cargokit/build_tool/lib/src/rustup.dart b/cargokit/build_tool/lib/src/rustup.dart new file mode 100644 index 00000000..f284179a --- /dev/null +++ b/cargokit/build_tool/lib/src/rustup.dart @@ -0,0 +1,133 @@ +import 'dart:io'; + +import 'package:collection/collection.dart'; +import 'package:path/path.dart' as path; + +import 'util.dart'; + +class _Toolchain { + _Toolchain( + this.name, + this.targets, + ); + + final String name; + final List targets; +} + +class Rustup { + List? installedTargets(String toolchain) { + final targets = _installedTargets(toolchain); + return targets != null ? List.unmodifiable(targets) : null; + } + + void installToolchain(String toolchain) { + log.info("Installing Rust toolchain: $toolchain"); + runCommand("rustup", ['toolchain', 'install', toolchain]); + _installedToolchains + .add(_Toolchain(toolchain, _getInstalledTargets(toolchain))); + } + + void installTarget( + String target, { + required String toolchain, + }) { + log.info("Installing Rust target: $target"); + runCommand("rustup", [ + 'target', + 'add', + '--toolchain', + toolchain, + target, + ]); + _installedTargets(toolchain)?.add(target); + } + + final List<_Toolchain> _installedToolchains; + + Rustup() : _installedToolchains = _getInstalledToolchains(); + + List? _installedTargets(String toolchain) => _installedToolchains + .firstWhereOrNull( + (e) => e.name == toolchain || e.name.startsWith('$toolchain-')) + ?.targets; + + static List<_Toolchain> _getInstalledToolchains() { + String extractToolchainName(String line) { + // ignore (default) after toolchain name + final parts = line.split(' '); + return parts[0]; + } + + final res = runCommand("rustup", ['toolchain', 'list']); + + // To list all non-custom toolchains, we need to filter out lines that + // don't start with "stable", "beta", or "nightly". + Pattern nonCustom = RegExp(r"^(stable|beta|nightly)"); + final lines = res.stdout + .toString() + .split('\n') + .where((e) => e.isNotEmpty && e.startsWith(nonCustom)) + .map(extractToolchainName) + .toList(growable: true); + + return lines + .map( + (name) => _Toolchain( + name, + _getInstalledTargets(name), + ), + ) + .toList(growable: true); + } + + static List _getInstalledTargets(String toolchain) { + final res = runCommand("rustup", [ + 'target', + 'list', + '--toolchain', + toolchain, + '--installed', + ]); + final lines = res.stdout + .toString() + .split('\n') + .where((e) => e.isNotEmpty) + .toList(growable: true); + return lines; + } + + bool _didInstallRustSrcForNightly = false; + + void installRustSrcForNightly() { + if (_didInstallRustSrcForNightly) { + return; + } + // Useful for -Z build-std + runCommand( + "rustup", + ['component', 'add', 'rust-src', '--toolchain', 'nightly'], + ); + _didInstallRustSrcForNightly = true; + } + + static String? executablePath() { + final envPath = Platform.environment['PATH']; + final envPathSeparator = Platform.isWindows ? ';' : ':'; + final home = Platform.isWindows + ? Platform.environment['USERPROFILE'] + : Platform.environment['HOME']; + final paths = [ + if (home != null) path.join(home, '.cargo', 'bin'), + if (envPath != null) ...envPath.split(envPathSeparator), + ]; + for (final p in paths) { + final rustup = Platform.isWindows ? 'rustup.exe' : 'rustup'; + final rustupPath = path.join(p, rustup); + if (File(rustupPath).existsSync()) { + return rustupPath; + } + } + return null; + } +} diff --git a/cargokit/build_tool/lib/src/target.dart b/cargokit/build_tool/lib/src/target.dart new file mode 100644 index 00000000..9287b23c --- /dev/null +++ b/cargokit/build_tool/lib/src/target.dart @@ -0,0 +1,137 @@ +import 'dart:io'; + +import 'package:collection/collection.dart'; + +import 'util.dart'; + +class Target { + Target({ + required this.rust, + this.flutter, + this.android, + this.androidMinSdkVersion, + this.darwinPlatform, + this.darwinArch, + }); + + static final all = [ + Target( + rust: 'armv7-linux-androideabi', + flutter: 'android-arm', + android: 'armeabi-v7a', + androidMinSdkVersion: 16, + ), + Target( + rust: 'aarch64-linux-android', + flutter: 'android-arm64', + android: 'arm64-v8a', + androidMinSdkVersion: 21, + ), + Target( + rust: 'i686-linux-android', + flutter: 'android-x86', + android: 'x86', + androidMinSdkVersion: 16, + ), + Target( + rust: 'x86_64-linux-android', + flutter: 'android-x64', + android: 'x86_64', + androidMinSdkVersion: 21, + ), + Target( + rust: 'x86_64-pc-windows-msvc', + flutter: 'windows-x64', + ), + Target( + rust: 'x86_64-unknown-linux-gnu', + flutter: 'linux-x64', + ), + Target( + rust: 'aarch64-unknown-linux-gnu', + flutter: 'linux-arm64', + ), + Target( + rust: 'x86_64-apple-darwin', + darwinPlatform: 'macosx', + darwinArch: 'x86_64', + ), + Target( + rust: 'aarch64-apple-darwin', + darwinPlatform: 'macosx', + darwinArch: 'arm64', + ), + Target( + rust: 'aarch64-apple-ios', + darwinPlatform: 'iphoneos', + darwinArch: 'arm64', + ), + Target( + rust: 'aarch64-apple-ios-sim', + darwinPlatform: 'iphonesimulator', + darwinArch: 'arm64', + ), + Target( + rust: 'x86_64-apple-ios', + darwinPlatform: 'iphonesimulator', + darwinArch: 'x86_64', + ), + ]; + + static Target? forFlutterName(String flutterName) { + return all.firstWhereOrNull((element) => element.flutter == flutterName); + } + + static Target? forDarwin({ + required String platformName, + required String darwinAarch, + }) { + return all.firstWhereOrNull((element) => // + element.darwinPlatform == platformName && + element.darwinArch == darwinAarch); + } + + static Target? forRustTriple(String triple) { + return all.firstWhereOrNull((element) => element.rust == triple); + } + + static List androidTargets() { + return all + .where((element) => element.android != null) + .toList(growable: false); + } + + /// Returns buildable targets on current host platform ignoring Android targets. + static List buildableTargets() { + if (Platform.isLinux) { + // Right now we don't support cross-compiling on Linux. So we just return + // the host target. + final arch = runCommand('arch', []).stdout as String; + if (arch.trim() == 'aarch64') { + return [Target.forRustTriple('aarch64-unknown-linux-gnu')!]; + } else { + return [Target.forRustTriple('x86_64-unknown-linux-gnu')!]; + } + } + return all.where((target) { + if (Platform.isWindows) { + return target.rust.contains('-windows-'); + } else if (Platform.isMacOS) { + return target.darwinPlatform != null; + } + return false; + }).toList(growable: false); + } + + @override + String toString() { + return rust; + } + + final String? flutter; + final String rust; + final String? android; + final int? androidMinSdkVersion; + final String? darwinPlatform; + final String? darwinArch; +} diff --git a/cargokit/build_tool/lib/src/util.dart b/cargokit/build_tool/lib/src/util.dart new file mode 100644 index 00000000..d8e30196 --- /dev/null +++ b/cargokit/build_tool/lib/src/util.dart @@ -0,0 +1,169 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as path; + +import 'logging.dart'; +import 'rustup.dart'; + +final log = Logger("process"); + +class CommandFailedException implements Exception { + final String executable; + final List arguments; + final ProcessResult result; + + CommandFailedException({ + required this.executable, + required this.arguments, + required this.result, + }); + + @override + String toString() { + final stdout = result.stdout.toString().trim(); + final stderr = result.stderr.toString().trim(); + return [ + "External Command: $executable ${arguments.map((e) => '"$e"').join(' ')}", + "Returned Exit Code: ${result.exitCode}", + kSeparator, + "STDOUT:", + if (stdout.isNotEmpty) stdout, + kSeparator, + "STDERR:", + if (stderr.isNotEmpty) stderr, + ].join('\n'); + } +} + +class TestRunCommandArgs { + final String executable; + final List arguments; + final String? workingDirectory; + final Map? environment; + final bool includeParentEnvironment; + final bool runInShell; + final Encoding? stdoutEncoding; + final Encoding? stderrEncoding; + + TestRunCommandArgs({ + required this.executable, + required this.arguments, + this.workingDirectory, + this.environment, + this.includeParentEnvironment = true, + this.runInShell = false, + this.stdoutEncoding, + this.stderrEncoding, + }); +} + +class TestRunCommandResult { + TestRunCommandResult({ + this.pid = 1, + this.exitCode = 0, + this.stdout = '', + this.stderr = '', + }); + + final int pid; + final int exitCode; + final String stdout; + final String stderr; +} + +TestRunCommandResult Function(TestRunCommandArgs args)? testRunCommandOverride; + +ProcessResult runCommand( + String executable, + List arguments, { + String? workingDirectory, + Map? environment, + bool includeParentEnvironment = true, + bool runInShell = false, + Encoding? stdoutEncoding = systemEncoding, + Encoding? stderrEncoding = systemEncoding, +}) { + if (testRunCommandOverride != null) { + final result = testRunCommandOverride!(TestRunCommandArgs( + executable: executable, + arguments: arguments, + workingDirectory: workingDirectory, + environment: environment, + includeParentEnvironment: includeParentEnvironment, + runInShell: runInShell, + stdoutEncoding: stdoutEncoding, + stderrEncoding: stderrEncoding, + )); + return ProcessResult( + result.pid, + result.exitCode, + result.stdout, + result.stderr, + ); + } + log.finer('Running command $executable ${arguments.join(' ')}'); + final res = Process.runSync( + _resolveExecutable(executable), + arguments, + workingDirectory: workingDirectory, + environment: environment, + includeParentEnvironment: includeParentEnvironment, + runInShell: runInShell, + stderrEncoding: stderrEncoding, + stdoutEncoding: stdoutEncoding, + ); + if (res.exitCode != 0) { + throw CommandFailedException( + executable: executable, + arguments: arguments, + result: res, + ); + } else { + return res; + } +} + +class RustupNotFoundException implements Exception { + @override + String toString() { + return [ + ' ', + 'rustup not found in PATH.', + ' ', + 'Maybe you need to install Rust? It only takes a minute:', + ' ', + if (Platform.isWindows) 'https://www.rust-lang.org/tools/install', + if (hasHomebrewRustInPath()) ...[ + '\$ brew unlink rust # Unlink homebrew Rust from PATH', + ], + if (!Platform.isWindows) + "\$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh", + ' ', + ].join('\n'); + } + + static bool hasHomebrewRustInPath() { + if (!Platform.isMacOS) { + return false; + } + final envPath = Platform.environment['PATH'] ?? ''; + final paths = envPath.split(':'); + return paths.any((p) { + return p.contains('homebrew') && File(path.join(p, 'rustc')).existsSync(); + }); + } +} + +String _resolveExecutable(String executable) { + if (executable == 'rustup') { + final resolved = Rustup.executablePath(); + if (resolved != null) { + return resolved; + } + throw RustupNotFoundException(); + } else { + return executable; + } +} diff --git a/cargokit/build_tool/lib/src/verify_binaries.dart b/cargokit/build_tool/lib/src/verify_binaries.dart new file mode 100644 index 00000000..0094c644 --- /dev/null +++ b/cargokit/build_tool/lib/src/verify_binaries.dart @@ -0,0 +1,81 @@ +import 'dart:io'; + +import 'package:ed25519_edwards/ed25519_edwards.dart'; +import 'package:http/http.dart'; + +import 'artifacts_provider.dart'; +import 'cargo.dart'; +import 'crate_hash.dart'; +import 'options.dart'; +import 'precompile_binaries.dart'; +import 'target.dart'; + +class VerifyBinaries { + VerifyBinaries({ + required this.manifestDir, + }); + + final String manifestDir; + + Future run() async { + final crateInfo = CrateInfo.load(manifestDir); + + final config = CargokitCrateOptions.load(manifestDir: manifestDir); + final precompiledBinaries = config.precompiledBinaries; + if (precompiledBinaries == null) { + stdout.writeln('Crate does not support precompiled binaries.'); + } else { + final crateHash = CrateHash.compute(manifestDir); + stdout.writeln('Crate hash: $crateHash'); + + for (final target in Target.all) { + final message = 'Checking ${target.rust}...'; + stdout.write(message.padRight(40)); + stdout.flush(); + + final artifacts = getArtifactNames( + target: target, + libraryName: crateInfo.packageName, + remote: true, + ); + + final prefix = precompiledBinaries.uriPrefix; + + bool ok = true; + + for (final artifact in artifacts) { + final fileName = PrecompileBinaries.fileName(target, artifact); + final signatureFileName = + PrecompileBinaries.signatureFileName(target, artifact); + + final url = Uri.parse('$prefix$crateHash/$fileName'); + final signatureUrl = + Uri.parse('$prefix$crateHash/$signatureFileName'); + + final signature = await get(signatureUrl); + if (signature.statusCode != 200) { + stdout.writeln('MISSING'); + ok = false; + break; + } + final asset = await get(url); + if (asset.statusCode != 200) { + stdout.writeln('MISSING'); + ok = false; + break; + } + + if (!verify(precompiledBinaries.publicKey, asset.bodyBytes, + signature.bodyBytes)) { + stdout.writeln('INVALID SIGNATURE'); + ok = false; + } + } + + if (ok) { + stdout.writeln('OK'); + } + } + } + } +} diff --git a/cargokit/build_tool/pubspec.lock b/cargokit/build_tool/pubspec.lock new file mode 100644 index 00000000..343bdd36 --- /dev/null +++ b/cargokit/build_tool/pubspec.lock @@ -0,0 +1,453 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + url: "https://pub.dev" + source: hosted + version: "64.0.0" + adaptive_number: + dependency: transitive + description: + name: adaptive_number + sha256: "3a567544e9b5c9c803006f51140ad544aedc79604fd4f3f2c1380003f97c1d77" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + url: "https://pub.dev" + source: hosted + version: "6.2.0" + args: + dependency: "direct main" + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + collection: + dependency: "direct main" + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + convert: + dependency: "direct main" + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + coverage: + dependency: transitive + description: + name: coverage + sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" + url: "https://pub.dev" + source: hosted + version: "1.6.3" + crypto: + dependency: "direct main" + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + ed25519_edwards: + dependency: "direct main" + description: + name: ed25519_edwards + sha256: "6ce0112d131327ec6d42beede1e5dfd526069b18ad45dcf654f15074ad9276cd" + url: "https://pub.dev" + source: hosted + version: "0.3.1" + file: + dependency: transitive + description: + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + github: + dependency: "direct main" + description: + name: github + sha256: "9966bc13bf612342e916b0a343e95e5f046c88f602a14476440e9b75d2295411" + url: "https://pub.dev" + source: hosted + version: "9.17.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + hex: + dependency: "direct main" + description: + name: hex + sha256: "4e7cd54e4b59ba026432a6be2dd9d96e4c5205725194997193bf871703b82c4a" + url: "https://pub.dev" + source: hosted + version: "0.2.0" + http: + dependency: "direct main" + description: + name: http + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.dev" + source: hosted + version: "4.8.1" + lints: + dependency: "direct dev" + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + logging: + dependency: "direct main" + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + meta: + dependency: transitive + description: + name: meta + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + mime: + dependency: transitive + description: + name: mime + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" + source: hosted + version: "1.0.4" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path: + dependency: "direct main" + description: + name: path + sha256: "2ad4cddff7f5cc0e2d13069f2a3f7a73ca18f66abd6f5ecf215219cdb3638edb" + url: "https://pub.dev" + source: hosted + version: "1.8.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + url: "https://pub.dev" + source: hosted + version: "5.4.0" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e + url: "https://pub.dev" + source: hosted + version: "1.1.2" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" + source: hosted + version: "0.10.12" + source_span: + dependency: "direct main" + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test: + dependency: "direct dev" + description: + name: test + sha256: "9b0dd8e36af4a5b1569029949d50a52cb2a2a2fdaa20cebb96e6603b9ae241f9" + url: "https://pub.dev" + source: hosted + version: "1.24.6" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" + source: hosted + version: "0.6.1" + test_core: + dependency: transitive + description: + name: test_core + sha256: "4bef837e56375537055fdbbbf6dd458b1859881f4c7e6da936158f77d61ab265" + url: "https://pub.dev" + source: hosted + version: "0.5.6" + toml: + dependency: "direct main" + description: + name: toml + sha256: "157c5dca5160fced243f3ce984117f729c788bb5e475504f3dbcda881accee44" + url: "https://pub.dev" + source: hosted + version: "0.14.0" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + version: + dependency: "direct main" + description: + name: version + sha256: "2307e23a45b43f96469eeab946208ed63293e8afca9c28cd8b5241ff31c55f55" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "0fae432c85c4ea880b33b497d32824b97795b04cdaa74d270219572a1f50268d" + url: "https://pub.dev" + source: hosted + version: "11.9.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + yaml: + dependency: "direct main" + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.0.0 <4.0.0" diff --git a/cargokit/build_tool/pubspec.yaml b/cargokit/build_tool/pubspec.yaml new file mode 100644 index 00000000..e01aa0ae --- /dev/null +++ b/cargokit/build_tool/pubspec.yaml @@ -0,0 +1,30 @@ +name: build_tool +description: Cargokit build_tool. Facilitates the build of Rust crate during Flutter application build. +publish_to: none +version: 1.0.0 + +environment: + sdk: ">=3.0.0 <4.0.0" + +# Add regular dependencies here. +dependencies: + # these are pinned on purpose because the bundle_tool_runner doesn't have + # pubspec.lock. See run_build_tool.sh + logging: 1.2.0 + path: 1.8.0 + version: 3.0.0 + collection: 1.18.0 + ed25519_edwards: 0.3.1 + hex: 0.2.0 + yaml: 3.1.2 + source_span: 1.10.0 + github: 9.17.0 + args: 2.4.2 + crypto: 3.0.3 + convert: 3.1.1 + http: 1.1.0 + toml: 0.14.0 + +dev_dependencies: + lints: ^2.1.0 + test: ^1.24.0 diff --git a/cargokit/build_tool/test/builder_test.dart b/cargokit/build_tool/test/builder_test.dart new file mode 100644 index 00000000..e92852e5 --- /dev/null +++ b/cargokit/build_tool/test/builder_test.dart @@ -0,0 +1,28 @@ +import 'package:build_tool/src/builder.dart'; +import 'package:test/test.dart'; + +void main() { + test('parseBuildConfiguration', () { + var b = BuildEnvironment.parseBuildConfiguration('debug'); + expect(b, BuildConfiguration.debug); + + b = BuildEnvironment.parseBuildConfiguration('profile'); + expect(b, BuildConfiguration.profile); + + b = BuildEnvironment.parseBuildConfiguration('release'); + expect(b, BuildConfiguration.release); + + b = BuildEnvironment.parseBuildConfiguration('debug-dev'); + expect(b, BuildConfiguration.debug); + + b = BuildEnvironment.parseBuildConfiguration('profile'); + expect(b, BuildConfiguration.profile); + + b = BuildEnvironment.parseBuildConfiguration('profile-prod'); + expect(b, BuildConfiguration.profile); + + // fallback to release + b = BuildEnvironment.parseBuildConfiguration('unknown'); + expect(b, BuildConfiguration.release); + }); +} diff --git a/cargokit/build_tool/test/cargo_test.dart b/cargokit/build_tool/test/cargo_test.dart new file mode 100644 index 00000000..00afe29f --- /dev/null +++ b/cargokit/build_tool/test/cargo_test.dart @@ -0,0 +1,28 @@ +import 'package:build_tool/src/cargo.dart'; +import 'package:test/test.dart'; + +final _cargoToml = """ +[workspace] + +[profile.release] +lto = true +panic = "abort" +opt-level = "z" +# strip = "symbols" + +[package] +name = "super_native_extensions" +version = "0.1.0" +edition = "2021" +resolver = "2" + +[lib] +crate-type = ["cdylib", "staticlib"] +"""; + +void main() { + test('parseCargoToml', () { + final info = CrateInfo.parseManifest(_cargoToml); + expect(info.packageName, 'super_native_extensions'); + }); +} diff --git a/cargokit/build_tool/test/options_test.dart b/cargokit/build_tool/test/options_test.dart new file mode 100644 index 00000000..25a85b6a --- /dev/null +++ b/cargokit/build_tool/test/options_test.dart @@ -0,0 +1,75 @@ +import 'package:build_tool/src/builder.dart'; +import 'package:build_tool/src/options.dart'; +import 'package:hex/hex.dart'; +import 'package:test/test.dart'; +import 'package:yaml/yaml.dart'; + +void main() { + test('parseCargoBuildOptions', () { + final yaml = """ +toolchain: nightly +extra_flags: + - -Z + # Comment here + - build-std=panic_abort,std +"""; + final node = loadYamlNode(yaml); + final options = CargoBuildOptions.parse(node); + expect(options.toolchain, Toolchain.nightly); + expect(options.flags, ['-Z', 'build-std=panic_abort,std']); + }); + + test('parsePrecompiledBinaries', () { + final yaml = """ +url_prefix: https://url-prefix +public_key: a4c3433798eb2c36edf2b94dbb4dd899d57496ca373a8982d8a792410b7f6445 +"""; + final precompiledBinaries = PrecompiledBinaries.parse(loadYamlNode(yaml)); + final key = HEX.decode( + 'a4c3433798eb2c36edf2b94dbb4dd899d57496ca373a8982d8a792410b7f6445'); + expect(precompiledBinaries.uriPrefix, 'https://url-prefix'); + expect(precompiledBinaries.publicKey.bytes, key); + }); + + test('parseCargokitOptions', () { + const yaml = ''' +cargo: + # For smalles binaries rebuilt the standard library with panic=abort + debug: + toolchain: nightly + extra_flags: + - -Z + # Comment here + - build-std=panic_abort,std + release: + toolchain: beta + +precompiled_binaries: + url_prefix: https://url-prefix + public_key: a4c3433798eb2c36edf2b94dbb4dd899d57496ca373a8982d8a792410b7f6445 +'''; + final options = CargokitCrateOptions.parse(loadYamlNode(yaml)); + expect(options.precompiledBinaries?.uriPrefix, 'https://url-prefix'); + final key = HEX.decode( + 'a4c3433798eb2c36edf2b94dbb4dd899d57496ca373a8982d8a792410b7f6445'); + expect(options.precompiledBinaries?.publicKey.bytes, key); + + final debugOptions = options.cargo[BuildConfiguration.debug]!; + expect(debugOptions.toolchain, Toolchain.nightly); + expect(debugOptions.flags, ['-Z', 'build-std=panic_abort,std']); + + final releaseOptions = options.cargo[BuildConfiguration.release]!; + expect(releaseOptions.toolchain, Toolchain.beta); + expect(releaseOptions.flags, []); + }); + + test('parseCargokitUserOptions', () { + const yaml = ''' +use_precompiled_binaries: false +verbose_logging: true +'''; + final options = CargokitUserOptions.parse(loadYamlNode(yaml)); + expect(options.usePrecompiledBinaries, false); + expect(options.verboseLogging, true); + }); +} diff --git a/cargokit/build_tool/test/rustup_test.dart b/cargokit/build_tool/test/rustup_test.dart new file mode 100644 index 00000000..af95303c --- /dev/null +++ b/cargokit/build_tool/test/rustup_test.dart @@ -0,0 +1,66 @@ +import 'package:build_tool/src/rustup.dart'; +import 'package:build_tool/src/util.dart'; +import 'package:test/test.dart'; + +void main() { + test('rustup with no toolchains', () { + bool didListToolchains = false; + bool didInstallStable = false; + bool didListTargets = false; + testRunCommandOverride = (args) { + expect(args.executable, 'rustup'); + switch (args.arguments) { + case ['toolchain', 'list']: + didListToolchains = true; + return TestRunCommandResult(stdout: 'no installed toolchains\n'); + case ['toolchain', 'install', 'stable']: + didInstallStable = true; + return TestRunCommandResult(); + case ['target', 'list', '--toolchain', 'stable', '--installed']: + didListTargets = true; + return TestRunCommandResult( + stdout: 'x86_64-unknown-linux-gnu\nx86_64-apple-darwin\n'); + default: + throw Exception('Unexpected call: ${args.arguments}'); + } + }; + final rustup = Rustup(); + rustup.installToolchain('stable'); + expect(didInstallStable, true); + expect(didListToolchains, true); + expect(didListTargets, true); + expect(rustup.installedTargets('stable'), [ + 'x86_64-unknown-linux-gnu', + 'x86_64-apple-darwin', + ]); + testRunCommandOverride = null; + }); + + test('rustup with esp toolchain', () { + final targetsQueried = []; + testRunCommandOverride = (args) { + expect(args.executable, 'rustup'); + switch (args.arguments) { + case ['toolchain', 'list']: + return TestRunCommandResult( + stdout: 'stable-aarch64-apple-darwin (default)\n' + 'nightly-aarch64-apple-darwin\n' + 'esp\n'); + case ['target', 'list', '--toolchain', String toolchain, '--installed']: + targetsQueried.add(toolchain); + return TestRunCommandResult(stdout: '$toolchain:target\n'); + default: + throw Exception('Unexpected call: ${args.arguments}'); + } + }; + final rustup = Rustup(); + expect(targetsQueried, [ + 'stable-aarch64-apple-darwin', + 'nightly-aarch64-apple-darwin', + ]); + expect(rustup.installedTargets('stable'), + ['stable-aarch64-apple-darwin:target']); + expect(rustup.installedTargets('nightly'), + ['nightly-aarch64-apple-darwin:target']); + }); +} diff --git a/cargokit/cmake/cargokit.cmake b/cargokit/cmake/cargokit.cmake new file mode 100644 index 00000000..88326005 --- /dev/null +++ b/cargokit/cmake/cargokit.cmake @@ -0,0 +1,97 @@ +SET(cargokit_cmake_root "${CMAKE_CURRENT_LIST_DIR}/..") + +# Workaround for https://github.com/dart-lang/pub/issues/4010 +get_filename_component(cargokit_cmake_root "${cargokit_cmake_root}" REALPATH) + +if(WIN32) + # REALPATH does not properly resolve symlinks on windows :-/ + execute_process(COMMAND powershell -ExecutionPolicy Bypass -File "${CMAKE_CURRENT_LIST_DIR}/resolve_symlinks.ps1" "${cargokit_cmake_root}" OUTPUT_VARIABLE cargokit_cmake_root OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + +# Arguments +# - target: CMAKE target to which rust library is linked +# - manifest_dir: relative path from current folder to directory containing cargo manifest +# - lib_name: cargo package name +# - any_symbol_name: name of any exported symbol from the library. +# used on windows to force linking with library. +function(apply_cargokit target manifest_dir lib_name any_symbol_name) + + set(CARGOKIT_LIB_NAME "${lib_name}") + set(CARGOKIT_LIB_FULL_NAME "${CMAKE_SHARED_MODULE_PREFIX}${CARGOKIT_LIB_NAME}${CMAKE_SHARED_MODULE_SUFFIX}") + if (CMAKE_CONFIGURATION_TYPES) + set(CARGOKIT_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$") + set(OUTPUT_LIB "${CMAKE_CURRENT_BINARY_DIR}/$/${CARGOKIT_LIB_FULL_NAME}") + else() + set(CARGOKIT_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}") + set(OUTPUT_LIB "${CMAKE_CURRENT_BINARY_DIR}/${CARGOKIT_LIB_FULL_NAME}") + endif() + set(CARGOKIT_TEMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/cargokit_build") + + if (FLUTTER_TARGET_PLATFORM) + set(CARGOKIT_TARGET_PLATFORM "${FLUTTER_TARGET_PLATFORM}") + else() + set(CARGOKIT_TARGET_PLATFORM "windows-x64") + endif() + + set(CARGOKIT_ENV + "CARGOKIT_CMAKE=${CMAKE_COMMAND}" + "CARGOKIT_CONFIGURATION=$" + "CARGOKIT_MANIFEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${manifest_dir}" + "CARGOKIT_TARGET_TEMP_DIR=${CARGOKIT_TEMP_DIR}" + "CARGOKIT_OUTPUT_DIR=${CARGOKIT_OUTPUT_DIR}" + "CARGOKIT_TARGET_PLATFORM=${CARGOKIT_TARGET_PLATFORM}" + "CARGOKIT_TOOL_TEMP_DIR=${CARGOKIT_TEMP_DIR}/tool" + "CARGOKIT_ROOT_PROJECT_DIR=${CMAKE_SOURCE_DIR}" + ) + + if (WIN32) + set(SCRIPT_EXTENSION ".cmd") + set(IMPORT_LIB_EXTENSION ".lib") + else() + set(SCRIPT_EXTENSION ".sh") + set(IMPORT_LIB_EXTENSION "") + endif() + + # Using generators in custom command is only supported in CMake 3.20+ + if (CMAKE_CONFIGURATION_TYPES AND ${CMAKE_VERSION} VERSION_LESS "3.20.0") + foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES) + add_custom_command( + OUTPUT + "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG}/${CARGOKIT_LIB_FULL_NAME}" + "${CMAKE_CURRENT_BINARY_DIR}/_phony_" + COMMAND ${CMAKE_COMMAND} -E env ${CARGOKIT_ENV} + "${cargokit_cmake_root}/run_build_tool${SCRIPT_EXTENSION}" build-cmake + VERBATIM + ) + endforeach() + else() + add_custom_command( + OUTPUT + ${OUTPUT_LIB} + "${CMAKE_CURRENT_BINARY_DIR}/_phony_" + COMMAND ${CMAKE_COMMAND} -E env ${CARGOKIT_ENV} + "${cargokit_cmake_root}/run_build_tool${SCRIPT_EXTENSION}" build-cmake + VERBATIM + ) + endif() + + set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/_phony_" PROPERTIES SYMBOLIC TRUE) + + if (TARGET ${target}) + # If we have actual cmake target provided create target and make existing + # target depend on it + add_custom_target("${target}_cargokit" DEPENDS ${OUTPUT_LIB}) + add_dependencies("${target}" "${target}_cargokit") + target_link_libraries("${target}" PRIVATE "${OUTPUT_LIB}${IMPORT_LIB_EXTENSION}") + if(WIN32) + target_link_options(${target} PRIVATE "/INCLUDE:${any_symbol_name}") + endif() + else() + # Otherwise (FFI) just use ALL to force building always + add_custom_target("${target}_cargokit" ALL DEPENDS ${OUTPUT_LIB}) + endif() + + # Allow adding the output library to plugin bundled libraries + set("${target}_cargokit_lib" ${OUTPUT_LIB} PARENT_SCOPE) + +endfunction() \ No newline at end of file diff --git a/cargokit/cmake/resolve_symlinks.ps1 b/cargokit/cmake/resolve_symlinks.ps1 new file mode 100644 index 00000000..3d10d283 --- /dev/null +++ b/cargokit/cmake/resolve_symlinks.ps1 @@ -0,0 +1,27 @@ +function Resolve-Symlinks { + [CmdletBinding()] + [OutputType([string])] + param( + [Parameter(Position = 0, Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] + [string] $Path + ) + + [string] $separator = '/' + [string[]] $parts = $Path.Split($separator) + + [string] $realPath = '' + foreach ($part in $parts) { + if ($realPath -and !$realPath.EndsWith($separator)) { + $realPath += $separator + } + $realPath += $part + $item = Get-Item $realPath + if ($item.Target) { + $realPath = $item.Target.Replace('\', '/') + } + } + $realPath +} + +$path=Resolve-Symlinks -Path $args[0] +Write-Host $path diff --git a/cargokit/docs/architecture.md b/cargokit/docs/architecture.md new file mode 100644 index 00000000..d9bcf4e2 --- /dev/null +++ b/cargokit/docs/architecture.md @@ -0,0 +1,104 @@ +# Cargokit Architecture + +Note: This is mostly relevant for plugins authors that want to see a bit under the hood rather then just following a tutorial. + +In ideal conditions the end-developer using the plugin should not even be aware of Cargokit existence. + +## Integration + +Cargokit is meant to be included in Flutter plugin (or application) that contains the Rust crate to be built during the Flutter build process. + +Cargokit can be either incuded as git submodule or git subtree (required for plugins - as pub does not support submodules for git dependencies). + +For a step by step tutorial on integrating Cargokit with a Flutter plugin see https://matejknopp.com/post/flutter_plugin_in_rust_with_no_prebuilt_binaries/. + +## build_tool + +Build tool is the core of cargokit. It is a Dart command line package that facilitates the build of Rust crate. It is invoked during the Flutter build process to build (or download) Rust artifacts, but it can be also used as a standalone tool. + +It handles the following commands: + +### build-cmake + +This is invoked from `cargokit.cmake` and it is used to build the Rust crate into a dynamic library on Linux and Windows (which use CMake as build system). + +The command takes no additional arguments, everything is controlled during environment variables set by `cargokit.cmake`. + +### build-gradle + +This is invoked from `plugin.gradle` and it is used to build the Rust crate into a dynamic library on Android. The command takes no additional arguments, everything is controlled during environment variables set by `plugin.gradle`. + +The build_tool installs NDK if needed, configures the Rust environment for cross compilation and then invokes `cargo build` with appropriate arguments and environment variables. + +The build-tool also acts a linker driver. + +### build-pod + +This is invoked from plugin's podspec `script_phase` through `build_pod.sh`. Bundle tool will build the Rust crate into a static library that gets linked into the plugin Framework. In this case must have `:execution_position` set to `:before_compile`. + +Cargokit will build binaries for all active architectures from XCode build and lipo them togherer. + +When using Cargokit to integrate Rust code with an application (not a plugin) you can also configure the `Cargo.toml` to just build a dynamic library. When Cargokit finds that the crate only built a dylib and no static lib, it will attempt to replace the Cocoapod framework binary with the dylib. In this case the script `:execution_position` must be set to `:after_compile`. This is *not* recommended for plugins and it's quite experimental. + +### gen-key, precompile-binaries, verify-binaries + +These are used as when providing precompiled binaries for Plugin. See [precompiled_binaries.md](precompiled_binaries.md) for more information. + +## Launching the build_tool during build. + +During Flutter build, the build tool can not be launched directly using `dart run`. Rather it is launched through `run_build_tool.sh` and `run_build_tool.cmd`. Because the `build_tool` is shipped as part of plugin, we generally don't want to write into the plugin directory during build, which would happen if the `build_tool` was simply invoked through `dart run` (For example the `.dart_tool/package_config.json` file would get written inside the `build_tool` directory). + +Instead the `run_build_tool` script creates a minimal Dart command line package in the build directory and references the `build_tool` as package. That way the `.dart_tool/package_config.json` file is created in the temporary build folder and not in the plugin itself. The script also precompiles the Dart code to speed up subsequent invocations. + +## Configuring Cargokit + +### Configuration for the Rust crate + +Cargokit can be configured through a `cargokit.yaml` file, which can be used to control the build of the Rust package and is placed into the Rust crate next to `Cargo.toml`. + +Here is an example `cargokit.yaml` with comments: +```yaml +cargo: + debug: # Configuration of cargo execution during debug builds + toolchain: stable # default + release: # Configuration of cargo execution for release builds + toolchain: nightly # rustup will be invoked with nightly toolchain + extra_flags: # extra arguments passed to cargo build + - -Z + - build-std=panic_abort,std + +# If crate ships with precompiled binaries, they can be configured here. +precompiled_binaries: + # Uri prefix used when downloading precompiled binaries. + url_prefix: https://github.com/superlistapp/super_native_extensions/releases/download/precompiled_ + + # Public key for verifying downloaded precompiled binaries. + public_key: 3a257ef1c7d72d84225ac4658d24812ada50a7a7a8a2138c2a91353389fdc514 +``` + +### Configuration for the application consuming the plugin + +A `cargokit_options.yaml` file can also be placed by developer using plugin to the root of the application package. In which case the file can be used to specify following options: + +```yaml +# Enables verbose logging of Cargokit during build +verbose_logging: true + +# Opts out of using precompiled binaries. If crate has configured +# and deployed precompiled binaries, these will be by default used whenever Rustup +# is not installed. With `use_precompiled_binaries` set to false, the build will +# instead be aborted prompting user to install Rustup. +use_precompiled_binaries: false +``` + +## Detecting Rustup + +When the plugin doesn't come with precompiled libraries (or user opt-out), `build_tool` will need to invoke Rustup during build to ensure that required Rust targets and toolchain are installed for current build and to build the Rust crate. + +Cargokit will attempt to detect Rustup in the default Rustup installation location (`~/.cargo/rustup`) as well as in PATH. This is done so that if user install Rustup but doesn't properly configure PATH, Cargokit will still work. + +If `build_tool` doesn't find Rustup, it will about the build with a message showing instructions to install Rustup specific to current platform. + +On macOS it will also detect a homebrew Rust installation in PATH and will prompt user to call `brew unlink rust` first to remove homebrew Rust installation from PATH, because it may interfere with Rustup. + +Homebrew Rust installation can not be used by Cargokit, because it can only build for host platform. Cargokit needs to be able to cross compile the Rust crate for iOS and Android and thus needs full Rustup installation. diff --git a/cargokit/docs/precompiled_binaries.md b/cargokit/docs/precompiled_binaries.md new file mode 100644 index 00000000..2026e867 --- /dev/null +++ b/cargokit/docs/precompiled_binaries.md @@ -0,0 +1,95 @@ +# Precompiled Binaries + +Because Cargokit builds the Rust crate during Flutter build, it is inherently +dependend on the Rust toolchain being installed on the developer's machine. + +To decrease the friction, it is possible for Cargokit to use precompiled binaries instead. + +This is how the process of using precompiled binaries looks from the perspective of the build on developer machine: + +1. Cargokit checks if there is `cargokit_options.yaml` file in the root folder of target application. If there is one, it will be checked for `use_precompiled_binaries` options to see if user opted out of using precompiled binaries. In which case Cargokit will insist on building from source. Cargokit will also build from source if the configuration file is absent, but user has Rustup installed. + +2. Cargokit checks if there is `cargokit.yaml` file placed in the Rust crate. If there is one, it will be checked for `precompiled_binaries` section to see if crate supports precompiled binaries. The configuration section must contain a public key and URL prefix. + +3. Cargokit computes a `crate-hash`. This is a SHA256 hash value computed from all Rust files inside crate, `Cargo.toml`, `Cargo.lock` and `cargokit.yaml`. This uniquely identifies the crate and it is used to find the correct precompiled binaries. + +4. Cargokit will attempt to download the precompiled binaries for target platform and `crate_hash` combination and a signature file for each downloaded binary. If download succeeds, the binary content will be verified against the signature and public key included in `cargokit.yaml` (which is part of Rust crate and thus part of published Flutter package). + +5. If the verification succeeds, the precompiled binaries will be used. Otherwise the binary will be discarded and Cargokit will insist on building from source. + +## Providing precompiled binaries + +Note that this assumes that precompiled binaries will be generated during github actions and deployed as github releases. + +### Use `build_tool` to generate a key-pair: + +``` +dart run build_tool gen-key +``` + +This will print the private key and public key. Store the private key securely. It needs to be provided as a secret to github action. + +The public key should be included in `cargokit.yaml` file in the Rust crate. + +### Provide a `cargokit.yaml` file in the Rust crate + +The file must be placed alongside Cargo.toml. + +```yaml +precompiled_binaries: + # Uri prefix used when downloading precompiled binaries. + url_prefix: https://github.com///releases/download/precompiled_ + + # Public key for verifying downloaded precompiled binaries. + public_key: +``` + +### Configure a github action to build and upload precompiled binaries. + +The github action should be run at every commit to main branch (and possibly other branches). + +The action needs two secrets - private key for signing binaries and GitHub token for uploading binaries as releases. Here is example action that precompiles and uploads binaries for all supported targets. + +```yaml +on: + push: + branches: [ main ] + +name: Precompile Binaries + +jobs: + Precompile: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macOS-latest + - windows-latest + steps: + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v1 + - name: Install GTK + if: (matrix.os == 'ubuntu-latest') + run: sudo apt-get update && sudo apt-get install libgtk-3-dev + - name: Precompile + if: (matrix.os == 'macOS-latest') || (matrix.os == 'windows-latest') + run: dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=superlistapp/super_native_extensions + working-directory: super_native_extensions/cargokit/build_tool + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} + PRIVATE_KEY: ${{ secrets.RELEASE_PRIVATE_KEY }} + - name: Precompile (with Android) + if: (matrix.os == 'ubuntu-latest') + run: dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=superlistapp/super_native_extensions --android-sdk-location=/usr/local/lib/android/sdk --android-ndk-version=24.0.8215888 --android-min-sdk-version=23 + working-directory: super_native_extensions/cargokit/build_tool + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} + PRIVATE_KEY: ${{ secrets.RELEASE_PRIVATE_KEY }} +``` + +By default the `built_tool precompile-binaries` commands build and uploads the binaries for all targets buildable from current host. This can be overriden using the `--target ` argument. + +Android binaries will be built when `--android-sdk-location` and `--android-ndk-version` arguments are provided. + diff --git a/cargokit/gradle/plugin.gradle b/cargokit/gradle/plugin.gradle new file mode 100644 index 00000000..a9a6ec7a --- /dev/null +++ b/cargokit/gradle/plugin.gradle @@ -0,0 +1,166 @@ +import java.nio.file.Paths +import org.apache.tools.ant.taskdefs.condition.Os + +CargoKitPlugin.file = buildscript.sourceFile + +apply plugin: CargoKitPlugin + +class CargoKitExtension { + String manifestDir; // Relative path to folder containing Cargo.toml + String libname; // Library name within Cargo.toml. Must be a cdylib +} + +abstract class CargoKitBuildTask extends DefaultTask { + + @Input + String buildMode + + @Input + String buildDir + + @Input + String outputDir + + @Input + String ndkVersion + + @Input + String sdkDirectory + + @Input + int compileSdkVersion; + + @Input + int minSdkVersion; + + @Input + String pluginFile + + @Input + List targetPlatforms + + @TaskAction + def build() { + if (project.cargokit.manifestDir == null) { + throw new GradleException("Property 'manifestDir' must be set on cargokit extension"); + } + + if (project.cargokit.libname == null) { + throw new GradleException("Property 'libname' must be set on cargokit extension"); + } + + def executableName = Os.isFamily(Os.FAMILY_WINDOWS) ? "run_build_tool.cmd" : "run_build_tool.sh" + def path = Paths.get(new File(pluginFile).parent, "..", executableName); + + def manifestDir = Paths.get(project.buildscript.sourceFile.parent, project.cargokit.manifestDir) + + def rootProjectDir = project.rootProject.projectDir + + project.exec { + executable path + args "build-gradle" + environment "CARGOKIT_ROOT_PROJECT_DIR", rootProjectDir + environment "CARGOKIT_TOOL_TEMP_DIR", "${buildDir}/build_tool" + environment "CARGOKIT_MANIFEST_DIR", manifestDir + environment "CARGOKIT_CONFIGURATION", buildMode + environment "CARGOKIT_TARGET_TEMP_DIR", buildDir + environment "CARGOKIT_OUTPUT_DIR", outputDir + environment "CARGOKIT_NDK_VERSION", ndkVersion + environment "CARGOKIT_SDK_DIR", sdkDirectory + environment "CARGOKIT_COMPILE_SDK_VERSION", compileSdkVersion + environment "CARGOKIT_MIN_SDK_VERSION", minSdkVersion + environment "CARGOKIT_TARGET_PLATFORMS", targetPlatforms.join(",") + environment "CARGOKIT_JAVA_HOME", System.properties['java.home'] + } + } +} + +class CargoKitPlugin implements Plugin { + + static String file; + + private Plugin findFlutterPlugin(Project rootProject) { + _findFlutterPlugin(rootProject.childProjects) + } + + private Plugin _findFlutterPlugin(Map projects) { + for (project in projects) { + for (plugin in project.value.getPlugins()) { + if (plugin.class.name == "FlutterPlugin") { + return plugin; + } + } + def plugin = _findFlutterPlugin(project.value.childProjects); + if (plugin != null) { + return plugin; + } + } + return null; + } + + @Override + void apply(Project project) { + def plugin = findFlutterPlugin(project.rootProject); + + project.extensions.create("cargokit", CargoKitExtension) + + if (plugin == null) { + print("Flutter plugin not found, CargoKit plugin will not be applied.") + return; + } + + def cargoBuildDir = "${project.buildDir}/build" + + plugin.project.android.applicationVariants.all { variant -> + + final buildType = variant.buildType.name + + def cargoOutputDir = "${project.buildDir}/jniLibs/${buildType}"; + def jniLibs = project.android.sourceSets.maybeCreate(buildType).jniLibs; + jniLibs.srcDir(new File(cargoOutputDir)) + + def platforms = plugin.getTargetPlatforms().collect() + + // Same thing addFlutterDependencies does in flutter.gradle + if (buildType == "debug") { + platforms.add("android-x86") + platforms.add("android-x64") + } + + // The task name depends on plugin properties, which are not available + // at this point + project.getGradle().afterProject { + def taskName = "cargokitCargoBuild${project.cargokit.libname.capitalize()}${buildType.capitalize()}"; + + if (project.tasks.findByName(taskName)) { + return + } + + if (plugin.project.android.ndkVersion == null) { + throw new GradleException("Please set 'android.ndkVersion' in 'app/build.gradle'.") + } + + def task = project.tasks.create(taskName, CargoKitBuildTask.class) { + buildMode = variant.buildType.name + buildDir = cargoBuildDir + outputDir = cargoOutputDir + ndkVersion = plugin.project.android.ndkVersion + sdkDirectory = plugin.project.android.sdkDirectory + minSdkVersion = plugin.project.android.defaultConfig.minSdkVersion.apiLevel as int + compileSdkVersion = plugin.project.android.compileSdkVersion.substring(8) as int + targetPlatforms = platforms + pluginFile = CargoKitPlugin.file + } + def onTask = { newTask -> + if (newTask.name == "merge${buildType.capitalize()}NativeLibs") { + newTask.dependsOn task + // Fix gradle 7.4.2 not picking up JNI library changes + newTask.outputs.upToDateWhen { false } + } + } + project.tasks.each onTask + project.tasks.whenTaskAdded onTask + } + } + } +} diff --git a/cargokit/run_build_tool.cmd b/cargokit/run_build_tool.cmd new file mode 100644 index 00000000..c45d0aa8 --- /dev/null +++ b/cargokit/run_build_tool.cmd @@ -0,0 +1,91 @@ +@echo off +setlocal + +setlocal ENABLEDELAYEDEXPANSION + +SET BASEDIR=%~dp0 + +if not exist "%CARGOKIT_TOOL_TEMP_DIR%" ( + mkdir "%CARGOKIT_TOOL_TEMP_DIR%" +) +cd /D "%CARGOKIT_TOOL_TEMP_DIR%" + +SET BUILD_TOOL_PKG_DIR=%BASEDIR%build_tool +SET DART=%FLUTTER_ROOT%\bin\cache\dart-sdk\bin\dart + +set BUILD_TOOL_PKG_DIR_POSIX=%BUILD_TOOL_PKG_DIR:\=/% + +( + echo name: build_tool_runner + echo version: 1.0.0 + echo publish_to: none + echo. + echo environment: + echo sdk: '^>=3.0.0 ^<4.0.0' + echo. + echo dependencies: + echo build_tool: + echo path: %BUILD_TOOL_PKG_DIR_POSIX% +) >pubspec.yaml + +if not exist bin ( + mkdir bin +) + +( + echo import 'package:build_tool/build_tool.dart' as build_tool; + echo void main^(List^ args^) ^{ + echo build_tool.runMain^(args^); + echo ^} +) >bin\build_tool_runner.dart + +SET PRECOMPILED=bin\build_tool_runner.dill + +REM To detect changes in package we compare output of DIR /s (recursive) +set PREV_PACKAGE_INFO=.dart_tool\package_info.prev +set CUR_PACKAGE_INFO=.dart_tool\package_info.cur + +DIR "%BUILD_TOOL_PKG_DIR%" /s > "%CUR_PACKAGE_INFO%_orig" + +REM Last line in dir output is free space on harddrive. That is bound to +REM change between invocation so we need to remove it +( + Set "Line=" + For /F "UseBackQ Delims=" %%A In ("%CUR_PACKAGE_INFO%_orig") Do ( + SetLocal EnableDelayedExpansion + If Defined Line Echo !Line! + EndLocal + Set "Line=%%A") +) >"%CUR_PACKAGE_INFO%" +DEL "%CUR_PACKAGE_INFO%_orig" + +REM Compare current directory listing with previous +FC /B "%CUR_PACKAGE_INFO%" "%PREV_PACKAGE_INFO%" > nul 2>&1 + +If %ERRORLEVEL% neq 0 ( + REM Changed - copy current to previous and remove precompiled kernel + if exist "%PREV_PACKAGE_INFO%" ( + DEL "%PREV_PACKAGE_INFO%" + ) + MOVE /Y "%CUR_PACKAGE_INFO%" "%PREV_PACKAGE_INFO%" + if exist "%PRECOMPILED%" ( + DEL "%PRECOMPILED%" + ) +) + +REM There is no CUR_PACKAGE_INFO it was renamed in previous step to %PREV_PACKAGE_INFO% +REM which means we need to do pub get and precompile +if not exist "%PRECOMPILED%" ( + echo Running pub get in "%cd%" + "%DART%" pub get --no-precompile + "%DART%" compile kernel bin/build_tool_runner.dart +) + +"%DART%" "%PRECOMPILED%" %* + +REM 253 means invalid snapshot version. +If %ERRORLEVEL% equ 253 ( + "%DART%" pub get --no-precompile + "%DART%" compile kernel bin/build_tool_runner.dart + "%DART%" "%PRECOMPILED%" %* +) diff --git a/cargokit/run_build_tool.sh b/cargokit/run_build_tool.sh new file mode 100755 index 00000000..6e594a23 --- /dev/null +++ b/cargokit/run_build_tool.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +set -e + +BASEDIR=$(dirname "$0") + +mkdir -p "$CARGOKIT_TOOL_TEMP_DIR" + +cd "$CARGOKIT_TOOL_TEMP_DIR" + +# Write a very simple bin package in temp folder that depends on build_tool package +# from Cargokit. This is done to ensure that we don't pollute Cargokit folder +# with .dart_tool contents. + +BUILD_TOOL_PKG_DIR="$BASEDIR/build_tool" + +if [[ -z $FLUTTER_ROOT ]]; then # not defined + DART=dart +else + DART="$FLUTTER_ROOT/bin/cache/dart-sdk/bin/dart" +fi + +cat << EOF > "pubspec.yaml" +name: build_tool_runner +version: 1.0.0 +publish_to: none + +environment: + sdk: '>=3.0.0 <4.0.0' + +dependencies: + build_tool: + path: "$BUILD_TOOL_PKG_DIR" +EOF + +mkdir -p "bin" + +cat << EOF > "bin/build_tool_runner.dart" +import 'package:build_tool/build_tool.dart' as build_tool; +void main(List args) { + build_tool.runMain(args); +} +EOF + +# Create alias for `shasum` if it does not exist and `sha1sum` exists +if ! [ -x "$(command -v shasum)" ] && [ -x "$(command -v sha1sum)" ]; then + shopt -s expand_aliases + alias shasum="sha1sum" +fi + +# Dart run will not cache any package that has a path dependency, which +# is the case for our build_tool_runner. So instead we precompile the package +# ourselves. +# To invalidate the cached kernel we use the hash of ls -LR of the build_tool +# package directory. This should be good enough, as the build_tool package +# itself is not meant to have any path dependencies. + +if [[ "$OSTYPE" == "darwin"* ]]; then + PACKAGE_HASH=$(ls -lTR "$BUILD_TOOL_PKG_DIR" | shasum) +else + PACKAGE_HASH=$(ls -lR --full-time "$BUILD_TOOL_PKG_DIR" | shasum) +fi + +PACKAGE_HASH_FILE=".package_hash" + +if [ -f "$PACKAGE_HASH_FILE" ]; then + EXISTING_HASH=$(cat "$PACKAGE_HASH_FILE") + if [ "$PACKAGE_HASH" != "$EXISTING_HASH" ]; then + rm "$PACKAGE_HASH_FILE" + fi +fi + +# Run pub get if needed. +if [ ! -f "$PACKAGE_HASH_FILE" ]; then + "$DART" pub get --no-precompile + "$DART" compile kernel bin/build_tool_runner.dart + echo "$PACKAGE_HASH" > "$PACKAGE_HASH_FILE" +fi + +set +e + +"$DART" bin/build_tool_runner.dill "$@" + +exit_code=$? + +# 253 means invalid snapshot version. +if [ $exit_code == 253 ]; then + "$DART" pub get --no-precompile + "$DART" compile kernel bin/build_tool_runner.dart + "$DART" bin/build_tool_runner.dill "$@" + exit_code=$? +fi + +exit $exit_code diff --git a/cargokit_options.yaml b/cargokit_options.yaml new file mode 100644 index 00000000..01f175a0 --- /dev/null +++ b/cargokit_options.yaml @@ -0,0 +1,2 @@ +verbose_logging: false +use_precompiled_binaries: true \ No newline at end of file diff --git a/check_precompiled.sh b/check_precompiled.sh new file mode 100644 index 00000000..d6ff7498 --- /dev/null +++ b/check_precompiled.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +BASEDIR=$(dirname "$0") + +cd $BASEDIR/cargokit/build_tool + +# Check whether the precompiled binaries ara available for each architecture. +# Note: aaarch64-unknown-linux-gnu binary is missing as there is no +# cross-compilation available currently. + +dart run build_tool verify-binaries --manifest-dir=../../rust \ No newline at end of file diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 77b8e00b..2e1f0a29 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -138,6 +138,7 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + F21923F72FCD31730B9E86ED /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -249,6 +250,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + F21923F72FCD31730B9E86ED /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/example/lib/bdk_library.dart b/example/lib/bdk_library.dart index 983b290f..dbe57859 100644 --- a/example/lib/bdk_library.dart +++ b/example/lib/bdk_library.dart @@ -1,24 +1,21 @@ -import 'dart:convert'; -import 'dart:isolate'; - import 'package:bdk_flutter/bdk_flutter.dart'; import 'package:flutter/cupertino.dart'; class BdkLibrary { Future createMnemonic() async { - final res = await Mnemonic.create(WordCount.Words12); + final res = await Mnemonic.create(WordCount.words12); return res; } Future createDescriptor(Mnemonic mnemonic) async { final descriptorSecretKey = await DescriptorSecretKey.create( - network: Network.Testnet, + network: Network.testnet, mnemonic: mnemonic, ); final descriptor = await Descriptor.newBip84( secretKey: descriptorSecretKey, - network: Network.Testnet, - keychain: KeychainKind.External); + network: Network.testnet, + keychain: KeychainKind.externalChain); return descriptor; } @@ -46,22 +43,22 @@ class BdkLibrary { Future restoreWallet(Descriptor descriptor) async { final wallet = await Wallet.create( descriptor: descriptor, - network: Network.Testnet, + network: Network.testnet, databaseConfig: const DatabaseConfig.memory()); return wallet; } Future sync(Blockchain blockchain, Wallet aliceWallet) async { try { - Isolate.run(() async => {await aliceWallet.sync(blockchain)}); + await aliceWallet.sync(blockchain: blockchain); } on FormatException catch (e) { debugPrint(e.message); } } Future getAddress(Wallet aliceWallet) async { - final address = - await aliceWallet.getAddress(addressIndex: const AddressIndex()); + final address = await aliceWallet.getAddress( + addressIndex: const AddressIndex.increase()); return address; } @@ -75,7 +72,7 @@ class BdkLibrary { Future> getUnConfirmedTransactions( Wallet aliceWallet) async { List unConfirmed = []; - final res = await aliceWallet.listTransactions(true); + final res = await aliceWallet.listTransactions(includeRaw: true); for (var e in res) { if (e.confirmationTime == null) unConfirmed.add(e); } @@ -85,7 +82,7 @@ class BdkLibrary { Future> getConfirmedTransactions( Wallet aliceWallet) async { List confirmed = []; - final res = await aliceWallet.listTransactions(true); + final res = await aliceWallet.listTransactions(includeRaw: true); for (var e in res) { if (e.confirmationTime != null) confirmed.add(e); @@ -107,46 +104,32 @@ class BdkLibrary { int blocks, Blockchain blockchain, ) async { - final feeRate = await blockchain.estimateFee(blocks); + final feeRate = await blockchain.estimateFee(target: blocks); return feeRate; } - getInputOutPuts( - TxBuilderResult txBuilderResult, - Blockchain blockchain, - ) async { - final serializedPsbtTx = await txBuilderResult.psbt.jsonSerialize(); - final jsonObj = json.decode(serializedPsbtTx); - final outputs = jsonObj["unsigned_tx"]["output"] as List; - final inputs = jsonObj["inputs"][0]["non_witness_utxo"]["output"] as List; - debugPrint("=========Inputs====="); - for (var e in inputs) { - debugPrint("amount: ${e["value"]}"); - debugPrint("script_pubkey: ${e["script_pubkey"]}"); - } - debugPrint("=========Outputs====="); - for (var e in outputs) { - debugPrint("amount: ${e["value"]}"); - debugPrint("script_pubkey: ${e["script_pubkey"]}"); - } - } - sendBitcoin( Blockchain blockchain, Wallet aliceWallet, String addressStr) async { try { final txBuilder = TxBuilder(); - final address = await Address.create(address: addressStr); + final address = await Address.fromString( + s: addressStr, network: (await aliceWallet.network())); - final script = await address.scriptPubKey(); + final script = await address.scriptPubkey(); final feeRate = await estimateFeeRate(25, blockchain); - final txBuilderResult = await txBuilder + final (psbt, _) = await txBuilder .addRecipient(script, 750) - .feeRate(feeRate.asSatPerVb()) + .feeRate(feeRate.satPerVb) .finish(aliceWallet); - getInputOutPuts(txBuilderResult, blockchain); - final aliceSbt = await aliceWallet.sign(psbt: txBuilderResult.psbt); - final tx = await aliceSbt.extractTx(); - Isolate.run(() async => {await blockchain.broadcast(tx)}); + final isFinalized = await aliceWallet.sign(psbt: psbt); + if (isFinalized) { + final tx = await psbt.extractTx(); + final res = await blockchain.broadcast(transaction: tx); + debugPrint(res); + } else { + debugPrint("psbt not finalized!"); + } + // Isolate.run(() async => {}); } on Exception catch (_) { rethrow; } diff --git a/example/lib/multi_sig_wallet.dart b/example/lib/multi_sig_wallet.dart index 026186f2..395c74b8 100644 --- a/example/lib/multi_sig_wallet.dart +++ b/example/lib/multi_sig_wallet.dart @@ -1,5 +1,3 @@ -import 'dart:isolate'; - import 'package:bdk_flutter/bdk_flutter.dart'; import 'package:flutter/foundation.dart'; @@ -8,7 +6,7 @@ class MultiSigWallet { final List descriptorInfos = []; for (var e in mnemonics) { final secret = await DescriptorSecretKey.create( - network: Network.Testnet, mnemonic: e); + network: Network.testnet, mnemonic: e); final public = await secret.asPublic(); descriptorInfos.add(DescriptorKeyInfo(secret, public)); } @@ -22,7 +20,7 @@ class MultiSigWallet { final parsedDes = [alice, bob, dave]; for (var e in parsedDes) { final res = - await Descriptor.create(descriptor: e, network: Network.Testnet); + await Descriptor.create(descriptor: e, network: Network.testnet); descriptors.add(res); } return descriptors; @@ -43,15 +41,15 @@ class MultiSigWallet { final descriptors = await createDescriptors(); final alice = await Wallet.create( descriptor: descriptors[0], - network: Network.Testnet, + network: Network.testnet, databaseConfig: const DatabaseConfig.memory()); final bob = await Wallet.create( descriptor: descriptors[1], - network: Network.Testnet, + network: Network.testnet, databaseConfig: const DatabaseConfig.memory()); final dave = await Wallet.create( descriptor: descriptors[2], - network: Network.Testnet, + network: Network.testnet, databaseConfig: const DatabaseConfig.memory()); return [alice, bob, dave]; } @@ -60,26 +58,31 @@ class MultiSigWallet { String addressStr) async { try { final txBuilder = TxBuilder(); - final address = await Address.create(address: addressStr); - final script = await address.scriptPubKey(); - final feeRate = await blockchain.estimateFee(25); - final txBuilderResult = await txBuilder + final address = await Address.fromString( + s: addressStr, network: (await aliceWallet.network())); + final script = await address.scriptPubkey(); + final feeRate = await blockchain.estimateFee(target: 25); + final (psbt, _) = await txBuilder .addRecipient(script, 1000) - .feeRate(feeRate.asSatPerVb()) + .feeRate(feeRate.satPerVb) .finish(aliceWallet); - final aliceSbt = await aliceWallet.sign( - psbt: txBuilderResult.psbt, + await aliceWallet.sign( + psbt: psbt, signOptions: const SignOptions( - isMultiSig: true, + multiSig: true, trustWitnessUtxo: false, allowAllSighashes: true, removePartialSigs: true, tryFinalize: true, signWithTapInternalKey: true, allowGrinding: true)); - final bobSbt = await bobWallet.sign(psbt: aliceSbt); - final tx = await bobSbt.extractTx(); - Isolate.run(() async => {await blockchain.broadcast(tx)}); + final isFinalized = await bobWallet.sign(psbt: psbt); + if (isFinalized) { + final tx = await psbt.extractTx(); + await blockchain.broadcast(transaction: tx); + } else { + debugPrint("Psbt not finalized!"); + } } on FormatException catch (e) { if (kDebugMode) { print(e.message); diff --git a/example/lib/simple_wallet.dart b/example/lib/simple_wallet.dart index 6f9f1a6d..cbde86d0 100644 --- a/example/lib/simple_wallet.dart +++ b/example/lib/simple_wallet.dart @@ -29,7 +29,7 @@ class _SimpleWalletState extends State { displayText = res.toString(); }); if (kDebugMode) { - print(res.asString()); + print(await res.asString()); } } @@ -74,7 +74,7 @@ class _SimpleWalletState extends State { print(" fee: ${e.fee}"); print(" received: ${e.received}"); print(" send: ${e.sent}"); - print(" output address: ${txOut.last.scriptPubkey.inner}"); + print(" output address: ${txOut.last.scriptPubkey.bytes}"); print("==========================="); } } @@ -100,7 +100,7 @@ class _SimpleWalletState extends State { } print(" =============TxOut=============="); for (var e in txOut) { - print(" script: ${e.scriptPubkey.inner}"); + print(" script: ${e.scriptPubkey.bytes}"); print(" value: ${e.value}"); } print("========================================"); @@ -129,7 +129,7 @@ class _SimpleWalletState extends State { print( "outPoint: { txid:${e.outpoint.txid}, vout: ${e.outpoint.vout} } "); print( - "txout: { address:${e.txout.scriptPubkey.inner.toString()}, value: ${e.txout.value} }"); + "txout: { address:${e.txout.scriptPubkey.bytes}, value: ${e.txout.value} }"); print("==========================="); } } @@ -148,7 +148,7 @@ class _SimpleWalletState extends State { getBlockHash() async { final height = await getBlockHeight(); - final blockHash = await blockchain!.getBlockHash(height); + final blockHash = await blockchain!.getBlockHash(height: height); setState(() { displayText = "BlockHash: $blockHash"; }); diff --git a/example/macos/Podfile b/example/macos/Podfile index c795730d..1f811a92 100644 --- a/example/macos/Podfile +++ b/example/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.14' +platform :osx, '14.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 93eab81c..4f1e82f9 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -1,5 +1,6 @@ PODS: - - bdk_flutter (0.30.0) + - bdk_flutter (0.31.1-dev): + - FlutterMacOS - FlutterMacOS (1.0.0) DEPENDENCIES: @@ -13,9 +14,9 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral SPEC CHECKSUMS: - bdk_flutter: 0e9b59c086f99106db9ab85bc51495482e4b3653 + bdk_flutter: 22cd6fbac0aed9857319da174d227539ddfc5f4c FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 -PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 +PODFILE CHECKSUM: 6acf97521436d16fc31cd5e1a02000905acdb3ae COCOAPODS: 1.14.3 diff --git a/example/test/bdk_flutter_unit_test.dart b/example/test/bdk_flutter_unit_test.dart deleted file mode 100644 index ef0b3baa..00000000 --- a/example/test/bdk_flutter_unit_test.dart +++ /dev/null @@ -1,335 +0,0 @@ -import 'dart:typed_data'; - -import 'package:bdk_flutter/bdk_flutter.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter_test/flutter_test.dart'; - -Future main() async { - WidgetsFlutterBinding.ensureInitialized(); - await setCurrentDirectory(); - const derivationPath = "m/44'/1'/0'"; - const script = [ - 118, - 169, - 20, - 159, - 154, - 122, - 189, - 96, - 12, - 12, - 170, - 3, - 152, - 58, - 119, - 200, - 195, - 223, - 142, - 6, - 44, - 178, - 250, - 136, - 172 - ]; - - final address = - await Address.create(address: "mv4rnyY3Su5gjcDNzbMLKBQkBicCtHUtFB"); - final blockchain = await Blockchain.create( - config: const BlockchainConfig.electrum( - config: ElectrumConfig( - stopGap: 10, - timeout: 5, - retry: 5, - url: "ssl://electrum.blockstream.info:60002", - validateDomain: true))); - - Future getDescriptorSecretKey() async { - final mnemonic = await Mnemonic.fromString( - "chaos fabric time speed sponsor all flat solution wisdom trophy crack object robot pave observe combine where aware bench orient secret primary cable detect"); - return await DescriptorSecretKey.create( - network: Network.Testnet, mnemonic: mnemonic); - } - - Future deriveDescriptorSecretKey( - DescriptorSecretKey secretKey, String path) async { - return await secretKey.derive(await DerivationPath.create(path: path)); - } - - Future extendDescriptorSecretKey( - DescriptorSecretKey secretKey, String path) async { - return await secretKey.extend(await DerivationPath.create(path: path)); - } - - Future deriveDescriptorPublicKey( - DescriptorPublicKey publicKey, String path) async { - return await publicKey.derive(await DerivationPath.create(path: path)); - } - - Future extendDescriptorPublicKey( - DescriptorPublicKey publicKey, String path) async { - return await publicKey.extend(await DerivationPath.create(path: path)); - } - - Future getFundedWallet(String descriptor) async { - return await Wallet.create( - descriptor: (await Descriptor.create( - descriptor: descriptor, network: Network.Testnet)), - network: Network.Testnet, - databaseConfig: const DatabaseConfig.memory()); - } - - group('Address', () { - test('verify toString()', () async { - final res = address.toString(); - expect(res, "mv4rnyY3Su5gjcDNzbMLKBQkBicCtHUtFB"); - }); - test('verify scriptPubKey ()', () async { - final res = await address.scriptPubKey(); - expect(res.inner, script); - }); - test('verify scriptPubKey type()', () async { - final res = await address.scriptPubKey(); - expect(res.inner, isA()); - }); - test('verify network()', () async { - final res = await address.network(); - expect(res, Network.Testnet); - }); - test('verify payload()', () async { - final res = await address.payload(); - expect(res, isA()); - }); - }); - group('Blockchain', () { - test('verify getHeight() type', () async { - final res = await blockchain.getHeight(); - expect(res, isA()); - }); - test('verify getBlockHash() type', () async { - final height = await blockchain.getHeight(); - final res = await blockchain.getBlockHash(height); - expect(res, isA()); - }); - test('verify estimateFee() type', () async { - final res = await blockchain.estimateFee(25); - expect(res, isA()); - }); - }); - group('DerivationPath', () { - test('verify create() type', () async { - final res = await DerivationPath.create(path: "m/44h/1h/0h"); - expect(res.toString(), derivationPath); - }); - }); - group('Mnemonic', () { - test('verify mnemonic length; create()', () async { - for (var e in [WordCount.Words12, WordCount.Words18, WordCount.Words24]) { - final length = int.parse(e.name.split('s').last); - final res = await Mnemonic.create(e); - expect(res.asString().split(RegExp(r'\s+')).length, length); - } - }); - test('verify fromString()', () async { - final res = await Mnemonic.fromString( - "chaos fabric time speed sponsor all flat solution wisdom trophy crack object robot pave observe combine where aware bench orient secret primary cable detect"); - expect(res, isA()); - }); - }); - group('Descriptor', () { - //DescriptorSecretKey - test('verify generate_descriptor_secret_key', () async { - final res = await getDescriptorSecretKey(); - expect(res.asString(), - "tprv8ZgxMBicQKsPdWuqM1t1CDRvQtQuBPyfL6GbhQwtxDKgUAVPbxmj71pRA8raTqLrec5LyTs5TqCxdABcZr77bt2KyWA5bizJHnC4g4ysm4h/*"); - expect((await res.asPublic()).asString(), - "tpubD6NzVbkrYhZ4WywdEfYbbd62yuvqLjAZuPsNyvzCNV85JekAEMbKHWSHLF9h3j45SxewXDcLv328B1SEZrxg4iwGfmdt1pDFjZiTkGiFqGa/*"); - }); - test('_derive_self', () async { - final secretKey = await getDescriptorSecretKey(); - final derivedDsk = await deriveDescriptorSecretKey(secretKey, "m"); - expect(derivedDsk.asString(), - "[d1d04177]tprv8ZgxMBicQKsPdWuqM1t1CDRvQtQuBPyfL6GbhQwtxDKgUAVPbxmj71pRA8raTqLrec5LyTs5TqCxdABcZr77bt2KyWA5bizJHnC4g4ysm4h/*"); - final publicKey = await secretKey.asPublic(); - final derivedDpk = await deriveDescriptorPublicKey(publicKey, "m"); - expect(derivedDpk.asString(), - "[d1d04177]tpubD6NzVbkrYhZ4WywdEfYbbd62yuvqLjAZuPsNyvzCNV85JekAEMbKHWSHLF9h3j45SxewXDcLv328B1SEZrxg4iwGfmdt1pDFjZiTkGiFqGa/*"); - }); - - test('verify DescriptorSecretKey.create() type', () async { - final res = await getDescriptorSecretKey(); - expect(res, isA()); - }); - test('verify descriptorSecretKey.asPublic type', () async { - final res = await getDescriptorSecretKey(); - expect(await res.asPublic(), isA()); - }); - - test('verify descriptorSecretKey.secretBytes()', () async { - final res = await getDescriptorSecretKey(); - expect((await res.secretBytes()), [ - 233, - 51, - 21, - 214, - 206, - 64, - 30, - 180, - 219, - 128, - 58, - 86, - 35, - 47, - 14, - 211, - 230, - 155, - 5, - 55, - 116, - 230, - 4, - 125, - 245, - 79, - 27, - 208, - 14, - 94, - 169, - 54 - ]); - }); - test('verify descriptorSecretKey.extend()', () async { - expect( - (await extendDescriptorSecretKey( - await getDescriptorSecretKey(), derivationPath)) - .asString(), - "tprv8ZgxMBicQKsPdWuqM1t1CDRvQtQuBPyfL6GbhQwtxDKgUAVPbxmj71pRA8raTqLrec5LyTs5TqCxdABcZr77bt2KyWA5bizJHnC4g4ysm4h/44'/1'/0'/*"); - }); - test('verify descriptorSecretKey.derive()', () async { - expect( - ((await deriveDescriptorSecretKey( - await getDescriptorSecretKey(), derivationPath))) - .asString(), - "[d1d04177/44'/1'/0']tprv8g7MbPjRKU1LkemDd2cE1UWJwsEyVCDG5Wrs6JURJcdec9fMnvURoRqz68mKiJLXBiBiWc3aUVRL8RaGZPVWxFZ67btBuf1kp2Z5HLSwTGo/*"); - }); - test('verify DescriptorSecretKey.fromString', () async { - final res = await DescriptorSecretKey.fromString( - "[d1d04177/44'/1'/0']tprv8g7MbPjRKU1LkemDd2cE1UWJwsEyVCDG5Wrs6JURJcdec9fMnvURoRqz68mKiJLXBiBiWc3aUVRL8RaGZPVWxFZ67btBuf1kp2Z5HLSwTGo/*"); - expect(res.asString(), - "[d1d04177/44'/1'/0']tprv8g7MbPjRKU1LkemDd2cE1UWJwsEyVCDG5Wrs6JURJcdec9fMnvURoRqz68mKiJLXBiBiWc3aUVRL8RaGZPVWxFZ67btBuf1kp2Z5HLSwTGo/*"); - }); - // descriptorPublicKey - test('verify descriptorPublicKey.asString()', () async { - final res = await getDescriptorSecretKey(); - expect((await res.asPublic()).asString(), - "tpubD6NzVbkrYhZ4WywdEfYbbd62yuvqLjAZuPsNyvzCNV85JekAEMbKHWSHLF9h3j45SxewXDcLv328B1SEZrxg4iwGfmdt1pDFjZiTkGiFqGa/*"); - }); - test('verify descriptorPublicKey.extend()', () async { - final descriptorSecretKey = await getDescriptorSecretKey(); - final descriptorPublicKey = await descriptorSecretKey.asPublic(); - expect( - (await extendDescriptorPublicKey(descriptorPublicKey, derivationPath)) - .toString(), - "tpubD6NzVbkrYhZ4WywdEfYbbd62yuvqLjAZuPsNyvzCNV85JekAEMbKHWSHLF9h3j45SxewXDcLv328B1SEZrxg4iwGfmdt1pDFjZiTkGiFqGa/44'/1'/0'/*"); - }); - test('verify DescriptorPublicKey.fromString', () async { - expect( - (await DescriptorPublicKey.fromString( - "tpubD6NzVbkrYhZ4WywdEfYbbd62yuvqLjAZuPsNyvzCNV85JekAEMbKHWSHLF9h3j45SxewXDcLv328B1SEZrxg4iwGfmdt1pDFjZiTkGiFqGa/44'/1'/0'/*")) - .toString(), - "tpubD6NzVbkrYhZ4WywdEfYbbd62yuvqLjAZuPsNyvzCNV85JekAEMbKHWSHLF9h3j45SxewXDcLv328B1SEZrxg4iwGfmdt1pDFjZiTkGiFqGa/44'/1'/0'/*"); - }); - - test('verify Descriptor templates', () async { - final descriptorSecretKey = await getDescriptorSecretKey(); - debugPrint("DescriptorSecretKey: ${descriptorSecretKey.asString()}"); - final handmadePublic44 = await (await deriveDescriptorSecretKey( - descriptorSecretKey, "m/44h/1h/0h")) - .asPublic(); - debugPrint("Public 44: ${handmadePublic44.asString()}"); - final handmadePublic49 = await (await deriveDescriptorSecretKey( - descriptorSecretKey, "m/49h/1h/0h")) - .asPublic(); - - debugPrint("Public 49: ${handmadePublic49.asString()}"); - - final handmadePublic84 = await (await deriveDescriptorSecretKey( - descriptorSecretKey, "m/84h/1h/0h")) - .asPublic(); - - debugPrint("Public 84: ${handmadePublic84.asString()}"); - - final templatePrivate44 = await Descriptor.newBip44( - secretKey: descriptorSecretKey, - network: Network.Testnet, - keychain: KeychainKind.External); - final templatePrivate49 = await Descriptor.newBip49( - secretKey: descriptorSecretKey, - network: Network.Testnet, - keychain: KeychainKind.External); - final templatePrivate84 = await Descriptor.newBip84( - secretKey: descriptorSecretKey, - network: Network.Testnet, - keychain: KeychainKind.External); - debugPrint("Template 49: ${await templatePrivate44.asString()}"); - debugPrint("Template 44: ${await templatePrivate49.asString()}"); - debugPrint("Template 84: ${await templatePrivate84.asString()}"); - - final templatePublic44 = await Descriptor.newBip44Public( - publicKey: handmadePublic44, - network: Network.Testnet, - keychain: KeychainKind.External, - fingerPrint: 'd1d04177'); - final templatePublic49 = await Descriptor.newBip49Public( - publicKey: handmadePublic49, - network: Network.Testnet, - keychain: KeychainKind.External, - fingerPrint: 'd1d04177'); - final templatePublic84 = await Descriptor.newBip84Public( - publicKey: handmadePublic84, - network: Network.Testnet, - keychain: KeychainKind.External, - fingerPrint: 'd1d04177'); - expect(await templatePublic84.asString(), - await templatePublic84.asStringPrivate()); - expect(await templatePublic44.asString(), - await templatePublic44.asStringPrivate()); - expect(await templatePublic49.asString(), - await templatePublic49.asStringPrivate()); - // when using asString on a private key, we get the same result as when using it on a public key - expect( - await templatePublic84.asString(), await templatePublic84.asString()); - expect( - await templatePublic44.asString(), await templatePublic44.asString()); - expect( - await templatePublic49.asString(), await templatePublic49.asString()); - }); - }); - group('Psbt', () { - test('verify psbt_fee', () async { - const testWpkh = - "wpkh(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW)"; - final wallet = await getFundedWallet(testWpkh); - await wallet.sync(blockchain); - const drainToAddress = "tb1ql7w62elx9ucw4pj5lgw4l028hmuw80sndtntxt"; - final drainToScript = - await (await Address.create(address: drainToAddress)).scriptPubKey(); - final txBuilder = - TxBuilder().feeRate(2.0).drainWallet().drainTo(drainToScript); - final builderRes = await txBuilder.finish(wallet); - expect((await builderRes.psbt.feeRate() != null), true); - expect( - (await builderRes.psbt.feeRate())?.asSatPerVb(), 3.2113821506500244); - - expect((await builderRes.psbt.feeAmount() != null), true); - expect((await builderRes.psbt.feeAmount()), 1580); - }); - }); -} diff --git a/flutter_rust_bridge.yaml b/flutter_rust_bridge.yaml new file mode 100644 index 00000000..f6eebc0f --- /dev/null +++ b/flutter_rust_bridge.yaml @@ -0,0 +1,5 @@ +rust_input: rust/src/api/*.rs +dart_output: lib/src/generated/ +full_dep: true +c_output: ios/Classes/frb_generated.h +dart_entrypoint_class_name: BdkCore \ No newline at end of file diff --git a/ios/Classes/bdk_flutter.c b/ios/Classes/bdk_flutter.c new file mode 100644 index 00000000..e69de29b diff --git a/ios/Classes/bindings.h b/ios/Classes/bindings.h deleted file mode 100644 index 25d6a0ee..00000000 --- a/ios/Classes/bindings.h +++ /dev/null @@ -1,646 +0,0 @@ -#include -#include -#include -typedef struct _Dart_Handle* Dart_Handle; - -typedef struct DartCObject DartCObject; - -typedef int64_t DartPort; - -typedef bool (*DartPostCObjectFnType)(DartPort port_id, void *message); - -typedef struct wire_uint_8_list { - uint8_t *ptr; - int32_t len; -} wire_uint_8_list; - -typedef struct wire_ElectrumConfig { - struct wire_uint_8_list *url; - struct wire_uint_8_list *socks5; - uint8_t retry; - uint8_t *timeout; - uint64_t stop_gap; - bool validate_domain; -} wire_ElectrumConfig; - -typedef struct wire_BlockchainConfig_Electrum { - struct wire_ElectrumConfig *config; -} wire_BlockchainConfig_Electrum; - -typedef struct wire_EsploraConfig { - struct wire_uint_8_list *base_url; - struct wire_uint_8_list *proxy; - uint8_t *concurrency; - uint64_t stop_gap; - uint64_t *timeout; -} wire_EsploraConfig; - -typedef struct wire_BlockchainConfig_Esplora { - struct wire_EsploraConfig *config; -} wire_BlockchainConfig_Esplora; - -typedef struct wire_UserPass { - struct wire_uint_8_list *username; - struct wire_uint_8_list *password; -} wire_UserPass; - -typedef struct wire_RpcSyncParams { - uint64_t start_script_count; - uint64_t start_time; - bool force_start_time; - uint64_t poll_rate_sec; -} wire_RpcSyncParams; - -typedef struct wire_RpcConfig { - struct wire_uint_8_list *url; - struct wire_uint_8_list *auth_cookie; - struct wire_UserPass *auth_user_pass; - int32_t network; - struct wire_uint_8_list *wallet_name; - struct wire_RpcSyncParams *sync_params; -} wire_RpcConfig; - -typedef struct wire_BlockchainConfig_Rpc { - struct wire_RpcConfig *config; -} wire_BlockchainConfig_Rpc; - -typedef union BlockchainConfigKind { - struct wire_BlockchainConfig_Electrum *Electrum; - struct wire_BlockchainConfig_Esplora *Esplora; - struct wire_BlockchainConfig_Rpc *Rpc; -} BlockchainConfigKind; - -typedef struct wire_BlockchainConfig { - int32_t tag; - union BlockchainConfigKind *kind; -} wire_BlockchainConfig; - -typedef struct wire_Script { - struct wire_uint_8_list *inner; -} wire_Script; - -typedef struct wire_ScriptAmount { - struct wire_Script script; - uint64_t amount; -} wire_ScriptAmount; - -typedef struct wire_list_script_amount { - struct wire_ScriptAmount *ptr; - int32_t len; -} wire_list_script_amount; - -typedef struct wire_OutPoint { - struct wire_uint_8_list *txid; - uint32_t vout; -} wire_OutPoint; - -typedef struct wire_list_out_point { - struct wire_OutPoint *ptr; - int32_t len; -} wire_list_out_point; - -typedef struct wire___record__out_point_String_usize { - struct wire_OutPoint field0; - struct wire_uint_8_list *field1; - uintptr_t field2; -} wire___record__out_point_String_usize; - -typedef struct wire_RbfValue_RbfDefault { - -} wire_RbfValue_RbfDefault; - -typedef struct wire_RbfValue_Value { - uint32_t field0; -} wire_RbfValue_Value; - -typedef union RbfValueKind { - struct wire_RbfValue_RbfDefault *RbfDefault; - struct wire_RbfValue_Value *Value; -} RbfValueKind; - -typedef struct wire_RbfValue { - int32_t tag; - union RbfValueKind *kind; -} wire_RbfValue; - -typedef struct wire_DatabaseConfig_Memory { - -} wire_DatabaseConfig_Memory; - -typedef struct wire_SqliteDbConfiguration { - struct wire_uint_8_list *path; -} wire_SqliteDbConfiguration; - -typedef struct wire_DatabaseConfig_Sqlite { - struct wire_SqliteDbConfiguration *config; -} wire_DatabaseConfig_Sqlite; - -typedef struct wire_SledDbConfiguration { - struct wire_uint_8_list *path; - struct wire_uint_8_list *tree_name; -} wire_SledDbConfiguration; - -typedef struct wire_DatabaseConfig_Sled { - struct wire_SledDbConfiguration *config; -} wire_DatabaseConfig_Sled; - -typedef union DatabaseConfigKind { - struct wire_DatabaseConfig_Memory *Memory; - struct wire_DatabaseConfig_Sqlite *Sqlite; - struct wire_DatabaseConfig_Sled *Sled; -} DatabaseConfigKind; - -typedef struct wire_DatabaseConfig { - int32_t tag; - union DatabaseConfigKind *kind; -} wire_DatabaseConfig; - -typedef struct wire_AddressIndex_New { - -} wire_AddressIndex_New; - -typedef struct wire_AddressIndex_LastUnused { - -} wire_AddressIndex_LastUnused; - -typedef struct wire_AddressIndex_Peek { - uint32_t index; -} wire_AddressIndex_Peek; - -typedef struct wire_AddressIndex_Reset { - uint32_t index; -} wire_AddressIndex_Reset; - -typedef union AddressIndexKind { - struct wire_AddressIndex_New *New; - struct wire_AddressIndex_LastUnused *LastUnused; - struct wire_AddressIndex_Peek *Peek; - struct wire_AddressIndex_Reset *Reset; -} AddressIndexKind; - -typedef struct wire_AddressIndex { - int32_t tag; - union AddressIndexKind *kind; -} wire_AddressIndex; - -typedef struct wire_SignOptions { - bool is_multi_sig; - bool trust_witness_utxo; - uint32_t *assume_height; - bool allow_all_sighashes; - bool remove_partial_sigs; - bool try_finalize; - bool sign_with_tap_internal_key; - bool allow_grinding; -} wire_SignOptions; - -typedef struct wire_TxOut { - uint64_t value; - struct wire_Script script_pubkey; -} wire_TxOut; - -typedef struct wire_LocalUtxo { - struct wire_OutPoint outpoint; - struct wire_TxOut txout; - bool is_spent; - int32_t keychain; -} wire_LocalUtxo; - -typedef struct wire_PsbtSigHashType { - uint32_t inner; -} wire_PsbtSigHashType; - -typedef struct DartCObject *WireSyncReturn; - -void store_dart_post_cobject(DartPostCObjectFnType ptr); - -Dart_Handle get_dart_object(uintptr_t ptr); - -void drop_dart_object(uintptr_t ptr); - -uintptr_t new_dart_opaque(Dart_Handle handle); - -intptr_t init_frb_dart_api_dl(void *obj); - -void wire_create_blockchain__static_method__Api(int64_t port_, - struct wire_BlockchainConfig *config); - -void wire_get_height__static_method__Api(int64_t port_, struct wire_uint_8_list *blockchain_id); - -void wire_get_blockchain_hash__static_method__Api(int64_t port_, - uint32_t blockchain_height, - struct wire_uint_8_list *blockchain_id); - -void wire_estimate_fee__static_method__Api(int64_t port_, - uint64_t target, - struct wire_uint_8_list *blockchain_id); - -void wire_broadcast__static_method__Api(int64_t port_, - struct wire_uint_8_list *tx, - struct wire_uint_8_list *blockchain_id); - -void wire_create_transaction__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_tx_txid__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_weight__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_size__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_vsize__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_serialize_tx__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_is_coin_base__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_is_explicitly_rbf__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_is_lock_time_enabled__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_version__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_lock_time__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_input__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_output__static_method__Api(int64_t port_, struct wire_uint_8_list *tx); - -void wire_serialize_psbt__static_method__Api(int64_t port_, struct wire_uint_8_list *psbt_str); - -void wire_psbt_txid__static_method__Api(int64_t port_, struct wire_uint_8_list *psbt_str); - -void wire_extract_tx__static_method__Api(int64_t port_, struct wire_uint_8_list *psbt_str); - -void wire_psbt_fee_rate__static_method__Api(int64_t port_, struct wire_uint_8_list *psbt_str); - -void wire_psbt_fee_amount__static_method__Api(int64_t port_, struct wire_uint_8_list *psbt_str); - -void wire_combine_psbt__static_method__Api(int64_t port_, - struct wire_uint_8_list *psbt_str, - struct wire_uint_8_list *other); - -void wire_json_serialize__static_method__Api(int64_t port_, struct wire_uint_8_list *psbt_str); - -void wire_tx_builder_finish__static_method__Api(int64_t port_, - struct wire_uint_8_list *wallet_id, - struct wire_list_script_amount *recipients, - struct wire_list_out_point *utxos, - struct wire___record__out_point_String_usize *foreign_utxo, - struct wire_list_out_point *unspendable, - int32_t change_policy, - bool manually_selected_only, - float *fee_rate, - uint64_t *fee_absolute, - bool drain_wallet, - struct wire_Script *drain_to, - struct wire_RbfValue *rbf, - struct wire_uint_8_list *data); - -void wire_bump_fee_tx_builder_finish__static_method__Api(int64_t port_, - struct wire_uint_8_list *txid, - float fee_rate, - struct wire_uint_8_list *allow_shrinking, - struct wire_uint_8_list *wallet_id, - bool enable_rbf, - uint32_t *n_sequence); - -void wire_create_descriptor__static_method__Api(int64_t port_, - struct wire_uint_8_list *descriptor, - int32_t network); - -void wire_new_bip44_descriptor__static_method__Api(int64_t port_, - int32_t key_chain_kind, - struct wire_uint_8_list *secret_key, - int32_t network); - -void wire_new_bip44_public__static_method__Api(int64_t port_, - int32_t key_chain_kind, - struct wire_uint_8_list *public_key, - int32_t network, - struct wire_uint_8_list *fingerprint); - -void wire_new_bip49_descriptor__static_method__Api(int64_t port_, - int32_t key_chain_kind, - struct wire_uint_8_list *secret_key, - int32_t network); - -void wire_new_bip49_public__static_method__Api(int64_t port_, - int32_t key_chain_kind, - struct wire_uint_8_list *public_key, - int32_t network, - struct wire_uint_8_list *fingerprint); - -void wire_new_bip84_descriptor__static_method__Api(int64_t port_, - int32_t key_chain_kind, - struct wire_uint_8_list *secret_key, - int32_t network); - -void wire_new_bip84_public__static_method__Api(int64_t port_, - int32_t key_chain_kind, - struct wire_uint_8_list *public_key, - int32_t network, - struct wire_uint_8_list *fingerprint); - -void wire_new_bip86_descriptor__static_method__Api(int64_t port_, - int32_t key_chain_kind, - struct wire_uint_8_list *secret_key, - int32_t network); - -void wire_new_bip86_public__static_method__Api(int64_t port_, - int32_t key_chain_kind, - struct wire_uint_8_list *public_key, - int32_t network, - struct wire_uint_8_list *fingerprint); - -void wire_descriptor_as_string_private__static_method__Api(int64_t port_, - struct wire_uint_8_list *descriptor, - int32_t network); - -void wire_descriptor_as_string__static_method__Api(int64_t port_, - struct wire_uint_8_list *descriptor, - int32_t network); - -void wire_max_satisfaction_weight__static_method__Api(int64_t port_, - struct wire_uint_8_list *descriptor, - int32_t network); - -void wire_create_descriptor_secret__static_method__Api(int64_t port_, - int32_t network, - struct wire_uint_8_list *mnemonic, - struct wire_uint_8_list *password); - -void wire_descriptor_secret_from_string__static_method__Api(int64_t port_, - struct wire_uint_8_list *secret); - -void wire_extend_descriptor_secret__static_method__Api(int64_t port_, - struct wire_uint_8_list *secret, - struct wire_uint_8_list *path); - -void wire_derive_descriptor_secret__static_method__Api(int64_t port_, - struct wire_uint_8_list *secret, - struct wire_uint_8_list *path); - -void wire_descriptor_secret_as_secret_bytes__static_method__Api(int64_t port_, - struct wire_uint_8_list *secret); - -void wire_descriptor_secret_as_public__static_method__Api(int64_t port_, - struct wire_uint_8_list *secret); - -void wire_create_derivation_path__static_method__Api(int64_t port_, struct wire_uint_8_list *path); - -void wire_descriptor_public_from_string__static_method__Api(int64_t port_, - struct wire_uint_8_list *public_key); - -void wire_create_descriptor_public__static_method__Api(int64_t port_, - struct wire_uint_8_list *xpub, - struct wire_uint_8_list *path, - bool derive); - -void wire_create_script__static_method__Api(int64_t port_, - struct wire_uint_8_list *raw_output_script); - -void wire_create_address__static_method__Api(int64_t port_, struct wire_uint_8_list *address); - -void wire_address_from_script__static_method__Api(int64_t port_, - struct wire_Script *script, - int32_t network); - -void wire_address_to_script_pubkey__static_method__Api(int64_t port_, - struct wire_uint_8_list *address); - -void wire_payload__static_method__Api(int64_t port_, struct wire_uint_8_list *address); - -void wire_address_network__static_method__Api(int64_t port_, struct wire_uint_8_list *address); - -void wire_create_wallet__static_method__Api(int64_t port_, - struct wire_uint_8_list *descriptor, - struct wire_uint_8_list *change_descriptor, - int32_t network, - struct wire_DatabaseConfig *database_config); - -void wire_get_address__static_method__Api(int64_t port_, - struct wire_uint_8_list *wallet_id, - struct wire_AddressIndex *address_index); - -void wire_is_mine__static_method__Api(int64_t port_, - struct wire_Script *script, - struct wire_uint_8_list *wallet_id); - -void wire_get_internal_address__static_method__Api(int64_t port_, - struct wire_uint_8_list *wallet_id, - struct wire_AddressIndex *address_index); - -void wire_sync_wallet__static_method__Api(int64_t port_, - struct wire_uint_8_list *wallet_id, - struct wire_uint_8_list *blockchain_id); - -void wire_get_balance__static_method__Api(int64_t port_, struct wire_uint_8_list *wallet_id); - -void wire_list_unspent_outputs__static_method__Api(int64_t port_, - struct wire_uint_8_list *wallet_id); - -void wire_get_transactions__static_method__Api(int64_t port_, - struct wire_uint_8_list *wallet_id, - bool include_raw); - -void wire_sign__static_method__Api(int64_t port_, - struct wire_uint_8_list *wallet_id, - struct wire_uint_8_list *psbt_str, - struct wire_SignOptions *sign_options); - -void wire_wallet_network__static_method__Api(int64_t port_, struct wire_uint_8_list *wallet_id); - -void wire_list_unspent__static_method__Api(int64_t port_, struct wire_uint_8_list *wallet_id); - -void wire_get_psbt_input__static_method__Api(int64_t port_, - struct wire_uint_8_list *wallet_id, - struct wire_LocalUtxo *utxo, - bool only_witness_utxo, - struct wire_PsbtSigHashType *psbt_sighash_type); - -void wire_get_descriptor_for_keychain__static_method__Api(int64_t port_, - struct wire_uint_8_list *wallet_id, - int32_t keychain); - -void wire_generate_seed_from_word_count__static_method__Api(int64_t port_, int32_t word_count); - -void wire_generate_seed_from_string__static_method__Api(int64_t port_, - struct wire_uint_8_list *mnemonic); - -void wire_generate_seed_from_entropy__static_method__Api(int64_t port_, - struct wire_uint_8_list *entropy); - -struct wire___record__out_point_String_usize *new_box_autoadd___record__out_point_String_usize_0(void); - -struct wire_AddressIndex *new_box_autoadd_address_index_0(void); - -struct wire_BlockchainConfig *new_box_autoadd_blockchain_config_0(void); - -struct wire_DatabaseConfig *new_box_autoadd_database_config_0(void); - -struct wire_ElectrumConfig *new_box_autoadd_electrum_config_0(void); - -struct wire_EsploraConfig *new_box_autoadd_esplora_config_0(void); - -float *new_box_autoadd_f32_0(float value); - -struct wire_LocalUtxo *new_box_autoadd_local_utxo_0(void); - -struct wire_PsbtSigHashType *new_box_autoadd_psbt_sig_hash_type_0(void); - -struct wire_RbfValue *new_box_autoadd_rbf_value_0(void); - -struct wire_RpcConfig *new_box_autoadd_rpc_config_0(void); - -struct wire_RpcSyncParams *new_box_autoadd_rpc_sync_params_0(void); - -struct wire_Script *new_box_autoadd_script_0(void); - -struct wire_SignOptions *new_box_autoadd_sign_options_0(void); - -struct wire_SledDbConfiguration *new_box_autoadd_sled_db_configuration_0(void); - -struct wire_SqliteDbConfiguration *new_box_autoadd_sqlite_db_configuration_0(void); - -uint32_t *new_box_autoadd_u32_0(uint32_t value); - -uint64_t *new_box_autoadd_u64_0(uint64_t value); - -uint8_t *new_box_autoadd_u8_0(uint8_t value); - -struct wire_UserPass *new_box_autoadd_user_pass_0(void); - -struct wire_list_out_point *new_list_out_point_0(int32_t len); - -struct wire_list_script_amount *new_list_script_amount_0(int32_t len); - -struct wire_uint_8_list *new_uint_8_list_0(int32_t len); - -union AddressIndexKind *inflate_AddressIndex_Peek(void); - -union AddressIndexKind *inflate_AddressIndex_Reset(void); - -union BlockchainConfigKind *inflate_BlockchainConfig_Electrum(void); - -union BlockchainConfigKind *inflate_BlockchainConfig_Esplora(void); - -union BlockchainConfigKind *inflate_BlockchainConfig_Rpc(void); - -union DatabaseConfigKind *inflate_DatabaseConfig_Sqlite(void); - -union DatabaseConfigKind *inflate_DatabaseConfig_Sled(void); - -union RbfValueKind *inflate_RbfValue_Value(void); - -void free_WireSyncReturn(WireSyncReturn ptr); - -static int64_t dummy_method_to_enforce_bundling(void) { - int64_t dummy_var = 0; - dummy_var ^= ((int64_t) (void*) wire_create_blockchain__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_get_height__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_get_blockchain_hash__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_estimate_fee__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_broadcast__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_create_transaction__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_tx_txid__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_weight__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_size__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_vsize__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_serialize_tx__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_is_coin_base__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_is_explicitly_rbf__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_is_lock_time_enabled__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_version__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_lock_time__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_input__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_output__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_serialize_psbt__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_psbt_txid__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_extract_tx__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_psbt_fee_rate__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_psbt_fee_amount__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_combine_psbt__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_json_serialize__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_tx_builder_finish__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_bump_fee_tx_builder_finish__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_create_descriptor__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_new_bip44_descriptor__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_new_bip44_public__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_new_bip49_descriptor__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_new_bip49_public__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_new_bip84_descriptor__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_new_bip84_public__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_new_bip86_descriptor__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_new_bip86_public__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_descriptor_as_string_private__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_descriptor_as_string__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_max_satisfaction_weight__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_create_descriptor_secret__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_descriptor_secret_from_string__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_extend_descriptor_secret__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_derive_descriptor_secret__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_descriptor_secret_as_secret_bytes__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_descriptor_secret_as_public__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_create_derivation_path__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_descriptor_public_from_string__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_create_descriptor_public__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_create_script__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_create_address__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_address_from_script__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_address_to_script_pubkey__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_payload__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_address_network__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_create_wallet__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_get_address__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_is_mine__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_get_internal_address__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_sync_wallet__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_get_balance__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_list_unspent_outputs__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_get_transactions__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_sign__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_wallet_network__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_list_unspent__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_get_psbt_input__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_get_descriptor_for_keychain__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_generate_seed_from_word_count__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_generate_seed_from_string__static_method__Api); - dummy_var ^= ((int64_t) (void*) wire_generate_seed_from_entropy__static_method__Api); - dummy_var ^= ((int64_t) (void*) new_box_autoadd___record__out_point_String_usize_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_address_index_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_blockchain_config_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_database_config_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_electrum_config_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_esplora_config_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_f32_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_local_utxo_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_psbt_sig_hash_type_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_rbf_value_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_rpc_config_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_rpc_sync_params_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_script_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_sign_options_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_sled_db_configuration_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_sqlite_db_configuration_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_u32_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_u64_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_u8_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_user_pass_0); - dummy_var ^= ((int64_t) (void*) new_list_out_point_0); - dummy_var ^= ((int64_t) (void*) new_list_script_amount_0); - dummy_var ^= ((int64_t) (void*) new_uint_8_list_0); - dummy_var ^= ((int64_t) (void*) inflate_AddressIndex_Peek); - dummy_var ^= ((int64_t) (void*) inflate_AddressIndex_Reset); - dummy_var ^= ((int64_t) (void*) inflate_BlockchainConfig_Electrum); - dummy_var ^= ((int64_t) (void*) inflate_BlockchainConfig_Esplora); - dummy_var ^= ((int64_t) (void*) inflate_BlockchainConfig_Rpc); - dummy_var ^= ((int64_t) (void*) inflate_DatabaseConfig_Sqlite); - dummy_var ^= ((int64_t) (void*) inflate_DatabaseConfig_Sled); - dummy_var ^= ((int64_t) (void*) inflate_RbfValue_Value); - dummy_var ^= ((int64_t) (void*) free_WireSyncReturn); - dummy_var ^= ((int64_t) (void*) store_dart_post_cobject); - dummy_var ^= ((int64_t) (void*) get_dart_object); - dummy_var ^= ((int64_t) (void*) drop_dart_object); - dummy_var ^= ((int64_t) (void*) new_dart_opaque); - return dummy_var; -} diff --git a/ios/Classes/frb_generated.h b/ios/Classes/frb_generated.h new file mode 100644 index 00000000..f8bc1d42 --- /dev/null +++ b/ios/Classes/frb_generated.h @@ -0,0 +1,1255 @@ +#include +#include +#include +// EXTRA BEGIN +typedef struct DartCObject *WireSyncRust2DartDco; +typedef struct WireSyncRust2DartSse { + uint8_t *ptr; + int32_t len; +} WireSyncRust2DartSse; + +typedef int64_t DartPort; +typedef bool (*DartPostCObjectFnType)(DartPort port_id, void *message); +void store_dart_post_cobject(DartPostCObjectFnType ptr); +// EXTRA END +typedef struct _Dart_Handle* Dart_Handle; + +typedef struct wire_cst_blockchain_base { + uintptr_t ptr; +} wire_cst_blockchain_base; + +typedef struct wire_cst_list_prim_u_8_strict { + uint8_t *ptr; + int32_t len; +} wire_cst_list_prim_u_8_strict; + +typedef struct wire_cst_transaction_base { + struct wire_cst_list_prim_u_8_strict *inner; +} wire_cst_transaction_base; + +typedef struct wire_cst_electrum_config { + struct wire_cst_list_prim_u_8_strict *url; + struct wire_cst_list_prim_u_8_strict *socks5; + uint8_t retry; + uint8_t *timeout; + uint64_t stop_gap; + bool validate_domain; +} wire_cst_electrum_config; + +typedef struct wire_cst_BlockchainConfig_Electrum { + struct wire_cst_electrum_config *config; +} wire_cst_BlockchainConfig_Electrum; + +typedef struct wire_cst_esplora_config { + struct wire_cst_list_prim_u_8_strict *base_url; + struct wire_cst_list_prim_u_8_strict *proxy; + uint8_t *concurrency; + uint64_t stop_gap; + uint64_t *timeout; +} wire_cst_esplora_config; + +typedef struct wire_cst_BlockchainConfig_Esplora { + struct wire_cst_esplora_config *config; +} wire_cst_BlockchainConfig_Esplora; + +typedef struct wire_cst_Auth_UserPass { + struct wire_cst_list_prim_u_8_strict *username; + struct wire_cst_list_prim_u_8_strict *password; +} wire_cst_Auth_UserPass; + +typedef struct wire_cst_Auth_Cookie { + struct wire_cst_list_prim_u_8_strict *file; +} wire_cst_Auth_Cookie; + +typedef union AuthKind { + struct wire_cst_Auth_UserPass UserPass; + struct wire_cst_Auth_Cookie Cookie; +} AuthKind; + +typedef struct wire_cst_auth { + int32_t tag; + union AuthKind kind; +} wire_cst_auth; + +typedef struct wire_cst_rpc_sync_params { + uint64_t start_script_count; + uint64_t start_time; + bool force_start_time; + uint64_t poll_rate_sec; +} wire_cst_rpc_sync_params; + +typedef struct wire_cst_rpc_config { + struct wire_cst_list_prim_u_8_strict *url; + struct wire_cst_auth auth; + int32_t network; + struct wire_cst_list_prim_u_8_strict *wallet_name; + struct wire_cst_rpc_sync_params *sync_params; +} wire_cst_rpc_config; + +typedef struct wire_cst_BlockchainConfig_Rpc { + struct wire_cst_rpc_config *config; +} wire_cst_BlockchainConfig_Rpc; + +typedef union BlockchainConfigKind { + struct wire_cst_BlockchainConfig_Electrum Electrum; + struct wire_cst_BlockchainConfig_Esplora Esplora; + struct wire_cst_BlockchainConfig_Rpc Rpc; +} BlockchainConfigKind; + +typedef struct wire_cst_blockchain_config { + int32_t tag; + union BlockchainConfigKind kind; +} wire_cst_blockchain_config; + +typedef struct wire_cst_descriptor_base { + uintptr_t extended_descriptor; + uintptr_t key_map; +} wire_cst_descriptor_base; + +typedef struct wire_cst_descriptor_secret_key_base { + uintptr_t ptr; +} wire_cst_descriptor_secret_key_base; + +typedef struct wire_cst_descriptor_public_key_base { + uintptr_t ptr; +} wire_cst_descriptor_public_key_base; + +typedef struct wire_cst_derivation_path_base { + uintptr_t ptr; +} wire_cst_derivation_path_base; + +typedef struct wire_cst_mnemonic_base { + uintptr_t ptr; +} wire_cst_mnemonic_base; + +typedef struct wire_cst_list_prim_u_8_loose { + uint8_t *ptr; + int32_t len; +} wire_cst_list_prim_u_8_loose; + +typedef struct wire_cst_psbt_base { + uintptr_t ptr; +} wire_cst_psbt_base; + +typedef struct wire_cst_address_base { + uintptr_t ptr; +} wire_cst_address_base; + +typedef struct wire_cst_script_buf_base { + struct wire_cst_list_prim_u_8_strict *bytes; +} wire_cst_script_buf_base; + +typedef struct wire_cst_wallet_base { + uintptr_t ptr; +} wire_cst_wallet_base; + +typedef struct wire_cst_AddressIndex_Peek { + uint32_t index; +} wire_cst_AddressIndex_Peek; + +typedef struct wire_cst_AddressIndex_Reset { + uint32_t index; +} wire_cst_AddressIndex_Reset; + +typedef union AddressIndexKind { + struct wire_cst_AddressIndex_Peek Peek; + struct wire_cst_AddressIndex_Reset Reset; +} AddressIndexKind; + +typedef struct wire_cst_address_index { + int32_t tag; + union AddressIndexKind kind; +} wire_cst_address_index; + +typedef struct wire_cst_out_point { + struct wire_cst_list_prim_u_8_strict *txid; + uint32_t vout; +} wire_cst_out_point; + +typedef struct wire_cst_tx_out { + uint64_t value; + struct wire_cst_script_buf_base script_pubkey; +} wire_cst_tx_out; + +typedef struct wire_cst_local_utxo { + struct wire_cst_out_point outpoint; + struct wire_cst_tx_out txout; + int32_t keychain; + bool is_spent; +} wire_cst_local_utxo; + +typedef struct wire_cst_psbt_sig_hash_type { + uint32_t inner; +} wire_cst_psbt_sig_hash_type; + +typedef struct wire_cst_sqlite_db_configuration { + struct wire_cst_list_prim_u_8_strict *path; +} wire_cst_sqlite_db_configuration; + +typedef struct wire_cst_DatabaseConfig_Sqlite { + struct wire_cst_sqlite_db_configuration *config; +} wire_cst_DatabaseConfig_Sqlite; + +typedef struct wire_cst_sled_db_configuration { + struct wire_cst_list_prim_u_8_strict *path; + struct wire_cst_list_prim_u_8_strict *tree_name; +} wire_cst_sled_db_configuration; + +typedef struct wire_cst_DatabaseConfig_Sled { + struct wire_cst_sled_db_configuration *config; +} wire_cst_DatabaseConfig_Sled; + +typedef union DatabaseConfigKind { + struct wire_cst_DatabaseConfig_Sqlite Sqlite; + struct wire_cst_DatabaseConfig_Sled Sled; +} DatabaseConfigKind; + +typedef struct wire_cst_database_config { + int32_t tag; + union DatabaseConfigKind kind; +} wire_cst_database_config; + +typedef struct wire_cst_sign_options { + bool multi_sig; + bool trust_witness_utxo; + uint32_t *assume_height; + bool allow_all_sighashes; + bool remove_partial_sigs; + bool try_finalize; + bool sign_with_tap_internal_key; + bool allow_grinding; +} wire_cst_sign_options; + +typedef struct wire_cst_script_amount { + struct wire_cst_script_buf_base script; + uint64_t amount; +} wire_cst_script_amount; + +typedef struct wire_cst_list_script_amount { + struct wire_cst_script_amount *ptr; + int32_t len; +} wire_cst_list_script_amount; + +typedef struct wire_cst_list_out_point { + struct wire_cst_out_point *ptr; + int32_t len; +} wire_cst_list_out_point; + +typedef struct wire_cst_input { + struct wire_cst_list_prim_u_8_strict *s; +} wire_cst_input; + +typedef struct wire_cst_record_out_point_input_usize { + struct wire_cst_out_point field0; + struct wire_cst_input field1; + uintptr_t field2; +} wire_cst_record_out_point_input_usize; + +typedef struct wire_cst_RbfValue_Value { + uint32_t field0; +} wire_cst_RbfValue_Value; + +typedef union RbfValueKind { + struct wire_cst_RbfValue_Value Value; +} RbfValueKind; + +typedef struct wire_cst_rbf_value { + int32_t tag; + union RbfValueKind kind; +} wire_cst_rbf_value; + +typedef struct wire_cst_AddressError_Base58 { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_AddressError_Base58; + +typedef struct wire_cst_AddressError_Bech32 { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_AddressError_Bech32; + +typedef struct wire_cst_AddressError_InvalidBech32Variant { + int32_t expected; + int32_t found; +} wire_cst_AddressError_InvalidBech32Variant; + +typedef struct wire_cst_AddressError_InvalidWitnessVersion { + uint8_t field0; +} wire_cst_AddressError_InvalidWitnessVersion; + +typedef struct wire_cst_AddressError_UnparsableWitnessVersion { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_AddressError_UnparsableWitnessVersion; + +typedef struct wire_cst_AddressError_InvalidWitnessProgramLength { + uintptr_t field0; +} wire_cst_AddressError_InvalidWitnessProgramLength; + +typedef struct wire_cst_AddressError_InvalidSegwitV0ProgramLength { + uintptr_t field0; +} wire_cst_AddressError_InvalidSegwitV0ProgramLength; + +typedef struct wire_cst_AddressError_UnknownAddressType { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_AddressError_UnknownAddressType; + +typedef struct wire_cst_AddressError_NetworkValidation { + int32_t network_required; + int32_t network_found; + struct wire_cst_list_prim_u_8_strict *address; +} wire_cst_AddressError_NetworkValidation; + +typedef union AddressErrorKind { + struct wire_cst_AddressError_Base58 Base58; + struct wire_cst_AddressError_Bech32 Bech32; + struct wire_cst_AddressError_InvalidBech32Variant InvalidBech32Variant; + struct wire_cst_AddressError_InvalidWitnessVersion InvalidWitnessVersion; + struct wire_cst_AddressError_UnparsableWitnessVersion UnparsableWitnessVersion; + struct wire_cst_AddressError_InvalidWitnessProgramLength InvalidWitnessProgramLength; + struct wire_cst_AddressError_InvalidSegwitV0ProgramLength InvalidSegwitV0ProgramLength; + struct wire_cst_AddressError_UnknownAddressType UnknownAddressType; + struct wire_cst_AddressError_NetworkValidation NetworkValidation; +} AddressErrorKind; + +typedef struct wire_cst_address_error { + int32_t tag; + union AddressErrorKind kind; +} wire_cst_address_error; + +typedef struct wire_cst_block_time { + uint32_t height; + uint64_t timestamp; +} wire_cst_block_time; + +typedef struct wire_cst_ConsensusError_Io { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_ConsensusError_Io; + +typedef struct wire_cst_ConsensusError_OversizedVectorAllocation { + uintptr_t requested; + uintptr_t max; +} wire_cst_ConsensusError_OversizedVectorAllocation; + +typedef struct wire_cst_ConsensusError_InvalidChecksum { + struct wire_cst_list_prim_u_8_strict *expected; + struct wire_cst_list_prim_u_8_strict *actual; +} wire_cst_ConsensusError_InvalidChecksum; + +typedef struct wire_cst_ConsensusError_ParseFailed { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_ConsensusError_ParseFailed; + +typedef struct wire_cst_ConsensusError_UnsupportedSegwitFlag { + uint8_t field0; +} wire_cst_ConsensusError_UnsupportedSegwitFlag; + +typedef union ConsensusErrorKind { + struct wire_cst_ConsensusError_Io Io; + struct wire_cst_ConsensusError_OversizedVectorAllocation OversizedVectorAllocation; + struct wire_cst_ConsensusError_InvalidChecksum InvalidChecksum; + struct wire_cst_ConsensusError_ParseFailed ParseFailed; + struct wire_cst_ConsensusError_UnsupportedSegwitFlag UnsupportedSegwitFlag; +} ConsensusErrorKind; + +typedef struct wire_cst_consensus_error { + int32_t tag; + union ConsensusErrorKind kind; +} wire_cst_consensus_error; + +typedef struct wire_cst_DescriptorError_Key { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_DescriptorError_Key; + +typedef struct wire_cst_DescriptorError_Policy { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_DescriptorError_Policy; + +typedef struct wire_cst_DescriptorError_InvalidDescriptorCharacter { + uint8_t field0; +} wire_cst_DescriptorError_InvalidDescriptorCharacter; + +typedef struct wire_cst_DescriptorError_Bip32 { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_DescriptorError_Bip32; + +typedef struct wire_cst_DescriptorError_Base58 { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_DescriptorError_Base58; + +typedef struct wire_cst_DescriptorError_Pk { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_DescriptorError_Pk; + +typedef struct wire_cst_DescriptorError_Miniscript { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_DescriptorError_Miniscript; + +typedef struct wire_cst_DescriptorError_Hex { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_DescriptorError_Hex; + +typedef union DescriptorErrorKind { + struct wire_cst_DescriptorError_Key Key; + struct wire_cst_DescriptorError_Policy Policy; + struct wire_cst_DescriptorError_InvalidDescriptorCharacter InvalidDescriptorCharacter; + struct wire_cst_DescriptorError_Bip32 Bip32; + struct wire_cst_DescriptorError_Base58 Base58; + struct wire_cst_DescriptorError_Pk Pk; + struct wire_cst_DescriptorError_Miniscript Miniscript; + struct wire_cst_DescriptorError_Hex Hex; +} DescriptorErrorKind; + +typedef struct wire_cst_descriptor_error { + int32_t tag; + union DescriptorErrorKind kind; +} wire_cst_descriptor_error; + +typedef struct wire_cst_fee_rate { + float sat_per_vb; +} wire_cst_fee_rate; + +typedef struct wire_cst_HexError_InvalidChar { + uint8_t field0; +} wire_cst_HexError_InvalidChar; + +typedef struct wire_cst_HexError_OddLengthString { + uintptr_t field0; +} wire_cst_HexError_OddLengthString; + +typedef struct wire_cst_HexError_InvalidLength { + uintptr_t field0; + uintptr_t field1; +} wire_cst_HexError_InvalidLength; + +typedef union HexErrorKind { + struct wire_cst_HexError_InvalidChar InvalidChar; + struct wire_cst_HexError_OddLengthString OddLengthString; + struct wire_cst_HexError_InvalidLength InvalidLength; +} HexErrorKind; + +typedef struct wire_cst_hex_error { + int32_t tag; + union HexErrorKind kind; +} wire_cst_hex_error; + +typedef struct wire_cst_list_list_prim_u_8_strict { + struct wire_cst_list_prim_u_8_strict **ptr; + int32_t len; +} wire_cst_list_list_prim_u_8_strict; + +typedef struct wire_cst_list_local_utxo { + struct wire_cst_local_utxo *ptr; + int32_t len; +} wire_cst_list_local_utxo; + +typedef struct wire_cst_transaction_details { + struct wire_cst_transaction_base *transaction; + struct wire_cst_list_prim_u_8_strict *txid; + uint64_t received; + uint64_t sent; + uint64_t *fee; + struct wire_cst_block_time *confirmation_time; +} wire_cst_transaction_details; + +typedef struct wire_cst_list_transaction_details { + struct wire_cst_transaction_details *ptr; + int32_t len; +} wire_cst_list_transaction_details; + +typedef struct wire_cst_tx_in { + struct wire_cst_out_point previous_output; + struct wire_cst_script_buf_base script_sig; + uint32_t sequence; + struct wire_cst_list_list_prim_u_8_strict *witness; +} wire_cst_tx_in; + +typedef struct wire_cst_list_tx_in { + struct wire_cst_tx_in *ptr; + int32_t len; +} wire_cst_list_tx_in; + +typedef struct wire_cst_list_tx_out { + struct wire_cst_tx_out *ptr; + int32_t len; +} wire_cst_list_tx_out; + +typedef struct wire_cst_address_info { + uint32_t index; + struct wire_cst_list_prim_u_8_strict *address; +} wire_cst_address_info; + +typedef struct wire_cst_balance { + uint64_t immature; + uint64_t trusted_pending; + uint64_t untrusted_pending; + uint64_t confirmed; + uint64_t spendable; + uint64_t total; +} wire_cst_balance; + +typedef struct wire_cst_BdkError_Hex { + struct wire_cst_hex_error *field0; +} wire_cst_BdkError_Hex; + +typedef struct wire_cst_BdkError_Consensus { + struct wire_cst_consensus_error *field0; +} wire_cst_BdkError_Consensus; + +typedef struct wire_cst_BdkError_Address { + struct wire_cst_address_error *field0; +} wire_cst_BdkError_Address; + +typedef struct wire_cst_BdkError_Descriptor { + struct wire_cst_descriptor_error *field0; +} wire_cst_BdkError_Descriptor; + +typedef struct wire_cst_BdkError_InvalidU32Bytes { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_InvalidU32Bytes; + +typedef struct wire_cst_BdkError_Generic { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Generic; + +typedef struct wire_cst_BdkError_OutputBelowDustLimit { + uintptr_t field0; +} wire_cst_BdkError_OutputBelowDustLimit; + +typedef struct wire_cst_BdkError_InsufficientFunds { + uint64_t needed; + uint64_t available; +} wire_cst_BdkError_InsufficientFunds; + +typedef struct wire_cst_BdkError_FeeRateTooLow { + float needed; +} wire_cst_BdkError_FeeRateTooLow; + +typedef struct wire_cst_BdkError_FeeTooLow { + uint64_t needed; +} wire_cst_BdkError_FeeTooLow; + +typedef struct wire_cst_BdkError_MissingKeyOrigin { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_MissingKeyOrigin; + +typedef struct wire_cst_BdkError_Key { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Key; + +typedef struct wire_cst_BdkError_SpendingPolicyRequired { + int32_t field0; +} wire_cst_BdkError_SpendingPolicyRequired; + +typedef struct wire_cst_BdkError_InvalidPolicyPathError { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_InvalidPolicyPathError; + +typedef struct wire_cst_BdkError_Signer { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Signer; + +typedef struct wire_cst_BdkError_InvalidNetwork { + int32_t requested; + int32_t found; +} wire_cst_BdkError_InvalidNetwork; + +typedef struct wire_cst_BdkError_InvalidOutpoint { + struct wire_cst_out_point *field0; +} wire_cst_BdkError_InvalidOutpoint; + +typedef struct wire_cst_BdkError_Encode { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Encode; + +typedef struct wire_cst_BdkError_Miniscript { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Miniscript; + +typedef struct wire_cst_BdkError_MiniscriptPsbt { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_MiniscriptPsbt; + +typedef struct wire_cst_BdkError_Bip32 { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Bip32; + +typedef struct wire_cst_BdkError_Bip39 { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Bip39; + +typedef struct wire_cst_BdkError_Secp256k1 { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Secp256k1; + +typedef struct wire_cst_BdkError_Json { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Json; + +typedef struct wire_cst_BdkError_Psbt { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Psbt; + +typedef struct wire_cst_BdkError_PsbtParse { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_PsbtParse; + +typedef struct wire_cst_BdkError_MissingCachedScripts { + uintptr_t field0; + uintptr_t field1; +} wire_cst_BdkError_MissingCachedScripts; + +typedef struct wire_cst_BdkError_Electrum { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Electrum; + +typedef struct wire_cst_BdkError_Esplora { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Esplora; + +typedef struct wire_cst_BdkError_Sled { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Sled; + +typedef struct wire_cst_BdkError_Rpc { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Rpc; + +typedef struct wire_cst_BdkError_Rusqlite { + struct wire_cst_list_prim_u_8_strict *field0; +} wire_cst_BdkError_Rusqlite; + +typedef union BdkErrorKind { + struct wire_cst_BdkError_Hex Hex; + struct wire_cst_BdkError_Consensus Consensus; + struct wire_cst_BdkError_Address Address; + struct wire_cst_BdkError_Descriptor Descriptor; + struct wire_cst_BdkError_InvalidU32Bytes InvalidU32Bytes; + struct wire_cst_BdkError_Generic Generic; + struct wire_cst_BdkError_OutputBelowDustLimit OutputBelowDustLimit; + struct wire_cst_BdkError_InsufficientFunds InsufficientFunds; + struct wire_cst_BdkError_FeeRateTooLow FeeRateTooLow; + struct wire_cst_BdkError_FeeTooLow FeeTooLow; + struct wire_cst_BdkError_MissingKeyOrigin MissingKeyOrigin; + struct wire_cst_BdkError_Key Key; + struct wire_cst_BdkError_SpendingPolicyRequired SpendingPolicyRequired; + struct wire_cst_BdkError_InvalidPolicyPathError InvalidPolicyPathError; + struct wire_cst_BdkError_Signer Signer; + struct wire_cst_BdkError_InvalidNetwork InvalidNetwork; + struct wire_cst_BdkError_InvalidOutpoint InvalidOutpoint; + struct wire_cst_BdkError_Encode Encode; + struct wire_cst_BdkError_Miniscript Miniscript; + struct wire_cst_BdkError_MiniscriptPsbt MiniscriptPsbt; + struct wire_cst_BdkError_Bip32 Bip32; + struct wire_cst_BdkError_Bip39 Bip39; + struct wire_cst_BdkError_Secp256k1 Secp256k1; + struct wire_cst_BdkError_Json Json; + struct wire_cst_BdkError_Psbt Psbt; + struct wire_cst_BdkError_PsbtParse PsbtParse; + struct wire_cst_BdkError_MissingCachedScripts MissingCachedScripts; + struct wire_cst_BdkError_Electrum Electrum; + struct wire_cst_BdkError_Esplora Esplora; + struct wire_cst_BdkError_Sled Sled; + struct wire_cst_BdkError_Rpc Rpc; + struct wire_cst_BdkError_Rusqlite Rusqlite; +} BdkErrorKind; + +typedef struct wire_cst_bdk_error { + int32_t tag; + union BdkErrorKind kind; +} wire_cst_bdk_error; + +typedef struct wire_cst_Payload_PubkeyHash { + struct wire_cst_list_prim_u_8_strict *pubkey_hash; +} wire_cst_Payload_PubkeyHash; + +typedef struct wire_cst_Payload_ScriptHash { + struct wire_cst_list_prim_u_8_strict *script_hash; +} wire_cst_Payload_ScriptHash; + +typedef struct wire_cst_Payload_WitnessProgram { + int32_t version; + struct wire_cst_list_prim_u_8_strict *program; +} wire_cst_Payload_WitnessProgram; + +typedef union PayloadKind { + struct wire_cst_Payload_PubkeyHash PubkeyHash; + struct wire_cst_Payload_ScriptHash ScriptHash; + struct wire_cst_Payload_WitnessProgram WitnessProgram; +} PayloadKind; + +typedef struct wire_cst_payload { + int32_t tag; + union PayloadKind kind; +} wire_cst_payload; + +typedef struct wire_cst_record_psbt_base_transaction_details { + struct wire_cst_psbt_base field0; + struct wire_cst_transaction_details field1; +} wire_cst_record_psbt_base_transaction_details; + +void frbgen_bdk_flutter_wire_BlockchainBase_broadcast(int64_t port_, + struct wire_cst_blockchain_base *that, + struct wire_cst_transaction_base *transaction); + +void frbgen_bdk_flutter_wire_BlockchainBase_estimate_fee(int64_t port_, + struct wire_cst_blockchain_base *that, + uint64_t target); + +void frbgen_bdk_flutter_wire_BlockchainBase_get_block_hash(int64_t port_, + struct wire_cst_blockchain_base *that, + uint32_t height); + +void frbgen_bdk_flutter_wire_BlockchainBase_get_height(int64_t port_, + struct wire_cst_blockchain_base *that); + +void frbgen_bdk_flutter_wire_BlockchainBase_new(int64_t port_, + struct wire_cst_blockchain_config *blockchain_config); + +void frbgen_bdk_flutter_wire_DescriptorBase_as_string(int64_t port_, + struct wire_cst_descriptor_base *that); + +void frbgen_bdk_flutter_wire_DescriptorBase_as_string_private(int64_t port_, + struct wire_cst_descriptor_base *that); + +void frbgen_bdk_flutter_wire_DescriptorBase_max_satisfaction_weight(int64_t port_, + struct wire_cst_descriptor_base *that); + +void frbgen_bdk_flutter_wire_DescriptorBase_new(int64_t port_, + struct wire_cst_list_prim_u_8_strict *descriptor, + int32_t network); + +void frbgen_bdk_flutter_wire_DescriptorBase_new_bip44(int64_t port_, + struct wire_cst_descriptor_secret_key_base *secret_key, + int32_t keychain_kind, + int32_t network); + +void frbgen_bdk_flutter_wire_DescriptorBase_new_bip44_public(int64_t port_, + struct wire_cst_descriptor_public_key_base *public_key, + struct wire_cst_list_prim_u_8_strict *fingerprint, + int32_t keychain_kind, + int32_t network); + +void frbgen_bdk_flutter_wire_DescriptorBase_new_bip49(int64_t port_, + struct wire_cst_descriptor_secret_key_base *secret_key, + int32_t keychain_kind, + int32_t network); + +void frbgen_bdk_flutter_wire_DescriptorBase_new_bip49_public(int64_t port_, + struct wire_cst_descriptor_public_key_base *public_key, + struct wire_cst_list_prim_u_8_strict *fingerprint, + int32_t keychain_kind, + int32_t network); + +void frbgen_bdk_flutter_wire_DescriptorBase_new_bip84(int64_t port_, + struct wire_cst_descriptor_secret_key_base *secret_key, + int32_t keychain_kind, + int32_t network); + +void frbgen_bdk_flutter_wire_DescriptorBase_new_bip84_public(int64_t port_, + struct wire_cst_descriptor_public_key_base *public_key, + struct wire_cst_list_prim_u_8_strict *fingerprint, + int32_t keychain_kind, + int32_t network); + +void frbgen_bdk_flutter_wire_DescriptorBase_new_bip86(int64_t port_, + struct wire_cst_descriptor_secret_key_base *secret_key, + int32_t keychain_kind, + int32_t network); + +void frbgen_bdk_flutter_wire_DescriptorBase_new_bip86_public(int64_t port_, + struct wire_cst_descriptor_public_key_base *public_key, + struct wire_cst_list_prim_u_8_strict *fingerprint, + int32_t keychain_kind, + int32_t network); + +void frbgen_bdk_flutter_wire_DerivationPathBase_from_string(int64_t port_, + struct wire_cst_list_prim_u_8_strict *path); + +void frbgen_bdk_flutter_wire_DescriptorPublicKeyBase_as_string(int64_t port_, + struct wire_cst_descriptor_public_key_base *that); + +void frbgen_bdk_flutter_wire_DescriptorPublicKeyBase_derive(int64_t port_, + struct wire_cst_descriptor_public_key_base *ptr, + struct wire_cst_derivation_path_base *path); + +void frbgen_bdk_flutter_wire_DescriptorPublicKeyBase_extend(int64_t port_, + struct wire_cst_descriptor_public_key_base *ptr, + struct wire_cst_derivation_path_base *path); + +void frbgen_bdk_flutter_wire_DescriptorPublicKeyBase_from_string(int64_t port_, + struct wire_cst_list_prim_u_8_strict *public_key); + +void frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_as_public(int64_t port_, + struct wire_cst_descriptor_secret_key_base *ptr); + +void frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_as_string(int64_t port_, + struct wire_cst_descriptor_secret_key_base *that); + +void frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_create(int64_t port_, + int32_t network, + struct wire_cst_mnemonic_base *mnemonic, + struct wire_cst_list_prim_u_8_strict *password); + +void frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_derive(int64_t port_, + struct wire_cst_descriptor_secret_key_base *ptr, + struct wire_cst_derivation_path_base *path); + +void frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_extend(int64_t port_, + struct wire_cst_descriptor_secret_key_base *ptr, + struct wire_cst_derivation_path_base *path); + +void frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_from_string(int64_t port_, + struct wire_cst_list_prim_u_8_strict *secret_key); + +void frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_secret_bytes(int64_t port_, + struct wire_cst_descriptor_secret_key_base *that); + +void frbgen_bdk_flutter_wire_MnemonicBase_as_string(int64_t port_, + struct wire_cst_mnemonic_base *that); + +void frbgen_bdk_flutter_wire_MnemonicBase_from_entropy(int64_t port_, + struct wire_cst_list_prim_u_8_loose *entropy); + +void frbgen_bdk_flutter_wire_MnemonicBase_from_string(int64_t port_, + struct wire_cst_list_prim_u_8_strict *mnemonic); + +void frbgen_bdk_flutter_wire_MnemonicBase_new(int64_t port_, int32_t word_count); + +void frbgen_bdk_flutter_wire_PsbtBase_combine(int64_t port_, + struct wire_cst_psbt_base *ptr, + struct wire_cst_psbt_base *other); + +void frbgen_bdk_flutter_wire_PsbtBase_extract_tx(int64_t port_, struct wire_cst_psbt_base *ptr); + +void frbgen_bdk_flutter_wire_PsbtBase_fee_amount(int64_t port_, struct wire_cst_psbt_base *that); + +void frbgen_bdk_flutter_wire_PsbtBase_fee_rate(int64_t port_, struct wire_cst_psbt_base *that); + +void frbgen_bdk_flutter_wire_PsbtBase_from_str(int64_t port_, + struct wire_cst_list_prim_u_8_strict *psbt_base64); + +void frbgen_bdk_flutter_wire_PsbtBase_json_serialize(int64_t port_, + struct wire_cst_psbt_base *that); + +void frbgen_bdk_flutter_wire_PsbtBase_serialize(int64_t port_, struct wire_cst_psbt_base *that); + +void frbgen_bdk_flutter_wire_PsbtBase_txid(int64_t port_, struct wire_cst_psbt_base *that); + +void frbgen_bdk_flutter_wire_AddressBase_as_string(int64_t port_, + struct wire_cst_address_base *that); + +void frbgen_bdk_flutter_wire_AddressBase_from_script(int64_t port_, + struct wire_cst_script_buf_base *script, + int32_t network); + +void frbgen_bdk_flutter_wire_AddressBase_from_string(int64_t port_, + struct wire_cst_list_prim_u_8_strict *address, + int32_t network); + +void frbgen_bdk_flutter_wire_AddressBase_is_valid_for_network(int64_t port_, + struct wire_cst_address_base *that, + int32_t network); + +void frbgen_bdk_flutter_wire_AddressBase_network(int64_t port_, struct wire_cst_address_base *that); + +void frbgen_bdk_flutter_wire_AddressBase_payload(int64_t port_, struct wire_cst_address_base *that); + +void frbgen_bdk_flutter_wire_AddressBase_script(int64_t port_, struct wire_cst_address_base *ptr); + +void frbgen_bdk_flutter_wire_AddressBase_to_qr_uri(int64_t port_, + struct wire_cst_address_base *that); + +void frbgen_bdk_flutter_wire_ScriptBufBase_empty(int64_t port_); + +void frbgen_bdk_flutter_wire_ScriptBufBase_from_hex(int64_t port_, + struct wire_cst_list_prim_u_8_strict *s); + +void frbgen_bdk_flutter_wire_ScriptBufBase_with_capacity(int64_t port_, uintptr_t capacity); + +void frbgen_bdk_flutter_wire_TransactionBase_input(int64_t port_, + struct wire_cst_transaction_base *that); + +void frbgen_bdk_flutter_wire_TransactionBase_is_coin_base(int64_t port_, + struct wire_cst_transaction_base *that); + +void frbgen_bdk_flutter_wire_TransactionBase_is_explicitly_rbf(int64_t port_, + struct wire_cst_transaction_base *that); + +void frbgen_bdk_flutter_wire_TransactionBase_is_lock_time_enabled(int64_t port_, + struct wire_cst_transaction_base *that); + +void frbgen_bdk_flutter_wire_TransactionBase_lock_time(int64_t port_, + struct wire_cst_transaction_base *that); + +void frbgen_bdk_flutter_wire_TransactionBase_new(int64_t port_, + struct wire_cst_list_prim_u_8_loose *transaction_bytes); + +void frbgen_bdk_flutter_wire_TransactionBase_output(int64_t port_, + struct wire_cst_transaction_base *that); + +void frbgen_bdk_flutter_wire_TransactionBase_serialize(int64_t port_, + struct wire_cst_transaction_base *that); + +void frbgen_bdk_flutter_wire_TransactionBase_size(int64_t port_, + struct wire_cst_transaction_base *that); + +void frbgen_bdk_flutter_wire_TransactionBase_txid(int64_t port_, + struct wire_cst_transaction_base *that); + +void frbgen_bdk_flutter_wire_TransactionBase_version(int64_t port_, + struct wire_cst_transaction_base *that); + +void frbgen_bdk_flutter_wire_TransactionBase_vsize(int64_t port_, + struct wire_cst_transaction_base *that); + +void frbgen_bdk_flutter_wire_TransactionBase_weight(int64_t port_, + struct wire_cst_transaction_base *that); + +void frbgen_bdk_flutter_wire_WalletBase_get_address(int64_t port_, + struct wire_cst_wallet_base *that, + struct wire_cst_address_index *address_index); + +void frbgen_bdk_flutter_wire_WalletBase_get_balance(int64_t port_, + struct wire_cst_wallet_base *that); + +void frbgen_bdk_flutter_wire_WalletBase_get_descriptor_for_keychain(int64_t port_, + struct wire_cst_wallet_base *ptr, + int32_t keychain); + +void frbgen_bdk_flutter_wire_WalletBase_get_internal_address(int64_t port_, + struct wire_cst_wallet_base *that, + struct wire_cst_address_index *address_index); + +void frbgen_bdk_flutter_wire_WalletBase_get_psbt_input(int64_t port_, + struct wire_cst_wallet_base *that, + struct wire_cst_local_utxo *utxo, + bool only_witness_utxo, + struct wire_cst_psbt_sig_hash_type *sighash_type); + +void frbgen_bdk_flutter_wire_WalletBase_is_mine(int64_t port_, + struct wire_cst_wallet_base *that, + struct wire_cst_script_buf_base *script); + +void frbgen_bdk_flutter_wire_WalletBase_list_transactions(int64_t port_, + struct wire_cst_wallet_base *that, + bool include_raw); + +void frbgen_bdk_flutter_wire_WalletBase_list_unspent(int64_t port_, + struct wire_cst_wallet_base *that); + +void frbgen_bdk_flutter_wire_WalletBase_network(int64_t port_, struct wire_cst_wallet_base *that); + +void frbgen_bdk_flutter_wire_WalletBase_new(int64_t port_, + struct wire_cst_descriptor_base *descriptor, + struct wire_cst_descriptor_base *change_descriptor, + int32_t network, + struct wire_cst_database_config *database_config); + +void frbgen_bdk_flutter_wire_WalletBase_sign(int64_t port_, + struct wire_cst_wallet_base *ptr, + struct wire_cst_psbt_base *psbt, + struct wire_cst_sign_options *sign_options); + +void frbgen_bdk_flutter_wire_WalletBase_sync(int64_t port_, + struct wire_cst_wallet_base *ptr, + struct wire_cst_blockchain_base *blockchain); + +void frbgen_bdk_flutter_wire_finish_bump_fee_tx_builder(int64_t port_, + struct wire_cst_list_prim_u_8_strict *txid, + float fee_rate, + struct wire_cst_address_base *allow_shrinking, + struct wire_cst_wallet_base *wallet, + bool enable_rbf, + uint32_t *n_sequence); + +void frbgen_bdk_flutter_wire_tx_builder_finish(int64_t port_, + struct wire_cst_wallet_base *wallet, + struct wire_cst_list_script_amount *recipients, + struct wire_cst_list_out_point *utxos, + struct wire_cst_record_out_point_input_usize *foreign_utxo, + struct wire_cst_list_out_point *un_spendable, + int32_t change_policy, + bool manually_selected_only, + float *fee_rate, + uint64_t *fee_absolute, + bool drain_wallet, + struct wire_cst_script_buf_base *drain_to, + struct wire_cst_rbf_value *rbf, + struct wire_cst_list_prim_u_8_loose *data); + +void frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_AnyBlockchain(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_AnyBlockchain(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_ExtendedDescriptor(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_ExtendedDescriptor(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_MutexPartiallySignedTransaction(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_MutexPartiallySignedTransaction(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_MutexbdkWalletAnyDatabase(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_MutexbdkWalletAnyDatabase(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_bdkbitcoinAddress(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_bdkbitcoinAddress(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_bitcoinbip32DerivationPath(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_bitcoinbip32DerivationPath(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_keysDescriptorPublicKey(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_keysDescriptorPublicKey(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_keysDescriptorSecretKey(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_keysDescriptorSecretKey(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_keysKeyMap(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_keysKeyMap(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_keysbip39Mnemonic(const void *ptr); + +void frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_keysbip39Mnemonic(const void *ptr); + +struct wire_cst_address_base *frbgen_bdk_flutter_cst_new_box_autoadd_address_base(void); + +struct wire_cst_address_error *frbgen_bdk_flutter_cst_new_box_autoadd_address_error(void); + +struct wire_cst_address_index *frbgen_bdk_flutter_cst_new_box_autoadd_address_index(void); + +struct wire_cst_block_time *frbgen_bdk_flutter_cst_new_box_autoadd_block_time(void); + +struct wire_cst_blockchain_base *frbgen_bdk_flutter_cst_new_box_autoadd_blockchain_base(void); + +struct wire_cst_blockchain_config *frbgen_bdk_flutter_cst_new_box_autoadd_blockchain_config(void); + +struct wire_cst_consensus_error *frbgen_bdk_flutter_cst_new_box_autoadd_consensus_error(void); + +struct wire_cst_database_config *frbgen_bdk_flutter_cst_new_box_autoadd_database_config(void); + +struct wire_cst_derivation_path_base *frbgen_bdk_flutter_cst_new_box_autoadd_derivation_path_base(void); + +struct wire_cst_descriptor_base *frbgen_bdk_flutter_cst_new_box_autoadd_descriptor_base(void); + +struct wire_cst_descriptor_error *frbgen_bdk_flutter_cst_new_box_autoadd_descriptor_error(void); + +struct wire_cst_descriptor_public_key_base *frbgen_bdk_flutter_cst_new_box_autoadd_descriptor_public_key_base(void); + +struct wire_cst_descriptor_secret_key_base *frbgen_bdk_flutter_cst_new_box_autoadd_descriptor_secret_key_base(void); + +struct wire_cst_electrum_config *frbgen_bdk_flutter_cst_new_box_autoadd_electrum_config(void); + +struct wire_cst_esplora_config *frbgen_bdk_flutter_cst_new_box_autoadd_esplora_config(void); + +float *frbgen_bdk_flutter_cst_new_box_autoadd_f_32(float value); + +struct wire_cst_fee_rate *frbgen_bdk_flutter_cst_new_box_autoadd_fee_rate(void); + +struct wire_cst_hex_error *frbgen_bdk_flutter_cst_new_box_autoadd_hex_error(void); + +struct wire_cst_local_utxo *frbgen_bdk_flutter_cst_new_box_autoadd_local_utxo(void); + +struct wire_cst_mnemonic_base *frbgen_bdk_flutter_cst_new_box_autoadd_mnemonic_base(void); + +struct wire_cst_out_point *frbgen_bdk_flutter_cst_new_box_autoadd_out_point(void); + +struct wire_cst_psbt_base *frbgen_bdk_flutter_cst_new_box_autoadd_psbt_base(void); + +struct wire_cst_psbt_sig_hash_type *frbgen_bdk_flutter_cst_new_box_autoadd_psbt_sig_hash_type(void); + +struct wire_cst_rbf_value *frbgen_bdk_flutter_cst_new_box_autoadd_rbf_value(void); + +struct wire_cst_record_out_point_input_usize *frbgen_bdk_flutter_cst_new_box_autoadd_record_out_point_input_usize(void); + +struct wire_cst_rpc_config *frbgen_bdk_flutter_cst_new_box_autoadd_rpc_config(void); + +struct wire_cst_rpc_sync_params *frbgen_bdk_flutter_cst_new_box_autoadd_rpc_sync_params(void); + +struct wire_cst_script_buf_base *frbgen_bdk_flutter_cst_new_box_autoadd_script_buf_base(void); + +struct wire_cst_sign_options *frbgen_bdk_flutter_cst_new_box_autoadd_sign_options(void); + +struct wire_cst_sled_db_configuration *frbgen_bdk_flutter_cst_new_box_autoadd_sled_db_configuration(void); + +struct wire_cst_sqlite_db_configuration *frbgen_bdk_flutter_cst_new_box_autoadd_sqlite_db_configuration(void); + +struct wire_cst_transaction_base *frbgen_bdk_flutter_cst_new_box_autoadd_transaction_base(void); + +uint32_t *frbgen_bdk_flutter_cst_new_box_autoadd_u_32(uint32_t value); + +uint64_t *frbgen_bdk_flutter_cst_new_box_autoadd_u_64(uint64_t value); + +uint8_t *frbgen_bdk_flutter_cst_new_box_autoadd_u_8(uint8_t value); + +struct wire_cst_wallet_base *frbgen_bdk_flutter_cst_new_box_autoadd_wallet_base(void); + +struct wire_cst_list_list_prim_u_8_strict *frbgen_bdk_flutter_cst_new_list_list_prim_u_8_strict(int32_t len); + +struct wire_cst_list_local_utxo *frbgen_bdk_flutter_cst_new_list_local_utxo(int32_t len); + +struct wire_cst_list_out_point *frbgen_bdk_flutter_cst_new_list_out_point(int32_t len); + +struct wire_cst_list_prim_u_8_loose *frbgen_bdk_flutter_cst_new_list_prim_u_8_loose(int32_t len); + +struct wire_cst_list_prim_u_8_strict *frbgen_bdk_flutter_cst_new_list_prim_u_8_strict(int32_t len); + +struct wire_cst_list_script_amount *frbgen_bdk_flutter_cst_new_list_script_amount(int32_t len); + +struct wire_cst_list_transaction_details *frbgen_bdk_flutter_cst_new_list_transaction_details(int32_t len); + +struct wire_cst_list_tx_in *frbgen_bdk_flutter_cst_new_list_tx_in(int32_t len); + +struct wire_cst_list_tx_out *frbgen_bdk_flutter_cst_new_list_tx_out(int32_t len); +static int64_t dummy_method_to_enforce_bundling(void) { + int64_t dummy_var = 0; + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_address_base); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_address_error); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_address_index); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_block_time); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_blockchain_base); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_blockchain_config); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_consensus_error); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_database_config); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_derivation_path_base); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_descriptor_base); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_descriptor_error); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_descriptor_public_key_base); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_descriptor_secret_key_base); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_electrum_config); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_esplora_config); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_f_32); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_fee_rate); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_hex_error); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_local_utxo); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_mnemonic_base); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_out_point); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_psbt_base); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_psbt_sig_hash_type); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_rbf_value); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_record_out_point_input_usize); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_rpc_config); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_rpc_sync_params); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_script_buf_base); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_sign_options); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_sled_db_configuration); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_sqlite_db_configuration); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_transaction_base); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_u_32); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_u_64); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_u_8); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_box_autoadd_wallet_base); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_list_prim_u_8_strict); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_local_utxo); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_out_point); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_prim_u_8_loose); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_prim_u_8_strict); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_script_amount); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_transaction_details); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_tx_in); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_tx_out); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_AnyBlockchain); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_ExtendedDescriptor); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_MutexPartiallySignedTransaction); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_MutexbdkWalletAnyDatabase); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_bdkbitcoinAddress); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_bitcoinbip32DerivationPath); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_keysDescriptorPublicKey); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_keysDescriptorSecretKey); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_keysKeyMap); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_keysbip39Mnemonic); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_AnyBlockchain); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_ExtendedDescriptor); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_MutexPartiallySignedTransaction); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_MutexbdkWalletAnyDatabase); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_bdkbitcoinAddress); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_bitcoinbip32DerivationPath); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_keysDescriptorPublicKey); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_keysDescriptorSecretKey); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_keysKeyMap); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_increment_strong_count_RustOpaque_keysbip39Mnemonic); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_AddressBase_as_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_AddressBase_from_script); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_AddressBase_from_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_AddressBase_is_valid_for_network); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_AddressBase_network); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_AddressBase_payload); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_AddressBase_script); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_AddressBase_to_qr_uri); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_BlockchainBase_broadcast); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_BlockchainBase_estimate_fee); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_BlockchainBase_get_block_hash); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_BlockchainBase_get_height); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_BlockchainBase_new); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DerivationPathBase_from_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorBase_as_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorBase_as_string_private); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorBase_max_satisfaction_weight); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorBase_new); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorBase_new_bip44); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorBase_new_bip44_public); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorBase_new_bip49); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorBase_new_bip49_public); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorBase_new_bip84); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorBase_new_bip84_public); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorBase_new_bip86); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorBase_new_bip86_public); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorPublicKeyBase_as_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorPublicKeyBase_derive); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorPublicKeyBase_extend); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorPublicKeyBase_from_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_as_public); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_as_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_create); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_derive); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_extend); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_from_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_DescriptorSecretKeyBase_secret_bytes); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_MnemonicBase_as_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_MnemonicBase_from_entropy); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_MnemonicBase_from_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_MnemonicBase_new); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_PsbtBase_combine); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_PsbtBase_extract_tx); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_PsbtBase_fee_amount); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_PsbtBase_fee_rate); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_PsbtBase_from_str); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_PsbtBase_json_serialize); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_PsbtBase_serialize); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_PsbtBase_txid); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_ScriptBufBase_empty); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_ScriptBufBase_from_hex); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_ScriptBufBase_with_capacity); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_input); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_is_coin_base); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_is_explicitly_rbf); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_is_lock_time_enabled); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_lock_time); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_new); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_output); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_serialize); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_size); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_txid); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_version); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_vsize); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_TransactionBase_weight); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_WalletBase_get_address); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_WalletBase_get_balance); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_WalletBase_get_descriptor_for_keychain); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_WalletBase_get_internal_address); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_WalletBase_get_psbt_input); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_WalletBase_is_mine); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_WalletBase_list_transactions); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_WalletBase_list_unspent); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_WalletBase_network); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_WalletBase_new); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_WalletBase_sign); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_WalletBase_sync); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_finish_bump_fee_tx_builder); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire_tx_builder_finish); + dummy_var ^= ((int64_t) (void*) store_dart_post_cobject); + return dummy_var; +} diff --git a/ios/bdk_flutter.podspec b/ios/bdk_flutter.podspec index ca91a786..91bc4c08 100644 --- a/ios/bdk_flutter.podspec +++ b/ios/bdk_flutter.podspec @@ -1,57 +1,31 @@ - -read_key_value_pairs = lambda do |file_path| - pairs = {} - File.foreach(file_path) do |line| - key, value = line.chomp.split('=') - pairs[key] = value - end - pairs -end -podspec_dir = File.dirname(__FILE__) -assets_dir = File.join(podspec_dir, '..', 'assets') -config_file_path = File.join(assets_dir, 'release.config.txt') -config = read_key_value_pairs.call(config_file_path) - -tag_version = "#{config['TAG_VERSION']}" -framework = 'rust_bdk_ffi.xcframework' -lib_name = "bdk.#{tag_version}" -url = "#{config['REPOSITORY_URL']}#{tag_version}/#{lib_name}.zip" -frameworks_dir = "ios" - -` -cd ../ -if [ ! -d #{lib_name} ]; then - curl -L #{url} -o #{lib_name}.zip - unzip #{lib_name}.zip - rm -rf __MACOSX - rm #{lib_name}.zip -fi - -if [ ! -d #{frameworks_dir}/#{framework} ]; then - cp -R #{lib_name}/#{framework} #{frameworks_dir} -fi -` - Pod::Spec.new do |s| -s.name = 'bdk_flutter' -s.version = "#{config['TAG_VERSION']}" -s.summary = 'A Flutter library for the Bitcoin Development Kit (https://bitcoindevkit.org/)' -s.description = <<-DESC - A new Flutter project. -DESC - s.homepage = 'https://github.com/LtbLightning/bdk-flutter' -s.license = { :file => '../LICENSE' } -s.author = { 'Bitcoin Zavior' => 'BitcoinZavior@GMail.Com' } -s.source = { :path => '.' } -s.source_files = 'Classes/**/*' -s.dependency 'Flutter' -s.platform = :ios, '12.0' -# Flutter.framework does not contain a i386 slice. -s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } -s.user_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } -s.swift_version = '5.0' -s.public_header_files = 'Classes**/*.h' -s.source_files = 'Classes/**/*' -s.static_framework = true -s.vendored_frameworks = "rust_bdk_ffi.xcframework" + s.name = 'bdk_flutter' + s.version = "0.31.0-dev" + s.summary = 'A Flutter library for the Bitcoin Development Kit (https://bitcoindevkit.org/)' + s.description = <<-DESC +A new Flutter plugin project. + DESC + s.homepage = 'https://github.com/LtbLightning/bdk-flutter' + s.license = { :file => '../LICENSE' } + s.author = { 'Bitcoin Zavior' => 'BitcoinZavior@GMail.Com' } + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + s.dependency 'Flutter' + s.platform = :ios, '12.0' + s.script_phase = { + :name => 'Build Rust library', + # First argument is relative path to the `rust` folder, second is name of rust library + :script => 'sh "$PODS_TARGET_SRCROOT/../cargokit/build_pod.sh" ../rust bdk_flutter', + :execution_position => :before_compile, + :input_files => ['${BUILT_PRODUCTS_DIR}/cargokit_phony'], + # Let XCode know that the static library referenced in -force_load below is + # created by this build step. + :output_files => ["${BUILT_PRODUCTS_DIR}/libbdk_flutter.a"], + } + s.pod_target_xcconfig = { + 'DEFINES_MODULE' => 'YES', + # Flutter.framework does not contain a i386 slice. + 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386', + 'OTHER_LDFLAGS' => '-force_load ${BUILT_PRODUCTS_DIR}/libbdk_flutter.a', + } end diff --git a/lib/bdk_flutter.dart b/lib/bdk_flutter.dart index 7729dd55..83e2847d 100644 --- a/lib/bdk_flutter.dart +++ b/lib/bdk_flutter.dart @@ -1,66 +1,56 @@ ///A Flutter library for the [Bitcoin Development Kit](https://bitcoindevkit.org/). library bdk_flutter; -export './src/generated/bridge_definitions.dart' +export './src/generated/api/blockchain.dart' hide - RustBdkFfi, - Script, + BlockchainBase, BlockchainConfig_Electrum, - BlockchainConfig_Rpc, BlockchainConfig_Esplora, - DatabaseConfig_Memory, - DatabaseConfig_Sqlite, + AnyBlockchain, + Auth_Cookie, + Auth_UserPass, + Auth_None, + BlockchainConfig_Rpc; +export './src/generated/api/descriptor.dart' + hide + DescriptorBase, + ExtendedDescriptor, + KeysDescriptorSecretKey, + KeysDescriptorPublicKey, + KeysKeyMap; +export './src/generated/api/key.dart' + hide + DerivationPathBase, + DescriptorPublicKeyBase, + DescriptorSecretKeyBase, + BitcoinBip32DerivationPath, + KeysBip39Mnemonic, + MnemonicBase; +export './src/generated/api/psbt.dart' + hide MutexPartiallySignedTransaction, PsbtBase; +export './src/generated/api/types.dart' + hide + BdkBitcoinAddress, + ScriptBufBase, + TransactionBase, AddressIndex_Reset, + AddressBase, AddressIndex_Peek, - AddressIndex_New, + AddressIndex_Increase, AddressIndex_LastUnused, Payload_PubkeyHash, Payload_ScriptHash, Payload_WitnessProgram, - RbfValue, + DatabaseConfig_Sled, + DatabaseConfig_Memory, RbfValue_RbfDefault, RbfValue_Value, - Error, - Error_Bip32, - Error_BnBNoExactMatch, - Error_BnBTotalTriesExceeded, - Error_ChecksumMismatch, - Error_Descriptor, - Error_Electrum, - Error_Encode, - Error_Esplora, - Error_FeeRateTooLow, - Error_FeeRateUnavailable, - Error_FeeTooLow, - Error_Generic, - Error_Hex, - Error_InsufficientFunds, - Error_InvalidNetwork, - Error_InvalidOutpoint, - Error_InvalidPolicyPathError, - Error_InvalidU32Bytes, - Error_IrreplaceableTransaction, - Error_Json, - Error_Key, - Error_Miniscript, - Error_MiniscriptPsbt, - Error_MissingCachedScripts, - Error_MissingKeyOrigin, - Error_NoRecipients, - Error_NoUtxosSelected, - Error_OutputBelowDustLimit, - Error_Psbt, - Error_PsbtParse, - Error_Rpc, - Error_Rusqlite, - Error_ScriptDoesntHaveAddressForm, - Error_Secp256k1, - Error_Signer, - Error_Sled, - Error_SpendingPolicyRequired, - Error_TransactionConfirmed, - Error_TransactionNotFound, - Error_UnknownUtxo, - DatabaseConfig_Sled; + DatabaseConfig_Sqlite; +export './src/generated/api/wallet.dart' + hide + MutexBdkWalletAnyDatabase, + WalletBase, + finishBumpFeeTxBuilder, + txBuilderFinish; export './src/root.dart'; -export 'src/utils/exceptions.dart' hide BdkFfiException, handleBdkException; +export 'src/utils/exceptions.dart'; diff --git a/lib/src/generated/api/blockchain.dart b/lib/src/generated/api/blockchain.dart new file mode 100644 index 00000000..72528466 --- /dev/null +++ b/lib/src/generated/api/blockchain.dart @@ -0,0 +1,324 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.28. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../frb_generated.dart'; +import 'error.dart'; +import 'package:collection/collection.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +import 'package:freezed_annotation/freezed_annotation.dart' hide protected; +import 'types.dart'; +part 'blockchain.freezed.dart'; + +// Rust type: RustOpaqueNom +@sealed +class AnyBlockchain extends RustOpaque { + AnyBlockchain.dcoDecode(List wire) + : super.dcoDecode(wire, _kStaticData); + + AnyBlockchain.sseDecode(int ptr, int externalSizeOnNative) + : super.sseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + BdkCore.instance.api.rust_arc_increment_strong_count_AnyBlockchain, + rustArcDecrementStrongCount: + BdkCore.instance.api.rust_arc_decrement_strong_count_AnyBlockchain, + rustArcDecrementStrongCountPtr: + BdkCore.instance.api.rust_arc_decrement_strong_count_AnyBlockchainPtr, + ); +} + +@freezed +sealed class Auth with _$Auth { + /// No authentication + const factory Auth.none() = Auth_None; + + /// Authentication with username and password. + const factory Auth.userPass({ + /// Username + required String username, + + /// Password + required String password, + }) = Auth_UserPass; + + /// Authentication with a cookie file + const factory Auth.cookie({ + /// Cookie file + required String file, + }) = Auth_Cookie; +} + +class BlockchainBase { + final AnyBlockchain ptr; + + const BlockchainBase({ + required this.ptr, + }); + + Future broadcast( + {required TransactionBase transaction, dynamic hint}) => + BdkCore.instance.api.blockchainBaseBroadcast( + that: this, + transaction: transaction, + ); + + Future estimateFee({required int target, dynamic hint}) => + BdkCore.instance.api.blockchainBaseEstimateFee( + that: this, + target: target, + ); + + Future getBlockHash({required int height, dynamic hint}) => + BdkCore.instance.api.blockchainBaseGetBlockHash( + that: this, + height: height, + ); + + Future getHeight({dynamic hint}) => + BdkCore.instance.api.blockchainBaseGetHeight( + that: this, + ); + + // HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class. + static Future newInstance( + {required BlockchainConfig blockchainConfig, dynamic hint}) => + BdkCore.instance.api + .blockchainBaseNew(blockchainConfig: blockchainConfig, hint: hint); + + @override + int get hashCode => ptr.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is BlockchainBase && + runtimeType == other.runtimeType && + ptr == other.ptr; +} + +@freezed +sealed class BlockchainConfig with _$BlockchainConfig { + /// Electrum client + const factory BlockchainConfig.electrum({ + required ElectrumConfig config, + }) = BlockchainConfig_Electrum; + + /// Esplora client + const factory BlockchainConfig.esplora({ + required EsploraConfig config, + }) = BlockchainConfig_Esplora; + + /// Bitcoin Core RPC client + const factory BlockchainConfig.rpc({ + required RpcConfig config, + }) = BlockchainConfig_Rpc; +} + +/// Configuration for an ElectrumBlockchain +class ElectrumConfig { + /// URL of the Electrum server (such as ElectrumX, Esplora, BWT) may start with ssl:// or tcp:// and include a port + /// e.g. ssl://electrum.blockstream.info:60002 + final String url; + + /// URL of the socks5 proxy server or a Tor service + final String? socks5; + + /// Request retry count + final int retry; + + /// Request timeout (seconds) + final int? timeout; + + /// Stop searching addresses for transactions after finding an unused gap of this length + final int stopGap; + + /// Validate the domain when using SSL + final bool validateDomain; + + const ElectrumConfig({ + required this.url, + this.socks5, + required this.retry, + this.timeout, + required this.stopGap, + required this.validateDomain, + }); + + @override + int get hashCode => + url.hashCode ^ + socks5.hashCode ^ + retry.hashCode ^ + timeout.hashCode ^ + stopGap.hashCode ^ + validateDomain.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ElectrumConfig && + runtimeType == other.runtimeType && + url == other.url && + socks5 == other.socks5 && + retry == other.retry && + timeout == other.timeout && + stopGap == other.stopGap && + validateDomain == other.validateDomain; +} + +/// Configuration for an EsploraBlockchain +class EsploraConfig { + /// Base URL of the esplora service + /// e.g. https://blockstream.info/api/ + final String baseUrl; + + /// Optional URL of the proxy to use to make requests to the Esplora server + /// The string should be formatted as: ://:@host:. + /// Note that the format of this value and the supported protocols change slightly between the + /// sync version of esplora (using ureq) and the async version (using reqwest). For more + /// details check with the documentation of the two crates. Both of them are compiled with + /// the socks feature enabled. + /// The proxy is ignored when targeting wasm32. + final String? proxy; + + /// Number of parallel requests sent to the esplora service (default: 4) + final int? concurrency; + + /// Stop searching addresses for transactions after finding an unused gap of this length. + final int stopGap; + + /// Socket timeout. + final int? timeout; + + const EsploraConfig({ + required this.baseUrl, + this.proxy, + this.concurrency, + required this.stopGap, + this.timeout, + }); + + @override + int get hashCode => + baseUrl.hashCode ^ + proxy.hashCode ^ + concurrency.hashCode ^ + stopGap.hashCode ^ + timeout.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is EsploraConfig && + runtimeType == other.runtimeType && + baseUrl == other.baseUrl && + proxy == other.proxy && + concurrency == other.concurrency && + stopGap == other.stopGap && + timeout == other.timeout; +} + +/// RpcBlockchain configuration options +class RpcConfig { + /// The bitcoin node url + final String url; + + /// The bitcoin node authentication mechanism + final Auth auth; + + /// The network we are using (it will be checked the bitcoin node network matches this) + final Network network; + + /// The wallet name in the bitcoin node. + final String walletName; + + /// Sync parameters + final RpcSyncParams? syncParams; + + const RpcConfig({ + required this.url, + required this.auth, + required this.network, + required this.walletName, + this.syncParams, + }); + + @override + int get hashCode => + url.hashCode ^ + auth.hashCode ^ + network.hashCode ^ + walletName.hashCode ^ + syncParams.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is RpcConfig && + runtimeType == other.runtimeType && + url == other.url && + auth == other.auth && + network == other.network && + walletName == other.walletName && + syncParams == other.syncParams; +} + +/// Sync parameters for Bitcoin Core RPC. +/// +/// In general, BDK tries to sync `scriptPubKey`s cached in `Database` with +/// `scriptPubKey`s imported in the Bitcoin Core Wallet. These parameters are used for determining +/// how the `importdescriptors` RPC calls are to be made. +class RpcSyncParams { + /// The minimum number of scripts to scan for on initial sync. + final int startScriptCount; + + /// Time in unix seconds in which initial sync will start scanning from (0 to start from genesis). + final int startTime; + + /// Forces every sync to use `start_time` as import timestamp. + final bool forceStartTime; + + /// RPC poll rate (in seconds) to get state updates. + final int pollRateSec; + + const RpcSyncParams({ + required this.startScriptCount, + required this.startTime, + required this.forceStartTime, + required this.pollRateSec, + }); + + @override + int get hashCode => + startScriptCount.hashCode ^ + startTime.hashCode ^ + forceStartTime.hashCode ^ + pollRateSec.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is RpcSyncParams && + runtimeType == other.runtimeType && + startScriptCount == other.startScriptCount && + startTime == other.startTime && + forceStartTime == other.forceStartTime && + pollRateSec == other.pollRateSec; +} + +class U8Array4 extends NonGrowableListView { + static const arraySize = 4; + + @internal + Uint8List get inner => _inner; + final Uint8List _inner; + + U8Array4(this._inner) + : assert(_inner.length == arraySize), + super(_inner); + + U8Array4.init() : this(Uint8List(arraySize)); +} diff --git a/lib/src/generated/api/blockchain.freezed.dart b/lib/src/generated/api/blockchain.freezed.dart new file mode 100644 index 00000000..0f42238f --- /dev/null +++ b/lib/src/generated/api/blockchain.freezed.dart @@ -0,0 +1,986 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'blockchain.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +/// @nodoc +mixin _$Auth { + @optionalTypeArgs + TResult when({ + required TResult Function() none, + required TResult Function(String username, String password) userPass, + required TResult Function(String file) cookie, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? none, + TResult? Function(String username, String password)? userPass, + TResult? Function(String file)? cookie, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? none, + TResult Function(String username, String password)? userPass, + TResult Function(String file)? cookie, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(Auth_None value) none, + required TResult Function(Auth_UserPass value) userPass, + required TResult Function(Auth_Cookie value) cookie, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(Auth_None value)? none, + TResult? Function(Auth_UserPass value)? userPass, + TResult? Function(Auth_Cookie value)? cookie, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Auth_None value)? none, + TResult Function(Auth_UserPass value)? userPass, + TResult Function(Auth_Cookie value)? cookie, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AuthCopyWith<$Res> { + factory $AuthCopyWith(Auth value, $Res Function(Auth) then) = + _$AuthCopyWithImpl<$Res, Auth>; +} + +/// @nodoc +class _$AuthCopyWithImpl<$Res, $Val extends Auth> + implements $AuthCopyWith<$Res> { + _$AuthCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$Auth_NoneImplCopyWith<$Res> { + factory _$$Auth_NoneImplCopyWith( + _$Auth_NoneImpl value, $Res Function(_$Auth_NoneImpl) then) = + __$$Auth_NoneImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$Auth_NoneImplCopyWithImpl<$Res> + extends _$AuthCopyWithImpl<$Res, _$Auth_NoneImpl> + implements _$$Auth_NoneImplCopyWith<$Res> { + __$$Auth_NoneImplCopyWithImpl( + _$Auth_NoneImpl _value, $Res Function(_$Auth_NoneImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$Auth_NoneImpl implements Auth_None { + const _$Auth_NoneImpl(); + + @override + String toString() { + return 'Auth.none()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$Auth_NoneImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() none, + required TResult Function(String username, String password) userPass, + required TResult Function(String file) cookie, + }) { + return none(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? none, + TResult? Function(String username, String password)? userPass, + TResult? Function(String file)? cookie, + }) { + return none?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? none, + TResult Function(String username, String password)? userPass, + TResult Function(String file)? cookie, + required TResult orElse(), + }) { + if (none != null) { + return none(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(Auth_None value) none, + required TResult Function(Auth_UserPass value) userPass, + required TResult Function(Auth_Cookie value) cookie, + }) { + return none(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(Auth_None value)? none, + TResult? Function(Auth_UserPass value)? userPass, + TResult? Function(Auth_Cookie value)? cookie, + }) { + return none?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Auth_None value)? none, + TResult Function(Auth_UserPass value)? userPass, + TResult Function(Auth_Cookie value)? cookie, + required TResult orElse(), + }) { + if (none != null) { + return none(this); + } + return orElse(); + } +} + +abstract class Auth_None implements Auth { + const factory Auth_None() = _$Auth_NoneImpl; +} + +/// @nodoc +abstract class _$$Auth_UserPassImplCopyWith<$Res> { + factory _$$Auth_UserPassImplCopyWith( + _$Auth_UserPassImpl value, $Res Function(_$Auth_UserPassImpl) then) = + __$$Auth_UserPassImplCopyWithImpl<$Res>; + @useResult + $Res call({String username, String password}); +} + +/// @nodoc +class __$$Auth_UserPassImplCopyWithImpl<$Res> + extends _$AuthCopyWithImpl<$Res, _$Auth_UserPassImpl> + implements _$$Auth_UserPassImplCopyWith<$Res> { + __$$Auth_UserPassImplCopyWithImpl( + _$Auth_UserPassImpl _value, $Res Function(_$Auth_UserPassImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? username = null, + Object? password = null, + }) { + return _then(_$Auth_UserPassImpl( + username: null == username + ? _value.username + : username // ignore: cast_nullable_to_non_nullable + as String, + password: null == password + ? _value.password + : password // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$Auth_UserPassImpl implements Auth_UserPass { + const _$Auth_UserPassImpl({required this.username, required this.password}); + + /// Username + @override + final String username; + + /// Password + @override + final String password; + + @override + String toString() { + return 'Auth.userPass(username: $username, password: $password)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$Auth_UserPassImpl && + (identical(other.username, username) || + other.username == username) && + (identical(other.password, password) || + other.password == password)); + } + + @override + int get hashCode => Object.hash(runtimeType, username, password); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$Auth_UserPassImplCopyWith<_$Auth_UserPassImpl> get copyWith => + __$$Auth_UserPassImplCopyWithImpl<_$Auth_UserPassImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() none, + required TResult Function(String username, String password) userPass, + required TResult Function(String file) cookie, + }) { + return userPass(username, password); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? none, + TResult? Function(String username, String password)? userPass, + TResult? Function(String file)? cookie, + }) { + return userPass?.call(username, password); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? none, + TResult Function(String username, String password)? userPass, + TResult Function(String file)? cookie, + required TResult orElse(), + }) { + if (userPass != null) { + return userPass(username, password); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(Auth_None value) none, + required TResult Function(Auth_UserPass value) userPass, + required TResult Function(Auth_Cookie value) cookie, + }) { + return userPass(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(Auth_None value)? none, + TResult? Function(Auth_UserPass value)? userPass, + TResult? Function(Auth_Cookie value)? cookie, + }) { + return userPass?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Auth_None value)? none, + TResult Function(Auth_UserPass value)? userPass, + TResult Function(Auth_Cookie value)? cookie, + required TResult orElse(), + }) { + if (userPass != null) { + return userPass(this); + } + return orElse(); + } +} + +abstract class Auth_UserPass implements Auth { + const factory Auth_UserPass( + {required final String username, + required final String password}) = _$Auth_UserPassImpl; + + /// Username + String get username; + + /// Password + String get password; + @JsonKey(ignore: true) + _$$Auth_UserPassImplCopyWith<_$Auth_UserPassImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$Auth_CookieImplCopyWith<$Res> { + factory _$$Auth_CookieImplCopyWith( + _$Auth_CookieImpl value, $Res Function(_$Auth_CookieImpl) then) = + __$$Auth_CookieImplCopyWithImpl<$Res>; + @useResult + $Res call({String file}); +} + +/// @nodoc +class __$$Auth_CookieImplCopyWithImpl<$Res> + extends _$AuthCopyWithImpl<$Res, _$Auth_CookieImpl> + implements _$$Auth_CookieImplCopyWith<$Res> { + __$$Auth_CookieImplCopyWithImpl( + _$Auth_CookieImpl _value, $Res Function(_$Auth_CookieImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? file = null, + }) { + return _then(_$Auth_CookieImpl( + file: null == file + ? _value.file + : file // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$Auth_CookieImpl implements Auth_Cookie { + const _$Auth_CookieImpl({required this.file}); + + /// Cookie file + @override + final String file; + + @override + String toString() { + return 'Auth.cookie(file: $file)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$Auth_CookieImpl && + (identical(other.file, file) || other.file == file)); + } + + @override + int get hashCode => Object.hash(runtimeType, file); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$Auth_CookieImplCopyWith<_$Auth_CookieImpl> get copyWith => + __$$Auth_CookieImplCopyWithImpl<_$Auth_CookieImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() none, + required TResult Function(String username, String password) userPass, + required TResult Function(String file) cookie, + }) { + return cookie(file); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? none, + TResult? Function(String username, String password)? userPass, + TResult? Function(String file)? cookie, + }) { + return cookie?.call(file); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? none, + TResult Function(String username, String password)? userPass, + TResult Function(String file)? cookie, + required TResult orElse(), + }) { + if (cookie != null) { + return cookie(file); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(Auth_None value) none, + required TResult Function(Auth_UserPass value) userPass, + required TResult Function(Auth_Cookie value) cookie, + }) { + return cookie(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(Auth_None value)? none, + TResult? Function(Auth_UserPass value)? userPass, + TResult? Function(Auth_Cookie value)? cookie, + }) { + return cookie?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Auth_None value)? none, + TResult Function(Auth_UserPass value)? userPass, + TResult Function(Auth_Cookie value)? cookie, + required TResult orElse(), + }) { + if (cookie != null) { + return cookie(this); + } + return orElse(); + } +} + +abstract class Auth_Cookie implements Auth { + const factory Auth_Cookie({required final String file}) = _$Auth_CookieImpl; + + /// Cookie file + String get file; + @JsonKey(ignore: true) + _$$Auth_CookieImplCopyWith<_$Auth_CookieImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$BlockchainConfig { + Object get config => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(ElectrumConfig config) electrum, + required TResult Function(EsploraConfig config) esplora, + required TResult Function(RpcConfig config) rpc, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(ElectrumConfig config)? electrum, + TResult? Function(EsploraConfig config)? esplora, + TResult? Function(RpcConfig config)? rpc, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(ElectrumConfig config)? electrum, + TResult Function(EsploraConfig config)? esplora, + TResult Function(RpcConfig config)? rpc, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(BlockchainConfig_Electrum value) electrum, + required TResult Function(BlockchainConfig_Esplora value) esplora, + required TResult Function(BlockchainConfig_Rpc value) rpc, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BlockchainConfig_Electrum value)? electrum, + TResult? Function(BlockchainConfig_Esplora value)? esplora, + TResult? Function(BlockchainConfig_Rpc value)? rpc, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BlockchainConfig_Electrum value)? electrum, + TResult Function(BlockchainConfig_Esplora value)? esplora, + TResult Function(BlockchainConfig_Rpc value)? rpc, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $BlockchainConfigCopyWith<$Res> { + factory $BlockchainConfigCopyWith( + BlockchainConfig value, $Res Function(BlockchainConfig) then) = + _$BlockchainConfigCopyWithImpl<$Res, BlockchainConfig>; +} + +/// @nodoc +class _$BlockchainConfigCopyWithImpl<$Res, $Val extends BlockchainConfig> + implements $BlockchainConfigCopyWith<$Res> { + _$BlockchainConfigCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$BlockchainConfig_ElectrumImplCopyWith<$Res> { + factory _$$BlockchainConfig_ElectrumImplCopyWith( + _$BlockchainConfig_ElectrumImpl value, + $Res Function(_$BlockchainConfig_ElectrumImpl) then) = + __$$BlockchainConfig_ElectrumImplCopyWithImpl<$Res>; + @useResult + $Res call({ElectrumConfig config}); +} + +/// @nodoc +class __$$BlockchainConfig_ElectrumImplCopyWithImpl<$Res> + extends _$BlockchainConfigCopyWithImpl<$Res, + _$BlockchainConfig_ElectrumImpl> + implements _$$BlockchainConfig_ElectrumImplCopyWith<$Res> { + __$$BlockchainConfig_ElectrumImplCopyWithImpl( + _$BlockchainConfig_ElectrumImpl _value, + $Res Function(_$BlockchainConfig_ElectrumImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? config = null, + }) { + return _then(_$BlockchainConfig_ElectrumImpl( + config: null == config + ? _value.config + : config // ignore: cast_nullable_to_non_nullable + as ElectrumConfig, + )); + } +} + +/// @nodoc + +class _$BlockchainConfig_ElectrumImpl implements BlockchainConfig_Electrum { + const _$BlockchainConfig_ElectrumImpl({required this.config}); + + @override + final ElectrumConfig config; + + @override + String toString() { + return 'BlockchainConfig.electrum(config: $config)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BlockchainConfig_ElectrumImpl && + (identical(other.config, config) || other.config == config)); + } + + @override + int get hashCode => Object.hash(runtimeType, config); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BlockchainConfig_ElectrumImplCopyWith<_$BlockchainConfig_ElectrumImpl> + get copyWith => __$$BlockchainConfig_ElectrumImplCopyWithImpl< + _$BlockchainConfig_ElectrumImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(ElectrumConfig config) electrum, + required TResult Function(EsploraConfig config) esplora, + required TResult Function(RpcConfig config) rpc, + }) { + return electrum(config); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(ElectrumConfig config)? electrum, + TResult? Function(EsploraConfig config)? esplora, + TResult? Function(RpcConfig config)? rpc, + }) { + return electrum?.call(config); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(ElectrumConfig config)? electrum, + TResult Function(EsploraConfig config)? esplora, + TResult Function(RpcConfig config)? rpc, + required TResult orElse(), + }) { + if (electrum != null) { + return electrum(config); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BlockchainConfig_Electrum value) electrum, + required TResult Function(BlockchainConfig_Esplora value) esplora, + required TResult Function(BlockchainConfig_Rpc value) rpc, + }) { + return electrum(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BlockchainConfig_Electrum value)? electrum, + TResult? Function(BlockchainConfig_Esplora value)? esplora, + TResult? Function(BlockchainConfig_Rpc value)? rpc, + }) { + return electrum?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BlockchainConfig_Electrum value)? electrum, + TResult Function(BlockchainConfig_Esplora value)? esplora, + TResult Function(BlockchainConfig_Rpc value)? rpc, + required TResult orElse(), + }) { + if (electrum != null) { + return electrum(this); + } + return orElse(); + } +} + +abstract class BlockchainConfig_Electrum implements BlockchainConfig { + const factory BlockchainConfig_Electrum( + {required final ElectrumConfig config}) = _$BlockchainConfig_ElectrumImpl; + + @override + ElectrumConfig get config; + @JsonKey(ignore: true) + _$$BlockchainConfig_ElectrumImplCopyWith<_$BlockchainConfig_ElectrumImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BlockchainConfig_EsploraImplCopyWith<$Res> { + factory _$$BlockchainConfig_EsploraImplCopyWith( + _$BlockchainConfig_EsploraImpl value, + $Res Function(_$BlockchainConfig_EsploraImpl) then) = + __$$BlockchainConfig_EsploraImplCopyWithImpl<$Res>; + @useResult + $Res call({EsploraConfig config}); +} + +/// @nodoc +class __$$BlockchainConfig_EsploraImplCopyWithImpl<$Res> + extends _$BlockchainConfigCopyWithImpl<$Res, _$BlockchainConfig_EsploraImpl> + implements _$$BlockchainConfig_EsploraImplCopyWith<$Res> { + __$$BlockchainConfig_EsploraImplCopyWithImpl( + _$BlockchainConfig_EsploraImpl _value, + $Res Function(_$BlockchainConfig_EsploraImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? config = null, + }) { + return _then(_$BlockchainConfig_EsploraImpl( + config: null == config + ? _value.config + : config // ignore: cast_nullable_to_non_nullable + as EsploraConfig, + )); + } +} + +/// @nodoc + +class _$BlockchainConfig_EsploraImpl implements BlockchainConfig_Esplora { + const _$BlockchainConfig_EsploraImpl({required this.config}); + + @override + final EsploraConfig config; + + @override + String toString() { + return 'BlockchainConfig.esplora(config: $config)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BlockchainConfig_EsploraImpl && + (identical(other.config, config) || other.config == config)); + } + + @override + int get hashCode => Object.hash(runtimeType, config); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BlockchainConfig_EsploraImplCopyWith<_$BlockchainConfig_EsploraImpl> + get copyWith => __$$BlockchainConfig_EsploraImplCopyWithImpl< + _$BlockchainConfig_EsploraImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(ElectrumConfig config) electrum, + required TResult Function(EsploraConfig config) esplora, + required TResult Function(RpcConfig config) rpc, + }) { + return esplora(config); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(ElectrumConfig config)? electrum, + TResult? Function(EsploraConfig config)? esplora, + TResult? Function(RpcConfig config)? rpc, + }) { + return esplora?.call(config); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(ElectrumConfig config)? electrum, + TResult Function(EsploraConfig config)? esplora, + TResult Function(RpcConfig config)? rpc, + required TResult orElse(), + }) { + if (esplora != null) { + return esplora(config); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BlockchainConfig_Electrum value) electrum, + required TResult Function(BlockchainConfig_Esplora value) esplora, + required TResult Function(BlockchainConfig_Rpc value) rpc, + }) { + return esplora(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BlockchainConfig_Electrum value)? electrum, + TResult? Function(BlockchainConfig_Esplora value)? esplora, + TResult? Function(BlockchainConfig_Rpc value)? rpc, + }) { + return esplora?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BlockchainConfig_Electrum value)? electrum, + TResult Function(BlockchainConfig_Esplora value)? esplora, + TResult Function(BlockchainConfig_Rpc value)? rpc, + required TResult orElse(), + }) { + if (esplora != null) { + return esplora(this); + } + return orElse(); + } +} + +abstract class BlockchainConfig_Esplora implements BlockchainConfig { + const factory BlockchainConfig_Esplora( + {required final EsploraConfig config}) = _$BlockchainConfig_EsploraImpl; + + @override + EsploraConfig get config; + @JsonKey(ignore: true) + _$$BlockchainConfig_EsploraImplCopyWith<_$BlockchainConfig_EsploraImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BlockchainConfig_RpcImplCopyWith<$Res> { + factory _$$BlockchainConfig_RpcImplCopyWith(_$BlockchainConfig_RpcImpl value, + $Res Function(_$BlockchainConfig_RpcImpl) then) = + __$$BlockchainConfig_RpcImplCopyWithImpl<$Res>; + @useResult + $Res call({RpcConfig config}); +} + +/// @nodoc +class __$$BlockchainConfig_RpcImplCopyWithImpl<$Res> + extends _$BlockchainConfigCopyWithImpl<$Res, _$BlockchainConfig_RpcImpl> + implements _$$BlockchainConfig_RpcImplCopyWith<$Res> { + __$$BlockchainConfig_RpcImplCopyWithImpl(_$BlockchainConfig_RpcImpl _value, + $Res Function(_$BlockchainConfig_RpcImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? config = null, + }) { + return _then(_$BlockchainConfig_RpcImpl( + config: null == config + ? _value.config + : config // ignore: cast_nullable_to_non_nullable + as RpcConfig, + )); + } +} + +/// @nodoc + +class _$BlockchainConfig_RpcImpl implements BlockchainConfig_Rpc { + const _$BlockchainConfig_RpcImpl({required this.config}); + + @override + final RpcConfig config; + + @override + String toString() { + return 'BlockchainConfig.rpc(config: $config)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BlockchainConfig_RpcImpl && + (identical(other.config, config) || other.config == config)); + } + + @override + int get hashCode => Object.hash(runtimeType, config); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BlockchainConfig_RpcImplCopyWith<_$BlockchainConfig_RpcImpl> + get copyWith => + __$$BlockchainConfig_RpcImplCopyWithImpl<_$BlockchainConfig_RpcImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(ElectrumConfig config) electrum, + required TResult Function(EsploraConfig config) esplora, + required TResult Function(RpcConfig config) rpc, + }) { + return rpc(config); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(ElectrumConfig config)? electrum, + TResult? Function(EsploraConfig config)? esplora, + TResult? Function(RpcConfig config)? rpc, + }) { + return rpc?.call(config); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(ElectrumConfig config)? electrum, + TResult Function(EsploraConfig config)? esplora, + TResult Function(RpcConfig config)? rpc, + required TResult orElse(), + }) { + if (rpc != null) { + return rpc(config); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BlockchainConfig_Electrum value) electrum, + required TResult Function(BlockchainConfig_Esplora value) esplora, + required TResult Function(BlockchainConfig_Rpc value) rpc, + }) { + return rpc(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BlockchainConfig_Electrum value)? electrum, + TResult? Function(BlockchainConfig_Esplora value)? esplora, + TResult? Function(BlockchainConfig_Rpc value)? rpc, + }) { + return rpc?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BlockchainConfig_Electrum value)? electrum, + TResult Function(BlockchainConfig_Esplora value)? esplora, + TResult Function(BlockchainConfig_Rpc value)? rpc, + required TResult orElse(), + }) { + if (rpc != null) { + return rpc(this); + } + return orElse(); + } +} + +abstract class BlockchainConfig_Rpc implements BlockchainConfig { + const factory BlockchainConfig_Rpc({required final RpcConfig config}) = + _$BlockchainConfig_RpcImpl; + + @override + RpcConfig get config; + @JsonKey(ignore: true) + _$$BlockchainConfig_RpcImplCopyWith<_$BlockchainConfig_RpcImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/generated/api/descriptor.dart b/lib/src/generated/api/descriptor.dart new file mode 100644 index 00000000..e21c01b7 --- /dev/null +++ b/lib/src/generated/api/descriptor.dart @@ -0,0 +1,227 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.28. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../frb_generated.dart'; +import 'blockchain.dart'; +import 'error.dart'; +import 'key.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +import 'types.dart'; + +// Rust type: RustOpaqueNom +@sealed +class ExtendedDescriptor extends RustOpaque { + ExtendedDescriptor.dcoDecode(List wire) + : super.dcoDecode(wire, _kStaticData); + + ExtendedDescriptor.sseDecode(int ptr, int externalSizeOnNative) + : super.sseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + BdkCore.instance.api.rust_arc_increment_strong_count_ExtendedDescriptor, + rustArcDecrementStrongCount: + BdkCore.instance.api.rust_arc_decrement_strong_count_ExtendedDescriptor, + rustArcDecrementStrongCountPtr: BdkCore + .instance.api.rust_arc_decrement_strong_count_ExtendedDescriptorPtr, + ); +} + +// Rust type: RustOpaqueNom +@sealed +class KeysDescriptorPublicKey extends RustOpaque { + KeysDescriptorPublicKey.dcoDecode(List wire) + : super.dcoDecode(wire, _kStaticData); + + KeysDescriptorPublicKey.sseDecode(int ptr, int externalSizeOnNative) + : super.sseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: BdkCore + .instance.api.rust_arc_increment_strong_count_KeysDescriptorPublicKey, + rustArcDecrementStrongCount: BdkCore + .instance.api.rust_arc_decrement_strong_count_KeysDescriptorPublicKey, + rustArcDecrementStrongCountPtr: BdkCore.instance.api + .rust_arc_decrement_strong_count_KeysDescriptorPublicKeyPtr, + ); +} + +// Rust type: RustOpaqueNom +@sealed +class KeysDescriptorSecretKey extends RustOpaque { + KeysDescriptorSecretKey.dcoDecode(List wire) + : super.dcoDecode(wire, _kStaticData); + + KeysDescriptorSecretKey.sseDecode(int ptr, int externalSizeOnNative) + : super.sseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: BdkCore + .instance.api.rust_arc_increment_strong_count_KeysDescriptorSecretKey, + rustArcDecrementStrongCount: BdkCore + .instance.api.rust_arc_decrement_strong_count_KeysDescriptorSecretKey, + rustArcDecrementStrongCountPtr: BdkCore.instance.api + .rust_arc_decrement_strong_count_KeysDescriptorSecretKeyPtr, + ); +} + +// Rust type: RustOpaqueNom +@sealed +class KeysKeyMap extends RustOpaque { + KeysKeyMap.dcoDecode(List wire) + : super.dcoDecode(wire, _kStaticData); + + KeysKeyMap.sseDecode(int ptr, int externalSizeOnNative) + : super.sseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + BdkCore.instance.api.rust_arc_increment_strong_count_KeysKeyMap, + rustArcDecrementStrongCount: + BdkCore.instance.api.rust_arc_decrement_strong_count_KeysKeyMap, + rustArcDecrementStrongCountPtr: + BdkCore.instance.api.rust_arc_decrement_strong_count_KeysKeyMapPtr, + ); +} + +class DescriptorBase { + final ExtendedDescriptor extendedDescriptor; + final KeysKeyMap keyMap; + + const DescriptorBase({ + required this.extendedDescriptor, + required this.keyMap, + }); + + Future asString({dynamic hint}) => + BdkCore.instance.api.descriptorBaseAsString( + that: this, + ); + + Future asStringPrivate({dynamic hint}) => + BdkCore.instance.api.descriptorBaseAsStringPrivate( + that: this, + ); + + Future maxSatisfactionWeight({dynamic hint}) => + BdkCore.instance.api.descriptorBaseMaxSatisfactionWeight( + that: this, + ); + + // HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class. + static Future newInstance( + {required String descriptor, + required Network network, + dynamic hint}) => + BdkCore.instance.api.descriptorBaseNew( + descriptor: descriptor, network: network, hint: hint); + + static Future newBip44( + {required DescriptorSecretKeyBase secretKey, + required KeychainKind keychainKind, + required Network network, + dynamic hint}) => + BdkCore.instance.api.descriptorBaseNewBip44( + secretKey: secretKey, + keychainKind: keychainKind, + network: network, + hint: hint); + + static Future newBip44Public( + {required DescriptorPublicKeyBase publicKey, + required String fingerprint, + required KeychainKind keychainKind, + required Network network, + dynamic hint}) => + BdkCore.instance.api.descriptorBaseNewBip44Public( + publicKey: publicKey, + fingerprint: fingerprint, + keychainKind: keychainKind, + network: network, + hint: hint); + + static Future newBip49( + {required DescriptorSecretKeyBase secretKey, + required KeychainKind keychainKind, + required Network network, + dynamic hint}) => + BdkCore.instance.api.descriptorBaseNewBip49( + secretKey: secretKey, + keychainKind: keychainKind, + network: network, + hint: hint); + + static Future newBip49Public( + {required DescriptorPublicKeyBase publicKey, + required String fingerprint, + required KeychainKind keychainKind, + required Network network, + dynamic hint}) => + BdkCore.instance.api.descriptorBaseNewBip49Public( + publicKey: publicKey, + fingerprint: fingerprint, + keychainKind: keychainKind, + network: network, + hint: hint); + + static Future newBip84( + {required DescriptorSecretKeyBase secretKey, + required KeychainKind keychainKind, + required Network network, + dynamic hint}) => + BdkCore.instance.api.descriptorBaseNewBip84( + secretKey: secretKey, + keychainKind: keychainKind, + network: network, + hint: hint); + + static Future newBip84Public( + {required DescriptorPublicKeyBase publicKey, + required String fingerprint, + required KeychainKind keychainKind, + required Network network, + dynamic hint}) => + BdkCore.instance.api.descriptorBaseNewBip84Public( + publicKey: publicKey, + fingerprint: fingerprint, + keychainKind: keychainKind, + network: network, + hint: hint); + + static Future newBip86( + {required DescriptorSecretKeyBase secretKey, + required KeychainKind keychainKind, + required Network network, + dynamic hint}) => + BdkCore.instance.api.descriptorBaseNewBip86( + secretKey: secretKey, + keychainKind: keychainKind, + network: network, + hint: hint); + + static Future newBip86Public( + {required DescriptorPublicKeyBase publicKey, + required String fingerprint, + required KeychainKind keychainKind, + required Network network, + dynamic hint}) => + BdkCore.instance.api.descriptorBaseNewBip86Public( + publicKey: publicKey, + fingerprint: fingerprint, + keychainKind: keychainKind, + network: network, + hint: hint); + + @override + int get hashCode => extendedDescriptor.hashCode ^ keyMap.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is DescriptorBase && + runtimeType == other.runtimeType && + extendedDescriptor == other.extendedDescriptor && + keyMap == other.keyMap; +} diff --git a/lib/src/generated/api/error.dart b/lib/src/generated/api/error.dart new file mode 100644 index 00000000..5ed1878d --- /dev/null +++ b/lib/src/generated/api/error.dart @@ -0,0 +1,338 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.28. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../frb_generated.dart'; +import 'blockchain.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +import 'package:freezed_annotation/freezed_annotation.dart' hide protected; +import 'types.dart'; +part 'error.freezed.dart'; + +@freezed +sealed class AddressError with _$AddressError { + const factory AddressError.base58( + String field0, + ) = AddressError_Base58; + const factory AddressError.bech32( + String field0, + ) = AddressError_Bech32; + const factory AddressError.emptyBech32Payload() = + AddressError_EmptyBech32Payload; + const factory AddressError.invalidBech32Variant({ + required Variant expected, + required Variant found, + }) = AddressError_InvalidBech32Variant; + const factory AddressError.invalidWitnessVersion( + int field0, + ) = AddressError_InvalidWitnessVersion; + const factory AddressError.unparsableWitnessVersion( + String field0, + ) = AddressError_UnparsableWitnessVersion; + const factory AddressError.malformedWitnessVersion() = + AddressError_MalformedWitnessVersion; + const factory AddressError.invalidWitnessProgramLength( + int field0, + ) = AddressError_InvalidWitnessProgramLength; + const factory AddressError.invalidSegwitV0ProgramLength( + int field0, + ) = AddressError_InvalidSegwitV0ProgramLength; + const factory AddressError.uncompressedPubkey() = + AddressError_UncompressedPubkey; + const factory AddressError.excessiveScriptSize() = + AddressError_ExcessiveScriptSize; + const factory AddressError.unrecognizedScript() = + AddressError_UnrecognizedScript; + const factory AddressError.unknownAddressType( + String field0, + ) = AddressError_UnknownAddressType; + const factory AddressError.networkValidation({ + required Network networkRequired, + required Network networkFound, + required String address, + }) = AddressError_NetworkValidation; +} + +@freezed +sealed class BdkError with _$BdkError implements FrbException { + /// Hex decoding error + const factory BdkError.hex( + HexError field0, + ) = BdkError_Hex; + + /// Encoding error + const factory BdkError.consensus( + ConsensusError field0, + ) = BdkError_Consensus; + + /// Address error. + const factory BdkError.address( + AddressError field0, + ) = BdkError_Address; + + /// Error related to the parsing and usage of descriptors + const factory BdkError.descriptor( + DescriptorError field0, + ) = BdkError_Descriptor; + + /// Wrong number of bytes found when trying to convert to u32 + const factory BdkError.invalidU32Bytes( + Uint8List field0, + ) = BdkError_InvalidU32Bytes; + + /// Generic error + const factory BdkError.generic( + String field0, + ) = BdkError_Generic; + + /// This error is thrown when trying to convert Bare and Public key script to address + const factory BdkError.scriptDoesntHaveAddressForm() = + BdkError_ScriptDoesntHaveAddressForm; + + /// Cannot build a tx without recipients + const factory BdkError.noRecipients() = BdkError_NoRecipients; + + /// `manually_selected_only` option is selected but no utxo has been passed + const factory BdkError.noUtxosSelected() = BdkError_NoUtxosSelected; + + /// Output created is under the dust limit, 546 satoshis + const factory BdkError.outputBelowDustLimit( + int field0, + ) = BdkError_OutputBelowDustLimit; + + /// Wallet's UTXO set is not enough to cover recipient's requested plus fee + const factory BdkError.insufficientFunds({ + /// Sats needed for some transaction + required int needed, + + /// Sats available for spending + required int available, + }) = BdkError_InsufficientFunds; + + /// Branch and bound coin selection possible attempts with sufficiently big UTXO set could grow + /// exponentially, thus a limit is set, and when hit, this error is thrown + const factory BdkError.bnBTotalTriesExceeded() = + BdkError_BnBTotalTriesExceeded; + + /// Branch and bound coin selection tries to avoid needing a change by finding the right inputs for + /// the desired outputs plus fee, if there is not such combination this error is thrown + const factory BdkError.bnBNoExactMatch() = BdkError_BnBNoExactMatch; + + /// Happens when trying to spend an UTXO that is not in the internal database + const factory BdkError.unknownUtxo() = BdkError_UnknownUtxo; + + /// Thrown when a tx is not found in the internal database + const factory BdkError.transactionNotFound() = BdkError_TransactionNotFound; + + /// Happens when trying to bump a transaction that is already confirmed + const factory BdkError.transactionConfirmed() = BdkError_TransactionConfirmed; + + /// Trying to replace a tx that has a sequence >= `0xFFFFFFFE` + const factory BdkError.irreplaceableTransaction() = + BdkError_IrreplaceableTransaction; + + /// When bumping a tx the fee rate requested is lower than required + const factory BdkError.feeRateTooLow({ + /// Required fee rate (satoshi/vbyte) + required double needed, + }) = BdkError_FeeRateTooLow; + + /// When bumping a tx the absolute fee requested is lower than replaced tx absolute fee + const factory BdkError.feeTooLow({ + /// Required fee absolute value (satoshi) + required int needed, + }) = BdkError_FeeTooLow; + + /// Node doesn't have data to estimate a fee rate + const factory BdkError.feeRateUnavailable() = BdkError_FeeRateUnavailable; + const factory BdkError.missingKeyOrigin( + String field0, + ) = BdkError_MissingKeyOrigin; + + /// Error while working with keys + const factory BdkError.key( + String field0, + ) = BdkError_Key; + + /// Descriptor checksum mismatch + const factory BdkError.checksumMismatch() = BdkError_ChecksumMismatch; + + /// Spending policy is not compatible with this [KeychainKind] + const factory BdkError.spendingPolicyRequired( + KeychainKind field0, + ) = BdkError_SpendingPolicyRequired; + + /// Error while extracting and manipulating policies + const factory BdkError.invalidPolicyPathError( + String field0, + ) = BdkError_InvalidPolicyPathError; + + /// Signing error + const factory BdkError.signer( + String field0, + ) = BdkError_Signer; + + /// Invalid network + const factory BdkError.invalidNetwork({ + /// requested network, for example what is given as bdk-cli option + required Network requested, + + /// found network, for example the network of the bitcoin node + required Network found, + }) = BdkError_InvalidNetwork; + + /// Requested outpoint doesn't exist in the tx (vout greater than available outputs) + const factory BdkError.invalidOutpoint( + OutPoint field0, + ) = BdkError_InvalidOutpoint; + + /// Encoding error + const factory BdkError.encode( + String field0, + ) = BdkError_Encode; + + /// Miniscript error + const factory BdkError.miniscript( + String field0, + ) = BdkError_Miniscript; + + /// Miniscript PSBT error + const factory BdkError.miniscriptPsbt( + String field0, + ) = BdkError_MiniscriptPsbt; + + /// BIP32 error + const factory BdkError.bip32( + String field0, + ) = BdkError_Bip32; + + /// BIP39 error + const factory BdkError.bip39( + String field0, + ) = BdkError_Bip39; + + /// A secp256k1 error + const factory BdkError.secp256K1( + String field0, + ) = BdkError_Secp256k1; + + /// Error serializing or deserializing JSON data + const factory BdkError.json( + String field0, + ) = BdkError_Json; + + /// Partially signed bitcoin transaction error + const factory BdkError.psbt( + String field0, + ) = BdkError_Psbt; + + /// Partially signed bitcoin transaction parse error + const factory BdkError.psbtParse( + String field0, + ) = BdkError_PsbtParse; + + /// sync attempt failed due to missing scripts in cache which + /// are needed to satisfy `stop_gap`. + const factory BdkError.missingCachedScripts( + int field0, + int field1, + ) = BdkError_MissingCachedScripts; + + /// Electrum client error + const factory BdkError.electrum( + String field0, + ) = BdkError_Electrum; + + /// Esplora client error + const factory BdkError.esplora( + String field0, + ) = BdkError_Esplora; + + /// Sled database error + const factory BdkError.sled( + String field0, + ) = BdkError_Sled; + + /// Rpc client error + const factory BdkError.rpc( + String field0, + ) = BdkError_Rpc; + + /// Rusqlite client error + const factory BdkError.rusqlite( + String field0, + ) = BdkError_Rusqlite; +} + +@freezed +sealed class ConsensusError with _$ConsensusError { + const factory ConsensusError.io( + String field0, + ) = ConsensusError_Io; + const factory ConsensusError.oversizedVectorAllocation({ + required int requested, + required int max, + }) = ConsensusError_OversizedVectorAllocation; + const factory ConsensusError.invalidChecksum({ + required U8Array4 expected, + required U8Array4 actual, + }) = ConsensusError_InvalidChecksum; + const factory ConsensusError.nonMinimalVarInt() = + ConsensusError_NonMinimalVarInt; + const factory ConsensusError.parseFailed( + String field0, + ) = ConsensusError_ParseFailed; + const factory ConsensusError.unsupportedSegwitFlag( + int field0, + ) = ConsensusError_UnsupportedSegwitFlag; +} + +@freezed +sealed class DescriptorError with _$DescriptorError { + const factory DescriptorError.invalidHdKeyPath() = + DescriptorError_InvalidHdKeyPath; + const factory DescriptorError.invalidDescriptorChecksum() = + DescriptorError_InvalidDescriptorChecksum; + const factory DescriptorError.hardenedDerivationXpub() = + DescriptorError_HardenedDerivationXpub; + const factory DescriptorError.multiPath() = DescriptorError_MultiPath; + const factory DescriptorError.key( + String field0, + ) = DescriptorError_Key; + const factory DescriptorError.policy( + String field0, + ) = DescriptorError_Policy; + const factory DescriptorError.invalidDescriptorCharacter( + int field0, + ) = DescriptorError_InvalidDescriptorCharacter; + const factory DescriptorError.bip32( + String field0, + ) = DescriptorError_Bip32; + const factory DescriptorError.base58( + String field0, + ) = DescriptorError_Base58; + const factory DescriptorError.pk( + String field0, + ) = DescriptorError_Pk; + const factory DescriptorError.miniscript( + String field0, + ) = DescriptorError_Miniscript; + const factory DescriptorError.hex( + String field0, + ) = DescriptorError_Hex; +} + +@freezed +sealed class HexError with _$HexError { + const factory HexError.invalidChar( + int field0, + ) = HexError_InvalidChar; + const factory HexError.oddLengthString( + int field0, + ) = HexError_OddLengthString; + const factory HexError.invalidLength( + int field0, + int field1, + ) = HexError_InvalidLength; +} diff --git a/lib/src/generated/api/error.freezed.dart b/lib/src/generated/api/error.freezed.dart new file mode 100644 index 00000000..5b95650a --- /dev/null +++ b/lib/src/generated/api/error.freezed.dart @@ -0,0 +1,25235 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'error.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +/// @nodoc +mixin _$AddressError { + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AddressErrorCopyWith<$Res> { + factory $AddressErrorCopyWith( + AddressError value, $Res Function(AddressError) then) = + _$AddressErrorCopyWithImpl<$Res, AddressError>; +} + +/// @nodoc +class _$AddressErrorCopyWithImpl<$Res, $Val extends AddressError> + implements $AddressErrorCopyWith<$Res> { + _$AddressErrorCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$AddressError_Base58ImplCopyWith<$Res> { + factory _$$AddressError_Base58ImplCopyWith(_$AddressError_Base58Impl value, + $Res Function(_$AddressError_Base58Impl) then) = + __$$AddressError_Base58ImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$AddressError_Base58ImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, _$AddressError_Base58Impl> + implements _$$AddressError_Base58ImplCopyWith<$Res> { + __$$AddressError_Base58ImplCopyWithImpl(_$AddressError_Base58Impl _value, + $Res Function(_$AddressError_Base58Impl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AddressError_Base58Impl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$AddressError_Base58Impl implements AddressError_Base58 { + const _$AddressError_Base58Impl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'AddressError.base58(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_Base58Impl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AddressError_Base58ImplCopyWith<_$AddressError_Base58Impl> get copyWith => + __$$AddressError_Base58ImplCopyWithImpl<_$AddressError_Base58Impl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return base58(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return base58?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (base58 != null) { + return base58(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return base58(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return base58?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (base58 != null) { + return base58(this); + } + return orElse(); + } +} + +abstract class AddressError_Base58 implements AddressError { + const factory AddressError_Base58(final String field0) = + _$AddressError_Base58Impl; + + String get field0; + @JsonKey(ignore: true) + _$$AddressError_Base58ImplCopyWith<_$AddressError_Base58Impl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AddressError_Bech32ImplCopyWith<$Res> { + factory _$$AddressError_Bech32ImplCopyWith(_$AddressError_Bech32Impl value, + $Res Function(_$AddressError_Bech32Impl) then) = + __$$AddressError_Bech32ImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$AddressError_Bech32ImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, _$AddressError_Bech32Impl> + implements _$$AddressError_Bech32ImplCopyWith<$Res> { + __$$AddressError_Bech32ImplCopyWithImpl(_$AddressError_Bech32Impl _value, + $Res Function(_$AddressError_Bech32Impl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AddressError_Bech32Impl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$AddressError_Bech32Impl implements AddressError_Bech32 { + const _$AddressError_Bech32Impl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'AddressError.bech32(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_Bech32Impl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AddressError_Bech32ImplCopyWith<_$AddressError_Bech32Impl> get copyWith => + __$$AddressError_Bech32ImplCopyWithImpl<_$AddressError_Bech32Impl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return bech32(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return bech32?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (bech32 != null) { + return bech32(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return bech32(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return bech32?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (bech32 != null) { + return bech32(this); + } + return orElse(); + } +} + +abstract class AddressError_Bech32 implements AddressError { + const factory AddressError_Bech32(final String field0) = + _$AddressError_Bech32Impl; + + String get field0; + @JsonKey(ignore: true) + _$$AddressError_Bech32ImplCopyWith<_$AddressError_Bech32Impl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AddressError_EmptyBech32PayloadImplCopyWith<$Res> { + factory _$$AddressError_EmptyBech32PayloadImplCopyWith( + _$AddressError_EmptyBech32PayloadImpl value, + $Res Function(_$AddressError_EmptyBech32PayloadImpl) then) = + __$$AddressError_EmptyBech32PayloadImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$AddressError_EmptyBech32PayloadImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, + _$AddressError_EmptyBech32PayloadImpl> + implements _$$AddressError_EmptyBech32PayloadImplCopyWith<$Res> { + __$$AddressError_EmptyBech32PayloadImplCopyWithImpl( + _$AddressError_EmptyBech32PayloadImpl _value, + $Res Function(_$AddressError_EmptyBech32PayloadImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$AddressError_EmptyBech32PayloadImpl + implements AddressError_EmptyBech32Payload { + const _$AddressError_EmptyBech32PayloadImpl(); + + @override + String toString() { + return 'AddressError.emptyBech32Payload()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_EmptyBech32PayloadImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return emptyBech32Payload(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return emptyBech32Payload?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (emptyBech32Payload != null) { + return emptyBech32Payload(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return emptyBech32Payload(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return emptyBech32Payload?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (emptyBech32Payload != null) { + return emptyBech32Payload(this); + } + return orElse(); + } +} + +abstract class AddressError_EmptyBech32Payload implements AddressError { + const factory AddressError_EmptyBech32Payload() = + _$AddressError_EmptyBech32PayloadImpl; +} + +/// @nodoc +abstract class _$$AddressError_InvalidBech32VariantImplCopyWith<$Res> { + factory _$$AddressError_InvalidBech32VariantImplCopyWith( + _$AddressError_InvalidBech32VariantImpl value, + $Res Function(_$AddressError_InvalidBech32VariantImpl) then) = + __$$AddressError_InvalidBech32VariantImplCopyWithImpl<$Res>; + @useResult + $Res call({Variant expected, Variant found}); +} + +/// @nodoc +class __$$AddressError_InvalidBech32VariantImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, + _$AddressError_InvalidBech32VariantImpl> + implements _$$AddressError_InvalidBech32VariantImplCopyWith<$Res> { + __$$AddressError_InvalidBech32VariantImplCopyWithImpl( + _$AddressError_InvalidBech32VariantImpl _value, + $Res Function(_$AddressError_InvalidBech32VariantImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? expected = null, + Object? found = null, + }) { + return _then(_$AddressError_InvalidBech32VariantImpl( + expected: null == expected + ? _value.expected + : expected // ignore: cast_nullable_to_non_nullable + as Variant, + found: null == found + ? _value.found + : found // ignore: cast_nullable_to_non_nullable + as Variant, + )); + } +} + +/// @nodoc + +class _$AddressError_InvalidBech32VariantImpl + implements AddressError_InvalidBech32Variant { + const _$AddressError_InvalidBech32VariantImpl( + {required this.expected, required this.found}); + + @override + final Variant expected; + @override + final Variant found; + + @override + String toString() { + return 'AddressError.invalidBech32Variant(expected: $expected, found: $found)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_InvalidBech32VariantImpl && + (identical(other.expected, expected) || + other.expected == expected) && + (identical(other.found, found) || other.found == found)); + } + + @override + int get hashCode => Object.hash(runtimeType, expected, found); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AddressError_InvalidBech32VariantImplCopyWith< + _$AddressError_InvalidBech32VariantImpl> + get copyWith => __$$AddressError_InvalidBech32VariantImplCopyWithImpl< + _$AddressError_InvalidBech32VariantImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return invalidBech32Variant(expected, found); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return invalidBech32Variant?.call(expected, found); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (invalidBech32Variant != null) { + return invalidBech32Variant(expected, found); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return invalidBech32Variant(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return invalidBech32Variant?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (invalidBech32Variant != null) { + return invalidBech32Variant(this); + } + return orElse(); + } +} + +abstract class AddressError_InvalidBech32Variant implements AddressError { + const factory AddressError_InvalidBech32Variant( + {required final Variant expected, + required final Variant found}) = _$AddressError_InvalidBech32VariantImpl; + + Variant get expected; + Variant get found; + @JsonKey(ignore: true) + _$$AddressError_InvalidBech32VariantImplCopyWith< + _$AddressError_InvalidBech32VariantImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AddressError_InvalidWitnessVersionImplCopyWith<$Res> { + factory _$$AddressError_InvalidWitnessVersionImplCopyWith( + _$AddressError_InvalidWitnessVersionImpl value, + $Res Function(_$AddressError_InvalidWitnessVersionImpl) then) = + __$$AddressError_InvalidWitnessVersionImplCopyWithImpl<$Res>; + @useResult + $Res call({int field0}); +} + +/// @nodoc +class __$$AddressError_InvalidWitnessVersionImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, + _$AddressError_InvalidWitnessVersionImpl> + implements _$$AddressError_InvalidWitnessVersionImplCopyWith<$Res> { + __$$AddressError_InvalidWitnessVersionImplCopyWithImpl( + _$AddressError_InvalidWitnessVersionImpl _value, + $Res Function(_$AddressError_InvalidWitnessVersionImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AddressError_InvalidWitnessVersionImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$AddressError_InvalidWitnessVersionImpl + implements AddressError_InvalidWitnessVersion { + const _$AddressError_InvalidWitnessVersionImpl(this.field0); + + @override + final int field0; + + @override + String toString() { + return 'AddressError.invalidWitnessVersion(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_InvalidWitnessVersionImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AddressError_InvalidWitnessVersionImplCopyWith< + _$AddressError_InvalidWitnessVersionImpl> + get copyWith => __$$AddressError_InvalidWitnessVersionImplCopyWithImpl< + _$AddressError_InvalidWitnessVersionImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return invalidWitnessVersion(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return invalidWitnessVersion?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (invalidWitnessVersion != null) { + return invalidWitnessVersion(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return invalidWitnessVersion(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return invalidWitnessVersion?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (invalidWitnessVersion != null) { + return invalidWitnessVersion(this); + } + return orElse(); + } +} + +abstract class AddressError_InvalidWitnessVersion implements AddressError { + const factory AddressError_InvalidWitnessVersion(final int field0) = + _$AddressError_InvalidWitnessVersionImpl; + + int get field0; + @JsonKey(ignore: true) + _$$AddressError_InvalidWitnessVersionImplCopyWith< + _$AddressError_InvalidWitnessVersionImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AddressError_UnparsableWitnessVersionImplCopyWith<$Res> { + factory _$$AddressError_UnparsableWitnessVersionImplCopyWith( + _$AddressError_UnparsableWitnessVersionImpl value, + $Res Function(_$AddressError_UnparsableWitnessVersionImpl) then) = + __$$AddressError_UnparsableWitnessVersionImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$AddressError_UnparsableWitnessVersionImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, + _$AddressError_UnparsableWitnessVersionImpl> + implements _$$AddressError_UnparsableWitnessVersionImplCopyWith<$Res> { + __$$AddressError_UnparsableWitnessVersionImplCopyWithImpl( + _$AddressError_UnparsableWitnessVersionImpl _value, + $Res Function(_$AddressError_UnparsableWitnessVersionImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AddressError_UnparsableWitnessVersionImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$AddressError_UnparsableWitnessVersionImpl + implements AddressError_UnparsableWitnessVersion { + const _$AddressError_UnparsableWitnessVersionImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'AddressError.unparsableWitnessVersion(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_UnparsableWitnessVersionImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AddressError_UnparsableWitnessVersionImplCopyWith< + _$AddressError_UnparsableWitnessVersionImpl> + get copyWith => __$$AddressError_UnparsableWitnessVersionImplCopyWithImpl< + _$AddressError_UnparsableWitnessVersionImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return unparsableWitnessVersion(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return unparsableWitnessVersion?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (unparsableWitnessVersion != null) { + return unparsableWitnessVersion(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return unparsableWitnessVersion(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return unparsableWitnessVersion?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (unparsableWitnessVersion != null) { + return unparsableWitnessVersion(this); + } + return orElse(); + } +} + +abstract class AddressError_UnparsableWitnessVersion implements AddressError { + const factory AddressError_UnparsableWitnessVersion(final String field0) = + _$AddressError_UnparsableWitnessVersionImpl; + + String get field0; + @JsonKey(ignore: true) + _$$AddressError_UnparsableWitnessVersionImplCopyWith< + _$AddressError_UnparsableWitnessVersionImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AddressError_MalformedWitnessVersionImplCopyWith<$Res> { + factory _$$AddressError_MalformedWitnessVersionImplCopyWith( + _$AddressError_MalformedWitnessVersionImpl value, + $Res Function(_$AddressError_MalformedWitnessVersionImpl) then) = + __$$AddressError_MalformedWitnessVersionImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$AddressError_MalformedWitnessVersionImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, + _$AddressError_MalformedWitnessVersionImpl> + implements _$$AddressError_MalformedWitnessVersionImplCopyWith<$Res> { + __$$AddressError_MalformedWitnessVersionImplCopyWithImpl( + _$AddressError_MalformedWitnessVersionImpl _value, + $Res Function(_$AddressError_MalformedWitnessVersionImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$AddressError_MalformedWitnessVersionImpl + implements AddressError_MalformedWitnessVersion { + const _$AddressError_MalformedWitnessVersionImpl(); + + @override + String toString() { + return 'AddressError.malformedWitnessVersion()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_MalformedWitnessVersionImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return malformedWitnessVersion(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return malformedWitnessVersion?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (malformedWitnessVersion != null) { + return malformedWitnessVersion(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return malformedWitnessVersion(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return malformedWitnessVersion?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (malformedWitnessVersion != null) { + return malformedWitnessVersion(this); + } + return orElse(); + } +} + +abstract class AddressError_MalformedWitnessVersion implements AddressError { + const factory AddressError_MalformedWitnessVersion() = + _$AddressError_MalformedWitnessVersionImpl; +} + +/// @nodoc +abstract class _$$AddressError_InvalidWitnessProgramLengthImplCopyWith<$Res> { + factory _$$AddressError_InvalidWitnessProgramLengthImplCopyWith( + _$AddressError_InvalidWitnessProgramLengthImpl value, + $Res Function(_$AddressError_InvalidWitnessProgramLengthImpl) then) = + __$$AddressError_InvalidWitnessProgramLengthImplCopyWithImpl<$Res>; + @useResult + $Res call({int field0}); +} + +/// @nodoc +class __$$AddressError_InvalidWitnessProgramLengthImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, + _$AddressError_InvalidWitnessProgramLengthImpl> + implements _$$AddressError_InvalidWitnessProgramLengthImplCopyWith<$Res> { + __$$AddressError_InvalidWitnessProgramLengthImplCopyWithImpl( + _$AddressError_InvalidWitnessProgramLengthImpl _value, + $Res Function(_$AddressError_InvalidWitnessProgramLengthImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AddressError_InvalidWitnessProgramLengthImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$AddressError_InvalidWitnessProgramLengthImpl + implements AddressError_InvalidWitnessProgramLength { + const _$AddressError_InvalidWitnessProgramLengthImpl(this.field0); + + @override + final int field0; + + @override + String toString() { + return 'AddressError.invalidWitnessProgramLength(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_InvalidWitnessProgramLengthImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AddressError_InvalidWitnessProgramLengthImplCopyWith< + _$AddressError_InvalidWitnessProgramLengthImpl> + get copyWith => + __$$AddressError_InvalidWitnessProgramLengthImplCopyWithImpl< + _$AddressError_InvalidWitnessProgramLengthImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return invalidWitnessProgramLength(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return invalidWitnessProgramLength?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (invalidWitnessProgramLength != null) { + return invalidWitnessProgramLength(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return invalidWitnessProgramLength(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return invalidWitnessProgramLength?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (invalidWitnessProgramLength != null) { + return invalidWitnessProgramLength(this); + } + return orElse(); + } +} + +abstract class AddressError_InvalidWitnessProgramLength + implements AddressError { + const factory AddressError_InvalidWitnessProgramLength(final int field0) = + _$AddressError_InvalidWitnessProgramLengthImpl; + + int get field0; + @JsonKey(ignore: true) + _$$AddressError_InvalidWitnessProgramLengthImplCopyWith< + _$AddressError_InvalidWitnessProgramLengthImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AddressError_InvalidSegwitV0ProgramLengthImplCopyWith<$Res> { + factory _$$AddressError_InvalidSegwitV0ProgramLengthImplCopyWith( + _$AddressError_InvalidSegwitV0ProgramLengthImpl value, + $Res Function(_$AddressError_InvalidSegwitV0ProgramLengthImpl) then) = + __$$AddressError_InvalidSegwitV0ProgramLengthImplCopyWithImpl<$Res>; + @useResult + $Res call({int field0}); +} + +/// @nodoc +class __$$AddressError_InvalidSegwitV0ProgramLengthImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, + _$AddressError_InvalidSegwitV0ProgramLengthImpl> + implements _$$AddressError_InvalidSegwitV0ProgramLengthImplCopyWith<$Res> { + __$$AddressError_InvalidSegwitV0ProgramLengthImplCopyWithImpl( + _$AddressError_InvalidSegwitV0ProgramLengthImpl _value, + $Res Function(_$AddressError_InvalidSegwitV0ProgramLengthImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AddressError_InvalidSegwitV0ProgramLengthImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$AddressError_InvalidSegwitV0ProgramLengthImpl + implements AddressError_InvalidSegwitV0ProgramLength { + const _$AddressError_InvalidSegwitV0ProgramLengthImpl(this.field0); + + @override + final int field0; + + @override + String toString() { + return 'AddressError.invalidSegwitV0ProgramLength(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_InvalidSegwitV0ProgramLengthImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AddressError_InvalidSegwitV0ProgramLengthImplCopyWith< + _$AddressError_InvalidSegwitV0ProgramLengthImpl> + get copyWith => + __$$AddressError_InvalidSegwitV0ProgramLengthImplCopyWithImpl< + _$AddressError_InvalidSegwitV0ProgramLengthImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return invalidSegwitV0ProgramLength(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return invalidSegwitV0ProgramLength?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (invalidSegwitV0ProgramLength != null) { + return invalidSegwitV0ProgramLength(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return invalidSegwitV0ProgramLength(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return invalidSegwitV0ProgramLength?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (invalidSegwitV0ProgramLength != null) { + return invalidSegwitV0ProgramLength(this); + } + return orElse(); + } +} + +abstract class AddressError_InvalidSegwitV0ProgramLength + implements AddressError { + const factory AddressError_InvalidSegwitV0ProgramLength(final int field0) = + _$AddressError_InvalidSegwitV0ProgramLengthImpl; + + int get field0; + @JsonKey(ignore: true) + _$$AddressError_InvalidSegwitV0ProgramLengthImplCopyWith< + _$AddressError_InvalidSegwitV0ProgramLengthImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AddressError_UncompressedPubkeyImplCopyWith<$Res> { + factory _$$AddressError_UncompressedPubkeyImplCopyWith( + _$AddressError_UncompressedPubkeyImpl value, + $Res Function(_$AddressError_UncompressedPubkeyImpl) then) = + __$$AddressError_UncompressedPubkeyImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$AddressError_UncompressedPubkeyImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, + _$AddressError_UncompressedPubkeyImpl> + implements _$$AddressError_UncompressedPubkeyImplCopyWith<$Res> { + __$$AddressError_UncompressedPubkeyImplCopyWithImpl( + _$AddressError_UncompressedPubkeyImpl _value, + $Res Function(_$AddressError_UncompressedPubkeyImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$AddressError_UncompressedPubkeyImpl + implements AddressError_UncompressedPubkey { + const _$AddressError_UncompressedPubkeyImpl(); + + @override + String toString() { + return 'AddressError.uncompressedPubkey()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_UncompressedPubkeyImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return uncompressedPubkey(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return uncompressedPubkey?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (uncompressedPubkey != null) { + return uncompressedPubkey(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return uncompressedPubkey(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return uncompressedPubkey?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (uncompressedPubkey != null) { + return uncompressedPubkey(this); + } + return orElse(); + } +} + +abstract class AddressError_UncompressedPubkey implements AddressError { + const factory AddressError_UncompressedPubkey() = + _$AddressError_UncompressedPubkeyImpl; +} + +/// @nodoc +abstract class _$$AddressError_ExcessiveScriptSizeImplCopyWith<$Res> { + factory _$$AddressError_ExcessiveScriptSizeImplCopyWith( + _$AddressError_ExcessiveScriptSizeImpl value, + $Res Function(_$AddressError_ExcessiveScriptSizeImpl) then) = + __$$AddressError_ExcessiveScriptSizeImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$AddressError_ExcessiveScriptSizeImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, + _$AddressError_ExcessiveScriptSizeImpl> + implements _$$AddressError_ExcessiveScriptSizeImplCopyWith<$Res> { + __$$AddressError_ExcessiveScriptSizeImplCopyWithImpl( + _$AddressError_ExcessiveScriptSizeImpl _value, + $Res Function(_$AddressError_ExcessiveScriptSizeImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$AddressError_ExcessiveScriptSizeImpl + implements AddressError_ExcessiveScriptSize { + const _$AddressError_ExcessiveScriptSizeImpl(); + + @override + String toString() { + return 'AddressError.excessiveScriptSize()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_ExcessiveScriptSizeImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return excessiveScriptSize(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return excessiveScriptSize?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (excessiveScriptSize != null) { + return excessiveScriptSize(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return excessiveScriptSize(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return excessiveScriptSize?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (excessiveScriptSize != null) { + return excessiveScriptSize(this); + } + return orElse(); + } +} + +abstract class AddressError_ExcessiveScriptSize implements AddressError { + const factory AddressError_ExcessiveScriptSize() = + _$AddressError_ExcessiveScriptSizeImpl; +} + +/// @nodoc +abstract class _$$AddressError_UnrecognizedScriptImplCopyWith<$Res> { + factory _$$AddressError_UnrecognizedScriptImplCopyWith( + _$AddressError_UnrecognizedScriptImpl value, + $Res Function(_$AddressError_UnrecognizedScriptImpl) then) = + __$$AddressError_UnrecognizedScriptImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$AddressError_UnrecognizedScriptImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, + _$AddressError_UnrecognizedScriptImpl> + implements _$$AddressError_UnrecognizedScriptImplCopyWith<$Res> { + __$$AddressError_UnrecognizedScriptImplCopyWithImpl( + _$AddressError_UnrecognizedScriptImpl _value, + $Res Function(_$AddressError_UnrecognizedScriptImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$AddressError_UnrecognizedScriptImpl + implements AddressError_UnrecognizedScript { + const _$AddressError_UnrecognizedScriptImpl(); + + @override + String toString() { + return 'AddressError.unrecognizedScript()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_UnrecognizedScriptImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return unrecognizedScript(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return unrecognizedScript?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (unrecognizedScript != null) { + return unrecognizedScript(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return unrecognizedScript(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return unrecognizedScript?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (unrecognizedScript != null) { + return unrecognizedScript(this); + } + return orElse(); + } +} + +abstract class AddressError_UnrecognizedScript implements AddressError { + const factory AddressError_UnrecognizedScript() = + _$AddressError_UnrecognizedScriptImpl; +} + +/// @nodoc +abstract class _$$AddressError_UnknownAddressTypeImplCopyWith<$Res> { + factory _$$AddressError_UnknownAddressTypeImplCopyWith( + _$AddressError_UnknownAddressTypeImpl value, + $Res Function(_$AddressError_UnknownAddressTypeImpl) then) = + __$$AddressError_UnknownAddressTypeImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$AddressError_UnknownAddressTypeImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, + _$AddressError_UnknownAddressTypeImpl> + implements _$$AddressError_UnknownAddressTypeImplCopyWith<$Res> { + __$$AddressError_UnknownAddressTypeImplCopyWithImpl( + _$AddressError_UnknownAddressTypeImpl _value, + $Res Function(_$AddressError_UnknownAddressTypeImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AddressError_UnknownAddressTypeImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$AddressError_UnknownAddressTypeImpl + implements AddressError_UnknownAddressType { + const _$AddressError_UnknownAddressTypeImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'AddressError.unknownAddressType(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_UnknownAddressTypeImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AddressError_UnknownAddressTypeImplCopyWith< + _$AddressError_UnknownAddressTypeImpl> + get copyWith => __$$AddressError_UnknownAddressTypeImplCopyWithImpl< + _$AddressError_UnknownAddressTypeImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return unknownAddressType(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return unknownAddressType?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (unknownAddressType != null) { + return unknownAddressType(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return unknownAddressType(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return unknownAddressType?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (unknownAddressType != null) { + return unknownAddressType(this); + } + return orElse(); + } +} + +abstract class AddressError_UnknownAddressType implements AddressError { + const factory AddressError_UnknownAddressType(final String field0) = + _$AddressError_UnknownAddressTypeImpl; + + String get field0; + @JsonKey(ignore: true) + _$$AddressError_UnknownAddressTypeImplCopyWith< + _$AddressError_UnknownAddressTypeImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AddressError_NetworkValidationImplCopyWith<$Res> { + factory _$$AddressError_NetworkValidationImplCopyWith( + _$AddressError_NetworkValidationImpl value, + $Res Function(_$AddressError_NetworkValidationImpl) then) = + __$$AddressError_NetworkValidationImplCopyWithImpl<$Res>; + @useResult + $Res call({Network networkRequired, Network networkFound, String address}); +} + +/// @nodoc +class __$$AddressError_NetworkValidationImplCopyWithImpl<$Res> + extends _$AddressErrorCopyWithImpl<$Res, + _$AddressError_NetworkValidationImpl> + implements _$$AddressError_NetworkValidationImplCopyWith<$Res> { + __$$AddressError_NetworkValidationImplCopyWithImpl( + _$AddressError_NetworkValidationImpl _value, + $Res Function(_$AddressError_NetworkValidationImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? networkRequired = null, + Object? networkFound = null, + Object? address = null, + }) { + return _then(_$AddressError_NetworkValidationImpl( + networkRequired: null == networkRequired + ? _value.networkRequired + : networkRequired // ignore: cast_nullable_to_non_nullable + as Network, + networkFound: null == networkFound + ? _value.networkFound + : networkFound // ignore: cast_nullable_to_non_nullable + as Network, + address: null == address + ? _value.address + : address // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$AddressError_NetworkValidationImpl + implements AddressError_NetworkValidation { + const _$AddressError_NetworkValidationImpl( + {required this.networkRequired, + required this.networkFound, + required this.address}); + + @override + final Network networkRequired; + @override + final Network networkFound; + @override + final String address; + + @override + String toString() { + return 'AddressError.networkValidation(networkRequired: $networkRequired, networkFound: $networkFound, address: $address)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressError_NetworkValidationImpl && + (identical(other.networkRequired, networkRequired) || + other.networkRequired == networkRequired) && + (identical(other.networkFound, networkFound) || + other.networkFound == networkFound) && + (identical(other.address, address) || other.address == address)); + } + + @override + int get hashCode => + Object.hash(runtimeType, networkRequired, networkFound, address); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AddressError_NetworkValidationImplCopyWith< + _$AddressError_NetworkValidationImpl> + get copyWith => __$$AddressError_NetworkValidationImplCopyWithImpl< + _$AddressError_NetworkValidationImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) base58, + required TResult Function(String field0) bech32, + required TResult Function() emptyBech32Payload, + required TResult Function(Variant expected, Variant found) + invalidBech32Variant, + required TResult Function(int field0) invalidWitnessVersion, + required TResult Function(String field0) unparsableWitnessVersion, + required TResult Function() malformedWitnessVersion, + required TResult Function(int field0) invalidWitnessProgramLength, + required TResult Function(int field0) invalidSegwitV0ProgramLength, + required TResult Function() uncompressedPubkey, + required TResult Function() excessiveScriptSize, + required TResult Function() unrecognizedScript, + required TResult Function(String field0) unknownAddressType, + required TResult Function( + Network networkRequired, Network networkFound, String address) + networkValidation, + }) { + return networkValidation(networkRequired, networkFound, address); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? base58, + TResult? Function(String field0)? bech32, + TResult? Function()? emptyBech32Payload, + TResult? Function(Variant expected, Variant found)? invalidBech32Variant, + TResult? Function(int field0)? invalidWitnessVersion, + TResult? Function(String field0)? unparsableWitnessVersion, + TResult? Function()? malformedWitnessVersion, + TResult? Function(int field0)? invalidWitnessProgramLength, + TResult? Function(int field0)? invalidSegwitV0ProgramLength, + TResult? Function()? uncompressedPubkey, + TResult? Function()? excessiveScriptSize, + TResult? Function()? unrecognizedScript, + TResult? Function(String field0)? unknownAddressType, + TResult? Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + }) { + return networkValidation?.call(networkRequired, networkFound, address); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? base58, + TResult Function(String field0)? bech32, + TResult Function()? emptyBech32Payload, + TResult Function(Variant expected, Variant found)? invalidBech32Variant, + TResult Function(int field0)? invalidWitnessVersion, + TResult Function(String field0)? unparsableWitnessVersion, + TResult Function()? malformedWitnessVersion, + TResult Function(int field0)? invalidWitnessProgramLength, + TResult Function(int field0)? invalidSegwitV0ProgramLength, + TResult Function()? uncompressedPubkey, + TResult Function()? excessiveScriptSize, + TResult Function()? unrecognizedScript, + TResult Function(String field0)? unknownAddressType, + TResult Function( + Network networkRequired, Network networkFound, String address)? + networkValidation, + required TResult orElse(), + }) { + if (networkValidation != null) { + return networkValidation(networkRequired, networkFound, address); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressError_Base58 value) base58, + required TResult Function(AddressError_Bech32 value) bech32, + required TResult Function(AddressError_EmptyBech32Payload value) + emptyBech32Payload, + required TResult Function(AddressError_InvalidBech32Variant value) + invalidBech32Variant, + required TResult Function(AddressError_InvalidWitnessVersion value) + invalidWitnessVersion, + required TResult Function(AddressError_UnparsableWitnessVersion value) + unparsableWitnessVersion, + required TResult Function(AddressError_MalformedWitnessVersion value) + malformedWitnessVersion, + required TResult Function(AddressError_InvalidWitnessProgramLength value) + invalidWitnessProgramLength, + required TResult Function(AddressError_InvalidSegwitV0ProgramLength value) + invalidSegwitV0ProgramLength, + required TResult Function(AddressError_UncompressedPubkey value) + uncompressedPubkey, + required TResult Function(AddressError_ExcessiveScriptSize value) + excessiveScriptSize, + required TResult Function(AddressError_UnrecognizedScript value) + unrecognizedScript, + required TResult Function(AddressError_UnknownAddressType value) + unknownAddressType, + required TResult Function(AddressError_NetworkValidation value) + networkValidation, + }) { + return networkValidation(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressError_Base58 value)? base58, + TResult? Function(AddressError_Bech32 value)? bech32, + TResult? Function(AddressError_EmptyBech32Payload value)? + emptyBech32Payload, + TResult? Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult? Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult? Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult? Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult? Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult? Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult? Function(AddressError_UncompressedPubkey value)? + uncompressedPubkey, + TResult? Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult? Function(AddressError_UnrecognizedScript value)? + unrecognizedScript, + TResult? Function(AddressError_UnknownAddressType value)? + unknownAddressType, + TResult? Function(AddressError_NetworkValidation value)? networkValidation, + }) { + return networkValidation?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressError_Base58 value)? base58, + TResult Function(AddressError_Bech32 value)? bech32, + TResult Function(AddressError_EmptyBech32Payload value)? emptyBech32Payload, + TResult Function(AddressError_InvalidBech32Variant value)? + invalidBech32Variant, + TResult Function(AddressError_InvalidWitnessVersion value)? + invalidWitnessVersion, + TResult Function(AddressError_UnparsableWitnessVersion value)? + unparsableWitnessVersion, + TResult Function(AddressError_MalformedWitnessVersion value)? + malformedWitnessVersion, + TResult Function(AddressError_InvalidWitnessProgramLength value)? + invalidWitnessProgramLength, + TResult Function(AddressError_InvalidSegwitV0ProgramLength value)? + invalidSegwitV0ProgramLength, + TResult Function(AddressError_UncompressedPubkey value)? uncompressedPubkey, + TResult Function(AddressError_ExcessiveScriptSize value)? + excessiveScriptSize, + TResult Function(AddressError_UnrecognizedScript value)? unrecognizedScript, + TResult Function(AddressError_UnknownAddressType value)? unknownAddressType, + TResult Function(AddressError_NetworkValidation value)? networkValidation, + required TResult orElse(), + }) { + if (networkValidation != null) { + return networkValidation(this); + } + return orElse(); + } +} + +abstract class AddressError_NetworkValidation implements AddressError { + const factory AddressError_NetworkValidation( + {required final Network networkRequired, + required final Network networkFound, + required final String address}) = _$AddressError_NetworkValidationImpl; + + Network get networkRequired; + Network get networkFound; + String get address; + @JsonKey(ignore: true) + _$$AddressError_NetworkValidationImplCopyWith< + _$AddressError_NetworkValidationImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$BdkError { + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $BdkErrorCopyWith<$Res> { + factory $BdkErrorCopyWith(BdkError value, $Res Function(BdkError) then) = + _$BdkErrorCopyWithImpl<$Res, BdkError>; +} + +/// @nodoc +class _$BdkErrorCopyWithImpl<$Res, $Val extends BdkError> + implements $BdkErrorCopyWith<$Res> { + _$BdkErrorCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$BdkError_HexImplCopyWith<$Res> { + factory _$$BdkError_HexImplCopyWith( + _$BdkError_HexImpl value, $Res Function(_$BdkError_HexImpl) then) = + __$$BdkError_HexImplCopyWithImpl<$Res>; + @useResult + $Res call({HexError field0}); + + $HexErrorCopyWith<$Res> get field0; +} + +/// @nodoc +class __$$BdkError_HexImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_HexImpl> + implements _$$BdkError_HexImplCopyWith<$Res> { + __$$BdkError_HexImplCopyWithImpl( + _$BdkError_HexImpl _value, $Res Function(_$BdkError_HexImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_HexImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as HexError, + )); + } + + @override + @pragma('vm:prefer-inline') + $HexErrorCopyWith<$Res> get field0 { + return $HexErrorCopyWith<$Res>(_value.field0, (value) { + return _then(_value.copyWith(field0: value)); + }); + } +} + +/// @nodoc + +class _$BdkError_HexImpl implements BdkError_Hex { + const _$BdkError_HexImpl(this.field0); + + @override + final HexError field0; + + @override + String toString() { + return 'BdkError.hex(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_HexImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_HexImplCopyWith<_$BdkError_HexImpl> get copyWith => + __$$BdkError_HexImplCopyWithImpl<_$BdkError_HexImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return hex(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return hex?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (hex != null) { + return hex(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return hex(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return hex?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (hex != null) { + return hex(this); + } + return orElse(); + } +} + +abstract class BdkError_Hex implements BdkError { + const factory BdkError_Hex(final HexError field0) = _$BdkError_HexImpl; + + HexError get field0; + @JsonKey(ignore: true) + _$$BdkError_HexImplCopyWith<_$BdkError_HexImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_ConsensusImplCopyWith<$Res> { + factory _$$BdkError_ConsensusImplCopyWith(_$BdkError_ConsensusImpl value, + $Res Function(_$BdkError_ConsensusImpl) then) = + __$$BdkError_ConsensusImplCopyWithImpl<$Res>; + @useResult + $Res call({ConsensusError field0}); + + $ConsensusErrorCopyWith<$Res> get field0; +} + +/// @nodoc +class __$$BdkError_ConsensusImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_ConsensusImpl> + implements _$$BdkError_ConsensusImplCopyWith<$Res> { + __$$BdkError_ConsensusImplCopyWithImpl(_$BdkError_ConsensusImpl _value, + $Res Function(_$BdkError_ConsensusImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_ConsensusImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as ConsensusError, + )); + } + + @override + @pragma('vm:prefer-inline') + $ConsensusErrorCopyWith<$Res> get field0 { + return $ConsensusErrorCopyWith<$Res>(_value.field0, (value) { + return _then(_value.copyWith(field0: value)); + }); + } +} + +/// @nodoc + +class _$BdkError_ConsensusImpl implements BdkError_Consensus { + const _$BdkError_ConsensusImpl(this.field0); + + @override + final ConsensusError field0; + + @override + String toString() { + return 'BdkError.consensus(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_ConsensusImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_ConsensusImplCopyWith<_$BdkError_ConsensusImpl> get copyWith => + __$$BdkError_ConsensusImplCopyWithImpl<_$BdkError_ConsensusImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return consensus(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return consensus?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (consensus != null) { + return consensus(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return consensus(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return consensus?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (consensus != null) { + return consensus(this); + } + return orElse(); + } +} + +abstract class BdkError_Consensus implements BdkError { + const factory BdkError_Consensus(final ConsensusError field0) = + _$BdkError_ConsensusImpl; + + ConsensusError get field0; + @JsonKey(ignore: true) + _$$BdkError_ConsensusImplCopyWith<_$BdkError_ConsensusImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_AddressImplCopyWith<$Res> { + factory _$$BdkError_AddressImplCopyWith(_$BdkError_AddressImpl value, + $Res Function(_$BdkError_AddressImpl) then) = + __$$BdkError_AddressImplCopyWithImpl<$Res>; + @useResult + $Res call({AddressError field0}); + + $AddressErrorCopyWith<$Res> get field0; +} + +/// @nodoc +class __$$BdkError_AddressImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_AddressImpl> + implements _$$BdkError_AddressImplCopyWith<$Res> { + __$$BdkError_AddressImplCopyWithImpl(_$BdkError_AddressImpl _value, + $Res Function(_$BdkError_AddressImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_AddressImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AddressError, + )); + } + + @override + @pragma('vm:prefer-inline') + $AddressErrorCopyWith<$Res> get field0 { + return $AddressErrorCopyWith<$Res>(_value.field0, (value) { + return _then(_value.copyWith(field0: value)); + }); + } +} + +/// @nodoc + +class _$BdkError_AddressImpl implements BdkError_Address { + const _$BdkError_AddressImpl(this.field0); + + @override + final AddressError field0; + + @override + String toString() { + return 'BdkError.address(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_AddressImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_AddressImplCopyWith<_$BdkError_AddressImpl> get copyWith => + __$$BdkError_AddressImplCopyWithImpl<_$BdkError_AddressImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return address(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return address?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (address != null) { + return address(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return address(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return address?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (address != null) { + return address(this); + } + return orElse(); + } +} + +abstract class BdkError_Address implements BdkError { + const factory BdkError_Address(final AddressError field0) = + _$BdkError_AddressImpl; + + AddressError get field0; + @JsonKey(ignore: true) + _$$BdkError_AddressImplCopyWith<_$BdkError_AddressImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_DescriptorImplCopyWith<$Res> { + factory _$$BdkError_DescriptorImplCopyWith(_$BdkError_DescriptorImpl value, + $Res Function(_$BdkError_DescriptorImpl) then) = + __$$BdkError_DescriptorImplCopyWithImpl<$Res>; + @useResult + $Res call({DescriptorError field0}); + + $DescriptorErrorCopyWith<$Res> get field0; +} + +/// @nodoc +class __$$BdkError_DescriptorImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_DescriptorImpl> + implements _$$BdkError_DescriptorImplCopyWith<$Res> { + __$$BdkError_DescriptorImplCopyWithImpl(_$BdkError_DescriptorImpl _value, + $Res Function(_$BdkError_DescriptorImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_DescriptorImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as DescriptorError, + )); + } + + @override + @pragma('vm:prefer-inline') + $DescriptorErrorCopyWith<$Res> get field0 { + return $DescriptorErrorCopyWith<$Res>(_value.field0, (value) { + return _then(_value.copyWith(field0: value)); + }); + } +} + +/// @nodoc + +class _$BdkError_DescriptorImpl implements BdkError_Descriptor { + const _$BdkError_DescriptorImpl(this.field0); + + @override + final DescriptorError field0; + + @override + String toString() { + return 'BdkError.descriptor(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_DescriptorImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_DescriptorImplCopyWith<_$BdkError_DescriptorImpl> get copyWith => + __$$BdkError_DescriptorImplCopyWithImpl<_$BdkError_DescriptorImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return descriptor(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return descriptor?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (descriptor != null) { + return descriptor(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return descriptor(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return descriptor?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (descriptor != null) { + return descriptor(this); + } + return orElse(); + } +} + +abstract class BdkError_Descriptor implements BdkError { + const factory BdkError_Descriptor(final DescriptorError field0) = + _$BdkError_DescriptorImpl; + + DescriptorError get field0; + @JsonKey(ignore: true) + _$$BdkError_DescriptorImplCopyWith<_$BdkError_DescriptorImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_InvalidU32BytesImplCopyWith<$Res> { + factory _$$BdkError_InvalidU32BytesImplCopyWith( + _$BdkError_InvalidU32BytesImpl value, + $Res Function(_$BdkError_InvalidU32BytesImpl) then) = + __$$BdkError_InvalidU32BytesImplCopyWithImpl<$Res>; + @useResult + $Res call({Uint8List field0}); +} + +/// @nodoc +class __$$BdkError_InvalidU32BytesImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_InvalidU32BytesImpl> + implements _$$BdkError_InvalidU32BytesImplCopyWith<$Res> { + __$$BdkError_InvalidU32BytesImplCopyWithImpl( + _$BdkError_InvalidU32BytesImpl _value, + $Res Function(_$BdkError_InvalidU32BytesImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_InvalidU32BytesImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as Uint8List, + )); + } +} + +/// @nodoc + +class _$BdkError_InvalidU32BytesImpl implements BdkError_InvalidU32Bytes { + const _$BdkError_InvalidU32BytesImpl(this.field0); + + @override + final Uint8List field0; + + @override + String toString() { + return 'BdkError.invalidU32Bytes(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_InvalidU32BytesImpl && + const DeepCollectionEquality().equals(other.field0, field0)); + } + + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(field0)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_InvalidU32BytesImplCopyWith<_$BdkError_InvalidU32BytesImpl> + get copyWith => __$$BdkError_InvalidU32BytesImplCopyWithImpl< + _$BdkError_InvalidU32BytesImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return invalidU32Bytes(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return invalidU32Bytes?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (invalidU32Bytes != null) { + return invalidU32Bytes(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return invalidU32Bytes(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return invalidU32Bytes?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (invalidU32Bytes != null) { + return invalidU32Bytes(this); + } + return orElse(); + } +} + +abstract class BdkError_InvalidU32Bytes implements BdkError { + const factory BdkError_InvalidU32Bytes(final Uint8List field0) = + _$BdkError_InvalidU32BytesImpl; + + Uint8List get field0; + @JsonKey(ignore: true) + _$$BdkError_InvalidU32BytesImplCopyWith<_$BdkError_InvalidU32BytesImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_GenericImplCopyWith<$Res> { + factory _$$BdkError_GenericImplCopyWith(_$BdkError_GenericImpl value, + $Res Function(_$BdkError_GenericImpl) then) = + __$$BdkError_GenericImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_GenericImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_GenericImpl> + implements _$$BdkError_GenericImplCopyWith<$Res> { + __$$BdkError_GenericImplCopyWithImpl(_$BdkError_GenericImpl _value, + $Res Function(_$BdkError_GenericImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_GenericImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_GenericImpl implements BdkError_Generic { + const _$BdkError_GenericImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.generic(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_GenericImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_GenericImplCopyWith<_$BdkError_GenericImpl> get copyWith => + __$$BdkError_GenericImplCopyWithImpl<_$BdkError_GenericImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return generic(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return generic?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (generic != null) { + return generic(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return generic(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return generic?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (generic != null) { + return generic(this); + } + return orElse(); + } +} + +abstract class BdkError_Generic implements BdkError { + const factory BdkError_Generic(final String field0) = _$BdkError_GenericImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_GenericImplCopyWith<_$BdkError_GenericImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_ScriptDoesntHaveAddressFormImplCopyWith<$Res> { + factory _$$BdkError_ScriptDoesntHaveAddressFormImplCopyWith( + _$BdkError_ScriptDoesntHaveAddressFormImpl value, + $Res Function(_$BdkError_ScriptDoesntHaveAddressFormImpl) then) = + __$$BdkError_ScriptDoesntHaveAddressFormImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$BdkError_ScriptDoesntHaveAddressFormImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, + _$BdkError_ScriptDoesntHaveAddressFormImpl> + implements _$$BdkError_ScriptDoesntHaveAddressFormImplCopyWith<$Res> { + __$$BdkError_ScriptDoesntHaveAddressFormImplCopyWithImpl( + _$BdkError_ScriptDoesntHaveAddressFormImpl _value, + $Res Function(_$BdkError_ScriptDoesntHaveAddressFormImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$BdkError_ScriptDoesntHaveAddressFormImpl + implements BdkError_ScriptDoesntHaveAddressForm { + const _$BdkError_ScriptDoesntHaveAddressFormImpl(); + + @override + String toString() { + return 'BdkError.scriptDoesntHaveAddressForm()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_ScriptDoesntHaveAddressFormImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return scriptDoesntHaveAddressForm(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return scriptDoesntHaveAddressForm?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (scriptDoesntHaveAddressForm != null) { + return scriptDoesntHaveAddressForm(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return scriptDoesntHaveAddressForm(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return scriptDoesntHaveAddressForm?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (scriptDoesntHaveAddressForm != null) { + return scriptDoesntHaveAddressForm(this); + } + return orElse(); + } +} + +abstract class BdkError_ScriptDoesntHaveAddressForm implements BdkError { + const factory BdkError_ScriptDoesntHaveAddressForm() = + _$BdkError_ScriptDoesntHaveAddressFormImpl; +} + +/// @nodoc +abstract class _$$BdkError_NoRecipientsImplCopyWith<$Res> { + factory _$$BdkError_NoRecipientsImplCopyWith( + _$BdkError_NoRecipientsImpl value, + $Res Function(_$BdkError_NoRecipientsImpl) then) = + __$$BdkError_NoRecipientsImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$BdkError_NoRecipientsImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_NoRecipientsImpl> + implements _$$BdkError_NoRecipientsImplCopyWith<$Res> { + __$$BdkError_NoRecipientsImplCopyWithImpl(_$BdkError_NoRecipientsImpl _value, + $Res Function(_$BdkError_NoRecipientsImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$BdkError_NoRecipientsImpl implements BdkError_NoRecipients { + const _$BdkError_NoRecipientsImpl(); + + @override + String toString() { + return 'BdkError.noRecipients()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_NoRecipientsImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return noRecipients(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return noRecipients?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (noRecipients != null) { + return noRecipients(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return noRecipients(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return noRecipients?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (noRecipients != null) { + return noRecipients(this); + } + return orElse(); + } +} + +abstract class BdkError_NoRecipients implements BdkError { + const factory BdkError_NoRecipients() = _$BdkError_NoRecipientsImpl; +} + +/// @nodoc +abstract class _$$BdkError_NoUtxosSelectedImplCopyWith<$Res> { + factory _$$BdkError_NoUtxosSelectedImplCopyWith( + _$BdkError_NoUtxosSelectedImpl value, + $Res Function(_$BdkError_NoUtxosSelectedImpl) then) = + __$$BdkError_NoUtxosSelectedImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$BdkError_NoUtxosSelectedImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_NoUtxosSelectedImpl> + implements _$$BdkError_NoUtxosSelectedImplCopyWith<$Res> { + __$$BdkError_NoUtxosSelectedImplCopyWithImpl( + _$BdkError_NoUtxosSelectedImpl _value, + $Res Function(_$BdkError_NoUtxosSelectedImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$BdkError_NoUtxosSelectedImpl implements BdkError_NoUtxosSelected { + const _$BdkError_NoUtxosSelectedImpl(); + + @override + String toString() { + return 'BdkError.noUtxosSelected()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_NoUtxosSelectedImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return noUtxosSelected(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return noUtxosSelected?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (noUtxosSelected != null) { + return noUtxosSelected(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return noUtxosSelected(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return noUtxosSelected?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (noUtxosSelected != null) { + return noUtxosSelected(this); + } + return orElse(); + } +} + +abstract class BdkError_NoUtxosSelected implements BdkError { + const factory BdkError_NoUtxosSelected() = _$BdkError_NoUtxosSelectedImpl; +} + +/// @nodoc +abstract class _$$BdkError_OutputBelowDustLimitImplCopyWith<$Res> { + factory _$$BdkError_OutputBelowDustLimitImplCopyWith( + _$BdkError_OutputBelowDustLimitImpl value, + $Res Function(_$BdkError_OutputBelowDustLimitImpl) then) = + __$$BdkError_OutputBelowDustLimitImplCopyWithImpl<$Res>; + @useResult + $Res call({int field0}); +} + +/// @nodoc +class __$$BdkError_OutputBelowDustLimitImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_OutputBelowDustLimitImpl> + implements _$$BdkError_OutputBelowDustLimitImplCopyWith<$Res> { + __$$BdkError_OutputBelowDustLimitImplCopyWithImpl( + _$BdkError_OutputBelowDustLimitImpl _value, + $Res Function(_$BdkError_OutputBelowDustLimitImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_OutputBelowDustLimitImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$BdkError_OutputBelowDustLimitImpl + implements BdkError_OutputBelowDustLimit { + const _$BdkError_OutputBelowDustLimitImpl(this.field0); + + @override + final int field0; + + @override + String toString() { + return 'BdkError.outputBelowDustLimit(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_OutputBelowDustLimitImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_OutputBelowDustLimitImplCopyWith< + _$BdkError_OutputBelowDustLimitImpl> + get copyWith => __$$BdkError_OutputBelowDustLimitImplCopyWithImpl< + _$BdkError_OutputBelowDustLimitImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return outputBelowDustLimit(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return outputBelowDustLimit?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (outputBelowDustLimit != null) { + return outputBelowDustLimit(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return outputBelowDustLimit(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return outputBelowDustLimit?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (outputBelowDustLimit != null) { + return outputBelowDustLimit(this); + } + return orElse(); + } +} + +abstract class BdkError_OutputBelowDustLimit implements BdkError { + const factory BdkError_OutputBelowDustLimit(final int field0) = + _$BdkError_OutputBelowDustLimitImpl; + + int get field0; + @JsonKey(ignore: true) + _$$BdkError_OutputBelowDustLimitImplCopyWith< + _$BdkError_OutputBelowDustLimitImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_InsufficientFundsImplCopyWith<$Res> { + factory _$$BdkError_InsufficientFundsImplCopyWith( + _$BdkError_InsufficientFundsImpl value, + $Res Function(_$BdkError_InsufficientFundsImpl) then) = + __$$BdkError_InsufficientFundsImplCopyWithImpl<$Res>; + @useResult + $Res call({int needed, int available}); +} + +/// @nodoc +class __$$BdkError_InsufficientFundsImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_InsufficientFundsImpl> + implements _$$BdkError_InsufficientFundsImplCopyWith<$Res> { + __$$BdkError_InsufficientFundsImplCopyWithImpl( + _$BdkError_InsufficientFundsImpl _value, + $Res Function(_$BdkError_InsufficientFundsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? needed = null, + Object? available = null, + }) { + return _then(_$BdkError_InsufficientFundsImpl( + needed: null == needed + ? _value.needed + : needed // ignore: cast_nullable_to_non_nullable + as int, + available: null == available + ? _value.available + : available // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$BdkError_InsufficientFundsImpl implements BdkError_InsufficientFunds { + const _$BdkError_InsufficientFundsImpl( + {required this.needed, required this.available}); + + /// Sats needed for some transaction + @override + final int needed; + + /// Sats available for spending + @override + final int available; + + @override + String toString() { + return 'BdkError.insufficientFunds(needed: $needed, available: $available)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_InsufficientFundsImpl && + (identical(other.needed, needed) || other.needed == needed) && + (identical(other.available, available) || + other.available == available)); + } + + @override + int get hashCode => Object.hash(runtimeType, needed, available); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_InsufficientFundsImplCopyWith<_$BdkError_InsufficientFundsImpl> + get copyWith => __$$BdkError_InsufficientFundsImplCopyWithImpl< + _$BdkError_InsufficientFundsImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return insufficientFunds(needed, available); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return insufficientFunds?.call(needed, available); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (insufficientFunds != null) { + return insufficientFunds(needed, available); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return insufficientFunds(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return insufficientFunds?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (insufficientFunds != null) { + return insufficientFunds(this); + } + return orElse(); + } +} + +abstract class BdkError_InsufficientFunds implements BdkError { + const factory BdkError_InsufficientFunds( + {required final int needed, + required final int available}) = _$BdkError_InsufficientFundsImpl; + + /// Sats needed for some transaction + int get needed; + + /// Sats available for spending + int get available; + @JsonKey(ignore: true) + _$$BdkError_InsufficientFundsImplCopyWith<_$BdkError_InsufficientFundsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_BnBTotalTriesExceededImplCopyWith<$Res> { + factory _$$BdkError_BnBTotalTriesExceededImplCopyWith( + _$BdkError_BnBTotalTriesExceededImpl value, + $Res Function(_$BdkError_BnBTotalTriesExceededImpl) then) = + __$$BdkError_BnBTotalTriesExceededImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$BdkError_BnBTotalTriesExceededImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_BnBTotalTriesExceededImpl> + implements _$$BdkError_BnBTotalTriesExceededImplCopyWith<$Res> { + __$$BdkError_BnBTotalTriesExceededImplCopyWithImpl( + _$BdkError_BnBTotalTriesExceededImpl _value, + $Res Function(_$BdkError_BnBTotalTriesExceededImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$BdkError_BnBTotalTriesExceededImpl + implements BdkError_BnBTotalTriesExceeded { + const _$BdkError_BnBTotalTriesExceededImpl(); + + @override + String toString() { + return 'BdkError.bnBTotalTriesExceeded()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_BnBTotalTriesExceededImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return bnBTotalTriesExceeded(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return bnBTotalTriesExceeded?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (bnBTotalTriesExceeded != null) { + return bnBTotalTriesExceeded(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return bnBTotalTriesExceeded(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return bnBTotalTriesExceeded?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (bnBTotalTriesExceeded != null) { + return bnBTotalTriesExceeded(this); + } + return orElse(); + } +} + +abstract class BdkError_BnBTotalTriesExceeded implements BdkError { + const factory BdkError_BnBTotalTriesExceeded() = + _$BdkError_BnBTotalTriesExceededImpl; +} + +/// @nodoc +abstract class _$$BdkError_BnBNoExactMatchImplCopyWith<$Res> { + factory _$$BdkError_BnBNoExactMatchImplCopyWith( + _$BdkError_BnBNoExactMatchImpl value, + $Res Function(_$BdkError_BnBNoExactMatchImpl) then) = + __$$BdkError_BnBNoExactMatchImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$BdkError_BnBNoExactMatchImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_BnBNoExactMatchImpl> + implements _$$BdkError_BnBNoExactMatchImplCopyWith<$Res> { + __$$BdkError_BnBNoExactMatchImplCopyWithImpl( + _$BdkError_BnBNoExactMatchImpl _value, + $Res Function(_$BdkError_BnBNoExactMatchImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$BdkError_BnBNoExactMatchImpl implements BdkError_BnBNoExactMatch { + const _$BdkError_BnBNoExactMatchImpl(); + + @override + String toString() { + return 'BdkError.bnBNoExactMatch()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_BnBNoExactMatchImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return bnBNoExactMatch(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return bnBNoExactMatch?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (bnBNoExactMatch != null) { + return bnBNoExactMatch(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return bnBNoExactMatch(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return bnBNoExactMatch?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (bnBNoExactMatch != null) { + return bnBNoExactMatch(this); + } + return orElse(); + } +} + +abstract class BdkError_BnBNoExactMatch implements BdkError { + const factory BdkError_BnBNoExactMatch() = _$BdkError_BnBNoExactMatchImpl; +} + +/// @nodoc +abstract class _$$BdkError_UnknownUtxoImplCopyWith<$Res> { + factory _$$BdkError_UnknownUtxoImplCopyWith(_$BdkError_UnknownUtxoImpl value, + $Res Function(_$BdkError_UnknownUtxoImpl) then) = + __$$BdkError_UnknownUtxoImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$BdkError_UnknownUtxoImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_UnknownUtxoImpl> + implements _$$BdkError_UnknownUtxoImplCopyWith<$Res> { + __$$BdkError_UnknownUtxoImplCopyWithImpl(_$BdkError_UnknownUtxoImpl _value, + $Res Function(_$BdkError_UnknownUtxoImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$BdkError_UnknownUtxoImpl implements BdkError_UnknownUtxo { + const _$BdkError_UnknownUtxoImpl(); + + @override + String toString() { + return 'BdkError.unknownUtxo()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_UnknownUtxoImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return unknownUtxo(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return unknownUtxo?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (unknownUtxo != null) { + return unknownUtxo(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return unknownUtxo(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return unknownUtxo?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (unknownUtxo != null) { + return unknownUtxo(this); + } + return orElse(); + } +} + +abstract class BdkError_UnknownUtxo implements BdkError { + const factory BdkError_UnknownUtxo() = _$BdkError_UnknownUtxoImpl; +} + +/// @nodoc +abstract class _$$BdkError_TransactionNotFoundImplCopyWith<$Res> { + factory _$$BdkError_TransactionNotFoundImplCopyWith( + _$BdkError_TransactionNotFoundImpl value, + $Res Function(_$BdkError_TransactionNotFoundImpl) then) = + __$$BdkError_TransactionNotFoundImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$BdkError_TransactionNotFoundImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_TransactionNotFoundImpl> + implements _$$BdkError_TransactionNotFoundImplCopyWith<$Res> { + __$$BdkError_TransactionNotFoundImplCopyWithImpl( + _$BdkError_TransactionNotFoundImpl _value, + $Res Function(_$BdkError_TransactionNotFoundImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$BdkError_TransactionNotFoundImpl + implements BdkError_TransactionNotFound { + const _$BdkError_TransactionNotFoundImpl(); + + @override + String toString() { + return 'BdkError.transactionNotFound()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_TransactionNotFoundImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return transactionNotFound(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return transactionNotFound?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (transactionNotFound != null) { + return transactionNotFound(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return transactionNotFound(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return transactionNotFound?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (transactionNotFound != null) { + return transactionNotFound(this); + } + return orElse(); + } +} + +abstract class BdkError_TransactionNotFound implements BdkError { + const factory BdkError_TransactionNotFound() = + _$BdkError_TransactionNotFoundImpl; +} + +/// @nodoc +abstract class _$$BdkError_TransactionConfirmedImplCopyWith<$Res> { + factory _$$BdkError_TransactionConfirmedImplCopyWith( + _$BdkError_TransactionConfirmedImpl value, + $Res Function(_$BdkError_TransactionConfirmedImpl) then) = + __$$BdkError_TransactionConfirmedImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$BdkError_TransactionConfirmedImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_TransactionConfirmedImpl> + implements _$$BdkError_TransactionConfirmedImplCopyWith<$Res> { + __$$BdkError_TransactionConfirmedImplCopyWithImpl( + _$BdkError_TransactionConfirmedImpl _value, + $Res Function(_$BdkError_TransactionConfirmedImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$BdkError_TransactionConfirmedImpl + implements BdkError_TransactionConfirmed { + const _$BdkError_TransactionConfirmedImpl(); + + @override + String toString() { + return 'BdkError.transactionConfirmed()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_TransactionConfirmedImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return transactionConfirmed(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return transactionConfirmed?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (transactionConfirmed != null) { + return transactionConfirmed(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return transactionConfirmed(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return transactionConfirmed?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (transactionConfirmed != null) { + return transactionConfirmed(this); + } + return orElse(); + } +} + +abstract class BdkError_TransactionConfirmed implements BdkError { + const factory BdkError_TransactionConfirmed() = + _$BdkError_TransactionConfirmedImpl; +} + +/// @nodoc +abstract class _$$BdkError_IrreplaceableTransactionImplCopyWith<$Res> { + factory _$$BdkError_IrreplaceableTransactionImplCopyWith( + _$BdkError_IrreplaceableTransactionImpl value, + $Res Function(_$BdkError_IrreplaceableTransactionImpl) then) = + __$$BdkError_IrreplaceableTransactionImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$BdkError_IrreplaceableTransactionImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, + _$BdkError_IrreplaceableTransactionImpl> + implements _$$BdkError_IrreplaceableTransactionImplCopyWith<$Res> { + __$$BdkError_IrreplaceableTransactionImplCopyWithImpl( + _$BdkError_IrreplaceableTransactionImpl _value, + $Res Function(_$BdkError_IrreplaceableTransactionImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$BdkError_IrreplaceableTransactionImpl + implements BdkError_IrreplaceableTransaction { + const _$BdkError_IrreplaceableTransactionImpl(); + + @override + String toString() { + return 'BdkError.irreplaceableTransaction()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_IrreplaceableTransactionImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return irreplaceableTransaction(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return irreplaceableTransaction?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (irreplaceableTransaction != null) { + return irreplaceableTransaction(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return irreplaceableTransaction(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return irreplaceableTransaction?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (irreplaceableTransaction != null) { + return irreplaceableTransaction(this); + } + return orElse(); + } +} + +abstract class BdkError_IrreplaceableTransaction implements BdkError { + const factory BdkError_IrreplaceableTransaction() = + _$BdkError_IrreplaceableTransactionImpl; +} + +/// @nodoc +abstract class _$$BdkError_FeeRateTooLowImplCopyWith<$Res> { + factory _$$BdkError_FeeRateTooLowImplCopyWith( + _$BdkError_FeeRateTooLowImpl value, + $Res Function(_$BdkError_FeeRateTooLowImpl) then) = + __$$BdkError_FeeRateTooLowImplCopyWithImpl<$Res>; + @useResult + $Res call({double needed}); +} + +/// @nodoc +class __$$BdkError_FeeRateTooLowImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_FeeRateTooLowImpl> + implements _$$BdkError_FeeRateTooLowImplCopyWith<$Res> { + __$$BdkError_FeeRateTooLowImplCopyWithImpl( + _$BdkError_FeeRateTooLowImpl _value, + $Res Function(_$BdkError_FeeRateTooLowImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? needed = null, + }) { + return _then(_$BdkError_FeeRateTooLowImpl( + needed: null == needed + ? _value.needed + : needed // ignore: cast_nullable_to_non_nullable + as double, + )); + } +} + +/// @nodoc + +class _$BdkError_FeeRateTooLowImpl implements BdkError_FeeRateTooLow { + const _$BdkError_FeeRateTooLowImpl({required this.needed}); + + /// Required fee rate (satoshi/vbyte) + @override + final double needed; + + @override + String toString() { + return 'BdkError.feeRateTooLow(needed: $needed)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_FeeRateTooLowImpl && + (identical(other.needed, needed) || other.needed == needed)); + } + + @override + int get hashCode => Object.hash(runtimeType, needed); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_FeeRateTooLowImplCopyWith<_$BdkError_FeeRateTooLowImpl> + get copyWith => __$$BdkError_FeeRateTooLowImplCopyWithImpl< + _$BdkError_FeeRateTooLowImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return feeRateTooLow(needed); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return feeRateTooLow?.call(needed); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (feeRateTooLow != null) { + return feeRateTooLow(needed); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return feeRateTooLow(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return feeRateTooLow?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (feeRateTooLow != null) { + return feeRateTooLow(this); + } + return orElse(); + } +} + +abstract class BdkError_FeeRateTooLow implements BdkError { + const factory BdkError_FeeRateTooLow({required final double needed}) = + _$BdkError_FeeRateTooLowImpl; + + /// Required fee rate (satoshi/vbyte) + double get needed; + @JsonKey(ignore: true) + _$$BdkError_FeeRateTooLowImplCopyWith<_$BdkError_FeeRateTooLowImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_FeeTooLowImplCopyWith<$Res> { + factory _$$BdkError_FeeTooLowImplCopyWith(_$BdkError_FeeTooLowImpl value, + $Res Function(_$BdkError_FeeTooLowImpl) then) = + __$$BdkError_FeeTooLowImplCopyWithImpl<$Res>; + @useResult + $Res call({int needed}); +} + +/// @nodoc +class __$$BdkError_FeeTooLowImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_FeeTooLowImpl> + implements _$$BdkError_FeeTooLowImplCopyWith<$Res> { + __$$BdkError_FeeTooLowImplCopyWithImpl(_$BdkError_FeeTooLowImpl _value, + $Res Function(_$BdkError_FeeTooLowImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? needed = null, + }) { + return _then(_$BdkError_FeeTooLowImpl( + needed: null == needed + ? _value.needed + : needed // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$BdkError_FeeTooLowImpl implements BdkError_FeeTooLow { + const _$BdkError_FeeTooLowImpl({required this.needed}); + + /// Required fee absolute value (satoshi) + @override + final int needed; + + @override + String toString() { + return 'BdkError.feeTooLow(needed: $needed)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_FeeTooLowImpl && + (identical(other.needed, needed) || other.needed == needed)); + } + + @override + int get hashCode => Object.hash(runtimeType, needed); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_FeeTooLowImplCopyWith<_$BdkError_FeeTooLowImpl> get copyWith => + __$$BdkError_FeeTooLowImplCopyWithImpl<_$BdkError_FeeTooLowImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return feeTooLow(needed); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return feeTooLow?.call(needed); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (feeTooLow != null) { + return feeTooLow(needed); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return feeTooLow(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return feeTooLow?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (feeTooLow != null) { + return feeTooLow(this); + } + return orElse(); + } +} + +abstract class BdkError_FeeTooLow implements BdkError { + const factory BdkError_FeeTooLow({required final int needed}) = + _$BdkError_FeeTooLowImpl; + + /// Required fee absolute value (satoshi) + int get needed; + @JsonKey(ignore: true) + _$$BdkError_FeeTooLowImplCopyWith<_$BdkError_FeeTooLowImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_FeeRateUnavailableImplCopyWith<$Res> { + factory _$$BdkError_FeeRateUnavailableImplCopyWith( + _$BdkError_FeeRateUnavailableImpl value, + $Res Function(_$BdkError_FeeRateUnavailableImpl) then) = + __$$BdkError_FeeRateUnavailableImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$BdkError_FeeRateUnavailableImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_FeeRateUnavailableImpl> + implements _$$BdkError_FeeRateUnavailableImplCopyWith<$Res> { + __$$BdkError_FeeRateUnavailableImplCopyWithImpl( + _$BdkError_FeeRateUnavailableImpl _value, + $Res Function(_$BdkError_FeeRateUnavailableImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$BdkError_FeeRateUnavailableImpl implements BdkError_FeeRateUnavailable { + const _$BdkError_FeeRateUnavailableImpl(); + + @override + String toString() { + return 'BdkError.feeRateUnavailable()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_FeeRateUnavailableImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return feeRateUnavailable(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return feeRateUnavailable?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (feeRateUnavailable != null) { + return feeRateUnavailable(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return feeRateUnavailable(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return feeRateUnavailable?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (feeRateUnavailable != null) { + return feeRateUnavailable(this); + } + return orElse(); + } +} + +abstract class BdkError_FeeRateUnavailable implements BdkError { + const factory BdkError_FeeRateUnavailable() = + _$BdkError_FeeRateUnavailableImpl; +} + +/// @nodoc +abstract class _$$BdkError_MissingKeyOriginImplCopyWith<$Res> { + factory _$$BdkError_MissingKeyOriginImplCopyWith( + _$BdkError_MissingKeyOriginImpl value, + $Res Function(_$BdkError_MissingKeyOriginImpl) then) = + __$$BdkError_MissingKeyOriginImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_MissingKeyOriginImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_MissingKeyOriginImpl> + implements _$$BdkError_MissingKeyOriginImplCopyWith<$Res> { + __$$BdkError_MissingKeyOriginImplCopyWithImpl( + _$BdkError_MissingKeyOriginImpl _value, + $Res Function(_$BdkError_MissingKeyOriginImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_MissingKeyOriginImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_MissingKeyOriginImpl implements BdkError_MissingKeyOrigin { + const _$BdkError_MissingKeyOriginImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.missingKeyOrigin(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_MissingKeyOriginImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_MissingKeyOriginImplCopyWith<_$BdkError_MissingKeyOriginImpl> + get copyWith => __$$BdkError_MissingKeyOriginImplCopyWithImpl< + _$BdkError_MissingKeyOriginImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return missingKeyOrigin(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return missingKeyOrigin?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (missingKeyOrigin != null) { + return missingKeyOrigin(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return missingKeyOrigin(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return missingKeyOrigin?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (missingKeyOrigin != null) { + return missingKeyOrigin(this); + } + return orElse(); + } +} + +abstract class BdkError_MissingKeyOrigin implements BdkError { + const factory BdkError_MissingKeyOrigin(final String field0) = + _$BdkError_MissingKeyOriginImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_MissingKeyOriginImplCopyWith<_$BdkError_MissingKeyOriginImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_KeyImplCopyWith<$Res> { + factory _$$BdkError_KeyImplCopyWith( + _$BdkError_KeyImpl value, $Res Function(_$BdkError_KeyImpl) then) = + __$$BdkError_KeyImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_KeyImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_KeyImpl> + implements _$$BdkError_KeyImplCopyWith<$Res> { + __$$BdkError_KeyImplCopyWithImpl( + _$BdkError_KeyImpl _value, $Res Function(_$BdkError_KeyImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_KeyImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_KeyImpl implements BdkError_Key { + const _$BdkError_KeyImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.key(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_KeyImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_KeyImplCopyWith<_$BdkError_KeyImpl> get copyWith => + __$$BdkError_KeyImplCopyWithImpl<_$BdkError_KeyImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return key(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return key?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (key != null) { + return key(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return key(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return key?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (key != null) { + return key(this); + } + return orElse(); + } +} + +abstract class BdkError_Key implements BdkError { + const factory BdkError_Key(final String field0) = _$BdkError_KeyImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_KeyImplCopyWith<_$BdkError_KeyImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_ChecksumMismatchImplCopyWith<$Res> { + factory _$$BdkError_ChecksumMismatchImplCopyWith( + _$BdkError_ChecksumMismatchImpl value, + $Res Function(_$BdkError_ChecksumMismatchImpl) then) = + __$$BdkError_ChecksumMismatchImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$BdkError_ChecksumMismatchImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_ChecksumMismatchImpl> + implements _$$BdkError_ChecksumMismatchImplCopyWith<$Res> { + __$$BdkError_ChecksumMismatchImplCopyWithImpl( + _$BdkError_ChecksumMismatchImpl _value, + $Res Function(_$BdkError_ChecksumMismatchImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$BdkError_ChecksumMismatchImpl implements BdkError_ChecksumMismatch { + const _$BdkError_ChecksumMismatchImpl(); + + @override + String toString() { + return 'BdkError.checksumMismatch()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_ChecksumMismatchImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return checksumMismatch(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return checksumMismatch?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (checksumMismatch != null) { + return checksumMismatch(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return checksumMismatch(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return checksumMismatch?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (checksumMismatch != null) { + return checksumMismatch(this); + } + return orElse(); + } +} + +abstract class BdkError_ChecksumMismatch implements BdkError { + const factory BdkError_ChecksumMismatch() = _$BdkError_ChecksumMismatchImpl; +} + +/// @nodoc +abstract class _$$BdkError_SpendingPolicyRequiredImplCopyWith<$Res> { + factory _$$BdkError_SpendingPolicyRequiredImplCopyWith( + _$BdkError_SpendingPolicyRequiredImpl value, + $Res Function(_$BdkError_SpendingPolicyRequiredImpl) then) = + __$$BdkError_SpendingPolicyRequiredImplCopyWithImpl<$Res>; + @useResult + $Res call({KeychainKind field0}); +} + +/// @nodoc +class __$$BdkError_SpendingPolicyRequiredImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_SpendingPolicyRequiredImpl> + implements _$$BdkError_SpendingPolicyRequiredImplCopyWith<$Res> { + __$$BdkError_SpendingPolicyRequiredImplCopyWithImpl( + _$BdkError_SpendingPolicyRequiredImpl _value, + $Res Function(_$BdkError_SpendingPolicyRequiredImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_SpendingPolicyRequiredImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as KeychainKind, + )); + } +} + +/// @nodoc + +class _$BdkError_SpendingPolicyRequiredImpl + implements BdkError_SpendingPolicyRequired { + const _$BdkError_SpendingPolicyRequiredImpl(this.field0); + + @override + final KeychainKind field0; + + @override + String toString() { + return 'BdkError.spendingPolicyRequired(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_SpendingPolicyRequiredImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_SpendingPolicyRequiredImplCopyWith< + _$BdkError_SpendingPolicyRequiredImpl> + get copyWith => __$$BdkError_SpendingPolicyRequiredImplCopyWithImpl< + _$BdkError_SpendingPolicyRequiredImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return spendingPolicyRequired(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return spendingPolicyRequired?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (spendingPolicyRequired != null) { + return spendingPolicyRequired(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return spendingPolicyRequired(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return spendingPolicyRequired?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (spendingPolicyRequired != null) { + return spendingPolicyRequired(this); + } + return orElse(); + } +} + +abstract class BdkError_SpendingPolicyRequired implements BdkError { + const factory BdkError_SpendingPolicyRequired(final KeychainKind field0) = + _$BdkError_SpendingPolicyRequiredImpl; + + KeychainKind get field0; + @JsonKey(ignore: true) + _$$BdkError_SpendingPolicyRequiredImplCopyWith< + _$BdkError_SpendingPolicyRequiredImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_InvalidPolicyPathErrorImplCopyWith<$Res> { + factory _$$BdkError_InvalidPolicyPathErrorImplCopyWith( + _$BdkError_InvalidPolicyPathErrorImpl value, + $Res Function(_$BdkError_InvalidPolicyPathErrorImpl) then) = + __$$BdkError_InvalidPolicyPathErrorImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_InvalidPolicyPathErrorImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_InvalidPolicyPathErrorImpl> + implements _$$BdkError_InvalidPolicyPathErrorImplCopyWith<$Res> { + __$$BdkError_InvalidPolicyPathErrorImplCopyWithImpl( + _$BdkError_InvalidPolicyPathErrorImpl _value, + $Res Function(_$BdkError_InvalidPolicyPathErrorImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_InvalidPolicyPathErrorImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_InvalidPolicyPathErrorImpl + implements BdkError_InvalidPolicyPathError { + const _$BdkError_InvalidPolicyPathErrorImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.invalidPolicyPathError(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_InvalidPolicyPathErrorImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_InvalidPolicyPathErrorImplCopyWith< + _$BdkError_InvalidPolicyPathErrorImpl> + get copyWith => __$$BdkError_InvalidPolicyPathErrorImplCopyWithImpl< + _$BdkError_InvalidPolicyPathErrorImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return invalidPolicyPathError(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return invalidPolicyPathError?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (invalidPolicyPathError != null) { + return invalidPolicyPathError(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return invalidPolicyPathError(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return invalidPolicyPathError?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (invalidPolicyPathError != null) { + return invalidPolicyPathError(this); + } + return orElse(); + } +} + +abstract class BdkError_InvalidPolicyPathError implements BdkError { + const factory BdkError_InvalidPolicyPathError(final String field0) = + _$BdkError_InvalidPolicyPathErrorImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_InvalidPolicyPathErrorImplCopyWith< + _$BdkError_InvalidPolicyPathErrorImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_SignerImplCopyWith<$Res> { + factory _$$BdkError_SignerImplCopyWith(_$BdkError_SignerImpl value, + $Res Function(_$BdkError_SignerImpl) then) = + __$$BdkError_SignerImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_SignerImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_SignerImpl> + implements _$$BdkError_SignerImplCopyWith<$Res> { + __$$BdkError_SignerImplCopyWithImpl( + _$BdkError_SignerImpl _value, $Res Function(_$BdkError_SignerImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_SignerImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_SignerImpl implements BdkError_Signer { + const _$BdkError_SignerImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.signer(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_SignerImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_SignerImplCopyWith<_$BdkError_SignerImpl> get copyWith => + __$$BdkError_SignerImplCopyWithImpl<_$BdkError_SignerImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return signer(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return signer?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (signer != null) { + return signer(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return signer(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return signer?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (signer != null) { + return signer(this); + } + return orElse(); + } +} + +abstract class BdkError_Signer implements BdkError { + const factory BdkError_Signer(final String field0) = _$BdkError_SignerImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_SignerImplCopyWith<_$BdkError_SignerImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_InvalidNetworkImplCopyWith<$Res> { + factory _$$BdkError_InvalidNetworkImplCopyWith( + _$BdkError_InvalidNetworkImpl value, + $Res Function(_$BdkError_InvalidNetworkImpl) then) = + __$$BdkError_InvalidNetworkImplCopyWithImpl<$Res>; + @useResult + $Res call({Network requested, Network found}); +} + +/// @nodoc +class __$$BdkError_InvalidNetworkImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_InvalidNetworkImpl> + implements _$$BdkError_InvalidNetworkImplCopyWith<$Res> { + __$$BdkError_InvalidNetworkImplCopyWithImpl( + _$BdkError_InvalidNetworkImpl _value, + $Res Function(_$BdkError_InvalidNetworkImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? requested = null, + Object? found = null, + }) { + return _then(_$BdkError_InvalidNetworkImpl( + requested: null == requested + ? _value.requested + : requested // ignore: cast_nullable_to_non_nullable + as Network, + found: null == found + ? _value.found + : found // ignore: cast_nullable_to_non_nullable + as Network, + )); + } +} + +/// @nodoc + +class _$BdkError_InvalidNetworkImpl implements BdkError_InvalidNetwork { + const _$BdkError_InvalidNetworkImpl( + {required this.requested, required this.found}); + + /// requested network, for example what is given as bdk-cli option + @override + final Network requested; + + /// found network, for example the network of the bitcoin node + @override + final Network found; + + @override + String toString() { + return 'BdkError.invalidNetwork(requested: $requested, found: $found)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_InvalidNetworkImpl && + (identical(other.requested, requested) || + other.requested == requested) && + (identical(other.found, found) || other.found == found)); + } + + @override + int get hashCode => Object.hash(runtimeType, requested, found); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_InvalidNetworkImplCopyWith<_$BdkError_InvalidNetworkImpl> + get copyWith => __$$BdkError_InvalidNetworkImplCopyWithImpl< + _$BdkError_InvalidNetworkImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return invalidNetwork(requested, found); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return invalidNetwork?.call(requested, found); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (invalidNetwork != null) { + return invalidNetwork(requested, found); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return invalidNetwork(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return invalidNetwork?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (invalidNetwork != null) { + return invalidNetwork(this); + } + return orElse(); + } +} + +abstract class BdkError_InvalidNetwork implements BdkError { + const factory BdkError_InvalidNetwork( + {required final Network requested, + required final Network found}) = _$BdkError_InvalidNetworkImpl; + + /// requested network, for example what is given as bdk-cli option + Network get requested; + + /// found network, for example the network of the bitcoin node + Network get found; + @JsonKey(ignore: true) + _$$BdkError_InvalidNetworkImplCopyWith<_$BdkError_InvalidNetworkImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_InvalidOutpointImplCopyWith<$Res> { + factory _$$BdkError_InvalidOutpointImplCopyWith( + _$BdkError_InvalidOutpointImpl value, + $Res Function(_$BdkError_InvalidOutpointImpl) then) = + __$$BdkError_InvalidOutpointImplCopyWithImpl<$Res>; + @useResult + $Res call({OutPoint field0}); +} + +/// @nodoc +class __$$BdkError_InvalidOutpointImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_InvalidOutpointImpl> + implements _$$BdkError_InvalidOutpointImplCopyWith<$Res> { + __$$BdkError_InvalidOutpointImplCopyWithImpl( + _$BdkError_InvalidOutpointImpl _value, + $Res Function(_$BdkError_InvalidOutpointImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_InvalidOutpointImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as OutPoint, + )); + } +} + +/// @nodoc + +class _$BdkError_InvalidOutpointImpl implements BdkError_InvalidOutpoint { + const _$BdkError_InvalidOutpointImpl(this.field0); + + @override + final OutPoint field0; + + @override + String toString() { + return 'BdkError.invalidOutpoint(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_InvalidOutpointImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_InvalidOutpointImplCopyWith<_$BdkError_InvalidOutpointImpl> + get copyWith => __$$BdkError_InvalidOutpointImplCopyWithImpl< + _$BdkError_InvalidOutpointImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return invalidOutpoint(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return invalidOutpoint?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (invalidOutpoint != null) { + return invalidOutpoint(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return invalidOutpoint(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return invalidOutpoint?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (invalidOutpoint != null) { + return invalidOutpoint(this); + } + return orElse(); + } +} + +abstract class BdkError_InvalidOutpoint implements BdkError { + const factory BdkError_InvalidOutpoint(final OutPoint field0) = + _$BdkError_InvalidOutpointImpl; + + OutPoint get field0; + @JsonKey(ignore: true) + _$$BdkError_InvalidOutpointImplCopyWith<_$BdkError_InvalidOutpointImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_EncodeImplCopyWith<$Res> { + factory _$$BdkError_EncodeImplCopyWith(_$BdkError_EncodeImpl value, + $Res Function(_$BdkError_EncodeImpl) then) = + __$$BdkError_EncodeImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_EncodeImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_EncodeImpl> + implements _$$BdkError_EncodeImplCopyWith<$Res> { + __$$BdkError_EncodeImplCopyWithImpl( + _$BdkError_EncodeImpl _value, $Res Function(_$BdkError_EncodeImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_EncodeImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_EncodeImpl implements BdkError_Encode { + const _$BdkError_EncodeImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.encode(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_EncodeImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_EncodeImplCopyWith<_$BdkError_EncodeImpl> get copyWith => + __$$BdkError_EncodeImplCopyWithImpl<_$BdkError_EncodeImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return encode(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return encode?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (encode != null) { + return encode(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return encode(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return encode?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (encode != null) { + return encode(this); + } + return orElse(); + } +} + +abstract class BdkError_Encode implements BdkError { + const factory BdkError_Encode(final String field0) = _$BdkError_EncodeImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_EncodeImplCopyWith<_$BdkError_EncodeImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_MiniscriptImplCopyWith<$Res> { + factory _$$BdkError_MiniscriptImplCopyWith(_$BdkError_MiniscriptImpl value, + $Res Function(_$BdkError_MiniscriptImpl) then) = + __$$BdkError_MiniscriptImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_MiniscriptImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_MiniscriptImpl> + implements _$$BdkError_MiniscriptImplCopyWith<$Res> { + __$$BdkError_MiniscriptImplCopyWithImpl(_$BdkError_MiniscriptImpl _value, + $Res Function(_$BdkError_MiniscriptImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_MiniscriptImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_MiniscriptImpl implements BdkError_Miniscript { + const _$BdkError_MiniscriptImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.miniscript(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_MiniscriptImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_MiniscriptImplCopyWith<_$BdkError_MiniscriptImpl> get copyWith => + __$$BdkError_MiniscriptImplCopyWithImpl<_$BdkError_MiniscriptImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return miniscript(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return miniscript?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (miniscript != null) { + return miniscript(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return miniscript(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return miniscript?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (miniscript != null) { + return miniscript(this); + } + return orElse(); + } +} + +abstract class BdkError_Miniscript implements BdkError { + const factory BdkError_Miniscript(final String field0) = + _$BdkError_MiniscriptImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_MiniscriptImplCopyWith<_$BdkError_MiniscriptImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_MiniscriptPsbtImplCopyWith<$Res> { + factory _$$BdkError_MiniscriptPsbtImplCopyWith( + _$BdkError_MiniscriptPsbtImpl value, + $Res Function(_$BdkError_MiniscriptPsbtImpl) then) = + __$$BdkError_MiniscriptPsbtImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_MiniscriptPsbtImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_MiniscriptPsbtImpl> + implements _$$BdkError_MiniscriptPsbtImplCopyWith<$Res> { + __$$BdkError_MiniscriptPsbtImplCopyWithImpl( + _$BdkError_MiniscriptPsbtImpl _value, + $Res Function(_$BdkError_MiniscriptPsbtImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_MiniscriptPsbtImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_MiniscriptPsbtImpl implements BdkError_MiniscriptPsbt { + const _$BdkError_MiniscriptPsbtImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.miniscriptPsbt(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_MiniscriptPsbtImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_MiniscriptPsbtImplCopyWith<_$BdkError_MiniscriptPsbtImpl> + get copyWith => __$$BdkError_MiniscriptPsbtImplCopyWithImpl< + _$BdkError_MiniscriptPsbtImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return miniscriptPsbt(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return miniscriptPsbt?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (miniscriptPsbt != null) { + return miniscriptPsbt(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return miniscriptPsbt(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return miniscriptPsbt?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (miniscriptPsbt != null) { + return miniscriptPsbt(this); + } + return orElse(); + } +} + +abstract class BdkError_MiniscriptPsbt implements BdkError { + const factory BdkError_MiniscriptPsbt(final String field0) = + _$BdkError_MiniscriptPsbtImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_MiniscriptPsbtImplCopyWith<_$BdkError_MiniscriptPsbtImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_Bip32ImplCopyWith<$Res> { + factory _$$BdkError_Bip32ImplCopyWith(_$BdkError_Bip32Impl value, + $Res Function(_$BdkError_Bip32Impl) then) = + __$$BdkError_Bip32ImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_Bip32ImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_Bip32Impl> + implements _$$BdkError_Bip32ImplCopyWith<$Res> { + __$$BdkError_Bip32ImplCopyWithImpl( + _$BdkError_Bip32Impl _value, $Res Function(_$BdkError_Bip32Impl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_Bip32Impl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_Bip32Impl implements BdkError_Bip32 { + const _$BdkError_Bip32Impl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.bip32(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_Bip32Impl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_Bip32ImplCopyWith<_$BdkError_Bip32Impl> get copyWith => + __$$BdkError_Bip32ImplCopyWithImpl<_$BdkError_Bip32Impl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return bip32(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return bip32?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (bip32 != null) { + return bip32(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return bip32(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return bip32?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (bip32 != null) { + return bip32(this); + } + return orElse(); + } +} + +abstract class BdkError_Bip32 implements BdkError { + const factory BdkError_Bip32(final String field0) = _$BdkError_Bip32Impl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_Bip32ImplCopyWith<_$BdkError_Bip32Impl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_Bip39ImplCopyWith<$Res> { + factory _$$BdkError_Bip39ImplCopyWith(_$BdkError_Bip39Impl value, + $Res Function(_$BdkError_Bip39Impl) then) = + __$$BdkError_Bip39ImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_Bip39ImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_Bip39Impl> + implements _$$BdkError_Bip39ImplCopyWith<$Res> { + __$$BdkError_Bip39ImplCopyWithImpl( + _$BdkError_Bip39Impl _value, $Res Function(_$BdkError_Bip39Impl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_Bip39Impl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_Bip39Impl implements BdkError_Bip39 { + const _$BdkError_Bip39Impl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.bip39(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_Bip39Impl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_Bip39ImplCopyWith<_$BdkError_Bip39Impl> get copyWith => + __$$BdkError_Bip39ImplCopyWithImpl<_$BdkError_Bip39Impl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return bip39(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return bip39?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (bip39 != null) { + return bip39(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return bip39(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return bip39?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (bip39 != null) { + return bip39(this); + } + return orElse(); + } +} + +abstract class BdkError_Bip39 implements BdkError { + const factory BdkError_Bip39(final String field0) = _$BdkError_Bip39Impl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_Bip39ImplCopyWith<_$BdkError_Bip39Impl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_Secp256k1ImplCopyWith<$Res> { + factory _$$BdkError_Secp256k1ImplCopyWith(_$BdkError_Secp256k1Impl value, + $Res Function(_$BdkError_Secp256k1Impl) then) = + __$$BdkError_Secp256k1ImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_Secp256k1ImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_Secp256k1Impl> + implements _$$BdkError_Secp256k1ImplCopyWith<$Res> { + __$$BdkError_Secp256k1ImplCopyWithImpl(_$BdkError_Secp256k1Impl _value, + $Res Function(_$BdkError_Secp256k1Impl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_Secp256k1Impl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_Secp256k1Impl implements BdkError_Secp256k1 { + const _$BdkError_Secp256k1Impl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.secp256K1(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_Secp256k1Impl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_Secp256k1ImplCopyWith<_$BdkError_Secp256k1Impl> get copyWith => + __$$BdkError_Secp256k1ImplCopyWithImpl<_$BdkError_Secp256k1Impl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return secp256K1(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return secp256K1?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (secp256K1 != null) { + return secp256K1(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return secp256K1(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return secp256K1?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (secp256K1 != null) { + return secp256K1(this); + } + return orElse(); + } +} + +abstract class BdkError_Secp256k1 implements BdkError { + const factory BdkError_Secp256k1(final String field0) = + _$BdkError_Secp256k1Impl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_Secp256k1ImplCopyWith<_$BdkError_Secp256k1Impl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_JsonImplCopyWith<$Res> { + factory _$$BdkError_JsonImplCopyWith( + _$BdkError_JsonImpl value, $Res Function(_$BdkError_JsonImpl) then) = + __$$BdkError_JsonImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_JsonImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_JsonImpl> + implements _$$BdkError_JsonImplCopyWith<$Res> { + __$$BdkError_JsonImplCopyWithImpl( + _$BdkError_JsonImpl _value, $Res Function(_$BdkError_JsonImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_JsonImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_JsonImpl implements BdkError_Json { + const _$BdkError_JsonImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.json(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_JsonImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_JsonImplCopyWith<_$BdkError_JsonImpl> get copyWith => + __$$BdkError_JsonImplCopyWithImpl<_$BdkError_JsonImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return json(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return json?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (json != null) { + return json(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return json(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return json?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (json != null) { + return json(this); + } + return orElse(); + } +} + +abstract class BdkError_Json implements BdkError { + const factory BdkError_Json(final String field0) = _$BdkError_JsonImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_JsonImplCopyWith<_$BdkError_JsonImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_PsbtImplCopyWith<$Res> { + factory _$$BdkError_PsbtImplCopyWith( + _$BdkError_PsbtImpl value, $Res Function(_$BdkError_PsbtImpl) then) = + __$$BdkError_PsbtImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_PsbtImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_PsbtImpl> + implements _$$BdkError_PsbtImplCopyWith<$Res> { + __$$BdkError_PsbtImplCopyWithImpl( + _$BdkError_PsbtImpl _value, $Res Function(_$BdkError_PsbtImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_PsbtImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_PsbtImpl implements BdkError_Psbt { + const _$BdkError_PsbtImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.psbt(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_PsbtImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_PsbtImplCopyWith<_$BdkError_PsbtImpl> get copyWith => + __$$BdkError_PsbtImplCopyWithImpl<_$BdkError_PsbtImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return psbt(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return psbt?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (psbt != null) { + return psbt(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return psbt(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return psbt?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (psbt != null) { + return psbt(this); + } + return orElse(); + } +} + +abstract class BdkError_Psbt implements BdkError { + const factory BdkError_Psbt(final String field0) = _$BdkError_PsbtImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_PsbtImplCopyWith<_$BdkError_PsbtImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_PsbtParseImplCopyWith<$Res> { + factory _$$BdkError_PsbtParseImplCopyWith(_$BdkError_PsbtParseImpl value, + $Res Function(_$BdkError_PsbtParseImpl) then) = + __$$BdkError_PsbtParseImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_PsbtParseImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_PsbtParseImpl> + implements _$$BdkError_PsbtParseImplCopyWith<$Res> { + __$$BdkError_PsbtParseImplCopyWithImpl(_$BdkError_PsbtParseImpl _value, + $Res Function(_$BdkError_PsbtParseImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_PsbtParseImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_PsbtParseImpl implements BdkError_PsbtParse { + const _$BdkError_PsbtParseImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.psbtParse(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_PsbtParseImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_PsbtParseImplCopyWith<_$BdkError_PsbtParseImpl> get copyWith => + __$$BdkError_PsbtParseImplCopyWithImpl<_$BdkError_PsbtParseImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return psbtParse(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return psbtParse?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (psbtParse != null) { + return psbtParse(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return psbtParse(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return psbtParse?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (psbtParse != null) { + return psbtParse(this); + } + return orElse(); + } +} + +abstract class BdkError_PsbtParse implements BdkError { + const factory BdkError_PsbtParse(final String field0) = + _$BdkError_PsbtParseImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_PsbtParseImplCopyWith<_$BdkError_PsbtParseImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_MissingCachedScriptsImplCopyWith<$Res> { + factory _$$BdkError_MissingCachedScriptsImplCopyWith( + _$BdkError_MissingCachedScriptsImpl value, + $Res Function(_$BdkError_MissingCachedScriptsImpl) then) = + __$$BdkError_MissingCachedScriptsImplCopyWithImpl<$Res>; + @useResult + $Res call({int field0, int field1}); +} + +/// @nodoc +class __$$BdkError_MissingCachedScriptsImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_MissingCachedScriptsImpl> + implements _$$BdkError_MissingCachedScriptsImplCopyWith<$Res> { + __$$BdkError_MissingCachedScriptsImplCopyWithImpl( + _$BdkError_MissingCachedScriptsImpl _value, + $Res Function(_$BdkError_MissingCachedScriptsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + Object? field1 = null, + }) { + return _then(_$BdkError_MissingCachedScriptsImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as int, + null == field1 + ? _value.field1 + : field1 // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$BdkError_MissingCachedScriptsImpl + implements BdkError_MissingCachedScripts { + const _$BdkError_MissingCachedScriptsImpl(this.field0, this.field1); + + @override + final int field0; + @override + final int field1; + + @override + String toString() { + return 'BdkError.missingCachedScripts(field0: $field0, field1: $field1)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_MissingCachedScriptsImpl && + (identical(other.field0, field0) || other.field0 == field0) && + (identical(other.field1, field1) || other.field1 == field1)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0, field1); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_MissingCachedScriptsImplCopyWith< + _$BdkError_MissingCachedScriptsImpl> + get copyWith => __$$BdkError_MissingCachedScriptsImplCopyWithImpl< + _$BdkError_MissingCachedScriptsImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return missingCachedScripts(field0, field1); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return missingCachedScripts?.call(field0, field1); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (missingCachedScripts != null) { + return missingCachedScripts(field0, field1); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return missingCachedScripts(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return missingCachedScripts?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (missingCachedScripts != null) { + return missingCachedScripts(this); + } + return orElse(); + } +} + +abstract class BdkError_MissingCachedScripts implements BdkError { + const factory BdkError_MissingCachedScripts( + final int field0, final int field1) = _$BdkError_MissingCachedScriptsImpl; + + int get field0; + int get field1; + @JsonKey(ignore: true) + _$$BdkError_MissingCachedScriptsImplCopyWith< + _$BdkError_MissingCachedScriptsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_ElectrumImplCopyWith<$Res> { + factory _$$BdkError_ElectrumImplCopyWith(_$BdkError_ElectrumImpl value, + $Res Function(_$BdkError_ElectrumImpl) then) = + __$$BdkError_ElectrumImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_ElectrumImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_ElectrumImpl> + implements _$$BdkError_ElectrumImplCopyWith<$Res> { + __$$BdkError_ElectrumImplCopyWithImpl(_$BdkError_ElectrumImpl _value, + $Res Function(_$BdkError_ElectrumImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_ElectrumImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_ElectrumImpl implements BdkError_Electrum { + const _$BdkError_ElectrumImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.electrum(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_ElectrumImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_ElectrumImplCopyWith<_$BdkError_ElectrumImpl> get copyWith => + __$$BdkError_ElectrumImplCopyWithImpl<_$BdkError_ElectrumImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return electrum(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return electrum?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (electrum != null) { + return electrum(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return electrum(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return electrum?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (electrum != null) { + return electrum(this); + } + return orElse(); + } +} + +abstract class BdkError_Electrum implements BdkError { + const factory BdkError_Electrum(final String field0) = + _$BdkError_ElectrumImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_ElectrumImplCopyWith<_$BdkError_ElectrumImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_EsploraImplCopyWith<$Res> { + factory _$$BdkError_EsploraImplCopyWith(_$BdkError_EsploraImpl value, + $Res Function(_$BdkError_EsploraImpl) then) = + __$$BdkError_EsploraImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_EsploraImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_EsploraImpl> + implements _$$BdkError_EsploraImplCopyWith<$Res> { + __$$BdkError_EsploraImplCopyWithImpl(_$BdkError_EsploraImpl _value, + $Res Function(_$BdkError_EsploraImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_EsploraImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_EsploraImpl implements BdkError_Esplora { + const _$BdkError_EsploraImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.esplora(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_EsploraImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_EsploraImplCopyWith<_$BdkError_EsploraImpl> get copyWith => + __$$BdkError_EsploraImplCopyWithImpl<_$BdkError_EsploraImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return esplora(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return esplora?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (esplora != null) { + return esplora(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return esplora(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return esplora?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (esplora != null) { + return esplora(this); + } + return orElse(); + } +} + +abstract class BdkError_Esplora implements BdkError { + const factory BdkError_Esplora(final String field0) = _$BdkError_EsploraImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_EsploraImplCopyWith<_$BdkError_EsploraImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_SledImplCopyWith<$Res> { + factory _$$BdkError_SledImplCopyWith( + _$BdkError_SledImpl value, $Res Function(_$BdkError_SledImpl) then) = + __$$BdkError_SledImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_SledImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_SledImpl> + implements _$$BdkError_SledImplCopyWith<$Res> { + __$$BdkError_SledImplCopyWithImpl( + _$BdkError_SledImpl _value, $Res Function(_$BdkError_SledImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_SledImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_SledImpl implements BdkError_Sled { + const _$BdkError_SledImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.sled(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_SledImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_SledImplCopyWith<_$BdkError_SledImpl> get copyWith => + __$$BdkError_SledImplCopyWithImpl<_$BdkError_SledImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return sled(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return sled?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (sled != null) { + return sled(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return sled(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return sled?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (sled != null) { + return sled(this); + } + return orElse(); + } +} + +abstract class BdkError_Sled implements BdkError { + const factory BdkError_Sled(final String field0) = _$BdkError_SledImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_SledImplCopyWith<_$BdkError_SledImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_RpcImplCopyWith<$Res> { + factory _$$BdkError_RpcImplCopyWith( + _$BdkError_RpcImpl value, $Res Function(_$BdkError_RpcImpl) then) = + __$$BdkError_RpcImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_RpcImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_RpcImpl> + implements _$$BdkError_RpcImplCopyWith<$Res> { + __$$BdkError_RpcImplCopyWithImpl( + _$BdkError_RpcImpl _value, $Res Function(_$BdkError_RpcImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_RpcImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_RpcImpl implements BdkError_Rpc { + const _$BdkError_RpcImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.rpc(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_RpcImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_RpcImplCopyWith<_$BdkError_RpcImpl> get copyWith => + __$$BdkError_RpcImplCopyWithImpl<_$BdkError_RpcImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return rpc(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return rpc?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (rpc != null) { + return rpc(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return rpc(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return rpc?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (rpc != null) { + return rpc(this); + } + return orElse(); + } +} + +abstract class BdkError_Rpc implements BdkError { + const factory BdkError_Rpc(final String field0) = _$BdkError_RpcImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_RpcImplCopyWith<_$BdkError_RpcImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$BdkError_RusqliteImplCopyWith<$Res> { + factory _$$BdkError_RusqliteImplCopyWith(_$BdkError_RusqliteImpl value, + $Res Function(_$BdkError_RusqliteImpl) then) = + __$$BdkError_RusqliteImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$BdkError_RusqliteImplCopyWithImpl<$Res> + extends _$BdkErrorCopyWithImpl<$Res, _$BdkError_RusqliteImpl> + implements _$$BdkError_RusqliteImplCopyWith<$Res> { + __$$BdkError_RusqliteImplCopyWithImpl(_$BdkError_RusqliteImpl _value, + $Res Function(_$BdkError_RusqliteImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$BdkError_RusqliteImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$BdkError_RusqliteImpl implements BdkError_Rusqlite { + const _$BdkError_RusqliteImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'BdkError.rusqlite(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BdkError_RusqliteImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BdkError_RusqliteImplCopyWith<_$BdkError_RusqliteImpl> get copyWith => + __$$BdkError_RusqliteImplCopyWithImpl<_$BdkError_RusqliteImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(HexError field0) hex, + required TResult Function(ConsensusError field0) consensus, + required TResult Function(AddressError field0) address, + required TResult Function(DescriptorError field0) descriptor, + required TResult Function(Uint8List field0) invalidU32Bytes, + required TResult Function(String field0) generic, + required TResult Function() scriptDoesntHaveAddressForm, + required TResult Function() noRecipients, + required TResult Function() noUtxosSelected, + required TResult Function(int field0) outputBelowDustLimit, + required TResult Function(int needed, int available) insufficientFunds, + required TResult Function() bnBTotalTriesExceeded, + required TResult Function() bnBNoExactMatch, + required TResult Function() unknownUtxo, + required TResult Function() transactionNotFound, + required TResult Function() transactionConfirmed, + required TResult Function() irreplaceableTransaction, + required TResult Function(double needed) feeRateTooLow, + required TResult Function(int needed) feeTooLow, + required TResult Function() feeRateUnavailable, + required TResult Function(String field0) missingKeyOrigin, + required TResult Function(String field0) key, + required TResult Function() checksumMismatch, + required TResult Function(KeychainKind field0) spendingPolicyRequired, + required TResult Function(String field0) invalidPolicyPathError, + required TResult Function(String field0) signer, + required TResult Function(Network requested, Network found) invalidNetwork, + required TResult Function(OutPoint field0) invalidOutpoint, + required TResult Function(String field0) encode, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) miniscriptPsbt, + required TResult Function(String field0) bip32, + required TResult Function(String field0) bip39, + required TResult Function(String field0) secp256K1, + required TResult Function(String field0) json, + required TResult Function(String field0) psbt, + required TResult Function(String field0) psbtParse, + required TResult Function(int field0, int field1) missingCachedScripts, + required TResult Function(String field0) electrum, + required TResult Function(String field0) esplora, + required TResult Function(String field0) sled, + required TResult Function(String field0) rpc, + required TResult Function(String field0) rusqlite, + }) { + return rusqlite(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(HexError field0)? hex, + TResult? Function(ConsensusError field0)? consensus, + TResult? Function(AddressError field0)? address, + TResult? Function(DescriptorError field0)? descriptor, + TResult? Function(Uint8List field0)? invalidU32Bytes, + TResult? Function(String field0)? generic, + TResult? Function()? scriptDoesntHaveAddressForm, + TResult? Function()? noRecipients, + TResult? Function()? noUtxosSelected, + TResult? Function(int field0)? outputBelowDustLimit, + TResult? Function(int needed, int available)? insufficientFunds, + TResult? Function()? bnBTotalTriesExceeded, + TResult? Function()? bnBNoExactMatch, + TResult? Function()? unknownUtxo, + TResult? Function()? transactionNotFound, + TResult? Function()? transactionConfirmed, + TResult? Function()? irreplaceableTransaction, + TResult? Function(double needed)? feeRateTooLow, + TResult? Function(int needed)? feeTooLow, + TResult? Function()? feeRateUnavailable, + TResult? Function(String field0)? missingKeyOrigin, + TResult? Function(String field0)? key, + TResult? Function()? checksumMismatch, + TResult? Function(KeychainKind field0)? spendingPolicyRequired, + TResult? Function(String field0)? invalidPolicyPathError, + TResult? Function(String field0)? signer, + TResult? Function(Network requested, Network found)? invalidNetwork, + TResult? Function(OutPoint field0)? invalidOutpoint, + TResult? Function(String field0)? encode, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? miniscriptPsbt, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? bip39, + TResult? Function(String field0)? secp256K1, + TResult? Function(String field0)? json, + TResult? Function(String field0)? psbt, + TResult? Function(String field0)? psbtParse, + TResult? Function(int field0, int field1)? missingCachedScripts, + TResult? Function(String field0)? electrum, + TResult? Function(String field0)? esplora, + TResult? Function(String field0)? sled, + TResult? Function(String field0)? rpc, + TResult? Function(String field0)? rusqlite, + }) { + return rusqlite?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(HexError field0)? hex, + TResult Function(ConsensusError field0)? consensus, + TResult Function(AddressError field0)? address, + TResult Function(DescriptorError field0)? descriptor, + TResult Function(Uint8List field0)? invalidU32Bytes, + TResult Function(String field0)? generic, + TResult Function()? scriptDoesntHaveAddressForm, + TResult Function()? noRecipients, + TResult Function()? noUtxosSelected, + TResult Function(int field0)? outputBelowDustLimit, + TResult Function(int needed, int available)? insufficientFunds, + TResult Function()? bnBTotalTriesExceeded, + TResult Function()? bnBNoExactMatch, + TResult Function()? unknownUtxo, + TResult Function()? transactionNotFound, + TResult Function()? transactionConfirmed, + TResult Function()? irreplaceableTransaction, + TResult Function(double needed)? feeRateTooLow, + TResult Function(int needed)? feeTooLow, + TResult Function()? feeRateUnavailable, + TResult Function(String field0)? missingKeyOrigin, + TResult Function(String field0)? key, + TResult Function()? checksumMismatch, + TResult Function(KeychainKind field0)? spendingPolicyRequired, + TResult Function(String field0)? invalidPolicyPathError, + TResult Function(String field0)? signer, + TResult Function(Network requested, Network found)? invalidNetwork, + TResult Function(OutPoint field0)? invalidOutpoint, + TResult Function(String field0)? encode, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? miniscriptPsbt, + TResult Function(String field0)? bip32, + TResult Function(String field0)? bip39, + TResult Function(String field0)? secp256K1, + TResult Function(String field0)? json, + TResult Function(String field0)? psbt, + TResult Function(String field0)? psbtParse, + TResult Function(int field0, int field1)? missingCachedScripts, + TResult Function(String field0)? electrum, + TResult Function(String field0)? esplora, + TResult Function(String field0)? sled, + TResult Function(String field0)? rpc, + TResult Function(String field0)? rusqlite, + required TResult orElse(), + }) { + if (rusqlite != null) { + return rusqlite(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BdkError_Hex value) hex, + required TResult Function(BdkError_Consensus value) consensus, + required TResult Function(BdkError_Address value) address, + required TResult Function(BdkError_Descriptor value) descriptor, + required TResult Function(BdkError_InvalidU32Bytes value) invalidU32Bytes, + required TResult Function(BdkError_Generic value) generic, + required TResult Function(BdkError_ScriptDoesntHaveAddressForm value) + scriptDoesntHaveAddressForm, + required TResult Function(BdkError_NoRecipients value) noRecipients, + required TResult Function(BdkError_NoUtxosSelected value) noUtxosSelected, + required TResult Function(BdkError_OutputBelowDustLimit value) + outputBelowDustLimit, + required TResult Function(BdkError_InsufficientFunds value) + insufficientFunds, + required TResult Function(BdkError_BnBTotalTriesExceeded value) + bnBTotalTriesExceeded, + required TResult Function(BdkError_BnBNoExactMatch value) bnBNoExactMatch, + required TResult Function(BdkError_UnknownUtxo value) unknownUtxo, + required TResult Function(BdkError_TransactionNotFound value) + transactionNotFound, + required TResult Function(BdkError_TransactionConfirmed value) + transactionConfirmed, + required TResult Function(BdkError_IrreplaceableTransaction value) + irreplaceableTransaction, + required TResult Function(BdkError_FeeRateTooLow value) feeRateTooLow, + required TResult Function(BdkError_FeeTooLow value) feeTooLow, + required TResult Function(BdkError_FeeRateUnavailable value) + feeRateUnavailable, + required TResult Function(BdkError_MissingKeyOrigin value) missingKeyOrigin, + required TResult Function(BdkError_Key value) key, + required TResult Function(BdkError_ChecksumMismatch value) checksumMismatch, + required TResult Function(BdkError_SpendingPolicyRequired value) + spendingPolicyRequired, + required TResult Function(BdkError_InvalidPolicyPathError value) + invalidPolicyPathError, + required TResult Function(BdkError_Signer value) signer, + required TResult Function(BdkError_InvalidNetwork value) invalidNetwork, + required TResult Function(BdkError_InvalidOutpoint value) invalidOutpoint, + required TResult Function(BdkError_Encode value) encode, + required TResult Function(BdkError_Miniscript value) miniscript, + required TResult Function(BdkError_MiniscriptPsbt value) miniscriptPsbt, + required TResult Function(BdkError_Bip32 value) bip32, + required TResult Function(BdkError_Bip39 value) bip39, + required TResult Function(BdkError_Secp256k1 value) secp256K1, + required TResult Function(BdkError_Json value) json, + required TResult Function(BdkError_Psbt value) psbt, + required TResult Function(BdkError_PsbtParse value) psbtParse, + required TResult Function(BdkError_MissingCachedScripts value) + missingCachedScripts, + required TResult Function(BdkError_Electrum value) electrum, + required TResult Function(BdkError_Esplora value) esplora, + required TResult Function(BdkError_Sled value) sled, + required TResult Function(BdkError_Rpc value) rpc, + required TResult Function(BdkError_Rusqlite value) rusqlite, + }) { + return rusqlite(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BdkError_Hex value)? hex, + TResult? Function(BdkError_Consensus value)? consensus, + TResult? Function(BdkError_Address value)? address, + TResult? Function(BdkError_Descriptor value)? descriptor, + TResult? Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult? Function(BdkError_Generic value)? generic, + TResult? Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult? Function(BdkError_NoRecipients value)? noRecipients, + TResult? Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult? Function(BdkError_OutputBelowDustLimit value)? + outputBelowDustLimit, + TResult? Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult? Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult? Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult? Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult? Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult? Function(BdkError_TransactionConfirmed value)? + transactionConfirmed, + TResult? Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult? Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult? Function(BdkError_FeeTooLow value)? feeTooLow, + TResult? Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult? Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult? Function(BdkError_Key value)? key, + TResult? Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult? Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult? Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult? Function(BdkError_Signer value)? signer, + TResult? Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult? Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult? Function(BdkError_Encode value)? encode, + TResult? Function(BdkError_Miniscript value)? miniscript, + TResult? Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult? Function(BdkError_Bip32 value)? bip32, + TResult? Function(BdkError_Bip39 value)? bip39, + TResult? Function(BdkError_Secp256k1 value)? secp256K1, + TResult? Function(BdkError_Json value)? json, + TResult? Function(BdkError_Psbt value)? psbt, + TResult? Function(BdkError_PsbtParse value)? psbtParse, + TResult? Function(BdkError_MissingCachedScripts value)? + missingCachedScripts, + TResult? Function(BdkError_Electrum value)? electrum, + TResult? Function(BdkError_Esplora value)? esplora, + TResult? Function(BdkError_Sled value)? sled, + TResult? Function(BdkError_Rpc value)? rpc, + TResult? Function(BdkError_Rusqlite value)? rusqlite, + }) { + return rusqlite?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BdkError_Hex value)? hex, + TResult Function(BdkError_Consensus value)? consensus, + TResult Function(BdkError_Address value)? address, + TResult Function(BdkError_Descriptor value)? descriptor, + TResult Function(BdkError_InvalidU32Bytes value)? invalidU32Bytes, + TResult Function(BdkError_Generic value)? generic, + TResult Function(BdkError_ScriptDoesntHaveAddressForm value)? + scriptDoesntHaveAddressForm, + TResult Function(BdkError_NoRecipients value)? noRecipients, + TResult Function(BdkError_NoUtxosSelected value)? noUtxosSelected, + TResult Function(BdkError_OutputBelowDustLimit value)? outputBelowDustLimit, + TResult Function(BdkError_InsufficientFunds value)? insufficientFunds, + TResult Function(BdkError_BnBTotalTriesExceeded value)? + bnBTotalTriesExceeded, + TResult Function(BdkError_BnBNoExactMatch value)? bnBNoExactMatch, + TResult Function(BdkError_UnknownUtxo value)? unknownUtxo, + TResult Function(BdkError_TransactionNotFound value)? transactionNotFound, + TResult Function(BdkError_TransactionConfirmed value)? transactionConfirmed, + TResult Function(BdkError_IrreplaceableTransaction value)? + irreplaceableTransaction, + TResult Function(BdkError_FeeRateTooLow value)? feeRateTooLow, + TResult Function(BdkError_FeeTooLow value)? feeTooLow, + TResult Function(BdkError_FeeRateUnavailable value)? feeRateUnavailable, + TResult Function(BdkError_MissingKeyOrigin value)? missingKeyOrigin, + TResult Function(BdkError_Key value)? key, + TResult Function(BdkError_ChecksumMismatch value)? checksumMismatch, + TResult Function(BdkError_SpendingPolicyRequired value)? + spendingPolicyRequired, + TResult Function(BdkError_InvalidPolicyPathError value)? + invalidPolicyPathError, + TResult Function(BdkError_Signer value)? signer, + TResult Function(BdkError_InvalidNetwork value)? invalidNetwork, + TResult Function(BdkError_InvalidOutpoint value)? invalidOutpoint, + TResult Function(BdkError_Encode value)? encode, + TResult Function(BdkError_Miniscript value)? miniscript, + TResult Function(BdkError_MiniscriptPsbt value)? miniscriptPsbt, + TResult Function(BdkError_Bip32 value)? bip32, + TResult Function(BdkError_Bip39 value)? bip39, + TResult Function(BdkError_Secp256k1 value)? secp256K1, + TResult Function(BdkError_Json value)? json, + TResult Function(BdkError_Psbt value)? psbt, + TResult Function(BdkError_PsbtParse value)? psbtParse, + TResult Function(BdkError_MissingCachedScripts value)? missingCachedScripts, + TResult Function(BdkError_Electrum value)? electrum, + TResult Function(BdkError_Esplora value)? esplora, + TResult Function(BdkError_Sled value)? sled, + TResult Function(BdkError_Rpc value)? rpc, + TResult Function(BdkError_Rusqlite value)? rusqlite, + required TResult orElse(), + }) { + if (rusqlite != null) { + return rusqlite(this); + } + return orElse(); + } +} + +abstract class BdkError_Rusqlite implements BdkError { + const factory BdkError_Rusqlite(final String field0) = + _$BdkError_RusqliteImpl; + + String get field0; + @JsonKey(ignore: true) + _$$BdkError_RusqliteImplCopyWith<_$BdkError_RusqliteImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$ConsensusError { + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) io, + required TResult Function(int requested, int max) oversizedVectorAllocation, + required TResult Function(U8Array4 expected, U8Array4 actual) + invalidChecksum, + required TResult Function() nonMinimalVarInt, + required TResult Function(String field0) parseFailed, + required TResult Function(int field0) unsupportedSegwitFlag, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? io, + TResult? Function(int requested, int max)? oversizedVectorAllocation, + TResult? Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult? Function()? nonMinimalVarInt, + TResult? Function(String field0)? parseFailed, + TResult? Function(int field0)? unsupportedSegwitFlag, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? io, + TResult Function(int requested, int max)? oversizedVectorAllocation, + TResult Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult Function()? nonMinimalVarInt, + TResult Function(String field0)? parseFailed, + TResult Function(int field0)? unsupportedSegwitFlag, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(ConsensusError_Io value) io, + required TResult Function(ConsensusError_OversizedVectorAllocation value) + oversizedVectorAllocation, + required TResult Function(ConsensusError_InvalidChecksum value) + invalidChecksum, + required TResult Function(ConsensusError_NonMinimalVarInt value) + nonMinimalVarInt, + required TResult Function(ConsensusError_ParseFailed value) parseFailed, + required TResult Function(ConsensusError_UnsupportedSegwitFlag value) + unsupportedSegwitFlag, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ConsensusError_Io value)? io, + TResult? Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult? Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult? Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult? Function(ConsensusError_ParseFailed value)? parseFailed, + TResult? Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ConsensusError_Io value)? io, + TResult Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult Function(ConsensusError_ParseFailed value)? parseFailed, + TResult Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ConsensusErrorCopyWith<$Res> { + factory $ConsensusErrorCopyWith( + ConsensusError value, $Res Function(ConsensusError) then) = + _$ConsensusErrorCopyWithImpl<$Res, ConsensusError>; +} + +/// @nodoc +class _$ConsensusErrorCopyWithImpl<$Res, $Val extends ConsensusError> + implements $ConsensusErrorCopyWith<$Res> { + _$ConsensusErrorCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$ConsensusError_IoImplCopyWith<$Res> { + factory _$$ConsensusError_IoImplCopyWith(_$ConsensusError_IoImpl value, + $Res Function(_$ConsensusError_IoImpl) then) = + __$$ConsensusError_IoImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$ConsensusError_IoImplCopyWithImpl<$Res> + extends _$ConsensusErrorCopyWithImpl<$Res, _$ConsensusError_IoImpl> + implements _$$ConsensusError_IoImplCopyWith<$Res> { + __$$ConsensusError_IoImplCopyWithImpl(_$ConsensusError_IoImpl _value, + $Res Function(_$ConsensusError_IoImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$ConsensusError_IoImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$ConsensusError_IoImpl implements ConsensusError_Io { + const _$ConsensusError_IoImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'ConsensusError.io(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ConsensusError_IoImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$ConsensusError_IoImplCopyWith<_$ConsensusError_IoImpl> get copyWith => + __$$ConsensusError_IoImplCopyWithImpl<_$ConsensusError_IoImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) io, + required TResult Function(int requested, int max) oversizedVectorAllocation, + required TResult Function(U8Array4 expected, U8Array4 actual) + invalidChecksum, + required TResult Function() nonMinimalVarInt, + required TResult Function(String field0) parseFailed, + required TResult Function(int field0) unsupportedSegwitFlag, + }) { + return io(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? io, + TResult? Function(int requested, int max)? oversizedVectorAllocation, + TResult? Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult? Function()? nonMinimalVarInt, + TResult? Function(String field0)? parseFailed, + TResult? Function(int field0)? unsupportedSegwitFlag, + }) { + return io?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? io, + TResult Function(int requested, int max)? oversizedVectorAllocation, + TResult Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult Function()? nonMinimalVarInt, + TResult Function(String field0)? parseFailed, + TResult Function(int field0)? unsupportedSegwitFlag, + required TResult orElse(), + }) { + if (io != null) { + return io(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ConsensusError_Io value) io, + required TResult Function(ConsensusError_OversizedVectorAllocation value) + oversizedVectorAllocation, + required TResult Function(ConsensusError_InvalidChecksum value) + invalidChecksum, + required TResult Function(ConsensusError_NonMinimalVarInt value) + nonMinimalVarInt, + required TResult Function(ConsensusError_ParseFailed value) parseFailed, + required TResult Function(ConsensusError_UnsupportedSegwitFlag value) + unsupportedSegwitFlag, + }) { + return io(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ConsensusError_Io value)? io, + TResult? Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult? Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult? Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult? Function(ConsensusError_ParseFailed value)? parseFailed, + TResult? Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + }) { + return io?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ConsensusError_Io value)? io, + TResult Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult Function(ConsensusError_ParseFailed value)? parseFailed, + TResult Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + required TResult orElse(), + }) { + if (io != null) { + return io(this); + } + return orElse(); + } +} + +abstract class ConsensusError_Io implements ConsensusError { + const factory ConsensusError_Io(final String field0) = + _$ConsensusError_IoImpl; + + String get field0; + @JsonKey(ignore: true) + _$$ConsensusError_IoImplCopyWith<_$ConsensusError_IoImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$ConsensusError_OversizedVectorAllocationImplCopyWith<$Res> { + factory _$$ConsensusError_OversizedVectorAllocationImplCopyWith( + _$ConsensusError_OversizedVectorAllocationImpl value, + $Res Function(_$ConsensusError_OversizedVectorAllocationImpl) then) = + __$$ConsensusError_OversizedVectorAllocationImplCopyWithImpl<$Res>; + @useResult + $Res call({int requested, int max}); +} + +/// @nodoc +class __$$ConsensusError_OversizedVectorAllocationImplCopyWithImpl<$Res> + extends _$ConsensusErrorCopyWithImpl<$Res, + _$ConsensusError_OversizedVectorAllocationImpl> + implements _$$ConsensusError_OversizedVectorAllocationImplCopyWith<$Res> { + __$$ConsensusError_OversizedVectorAllocationImplCopyWithImpl( + _$ConsensusError_OversizedVectorAllocationImpl _value, + $Res Function(_$ConsensusError_OversizedVectorAllocationImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? requested = null, + Object? max = null, + }) { + return _then(_$ConsensusError_OversizedVectorAllocationImpl( + requested: null == requested + ? _value.requested + : requested // ignore: cast_nullable_to_non_nullable + as int, + max: null == max + ? _value.max + : max // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$ConsensusError_OversizedVectorAllocationImpl + implements ConsensusError_OversizedVectorAllocation { + const _$ConsensusError_OversizedVectorAllocationImpl( + {required this.requested, required this.max}); + + @override + final int requested; + @override + final int max; + + @override + String toString() { + return 'ConsensusError.oversizedVectorAllocation(requested: $requested, max: $max)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ConsensusError_OversizedVectorAllocationImpl && + (identical(other.requested, requested) || + other.requested == requested) && + (identical(other.max, max) || other.max == max)); + } + + @override + int get hashCode => Object.hash(runtimeType, requested, max); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$ConsensusError_OversizedVectorAllocationImplCopyWith< + _$ConsensusError_OversizedVectorAllocationImpl> + get copyWith => + __$$ConsensusError_OversizedVectorAllocationImplCopyWithImpl< + _$ConsensusError_OversizedVectorAllocationImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) io, + required TResult Function(int requested, int max) oversizedVectorAllocation, + required TResult Function(U8Array4 expected, U8Array4 actual) + invalidChecksum, + required TResult Function() nonMinimalVarInt, + required TResult Function(String field0) parseFailed, + required TResult Function(int field0) unsupportedSegwitFlag, + }) { + return oversizedVectorAllocation(requested, max); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? io, + TResult? Function(int requested, int max)? oversizedVectorAllocation, + TResult? Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult? Function()? nonMinimalVarInt, + TResult? Function(String field0)? parseFailed, + TResult? Function(int field0)? unsupportedSegwitFlag, + }) { + return oversizedVectorAllocation?.call(requested, max); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? io, + TResult Function(int requested, int max)? oversizedVectorAllocation, + TResult Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult Function()? nonMinimalVarInt, + TResult Function(String field0)? parseFailed, + TResult Function(int field0)? unsupportedSegwitFlag, + required TResult orElse(), + }) { + if (oversizedVectorAllocation != null) { + return oversizedVectorAllocation(requested, max); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ConsensusError_Io value) io, + required TResult Function(ConsensusError_OversizedVectorAllocation value) + oversizedVectorAllocation, + required TResult Function(ConsensusError_InvalidChecksum value) + invalidChecksum, + required TResult Function(ConsensusError_NonMinimalVarInt value) + nonMinimalVarInt, + required TResult Function(ConsensusError_ParseFailed value) parseFailed, + required TResult Function(ConsensusError_UnsupportedSegwitFlag value) + unsupportedSegwitFlag, + }) { + return oversizedVectorAllocation(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ConsensusError_Io value)? io, + TResult? Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult? Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult? Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult? Function(ConsensusError_ParseFailed value)? parseFailed, + TResult? Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + }) { + return oversizedVectorAllocation?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ConsensusError_Io value)? io, + TResult Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult Function(ConsensusError_ParseFailed value)? parseFailed, + TResult Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + required TResult orElse(), + }) { + if (oversizedVectorAllocation != null) { + return oversizedVectorAllocation(this); + } + return orElse(); + } +} + +abstract class ConsensusError_OversizedVectorAllocation + implements ConsensusError { + const factory ConsensusError_OversizedVectorAllocation( + {required final int requested, + required final int max}) = _$ConsensusError_OversizedVectorAllocationImpl; + + int get requested; + int get max; + @JsonKey(ignore: true) + _$$ConsensusError_OversizedVectorAllocationImplCopyWith< + _$ConsensusError_OversizedVectorAllocationImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$ConsensusError_InvalidChecksumImplCopyWith<$Res> { + factory _$$ConsensusError_InvalidChecksumImplCopyWith( + _$ConsensusError_InvalidChecksumImpl value, + $Res Function(_$ConsensusError_InvalidChecksumImpl) then) = + __$$ConsensusError_InvalidChecksumImplCopyWithImpl<$Res>; + @useResult + $Res call({U8Array4 expected, U8Array4 actual}); +} + +/// @nodoc +class __$$ConsensusError_InvalidChecksumImplCopyWithImpl<$Res> + extends _$ConsensusErrorCopyWithImpl<$Res, + _$ConsensusError_InvalidChecksumImpl> + implements _$$ConsensusError_InvalidChecksumImplCopyWith<$Res> { + __$$ConsensusError_InvalidChecksumImplCopyWithImpl( + _$ConsensusError_InvalidChecksumImpl _value, + $Res Function(_$ConsensusError_InvalidChecksumImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? expected = null, + Object? actual = null, + }) { + return _then(_$ConsensusError_InvalidChecksumImpl( + expected: null == expected + ? _value.expected + : expected // ignore: cast_nullable_to_non_nullable + as U8Array4, + actual: null == actual + ? _value.actual + : actual // ignore: cast_nullable_to_non_nullable + as U8Array4, + )); + } +} + +/// @nodoc + +class _$ConsensusError_InvalidChecksumImpl + implements ConsensusError_InvalidChecksum { + const _$ConsensusError_InvalidChecksumImpl( + {required this.expected, required this.actual}); + + @override + final U8Array4 expected; + @override + final U8Array4 actual; + + @override + String toString() { + return 'ConsensusError.invalidChecksum(expected: $expected, actual: $actual)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ConsensusError_InvalidChecksumImpl && + const DeepCollectionEquality().equals(other.expected, expected) && + const DeepCollectionEquality().equals(other.actual, actual)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(expected), + const DeepCollectionEquality().hash(actual)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$ConsensusError_InvalidChecksumImplCopyWith< + _$ConsensusError_InvalidChecksumImpl> + get copyWith => __$$ConsensusError_InvalidChecksumImplCopyWithImpl< + _$ConsensusError_InvalidChecksumImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) io, + required TResult Function(int requested, int max) oversizedVectorAllocation, + required TResult Function(U8Array4 expected, U8Array4 actual) + invalidChecksum, + required TResult Function() nonMinimalVarInt, + required TResult Function(String field0) parseFailed, + required TResult Function(int field0) unsupportedSegwitFlag, + }) { + return invalidChecksum(expected, actual); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? io, + TResult? Function(int requested, int max)? oversizedVectorAllocation, + TResult? Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult? Function()? nonMinimalVarInt, + TResult? Function(String field0)? parseFailed, + TResult? Function(int field0)? unsupportedSegwitFlag, + }) { + return invalidChecksum?.call(expected, actual); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? io, + TResult Function(int requested, int max)? oversizedVectorAllocation, + TResult Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult Function()? nonMinimalVarInt, + TResult Function(String field0)? parseFailed, + TResult Function(int field0)? unsupportedSegwitFlag, + required TResult orElse(), + }) { + if (invalidChecksum != null) { + return invalidChecksum(expected, actual); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ConsensusError_Io value) io, + required TResult Function(ConsensusError_OversizedVectorAllocation value) + oversizedVectorAllocation, + required TResult Function(ConsensusError_InvalidChecksum value) + invalidChecksum, + required TResult Function(ConsensusError_NonMinimalVarInt value) + nonMinimalVarInt, + required TResult Function(ConsensusError_ParseFailed value) parseFailed, + required TResult Function(ConsensusError_UnsupportedSegwitFlag value) + unsupportedSegwitFlag, + }) { + return invalidChecksum(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ConsensusError_Io value)? io, + TResult? Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult? Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult? Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult? Function(ConsensusError_ParseFailed value)? parseFailed, + TResult? Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + }) { + return invalidChecksum?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ConsensusError_Io value)? io, + TResult Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult Function(ConsensusError_ParseFailed value)? parseFailed, + TResult Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + required TResult orElse(), + }) { + if (invalidChecksum != null) { + return invalidChecksum(this); + } + return orElse(); + } +} + +abstract class ConsensusError_InvalidChecksum implements ConsensusError { + const factory ConsensusError_InvalidChecksum( + {required final U8Array4 expected, + required final U8Array4 actual}) = _$ConsensusError_InvalidChecksumImpl; + + U8Array4 get expected; + U8Array4 get actual; + @JsonKey(ignore: true) + _$$ConsensusError_InvalidChecksumImplCopyWith< + _$ConsensusError_InvalidChecksumImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$ConsensusError_NonMinimalVarIntImplCopyWith<$Res> { + factory _$$ConsensusError_NonMinimalVarIntImplCopyWith( + _$ConsensusError_NonMinimalVarIntImpl value, + $Res Function(_$ConsensusError_NonMinimalVarIntImpl) then) = + __$$ConsensusError_NonMinimalVarIntImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$ConsensusError_NonMinimalVarIntImplCopyWithImpl<$Res> + extends _$ConsensusErrorCopyWithImpl<$Res, + _$ConsensusError_NonMinimalVarIntImpl> + implements _$$ConsensusError_NonMinimalVarIntImplCopyWith<$Res> { + __$$ConsensusError_NonMinimalVarIntImplCopyWithImpl( + _$ConsensusError_NonMinimalVarIntImpl _value, + $Res Function(_$ConsensusError_NonMinimalVarIntImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$ConsensusError_NonMinimalVarIntImpl + implements ConsensusError_NonMinimalVarInt { + const _$ConsensusError_NonMinimalVarIntImpl(); + + @override + String toString() { + return 'ConsensusError.nonMinimalVarInt()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ConsensusError_NonMinimalVarIntImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) io, + required TResult Function(int requested, int max) oversizedVectorAllocation, + required TResult Function(U8Array4 expected, U8Array4 actual) + invalidChecksum, + required TResult Function() nonMinimalVarInt, + required TResult Function(String field0) parseFailed, + required TResult Function(int field0) unsupportedSegwitFlag, + }) { + return nonMinimalVarInt(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? io, + TResult? Function(int requested, int max)? oversizedVectorAllocation, + TResult? Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult? Function()? nonMinimalVarInt, + TResult? Function(String field0)? parseFailed, + TResult? Function(int field0)? unsupportedSegwitFlag, + }) { + return nonMinimalVarInt?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? io, + TResult Function(int requested, int max)? oversizedVectorAllocation, + TResult Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult Function()? nonMinimalVarInt, + TResult Function(String field0)? parseFailed, + TResult Function(int field0)? unsupportedSegwitFlag, + required TResult orElse(), + }) { + if (nonMinimalVarInt != null) { + return nonMinimalVarInt(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ConsensusError_Io value) io, + required TResult Function(ConsensusError_OversizedVectorAllocation value) + oversizedVectorAllocation, + required TResult Function(ConsensusError_InvalidChecksum value) + invalidChecksum, + required TResult Function(ConsensusError_NonMinimalVarInt value) + nonMinimalVarInt, + required TResult Function(ConsensusError_ParseFailed value) parseFailed, + required TResult Function(ConsensusError_UnsupportedSegwitFlag value) + unsupportedSegwitFlag, + }) { + return nonMinimalVarInt(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ConsensusError_Io value)? io, + TResult? Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult? Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult? Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult? Function(ConsensusError_ParseFailed value)? parseFailed, + TResult? Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + }) { + return nonMinimalVarInt?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ConsensusError_Io value)? io, + TResult Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult Function(ConsensusError_ParseFailed value)? parseFailed, + TResult Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + required TResult orElse(), + }) { + if (nonMinimalVarInt != null) { + return nonMinimalVarInt(this); + } + return orElse(); + } +} + +abstract class ConsensusError_NonMinimalVarInt implements ConsensusError { + const factory ConsensusError_NonMinimalVarInt() = + _$ConsensusError_NonMinimalVarIntImpl; +} + +/// @nodoc +abstract class _$$ConsensusError_ParseFailedImplCopyWith<$Res> { + factory _$$ConsensusError_ParseFailedImplCopyWith( + _$ConsensusError_ParseFailedImpl value, + $Res Function(_$ConsensusError_ParseFailedImpl) then) = + __$$ConsensusError_ParseFailedImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$ConsensusError_ParseFailedImplCopyWithImpl<$Res> + extends _$ConsensusErrorCopyWithImpl<$Res, _$ConsensusError_ParseFailedImpl> + implements _$$ConsensusError_ParseFailedImplCopyWith<$Res> { + __$$ConsensusError_ParseFailedImplCopyWithImpl( + _$ConsensusError_ParseFailedImpl _value, + $Res Function(_$ConsensusError_ParseFailedImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$ConsensusError_ParseFailedImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$ConsensusError_ParseFailedImpl implements ConsensusError_ParseFailed { + const _$ConsensusError_ParseFailedImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'ConsensusError.parseFailed(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ConsensusError_ParseFailedImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$ConsensusError_ParseFailedImplCopyWith<_$ConsensusError_ParseFailedImpl> + get copyWith => __$$ConsensusError_ParseFailedImplCopyWithImpl< + _$ConsensusError_ParseFailedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) io, + required TResult Function(int requested, int max) oversizedVectorAllocation, + required TResult Function(U8Array4 expected, U8Array4 actual) + invalidChecksum, + required TResult Function() nonMinimalVarInt, + required TResult Function(String field0) parseFailed, + required TResult Function(int field0) unsupportedSegwitFlag, + }) { + return parseFailed(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? io, + TResult? Function(int requested, int max)? oversizedVectorAllocation, + TResult? Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult? Function()? nonMinimalVarInt, + TResult? Function(String field0)? parseFailed, + TResult? Function(int field0)? unsupportedSegwitFlag, + }) { + return parseFailed?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? io, + TResult Function(int requested, int max)? oversizedVectorAllocation, + TResult Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult Function()? nonMinimalVarInt, + TResult Function(String field0)? parseFailed, + TResult Function(int field0)? unsupportedSegwitFlag, + required TResult orElse(), + }) { + if (parseFailed != null) { + return parseFailed(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ConsensusError_Io value) io, + required TResult Function(ConsensusError_OversizedVectorAllocation value) + oversizedVectorAllocation, + required TResult Function(ConsensusError_InvalidChecksum value) + invalidChecksum, + required TResult Function(ConsensusError_NonMinimalVarInt value) + nonMinimalVarInt, + required TResult Function(ConsensusError_ParseFailed value) parseFailed, + required TResult Function(ConsensusError_UnsupportedSegwitFlag value) + unsupportedSegwitFlag, + }) { + return parseFailed(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ConsensusError_Io value)? io, + TResult? Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult? Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult? Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult? Function(ConsensusError_ParseFailed value)? parseFailed, + TResult? Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + }) { + return parseFailed?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ConsensusError_Io value)? io, + TResult Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult Function(ConsensusError_ParseFailed value)? parseFailed, + TResult Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + required TResult orElse(), + }) { + if (parseFailed != null) { + return parseFailed(this); + } + return orElse(); + } +} + +abstract class ConsensusError_ParseFailed implements ConsensusError { + const factory ConsensusError_ParseFailed(final String field0) = + _$ConsensusError_ParseFailedImpl; + + String get field0; + @JsonKey(ignore: true) + _$$ConsensusError_ParseFailedImplCopyWith<_$ConsensusError_ParseFailedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$ConsensusError_UnsupportedSegwitFlagImplCopyWith<$Res> { + factory _$$ConsensusError_UnsupportedSegwitFlagImplCopyWith( + _$ConsensusError_UnsupportedSegwitFlagImpl value, + $Res Function(_$ConsensusError_UnsupportedSegwitFlagImpl) then) = + __$$ConsensusError_UnsupportedSegwitFlagImplCopyWithImpl<$Res>; + @useResult + $Res call({int field0}); +} + +/// @nodoc +class __$$ConsensusError_UnsupportedSegwitFlagImplCopyWithImpl<$Res> + extends _$ConsensusErrorCopyWithImpl<$Res, + _$ConsensusError_UnsupportedSegwitFlagImpl> + implements _$$ConsensusError_UnsupportedSegwitFlagImplCopyWith<$Res> { + __$$ConsensusError_UnsupportedSegwitFlagImplCopyWithImpl( + _$ConsensusError_UnsupportedSegwitFlagImpl _value, + $Res Function(_$ConsensusError_UnsupportedSegwitFlagImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$ConsensusError_UnsupportedSegwitFlagImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$ConsensusError_UnsupportedSegwitFlagImpl + implements ConsensusError_UnsupportedSegwitFlag { + const _$ConsensusError_UnsupportedSegwitFlagImpl(this.field0); + + @override + final int field0; + + @override + String toString() { + return 'ConsensusError.unsupportedSegwitFlag(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ConsensusError_UnsupportedSegwitFlagImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$ConsensusError_UnsupportedSegwitFlagImplCopyWith< + _$ConsensusError_UnsupportedSegwitFlagImpl> + get copyWith => __$$ConsensusError_UnsupportedSegwitFlagImplCopyWithImpl< + _$ConsensusError_UnsupportedSegwitFlagImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) io, + required TResult Function(int requested, int max) oversizedVectorAllocation, + required TResult Function(U8Array4 expected, U8Array4 actual) + invalidChecksum, + required TResult Function() nonMinimalVarInt, + required TResult Function(String field0) parseFailed, + required TResult Function(int field0) unsupportedSegwitFlag, + }) { + return unsupportedSegwitFlag(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String field0)? io, + TResult? Function(int requested, int max)? oversizedVectorAllocation, + TResult? Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult? Function()? nonMinimalVarInt, + TResult? Function(String field0)? parseFailed, + TResult? Function(int field0)? unsupportedSegwitFlag, + }) { + return unsupportedSegwitFlag?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? io, + TResult Function(int requested, int max)? oversizedVectorAllocation, + TResult Function(U8Array4 expected, U8Array4 actual)? invalidChecksum, + TResult Function()? nonMinimalVarInt, + TResult Function(String field0)? parseFailed, + TResult Function(int field0)? unsupportedSegwitFlag, + required TResult orElse(), + }) { + if (unsupportedSegwitFlag != null) { + return unsupportedSegwitFlag(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ConsensusError_Io value) io, + required TResult Function(ConsensusError_OversizedVectorAllocation value) + oversizedVectorAllocation, + required TResult Function(ConsensusError_InvalidChecksum value) + invalidChecksum, + required TResult Function(ConsensusError_NonMinimalVarInt value) + nonMinimalVarInt, + required TResult Function(ConsensusError_ParseFailed value) parseFailed, + required TResult Function(ConsensusError_UnsupportedSegwitFlag value) + unsupportedSegwitFlag, + }) { + return unsupportedSegwitFlag(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ConsensusError_Io value)? io, + TResult? Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult? Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult? Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult? Function(ConsensusError_ParseFailed value)? parseFailed, + TResult? Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + }) { + return unsupportedSegwitFlag?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ConsensusError_Io value)? io, + TResult Function(ConsensusError_OversizedVectorAllocation value)? + oversizedVectorAllocation, + TResult Function(ConsensusError_InvalidChecksum value)? invalidChecksum, + TResult Function(ConsensusError_NonMinimalVarInt value)? nonMinimalVarInt, + TResult Function(ConsensusError_ParseFailed value)? parseFailed, + TResult Function(ConsensusError_UnsupportedSegwitFlag value)? + unsupportedSegwitFlag, + required TResult orElse(), + }) { + if (unsupportedSegwitFlag != null) { + return unsupportedSegwitFlag(this); + } + return orElse(); + } +} + +abstract class ConsensusError_UnsupportedSegwitFlag implements ConsensusError { + const factory ConsensusError_UnsupportedSegwitFlag(final int field0) = + _$ConsensusError_UnsupportedSegwitFlagImpl; + + int get field0; + @JsonKey(ignore: true) + _$$ConsensusError_UnsupportedSegwitFlagImplCopyWith< + _$ConsensusError_UnsupportedSegwitFlagImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$DescriptorError { + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $DescriptorErrorCopyWith<$Res> { + factory $DescriptorErrorCopyWith( + DescriptorError value, $Res Function(DescriptorError) then) = + _$DescriptorErrorCopyWithImpl<$Res, DescriptorError>; +} + +/// @nodoc +class _$DescriptorErrorCopyWithImpl<$Res, $Val extends DescriptorError> + implements $DescriptorErrorCopyWith<$Res> { + _$DescriptorErrorCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$DescriptorError_InvalidHdKeyPathImplCopyWith<$Res> { + factory _$$DescriptorError_InvalidHdKeyPathImplCopyWith( + _$DescriptorError_InvalidHdKeyPathImpl value, + $Res Function(_$DescriptorError_InvalidHdKeyPathImpl) then) = + __$$DescriptorError_InvalidHdKeyPathImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$DescriptorError_InvalidHdKeyPathImplCopyWithImpl<$Res> + extends _$DescriptorErrorCopyWithImpl<$Res, + _$DescriptorError_InvalidHdKeyPathImpl> + implements _$$DescriptorError_InvalidHdKeyPathImplCopyWith<$Res> { + __$$DescriptorError_InvalidHdKeyPathImplCopyWithImpl( + _$DescriptorError_InvalidHdKeyPathImpl _value, + $Res Function(_$DescriptorError_InvalidHdKeyPathImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$DescriptorError_InvalidHdKeyPathImpl + implements DescriptorError_InvalidHdKeyPath { + const _$DescriptorError_InvalidHdKeyPathImpl(); + + @override + String toString() { + return 'DescriptorError.invalidHdKeyPath()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptorError_InvalidHdKeyPathImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) { + return invalidHdKeyPath(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) { + return invalidHdKeyPath?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) { + if (invalidHdKeyPath != null) { + return invalidHdKeyPath(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) { + return invalidHdKeyPath(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) { + return invalidHdKeyPath?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) { + if (invalidHdKeyPath != null) { + return invalidHdKeyPath(this); + } + return orElse(); + } +} + +abstract class DescriptorError_InvalidHdKeyPath implements DescriptorError { + const factory DescriptorError_InvalidHdKeyPath() = + _$DescriptorError_InvalidHdKeyPathImpl; +} + +/// @nodoc +abstract class _$$DescriptorError_InvalidDescriptorChecksumImplCopyWith<$Res> { + factory _$$DescriptorError_InvalidDescriptorChecksumImplCopyWith( + _$DescriptorError_InvalidDescriptorChecksumImpl value, + $Res Function(_$DescriptorError_InvalidDescriptorChecksumImpl) then) = + __$$DescriptorError_InvalidDescriptorChecksumImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$DescriptorError_InvalidDescriptorChecksumImplCopyWithImpl<$Res> + extends _$DescriptorErrorCopyWithImpl<$Res, + _$DescriptorError_InvalidDescriptorChecksumImpl> + implements _$$DescriptorError_InvalidDescriptorChecksumImplCopyWith<$Res> { + __$$DescriptorError_InvalidDescriptorChecksumImplCopyWithImpl( + _$DescriptorError_InvalidDescriptorChecksumImpl _value, + $Res Function(_$DescriptorError_InvalidDescriptorChecksumImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$DescriptorError_InvalidDescriptorChecksumImpl + implements DescriptorError_InvalidDescriptorChecksum { + const _$DescriptorError_InvalidDescriptorChecksumImpl(); + + @override + String toString() { + return 'DescriptorError.invalidDescriptorChecksum()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptorError_InvalidDescriptorChecksumImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) { + return invalidDescriptorChecksum(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) { + return invalidDescriptorChecksum?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) { + if (invalidDescriptorChecksum != null) { + return invalidDescriptorChecksum(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) { + return invalidDescriptorChecksum(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) { + return invalidDescriptorChecksum?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) { + if (invalidDescriptorChecksum != null) { + return invalidDescriptorChecksum(this); + } + return orElse(); + } +} + +abstract class DescriptorError_InvalidDescriptorChecksum + implements DescriptorError { + const factory DescriptorError_InvalidDescriptorChecksum() = + _$DescriptorError_InvalidDescriptorChecksumImpl; +} + +/// @nodoc +abstract class _$$DescriptorError_HardenedDerivationXpubImplCopyWith<$Res> { + factory _$$DescriptorError_HardenedDerivationXpubImplCopyWith( + _$DescriptorError_HardenedDerivationXpubImpl value, + $Res Function(_$DescriptorError_HardenedDerivationXpubImpl) then) = + __$$DescriptorError_HardenedDerivationXpubImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$DescriptorError_HardenedDerivationXpubImplCopyWithImpl<$Res> + extends _$DescriptorErrorCopyWithImpl<$Res, + _$DescriptorError_HardenedDerivationXpubImpl> + implements _$$DescriptorError_HardenedDerivationXpubImplCopyWith<$Res> { + __$$DescriptorError_HardenedDerivationXpubImplCopyWithImpl( + _$DescriptorError_HardenedDerivationXpubImpl _value, + $Res Function(_$DescriptorError_HardenedDerivationXpubImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$DescriptorError_HardenedDerivationXpubImpl + implements DescriptorError_HardenedDerivationXpub { + const _$DescriptorError_HardenedDerivationXpubImpl(); + + @override + String toString() { + return 'DescriptorError.hardenedDerivationXpub()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptorError_HardenedDerivationXpubImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) { + return hardenedDerivationXpub(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) { + return hardenedDerivationXpub?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) { + if (hardenedDerivationXpub != null) { + return hardenedDerivationXpub(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) { + return hardenedDerivationXpub(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) { + return hardenedDerivationXpub?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) { + if (hardenedDerivationXpub != null) { + return hardenedDerivationXpub(this); + } + return orElse(); + } +} + +abstract class DescriptorError_HardenedDerivationXpub + implements DescriptorError { + const factory DescriptorError_HardenedDerivationXpub() = + _$DescriptorError_HardenedDerivationXpubImpl; +} + +/// @nodoc +abstract class _$$DescriptorError_MultiPathImplCopyWith<$Res> { + factory _$$DescriptorError_MultiPathImplCopyWith( + _$DescriptorError_MultiPathImpl value, + $Res Function(_$DescriptorError_MultiPathImpl) then) = + __$$DescriptorError_MultiPathImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$DescriptorError_MultiPathImplCopyWithImpl<$Res> + extends _$DescriptorErrorCopyWithImpl<$Res, _$DescriptorError_MultiPathImpl> + implements _$$DescriptorError_MultiPathImplCopyWith<$Res> { + __$$DescriptorError_MultiPathImplCopyWithImpl( + _$DescriptorError_MultiPathImpl _value, + $Res Function(_$DescriptorError_MultiPathImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$DescriptorError_MultiPathImpl implements DescriptorError_MultiPath { + const _$DescriptorError_MultiPathImpl(); + + @override + String toString() { + return 'DescriptorError.multiPath()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptorError_MultiPathImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) { + return multiPath(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) { + return multiPath?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) { + if (multiPath != null) { + return multiPath(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) { + return multiPath(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) { + return multiPath?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) { + if (multiPath != null) { + return multiPath(this); + } + return orElse(); + } +} + +abstract class DescriptorError_MultiPath implements DescriptorError { + const factory DescriptorError_MultiPath() = _$DescriptorError_MultiPathImpl; +} + +/// @nodoc +abstract class _$$DescriptorError_KeyImplCopyWith<$Res> { + factory _$$DescriptorError_KeyImplCopyWith(_$DescriptorError_KeyImpl value, + $Res Function(_$DescriptorError_KeyImpl) then) = + __$$DescriptorError_KeyImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$DescriptorError_KeyImplCopyWithImpl<$Res> + extends _$DescriptorErrorCopyWithImpl<$Res, _$DescriptorError_KeyImpl> + implements _$$DescriptorError_KeyImplCopyWith<$Res> { + __$$DescriptorError_KeyImplCopyWithImpl(_$DescriptorError_KeyImpl _value, + $Res Function(_$DescriptorError_KeyImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$DescriptorError_KeyImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$DescriptorError_KeyImpl implements DescriptorError_Key { + const _$DescriptorError_KeyImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'DescriptorError.key(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptorError_KeyImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DescriptorError_KeyImplCopyWith<_$DescriptorError_KeyImpl> get copyWith => + __$$DescriptorError_KeyImplCopyWithImpl<_$DescriptorError_KeyImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) { + return key(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) { + return key?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) { + if (key != null) { + return key(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) { + return key(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) { + return key?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) { + if (key != null) { + return key(this); + } + return orElse(); + } +} + +abstract class DescriptorError_Key implements DescriptorError { + const factory DescriptorError_Key(final String field0) = + _$DescriptorError_KeyImpl; + + String get field0; + @JsonKey(ignore: true) + _$$DescriptorError_KeyImplCopyWith<_$DescriptorError_KeyImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$DescriptorError_PolicyImplCopyWith<$Res> { + factory _$$DescriptorError_PolicyImplCopyWith( + _$DescriptorError_PolicyImpl value, + $Res Function(_$DescriptorError_PolicyImpl) then) = + __$$DescriptorError_PolicyImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$DescriptorError_PolicyImplCopyWithImpl<$Res> + extends _$DescriptorErrorCopyWithImpl<$Res, _$DescriptorError_PolicyImpl> + implements _$$DescriptorError_PolicyImplCopyWith<$Res> { + __$$DescriptorError_PolicyImplCopyWithImpl( + _$DescriptorError_PolicyImpl _value, + $Res Function(_$DescriptorError_PolicyImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$DescriptorError_PolicyImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$DescriptorError_PolicyImpl implements DescriptorError_Policy { + const _$DescriptorError_PolicyImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'DescriptorError.policy(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptorError_PolicyImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DescriptorError_PolicyImplCopyWith<_$DescriptorError_PolicyImpl> + get copyWith => __$$DescriptorError_PolicyImplCopyWithImpl< + _$DescriptorError_PolicyImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) { + return policy(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) { + return policy?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) { + if (policy != null) { + return policy(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) { + return policy(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) { + return policy?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) { + if (policy != null) { + return policy(this); + } + return orElse(); + } +} + +abstract class DescriptorError_Policy implements DescriptorError { + const factory DescriptorError_Policy(final String field0) = + _$DescriptorError_PolicyImpl; + + String get field0; + @JsonKey(ignore: true) + _$$DescriptorError_PolicyImplCopyWith<_$DescriptorError_PolicyImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$DescriptorError_InvalidDescriptorCharacterImplCopyWith<$Res> { + factory _$$DescriptorError_InvalidDescriptorCharacterImplCopyWith( + _$DescriptorError_InvalidDescriptorCharacterImpl value, + $Res Function(_$DescriptorError_InvalidDescriptorCharacterImpl) + then) = + __$$DescriptorError_InvalidDescriptorCharacterImplCopyWithImpl<$Res>; + @useResult + $Res call({int field0}); +} + +/// @nodoc +class __$$DescriptorError_InvalidDescriptorCharacterImplCopyWithImpl<$Res> + extends _$DescriptorErrorCopyWithImpl<$Res, + _$DescriptorError_InvalidDescriptorCharacterImpl> + implements _$$DescriptorError_InvalidDescriptorCharacterImplCopyWith<$Res> { + __$$DescriptorError_InvalidDescriptorCharacterImplCopyWithImpl( + _$DescriptorError_InvalidDescriptorCharacterImpl _value, + $Res Function(_$DescriptorError_InvalidDescriptorCharacterImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$DescriptorError_InvalidDescriptorCharacterImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$DescriptorError_InvalidDescriptorCharacterImpl + implements DescriptorError_InvalidDescriptorCharacter { + const _$DescriptorError_InvalidDescriptorCharacterImpl(this.field0); + + @override + final int field0; + + @override + String toString() { + return 'DescriptorError.invalidDescriptorCharacter(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptorError_InvalidDescriptorCharacterImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DescriptorError_InvalidDescriptorCharacterImplCopyWith< + _$DescriptorError_InvalidDescriptorCharacterImpl> + get copyWith => + __$$DescriptorError_InvalidDescriptorCharacterImplCopyWithImpl< + _$DescriptorError_InvalidDescriptorCharacterImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) { + return invalidDescriptorCharacter(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) { + return invalidDescriptorCharacter?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) { + if (invalidDescriptorCharacter != null) { + return invalidDescriptorCharacter(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) { + return invalidDescriptorCharacter(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) { + return invalidDescriptorCharacter?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) { + if (invalidDescriptorCharacter != null) { + return invalidDescriptorCharacter(this); + } + return orElse(); + } +} + +abstract class DescriptorError_InvalidDescriptorCharacter + implements DescriptorError { + const factory DescriptorError_InvalidDescriptorCharacter(final int field0) = + _$DescriptorError_InvalidDescriptorCharacterImpl; + + int get field0; + @JsonKey(ignore: true) + _$$DescriptorError_InvalidDescriptorCharacterImplCopyWith< + _$DescriptorError_InvalidDescriptorCharacterImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$DescriptorError_Bip32ImplCopyWith<$Res> { + factory _$$DescriptorError_Bip32ImplCopyWith( + _$DescriptorError_Bip32Impl value, + $Res Function(_$DescriptorError_Bip32Impl) then) = + __$$DescriptorError_Bip32ImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$DescriptorError_Bip32ImplCopyWithImpl<$Res> + extends _$DescriptorErrorCopyWithImpl<$Res, _$DescriptorError_Bip32Impl> + implements _$$DescriptorError_Bip32ImplCopyWith<$Res> { + __$$DescriptorError_Bip32ImplCopyWithImpl(_$DescriptorError_Bip32Impl _value, + $Res Function(_$DescriptorError_Bip32Impl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$DescriptorError_Bip32Impl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$DescriptorError_Bip32Impl implements DescriptorError_Bip32 { + const _$DescriptorError_Bip32Impl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'DescriptorError.bip32(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptorError_Bip32Impl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DescriptorError_Bip32ImplCopyWith<_$DescriptorError_Bip32Impl> + get copyWith => __$$DescriptorError_Bip32ImplCopyWithImpl< + _$DescriptorError_Bip32Impl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) { + return bip32(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) { + return bip32?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) { + if (bip32 != null) { + return bip32(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) { + return bip32(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) { + return bip32?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) { + if (bip32 != null) { + return bip32(this); + } + return orElse(); + } +} + +abstract class DescriptorError_Bip32 implements DescriptorError { + const factory DescriptorError_Bip32(final String field0) = + _$DescriptorError_Bip32Impl; + + String get field0; + @JsonKey(ignore: true) + _$$DescriptorError_Bip32ImplCopyWith<_$DescriptorError_Bip32Impl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$DescriptorError_Base58ImplCopyWith<$Res> { + factory _$$DescriptorError_Base58ImplCopyWith( + _$DescriptorError_Base58Impl value, + $Res Function(_$DescriptorError_Base58Impl) then) = + __$$DescriptorError_Base58ImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$DescriptorError_Base58ImplCopyWithImpl<$Res> + extends _$DescriptorErrorCopyWithImpl<$Res, _$DescriptorError_Base58Impl> + implements _$$DescriptorError_Base58ImplCopyWith<$Res> { + __$$DescriptorError_Base58ImplCopyWithImpl( + _$DescriptorError_Base58Impl _value, + $Res Function(_$DescriptorError_Base58Impl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$DescriptorError_Base58Impl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$DescriptorError_Base58Impl implements DescriptorError_Base58 { + const _$DescriptorError_Base58Impl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'DescriptorError.base58(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptorError_Base58Impl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DescriptorError_Base58ImplCopyWith<_$DescriptorError_Base58Impl> + get copyWith => __$$DescriptorError_Base58ImplCopyWithImpl< + _$DescriptorError_Base58Impl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) { + return base58(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) { + return base58?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) { + if (base58 != null) { + return base58(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) { + return base58(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) { + return base58?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) { + if (base58 != null) { + return base58(this); + } + return orElse(); + } +} + +abstract class DescriptorError_Base58 implements DescriptorError { + const factory DescriptorError_Base58(final String field0) = + _$DescriptorError_Base58Impl; + + String get field0; + @JsonKey(ignore: true) + _$$DescriptorError_Base58ImplCopyWith<_$DescriptorError_Base58Impl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$DescriptorError_PkImplCopyWith<$Res> { + factory _$$DescriptorError_PkImplCopyWith(_$DescriptorError_PkImpl value, + $Res Function(_$DescriptorError_PkImpl) then) = + __$$DescriptorError_PkImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$DescriptorError_PkImplCopyWithImpl<$Res> + extends _$DescriptorErrorCopyWithImpl<$Res, _$DescriptorError_PkImpl> + implements _$$DescriptorError_PkImplCopyWith<$Res> { + __$$DescriptorError_PkImplCopyWithImpl(_$DescriptorError_PkImpl _value, + $Res Function(_$DescriptorError_PkImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$DescriptorError_PkImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$DescriptorError_PkImpl implements DescriptorError_Pk { + const _$DescriptorError_PkImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'DescriptorError.pk(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptorError_PkImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DescriptorError_PkImplCopyWith<_$DescriptorError_PkImpl> get copyWith => + __$$DescriptorError_PkImplCopyWithImpl<_$DescriptorError_PkImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) { + return pk(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) { + return pk?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) { + if (pk != null) { + return pk(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) { + return pk(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) { + return pk?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) { + if (pk != null) { + return pk(this); + } + return orElse(); + } +} + +abstract class DescriptorError_Pk implements DescriptorError { + const factory DescriptorError_Pk(final String field0) = + _$DescriptorError_PkImpl; + + String get field0; + @JsonKey(ignore: true) + _$$DescriptorError_PkImplCopyWith<_$DescriptorError_PkImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$DescriptorError_MiniscriptImplCopyWith<$Res> { + factory _$$DescriptorError_MiniscriptImplCopyWith( + _$DescriptorError_MiniscriptImpl value, + $Res Function(_$DescriptorError_MiniscriptImpl) then) = + __$$DescriptorError_MiniscriptImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$DescriptorError_MiniscriptImplCopyWithImpl<$Res> + extends _$DescriptorErrorCopyWithImpl<$Res, + _$DescriptorError_MiniscriptImpl> + implements _$$DescriptorError_MiniscriptImplCopyWith<$Res> { + __$$DescriptorError_MiniscriptImplCopyWithImpl( + _$DescriptorError_MiniscriptImpl _value, + $Res Function(_$DescriptorError_MiniscriptImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$DescriptorError_MiniscriptImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$DescriptorError_MiniscriptImpl implements DescriptorError_Miniscript { + const _$DescriptorError_MiniscriptImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'DescriptorError.miniscript(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptorError_MiniscriptImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DescriptorError_MiniscriptImplCopyWith<_$DescriptorError_MiniscriptImpl> + get copyWith => __$$DescriptorError_MiniscriptImplCopyWithImpl< + _$DescriptorError_MiniscriptImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) { + return miniscript(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) { + return miniscript?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) { + if (miniscript != null) { + return miniscript(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) { + return miniscript(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) { + return miniscript?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) { + if (miniscript != null) { + return miniscript(this); + } + return orElse(); + } +} + +abstract class DescriptorError_Miniscript implements DescriptorError { + const factory DescriptorError_Miniscript(final String field0) = + _$DescriptorError_MiniscriptImpl; + + String get field0; + @JsonKey(ignore: true) + _$$DescriptorError_MiniscriptImplCopyWith<_$DescriptorError_MiniscriptImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$DescriptorError_HexImplCopyWith<$Res> { + factory _$$DescriptorError_HexImplCopyWith(_$DescriptorError_HexImpl value, + $Res Function(_$DescriptorError_HexImpl) then) = + __$$DescriptorError_HexImplCopyWithImpl<$Res>; + @useResult + $Res call({String field0}); +} + +/// @nodoc +class __$$DescriptorError_HexImplCopyWithImpl<$Res> + extends _$DescriptorErrorCopyWithImpl<$Res, _$DescriptorError_HexImpl> + implements _$$DescriptorError_HexImplCopyWith<$Res> { + __$$DescriptorError_HexImplCopyWithImpl(_$DescriptorError_HexImpl _value, + $Res Function(_$DescriptorError_HexImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$DescriptorError_HexImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$DescriptorError_HexImpl implements DescriptorError_Hex { + const _$DescriptorError_HexImpl(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'DescriptorError.hex(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptorError_HexImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DescriptorError_HexImplCopyWith<_$DescriptorError_HexImpl> get copyWith => + __$$DescriptorError_HexImplCopyWithImpl<_$DescriptorError_HexImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() invalidHdKeyPath, + required TResult Function() invalidDescriptorChecksum, + required TResult Function() hardenedDerivationXpub, + required TResult Function() multiPath, + required TResult Function(String field0) key, + required TResult Function(String field0) policy, + required TResult Function(int field0) invalidDescriptorCharacter, + required TResult Function(String field0) bip32, + required TResult Function(String field0) base58, + required TResult Function(String field0) pk, + required TResult Function(String field0) miniscript, + required TResult Function(String field0) hex, + }) { + return hex(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? invalidHdKeyPath, + TResult? Function()? invalidDescriptorChecksum, + TResult? Function()? hardenedDerivationXpub, + TResult? Function()? multiPath, + TResult? Function(String field0)? key, + TResult? Function(String field0)? policy, + TResult? Function(int field0)? invalidDescriptorCharacter, + TResult? Function(String field0)? bip32, + TResult? Function(String field0)? base58, + TResult? Function(String field0)? pk, + TResult? Function(String field0)? miniscript, + TResult? Function(String field0)? hex, + }) { + return hex?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? invalidHdKeyPath, + TResult Function()? invalidDescriptorChecksum, + TResult Function()? hardenedDerivationXpub, + TResult Function()? multiPath, + TResult Function(String field0)? key, + TResult Function(String field0)? policy, + TResult Function(int field0)? invalidDescriptorCharacter, + TResult Function(String field0)? bip32, + TResult Function(String field0)? base58, + TResult Function(String field0)? pk, + TResult Function(String field0)? miniscript, + TResult Function(String field0)? hex, + required TResult orElse(), + }) { + if (hex != null) { + return hex(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DescriptorError_InvalidHdKeyPath value) + invalidHdKeyPath, + required TResult Function(DescriptorError_InvalidDescriptorChecksum value) + invalidDescriptorChecksum, + required TResult Function(DescriptorError_HardenedDerivationXpub value) + hardenedDerivationXpub, + required TResult Function(DescriptorError_MultiPath value) multiPath, + required TResult Function(DescriptorError_Key value) key, + required TResult Function(DescriptorError_Policy value) policy, + required TResult Function(DescriptorError_InvalidDescriptorCharacter value) + invalidDescriptorCharacter, + required TResult Function(DescriptorError_Bip32 value) bip32, + required TResult Function(DescriptorError_Base58 value) base58, + required TResult Function(DescriptorError_Pk value) pk, + required TResult Function(DescriptorError_Miniscript value) miniscript, + required TResult Function(DescriptorError_Hex value) hex, + }) { + return hex(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult? Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult? Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult? Function(DescriptorError_MultiPath value)? multiPath, + TResult? Function(DescriptorError_Key value)? key, + TResult? Function(DescriptorError_Policy value)? policy, + TResult? Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult? Function(DescriptorError_Bip32 value)? bip32, + TResult? Function(DescriptorError_Base58 value)? base58, + TResult? Function(DescriptorError_Pk value)? pk, + TResult? Function(DescriptorError_Miniscript value)? miniscript, + TResult? Function(DescriptorError_Hex value)? hex, + }) { + return hex?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DescriptorError_InvalidHdKeyPath value)? invalidHdKeyPath, + TResult Function(DescriptorError_InvalidDescriptorChecksum value)? + invalidDescriptorChecksum, + TResult Function(DescriptorError_HardenedDerivationXpub value)? + hardenedDerivationXpub, + TResult Function(DescriptorError_MultiPath value)? multiPath, + TResult Function(DescriptorError_Key value)? key, + TResult Function(DescriptorError_Policy value)? policy, + TResult Function(DescriptorError_InvalidDescriptorCharacter value)? + invalidDescriptorCharacter, + TResult Function(DescriptorError_Bip32 value)? bip32, + TResult Function(DescriptorError_Base58 value)? base58, + TResult Function(DescriptorError_Pk value)? pk, + TResult Function(DescriptorError_Miniscript value)? miniscript, + TResult Function(DescriptorError_Hex value)? hex, + required TResult orElse(), + }) { + if (hex != null) { + return hex(this); + } + return orElse(); + } +} + +abstract class DescriptorError_Hex implements DescriptorError { + const factory DescriptorError_Hex(final String field0) = + _$DescriptorError_HexImpl; + + String get field0; + @JsonKey(ignore: true) + _$$DescriptorError_HexImplCopyWith<_$DescriptorError_HexImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$HexError { + int get field0 => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(int field0) invalidChar, + required TResult Function(int field0) oddLengthString, + required TResult Function(int field0, int field1) invalidLength, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int field0)? invalidChar, + TResult? Function(int field0)? oddLengthString, + TResult? Function(int field0, int field1)? invalidLength, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int field0)? invalidChar, + TResult Function(int field0)? oddLengthString, + TResult Function(int field0, int field1)? invalidLength, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(HexError_InvalidChar value) invalidChar, + required TResult Function(HexError_OddLengthString value) oddLengthString, + required TResult Function(HexError_InvalidLength value) invalidLength, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(HexError_InvalidChar value)? invalidChar, + TResult? Function(HexError_OddLengthString value)? oddLengthString, + TResult? Function(HexError_InvalidLength value)? invalidLength, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(HexError_InvalidChar value)? invalidChar, + TResult Function(HexError_OddLengthString value)? oddLengthString, + TResult Function(HexError_InvalidLength value)? invalidLength, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $HexErrorCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $HexErrorCopyWith<$Res> { + factory $HexErrorCopyWith(HexError value, $Res Function(HexError) then) = + _$HexErrorCopyWithImpl<$Res, HexError>; + @useResult + $Res call({int field0}); +} + +/// @nodoc +class _$HexErrorCopyWithImpl<$Res, $Val extends HexError> + implements $HexErrorCopyWith<$Res> { + _$HexErrorCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_value.copyWith( + field0: null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$HexError_InvalidCharImplCopyWith<$Res> + implements $HexErrorCopyWith<$Res> { + factory _$$HexError_InvalidCharImplCopyWith(_$HexError_InvalidCharImpl value, + $Res Function(_$HexError_InvalidCharImpl) then) = + __$$HexError_InvalidCharImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({int field0}); +} + +/// @nodoc +class __$$HexError_InvalidCharImplCopyWithImpl<$Res> + extends _$HexErrorCopyWithImpl<$Res, _$HexError_InvalidCharImpl> + implements _$$HexError_InvalidCharImplCopyWith<$Res> { + __$$HexError_InvalidCharImplCopyWithImpl(_$HexError_InvalidCharImpl _value, + $Res Function(_$HexError_InvalidCharImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$HexError_InvalidCharImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$HexError_InvalidCharImpl implements HexError_InvalidChar { + const _$HexError_InvalidCharImpl(this.field0); + + @override + final int field0; + + @override + String toString() { + return 'HexError.invalidChar(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$HexError_InvalidCharImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$HexError_InvalidCharImplCopyWith<_$HexError_InvalidCharImpl> + get copyWith => + __$$HexError_InvalidCharImplCopyWithImpl<_$HexError_InvalidCharImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(int field0) invalidChar, + required TResult Function(int field0) oddLengthString, + required TResult Function(int field0, int field1) invalidLength, + }) { + return invalidChar(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int field0)? invalidChar, + TResult? Function(int field0)? oddLengthString, + TResult? Function(int field0, int field1)? invalidLength, + }) { + return invalidChar?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int field0)? invalidChar, + TResult Function(int field0)? oddLengthString, + TResult Function(int field0, int field1)? invalidLength, + required TResult orElse(), + }) { + if (invalidChar != null) { + return invalidChar(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(HexError_InvalidChar value) invalidChar, + required TResult Function(HexError_OddLengthString value) oddLengthString, + required TResult Function(HexError_InvalidLength value) invalidLength, + }) { + return invalidChar(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(HexError_InvalidChar value)? invalidChar, + TResult? Function(HexError_OddLengthString value)? oddLengthString, + TResult? Function(HexError_InvalidLength value)? invalidLength, + }) { + return invalidChar?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(HexError_InvalidChar value)? invalidChar, + TResult Function(HexError_OddLengthString value)? oddLengthString, + TResult Function(HexError_InvalidLength value)? invalidLength, + required TResult orElse(), + }) { + if (invalidChar != null) { + return invalidChar(this); + } + return orElse(); + } +} + +abstract class HexError_InvalidChar implements HexError { + const factory HexError_InvalidChar(final int field0) = + _$HexError_InvalidCharImpl; + + @override + int get field0; + @override + @JsonKey(ignore: true) + _$$HexError_InvalidCharImplCopyWith<_$HexError_InvalidCharImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$HexError_OddLengthStringImplCopyWith<$Res> + implements $HexErrorCopyWith<$Res> { + factory _$$HexError_OddLengthStringImplCopyWith( + _$HexError_OddLengthStringImpl value, + $Res Function(_$HexError_OddLengthStringImpl) then) = + __$$HexError_OddLengthStringImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({int field0}); +} + +/// @nodoc +class __$$HexError_OddLengthStringImplCopyWithImpl<$Res> + extends _$HexErrorCopyWithImpl<$Res, _$HexError_OddLengthStringImpl> + implements _$$HexError_OddLengthStringImplCopyWith<$Res> { + __$$HexError_OddLengthStringImplCopyWithImpl( + _$HexError_OddLengthStringImpl _value, + $Res Function(_$HexError_OddLengthStringImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$HexError_OddLengthStringImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$HexError_OddLengthStringImpl implements HexError_OddLengthString { + const _$HexError_OddLengthStringImpl(this.field0); + + @override + final int field0; + + @override + String toString() { + return 'HexError.oddLengthString(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$HexError_OddLengthStringImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$HexError_OddLengthStringImplCopyWith<_$HexError_OddLengthStringImpl> + get copyWith => __$$HexError_OddLengthStringImplCopyWithImpl< + _$HexError_OddLengthStringImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(int field0) invalidChar, + required TResult Function(int field0) oddLengthString, + required TResult Function(int field0, int field1) invalidLength, + }) { + return oddLengthString(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int field0)? invalidChar, + TResult? Function(int field0)? oddLengthString, + TResult? Function(int field0, int field1)? invalidLength, + }) { + return oddLengthString?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int field0)? invalidChar, + TResult Function(int field0)? oddLengthString, + TResult Function(int field0, int field1)? invalidLength, + required TResult orElse(), + }) { + if (oddLengthString != null) { + return oddLengthString(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(HexError_InvalidChar value) invalidChar, + required TResult Function(HexError_OddLengthString value) oddLengthString, + required TResult Function(HexError_InvalidLength value) invalidLength, + }) { + return oddLengthString(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(HexError_InvalidChar value)? invalidChar, + TResult? Function(HexError_OddLengthString value)? oddLengthString, + TResult? Function(HexError_InvalidLength value)? invalidLength, + }) { + return oddLengthString?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(HexError_InvalidChar value)? invalidChar, + TResult Function(HexError_OddLengthString value)? oddLengthString, + TResult Function(HexError_InvalidLength value)? invalidLength, + required TResult orElse(), + }) { + if (oddLengthString != null) { + return oddLengthString(this); + } + return orElse(); + } +} + +abstract class HexError_OddLengthString implements HexError { + const factory HexError_OddLengthString(final int field0) = + _$HexError_OddLengthStringImpl; + + @override + int get field0; + @override + @JsonKey(ignore: true) + _$$HexError_OddLengthStringImplCopyWith<_$HexError_OddLengthStringImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$HexError_InvalidLengthImplCopyWith<$Res> + implements $HexErrorCopyWith<$Res> { + factory _$$HexError_InvalidLengthImplCopyWith( + _$HexError_InvalidLengthImpl value, + $Res Function(_$HexError_InvalidLengthImpl) then) = + __$$HexError_InvalidLengthImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({int field0, int field1}); +} + +/// @nodoc +class __$$HexError_InvalidLengthImplCopyWithImpl<$Res> + extends _$HexErrorCopyWithImpl<$Res, _$HexError_InvalidLengthImpl> + implements _$$HexError_InvalidLengthImplCopyWith<$Res> { + __$$HexError_InvalidLengthImplCopyWithImpl( + _$HexError_InvalidLengthImpl _value, + $Res Function(_$HexError_InvalidLengthImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + Object? field1 = null, + }) { + return _then(_$HexError_InvalidLengthImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as int, + null == field1 + ? _value.field1 + : field1 // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$HexError_InvalidLengthImpl implements HexError_InvalidLength { + const _$HexError_InvalidLengthImpl(this.field0, this.field1); + + @override + final int field0; + @override + final int field1; + + @override + String toString() { + return 'HexError.invalidLength(field0: $field0, field1: $field1)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$HexError_InvalidLengthImpl && + (identical(other.field0, field0) || other.field0 == field0) && + (identical(other.field1, field1) || other.field1 == field1)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0, field1); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$HexError_InvalidLengthImplCopyWith<_$HexError_InvalidLengthImpl> + get copyWith => __$$HexError_InvalidLengthImplCopyWithImpl< + _$HexError_InvalidLengthImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(int field0) invalidChar, + required TResult Function(int field0) oddLengthString, + required TResult Function(int field0, int field1) invalidLength, + }) { + return invalidLength(field0, field1); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int field0)? invalidChar, + TResult? Function(int field0)? oddLengthString, + TResult? Function(int field0, int field1)? invalidLength, + }) { + return invalidLength?.call(field0, field1); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int field0)? invalidChar, + TResult Function(int field0)? oddLengthString, + TResult Function(int field0, int field1)? invalidLength, + required TResult orElse(), + }) { + if (invalidLength != null) { + return invalidLength(field0, field1); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(HexError_InvalidChar value) invalidChar, + required TResult Function(HexError_OddLengthString value) oddLengthString, + required TResult Function(HexError_InvalidLength value) invalidLength, + }) { + return invalidLength(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(HexError_InvalidChar value)? invalidChar, + TResult? Function(HexError_OddLengthString value)? oddLengthString, + TResult? Function(HexError_InvalidLength value)? invalidLength, + }) { + return invalidLength?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(HexError_InvalidChar value)? invalidChar, + TResult Function(HexError_OddLengthString value)? oddLengthString, + TResult Function(HexError_InvalidLength value)? invalidLength, + required TResult orElse(), + }) { + if (invalidLength != null) { + return invalidLength(this); + } + return orElse(); + } +} + +abstract class HexError_InvalidLength implements HexError { + const factory HexError_InvalidLength(final int field0, final int field1) = + _$HexError_InvalidLengthImpl; + + @override + int get field0; + int get field1; + @override + @JsonKey(ignore: true) + _$$HexError_InvalidLengthImplCopyWith<_$HexError_InvalidLengthImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/generated/api/key.dart b/lib/src/generated/api/key.dart new file mode 100644 index 00000000..24dce7e8 --- /dev/null +++ b/lib/src/generated/api/key.dart @@ -0,0 +1,217 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.28. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../frb_generated.dart'; +import 'blockchain.dart'; +import 'descriptor.dart'; +import 'error.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +import 'types.dart'; + +// Rust type: RustOpaqueNom +@sealed +class BitcoinBip32DerivationPath extends RustOpaque { + BitcoinBip32DerivationPath.dcoDecode(List wire) + : super.dcoDecode(wire, _kStaticData); + + BitcoinBip32DerivationPath.sseDecode(int ptr, int externalSizeOnNative) + : super.sseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: BdkCore.instance.api + .rust_arc_increment_strong_count_BitcoinBip32DerivationPath, + rustArcDecrementStrongCount: BdkCore.instance.api + .rust_arc_decrement_strong_count_BitcoinBip32DerivationPath, + rustArcDecrementStrongCountPtr: BdkCore.instance.api + .rust_arc_decrement_strong_count_BitcoinBip32DerivationPathPtr, + ); +} + +// Rust type: RustOpaqueNom +@sealed +class KeysBip39Mnemonic extends RustOpaque { + KeysBip39Mnemonic.dcoDecode(List wire) + : super.dcoDecode(wire, _kStaticData); + + KeysBip39Mnemonic.sseDecode(int ptr, int externalSizeOnNative) + : super.sseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + BdkCore.instance.api.rust_arc_increment_strong_count_KeysBip39Mnemonic, + rustArcDecrementStrongCount: + BdkCore.instance.api.rust_arc_decrement_strong_count_KeysBip39Mnemonic, + rustArcDecrementStrongCountPtr: BdkCore + .instance.api.rust_arc_decrement_strong_count_KeysBip39MnemonicPtr, + ); +} + +class DerivationPathBase { + final BitcoinBip32DerivationPath ptr; + + const DerivationPathBase({ + required this.ptr, + }); + + static Future fromString( + {required String path, dynamic hint}) => + BdkCore.instance.api.derivationPathBaseFromString(path: path, hint: hint); + + @override + int get hashCode => ptr.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is DerivationPathBase && + runtimeType == other.runtimeType && + ptr == other.ptr; +} + +class DescriptorPublicKeyBase { + final KeysDescriptorPublicKey ptr; + + const DescriptorPublicKeyBase({ + required this.ptr, + }); + + Future asString({dynamic hint}) => + BdkCore.instance.api.descriptorPublicKeyBaseAsString( + that: this, + ); + + static Future derive( + {required DescriptorPublicKeyBase ptr, + required DerivationPathBase path, + dynamic hint}) => + BdkCore.instance.api + .descriptorPublicKeyBaseDerive(ptr: ptr, path: path, hint: hint); + + static Future extend( + {required DescriptorPublicKeyBase ptr, + required DerivationPathBase path, + dynamic hint}) => + BdkCore.instance.api + .descriptorPublicKeyBaseExtend(ptr: ptr, path: path, hint: hint); + + static Future fromString( + {required String publicKey, dynamic hint}) => + BdkCore.instance.api + .descriptorPublicKeyBaseFromString(publicKey: publicKey, hint: hint); + + @override + int get hashCode => ptr.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is DescriptorPublicKeyBase && + runtimeType == other.runtimeType && + ptr == other.ptr; +} + +class DescriptorSecretKeyBase { + final KeysDescriptorSecretKey ptr; + + const DescriptorSecretKeyBase({ + required this.ptr, + }); + + static Future asPublic( + {required DescriptorSecretKeyBase ptr, dynamic hint}) => + BdkCore.instance.api + .descriptorSecretKeyBaseAsPublic(ptr: ptr, hint: hint); + + Future asString({dynamic hint}) => + BdkCore.instance.api.descriptorSecretKeyBaseAsString( + that: this, + ); + + static Future create( + {required Network network, + required MnemonicBase mnemonic, + String? password, + dynamic hint}) => + BdkCore.instance.api.descriptorSecretKeyBaseCreate( + network: network, mnemonic: mnemonic, password: password, hint: hint); + + static Future derive( + {required DescriptorSecretKeyBase ptr, + required DerivationPathBase path, + dynamic hint}) => + BdkCore.instance.api + .descriptorSecretKeyBaseDerive(ptr: ptr, path: path, hint: hint); + + static Future extend( + {required DescriptorSecretKeyBase ptr, + required DerivationPathBase path, + dynamic hint}) => + BdkCore.instance.api + .descriptorSecretKeyBaseExtend(ptr: ptr, path: path, hint: hint); + + static Future fromString( + {required String secretKey, dynamic hint}) => + BdkCore.instance.api + .descriptorSecretKeyBaseFromString(secretKey: secretKey, hint: hint); + + /// Get the private key as bytes. + Future secretBytes({dynamic hint}) => + BdkCore.instance.api.descriptorSecretKeyBaseSecretBytes( + that: this, + ); + + @override + int get hashCode => ptr.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is DescriptorSecretKeyBase && + runtimeType == other.runtimeType && + ptr == other.ptr; +} + +class MnemonicBase { + final KeysBip39Mnemonic ptr; + + const MnemonicBase({ + required this.ptr, + }); + + /// Returns Mnemonic as string + Future asString({dynamic hint}) => + BdkCore.instance.api.mnemonicBaseAsString( + that: this, + ); + + /// Create a new Mnemonic in the specified language from the given entropy. + /// Entropy must be a multiple of 32 bits (4 bytes) and 128-256 bits in length. + static Future fromEntropy( + {required List entropy, dynamic hint}) => + BdkCore.instance.api + .mnemonicBaseFromEntropy(entropy: entropy, hint: hint); + + /// Parse a Mnemonic with given string + static Future fromString( + {required String mnemonic, dynamic hint}) => + BdkCore.instance.api + .mnemonicBaseFromString(mnemonic: mnemonic, hint: hint); + + // HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class. + /// Generates Mnemonic with a random entropy + static Future newInstance( + {required WordCount wordCount, dynamic hint}) => + BdkCore.instance.api.mnemonicBaseNew(wordCount: wordCount, hint: hint); + + @override + int get hashCode => ptr.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is MnemonicBase && + runtimeType == other.runtimeType && + ptr == other.ptr; +} diff --git a/lib/src/generated/api/psbt.dart b/lib/src/generated/api/psbt.dart new file mode 100644 index 00000000..3b2286a6 --- /dev/null +++ b/lib/src/generated/api/psbt.dart @@ -0,0 +1,91 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.28. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../frb_generated.dart'; +import 'blockchain.dart'; +import 'error.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +import 'types.dart'; + +// Rust type: RustOpaqueNom> +@sealed +class MutexPartiallySignedTransaction extends RustOpaque { + MutexPartiallySignedTransaction.dcoDecode(List wire) + : super.dcoDecode(wire, _kStaticData); + + MutexPartiallySignedTransaction.sseDecode(int ptr, int externalSizeOnNative) + : super.sseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: BdkCore.instance.api + .rust_arc_increment_strong_count_MutexPartiallySignedTransaction, + rustArcDecrementStrongCount: BdkCore.instance.api + .rust_arc_decrement_strong_count_MutexPartiallySignedTransaction, + rustArcDecrementStrongCountPtr: BdkCore.instance.api + .rust_arc_decrement_strong_count_MutexPartiallySignedTransactionPtr, + ); +} + +class PsbtBase { + final MutexPartiallySignedTransaction ptr; + + const PsbtBase({ + required this.ptr, + }); + + /// Combines this PartiallySignedTransaction with other PSBT as described by BIP 174. + /// + /// In accordance with BIP 174 this function is commutative i.e., `A.combine(B) == B.combine(A)` + static Future combine( + {required PsbtBase ptr, required PsbtBase other, dynamic hint}) => + BdkCore.instance.api.psbtBaseCombine(ptr: ptr, other: other, hint: hint); + + /// Return the transaction. + static Future extractTx( + {required PsbtBase ptr, dynamic hint}) => + BdkCore.instance.api.psbtBaseExtractTx(ptr: ptr, hint: hint); + + /// The total transaction fee amount, sum of input amounts minus sum of output amounts, in Sats. + /// If the PSBT is missing a TxOut for an input returns None. + Future feeAmount({dynamic hint}) => + BdkCore.instance.api.psbtBaseFeeAmount( + that: this, + ); + + /// The transaction's fee rate. This value will only be accurate if calculated AFTER the + /// `PartiallySignedTransaction` is finalized and all witness/signature data is added to the + /// transaction. + /// If the PSBT is missing a TxOut for an input returns None. + Future feeRate({dynamic hint}) => + BdkCore.instance.api.psbtBaseFeeRate( + that: this, + ); + + static Future fromStr({required String psbtBase64, dynamic hint}) => + BdkCore.instance.api.psbtBaseFromStr(psbtBase64: psbtBase64, hint: hint); + + /// Serialize the PSBT data structure as a String of JSON. + Future jsonSerialize({dynamic hint}) => + BdkCore.instance.api.psbtBaseJsonSerialize( + that: this, + ); + + Future serialize({dynamic hint}) => + BdkCore.instance.api.psbtBaseSerialize( + that: this, + ); + + Future txid({dynamic hint}) => BdkCore.instance.api.psbtBaseTxid( + that: this, + ); + + @override + int get hashCode => ptr.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is PsbtBase && runtimeType == other.runtimeType && ptr == other.ptr; +} diff --git a/lib/src/generated/api/types.dart b/lib/src/generated/api/types.dart new file mode 100644 index 00000000..baf866ea --- /dev/null +++ b/lib/src/generated/api/types.dart @@ -0,0 +1,872 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.28. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../frb_generated.dart'; +import 'blockchain.dart'; +import 'error.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +import 'package:freezed_annotation/freezed_annotation.dart' hide protected; +part 'types.freezed.dart'; + +// Rust type: RustOpaqueNom +@sealed +class BdkBitcoinAddress extends RustOpaque { + BdkBitcoinAddress.dcoDecode(List wire) + : super.dcoDecode(wire, _kStaticData); + + BdkBitcoinAddress.sseDecode(int ptr, int externalSizeOnNative) + : super.sseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + BdkCore.instance.api.rust_arc_increment_strong_count_BdkBitcoinAddress, + rustArcDecrementStrongCount: + BdkCore.instance.api.rust_arc_decrement_strong_count_BdkBitcoinAddress, + rustArcDecrementStrongCountPtr: BdkCore + .instance.api.rust_arc_decrement_strong_count_BdkBitcoinAddressPtr, + ); +} + +class AddressBase { + final BdkBitcoinAddress ptr; + + const AddressBase({ + required this.ptr, + }); + + Future asString({dynamic hint}) => + BdkCore.instance.api.addressBaseAsString( + that: this, + ); + + static Future fromScript( + {required ScriptBufBase script, + required Network network, + dynamic hint}) => + BdkCore.instance.api + .addressBaseFromScript(script: script, network: network, hint: hint); + + static Future fromString( + {required String address, required Network network, dynamic hint}) => + BdkCore.instance.api.addressBaseFromString( + address: address, network: network, hint: hint); + + Future isValidForNetwork({required Network network, dynamic hint}) => + BdkCore.instance.api.addressBaseIsValidForNetwork( + that: this, + network: network, + ); + + ///The network on which this address is usable. + Future network({dynamic hint}) => + BdkCore.instance.api.addressBaseNetwork( + that: this, + ); + + Future payload({dynamic hint}) => + BdkCore.instance.api.addressBasePayload( + that: this, + ); + + static Future script( + {required AddressBase ptr, dynamic hint}) => + BdkCore.instance.api.addressBaseScript(ptr: ptr, hint: hint); + + ///Creates a URI string bitcoin:address optimized to be encoded in QR codes. + Future toQrUri({dynamic hint}) => + BdkCore.instance.api.addressBaseToQrUri( + that: this, + ); + + @override + int get hashCode => ptr.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AddressBase && + runtimeType == other.runtimeType && + ptr == other.ptr; +} + +@freezed +sealed class AddressIndex with _$AddressIndex { + ///Return a new address after incrementing the current descriptor index. + const factory AddressIndex.increase() = AddressIndex_Increase; + + ///Return the address for the current descriptor index if it has not been used in a received transaction. Otherwise return a new address as with AddressIndex.New. + ///Use with caution, if the wallet has not yet detected an address has been used it could return an already used address. This function is primarily meant for situations where the caller is untrusted; for example when deriving donation addresses on-demand for a public web page. + const factory AddressIndex.lastUnused() = AddressIndex_LastUnused; + + /// Return the address for a specific descriptor index. Does not change the current descriptor + /// index used by `AddressIndex` and `AddressIndex.LastUsed`. + /// Use with caution, if an index is given that is less than the current descriptor index + /// then the returned address may have already been used. + const factory AddressIndex.peek({ + required int index, + }) = AddressIndex_Peek; + + /// Return the address for a specific descriptor index and reset the current descriptor index + /// used by `AddressIndex` and `AddressIndex.LastUsed` to this value. + /// Use with caution, if an index is given that is less than the current descriptor index + /// then the returned address and subsequent addresses returned by calls to `AddressIndex` + /// and `AddressIndex.LastUsed` may have already been used. Also if the index is reset to a + /// value earlier than the Blockchain stopGap (default is 20) then a + /// larger stopGap should be used to monitor for all possibly used addresses. + const factory AddressIndex.reset({ + required int index, + }) = AddressIndex_Reset; +} + +///A derived address and the index it was found at For convenience this automatically derefs to Address +class AddressInfo { + ///Child index of this address + final int index; + + /// Address + final String address; + + const AddressInfo({ + required this.index, + required this.address, + }); + + @override + int get hashCode => index.hashCode ^ address.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AddressInfo && + runtimeType == other.runtimeType && + index == other.index && + address == other.address; +} + +/// Local Wallet's Balance +class Balance { + final int immature; + + /// Unconfirmed UTXOs generated by a wallet tx + final int trustedPending; + + /// Unconfirmed UTXOs received from an external wallet + final int untrustedPending; + + /// Confirmed and immediately spendable balance + final int confirmed; + + /// Get sum of trusted_pending and confirmed coins + final int spendable; + + /// Get the whole balance visible to the wallet + final int total; + + const Balance({ + required this.immature, + required this.trustedPending, + required this.untrustedPending, + required this.confirmed, + required this.spendable, + required this.total, + }); + + @override + int get hashCode => + immature.hashCode ^ + trustedPending.hashCode ^ + untrustedPending.hashCode ^ + confirmed.hashCode ^ + spendable.hashCode ^ + total.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Balance && + runtimeType == other.runtimeType && + immature == other.immature && + trustedPending == other.trustedPending && + untrustedPending == other.untrustedPending && + confirmed == other.confirmed && + spendable == other.spendable && + total == other.total; +} + +///Block height and timestamp of a block +class BlockTime { + ///Confirmation block height + final int height; + + ///Confirmation block timestamp + final int timestamp; + + const BlockTime({ + required this.height, + required this.timestamp, + }); + + @override + int get hashCode => height.hashCode ^ timestamp.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is BlockTime && + runtimeType == other.runtimeType && + height == other.height && + timestamp == other.timestamp; +} + +enum ChangeSpendPolicy { + changeAllowed, + onlyChange, + changeForbidden, +} + +@freezed +sealed class DatabaseConfig with _$DatabaseConfig { + const factory DatabaseConfig.memory() = DatabaseConfig_Memory; + + ///Simple key-value embedded database based on sled + const factory DatabaseConfig.sqlite({ + required SqliteDbConfiguration config, + }) = DatabaseConfig_Sqlite; + + ///Sqlite embedded database using rusqlite + const factory DatabaseConfig.sled({ + required SledDbConfiguration config, + }) = DatabaseConfig_Sled; +} + +class FeeRate { + final double satPerVb; + + const FeeRate({ + required this.satPerVb, + }); + + @override + int get hashCode => satPerVb.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FeeRate && + runtimeType == other.runtimeType && + satPerVb == other.satPerVb; +} + +/// A key-value map for an input of the corresponding index in the unsigned +class Input { + final String s; + + const Input({ + required this.s, + }); + + @override + int get hashCode => s.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Input && runtimeType == other.runtimeType && s == other.s; +} + +///Types of keychains +enum KeychainKind { + externalChain, + + ///Internal, usually used for change outputs + internalChain, +} + +///Unspent outputs of this wallet +class LocalUtxo { + final OutPoint outpoint; + final TxOut txout; + final KeychainKind keychain; + final bool isSpent; + + const LocalUtxo({ + required this.outpoint, + required this.txout, + required this.keychain, + required this.isSpent, + }); + + @override + int get hashCode => + outpoint.hashCode ^ txout.hashCode ^ keychain.hashCode ^ isSpent.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is LocalUtxo && + runtimeType == other.runtimeType && + outpoint == other.outpoint && + txout == other.txout && + keychain == other.keychain && + isSpent == other.isSpent; +} + +///The cryptocurrency to act on +enum Network { + ///Bitcoin’s testnet + testnet, + + ///Bitcoin’s regtest + regtest, + + ///Classic Bitcoin + bitcoin, + + ///Bitcoin’s signet + signet, +} + +/// A reference to a transaction output. +class OutPoint { + /// The referenced transaction's txid. + final String txid; + + /// The index of the referenced output in its transaction's vout. + final int vout; + + const OutPoint({ + required this.txid, + required this.vout, + }); + + @override + int get hashCode => txid.hashCode ^ vout.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is OutPoint && + runtimeType == other.runtimeType && + txid == other.txid && + vout == other.vout; +} + +@freezed +sealed class Payload with _$Payload { + /// P2PKH address. + const factory Payload.pubkeyHash({ + required String pubkeyHash, + }) = Payload_PubkeyHash; + + /// P2SH address. + const factory Payload.scriptHash({ + required String scriptHash, + }) = Payload_ScriptHash; + + /// Segwit address. + const factory Payload.witnessProgram({ + /// The witness program version. + required WitnessVersion version, + + /// The witness program. + required Uint8List program, + }) = Payload_WitnessProgram; +} + +class PsbtSigHashType { + final int inner; + + const PsbtSigHashType({ + required this.inner, + }); + + @override + int get hashCode => inner.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is PsbtSigHashType && + runtimeType == other.runtimeType && + inner == other.inner; +} + +@freezed +sealed class RbfValue with _$RbfValue { + const factory RbfValue.rbfDefault() = RbfValue_RbfDefault; + const factory RbfValue.value( + int field0, + ) = RbfValue_Value; +} + +/// A output script and an amount of satoshis. +class ScriptAmount { + final ScriptBufBase script; + final int amount; + + const ScriptAmount({ + required this.script, + required this.amount, + }); + + @override + int get hashCode => script.hashCode ^ amount.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ScriptAmount && + runtimeType == other.runtimeType && + script == other.script && + amount == other.amount; +} + +class ScriptBufBase { + final Uint8List bytes; + + const ScriptBufBase({ + required this.bytes, + }); + + ///Creates a new empty script. + static Future empty({dynamic hint}) => + BdkCore.instance.api.scriptBufBaseEmpty(hint: hint); + + static Future fromHex({required String s, dynamic hint}) => + BdkCore.instance.api.scriptBufBaseFromHex(s: s, hint: hint); + + ///Creates a new empty script with pre-allocated capacity. + static Future withCapacity( + {required int capacity, dynamic hint}) => + BdkCore.instance.api + .scriptBufBaseWithCapacity(capacity: capacity, hint: hint); + + @override + int get hashCode => bytes.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ScriptBufBase && + runtimeType == other.runtimeType && + bytes == other.bytes; +} + +/// Options for a software signer +/// +/// Adjust the behavior of our software signers and the way a transaction is finalized +class SignOptions { + final bool multiSig; + + /// Whether the signer should trust the `witness_utxo`, if the `non_witness_utxo` hasn't been + /// provided + /// + /// Defaults to `false` to mitigate the "SegWit bug" which should trick the wallet into + /// paying a fee larger than expected. + /// + /// Some wallets, especially if relatively old, might not provide the `non_witness_utxo` for + /// SegWit transactions in the PSBT they generate: in those cases setting this to `true` + /// should correctly produce a signature, at the expense of an increased trust in the creator + /// of the PSBT. + /// + /// For more details see: + final bool trustWitnessUtxo; + + /// Whether the wallet should assume a specific height has been reached when trying to finalize + /// a transaction + /// + /// The wallet will only "use" a timelock to satisfy the spending policy of an input if the + /// timelock height has already been reached. This option allows overriding the "current height" to let the + /// wallet use timelocks in the future to spend a coin. + final int? assumeHeight; + + /// Whether the signer should use the `sighash_type` set in the PSBT when signing, no matter + /// what its value is + /// + /// Defaults to `false` which will only allow signing using `SIGHASH_ALL`. + final bool allowAllSighashes; + + /// Whether to remove partial signatures from the PSBT inputs while finalizing PSBT. + /// + /// Defaults to `true` which will remove partial signatures during finalization. + final bool removePartialSigs; + + /// Whether to try finalizing the PSBT after the inputs are signed. + /// + /// Defaults to `true` which will try finalizing PSBT after inputs are signed. + final bool tryFinalize; + + /// Whether we should try to sign a taproot transaction with the taproot internal key + /// or not. This option is ignored if we're signing a non-taproot PSBT. + /// + /// Defaults to `true`, i.e., we always try to sign with the taproot internal key. + final bool signWithTapInternalKey; + + /// Whether we should grind ECDSA signature to ensure signing with low r + /// or not. + /// Defaults to `true`, i.e., we always grind ECDSA signature to sign with low r. + final bool allowGrinding; + + const SignOptions({ + required this.multiSig, + required this.trustWitnessUtxo, + this.assumeHeight, + required this.allowAllSighashes, + required this.removePartialSigs, + required this.tryFinalize, + required this.signWithTapInternalKey, + required this.allowGrinding, + }); + + @override + int get hashCode => + multiSig.hashCode ^ + trustWitnessUtxo.hashCode ^ + assumeHeight.hashCode ^ + allowAllSighashes.hashCode ^ + removePartialSigs.hashCode ^ + tryFinalize.hashCode ^ + signWithTapInternalKey.hashCode ^ + allowGrinding.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SignOptions && + runtimeType == other.runtimeType && + multiSig == other.multiSig && + trustWitnessUtxo == other.trustWitnessUtxo && + assumeHeight == other.assumeHeight && + allowAllSighashes == other.allowAllSighashes && + removePartialSigs == other.removePartialSigs && + tryFinalize == other.tryFinalize && + signWithTapInternalKey == other.signWithTapInternalKey && + allowGrinding == other.allowGrinding; +} + +///Configuration type for a sled Tree database +class SledDbConfiguration { + ///Main directory of the db + final String path; + + ///Name of the database tree, a separated namespace for the data + final String treeName; + + const SledDbConfiguration({ + required this.path, + required this.treeName, + }); + + @override + int get hashCode => path.hashCode ^ treeName.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SledDbConfiguration && + runtimeType == other.runtimeType && + path == other.path && + treeName == other.treeName; +} + +///Configuration type for a SqliteDatabase database +class SqliteDbConfiguration { + ///Main directory of the db + final String path; + + const SqliteDbConfiguration({ + required this.path, + }); + + @override + int get hashCode => path.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SqliteDbConfiguration && + runtimeType == other.runtimeType && + path == other.path; +} + +class TransactionBase { + final String inner; + + const TransactionBase({ + required this.inner, + }); + + ///List of transaction inputs. + Future> input({dynamic hint}) => + BdkCore.instance.api.transactionBaseInput( + that: this, + ); + + ///Is this a coin base transaction? + Future isCoinBase({dynamic hint}) => + BdkCore.instance.api.transactionBaseIsCoinBase( + that: this, + ); + + ///Returns true if the transaction itself opted in to be BIP-125-replaceable (RBF). + /// This does not cover the case where a transaction becomes replaceable due to ancestors being RBF. + Future isExplicitlyRbf({dynamic hint}) => + BdkCore.instance.api.transactionBaseIsExplicitlyRbf( + that: this, + ); + + ///Returns true if this transactions nLockTime is enabled (BIP-65 ). + Future isLockTimeEnabled({dynamic hint}) => + BdkCore.instance.api.transactionBaseIsLockTimeEnabled( + that: this, + ); + + ///Block height or timestamp. Transaction cannot be included in a block until this height/time. + Future lockTime({dynamic hint}) => + BdkCore.instance.api.transactionBaseLockTime( + that: this, + ); + + // HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class. + static Future newInstance( + {required List transactionBytes, dynamic hint}) => + BdkCore.instance.api + .transactionBaseNew(transactionBytes: transactionBytes, hint: hint); + + ///List of transaction outputs. + Future> output({dynamic hint}) => + BdkCore.instance.api.transactionBaseOutput( + that: this, + ); + + ///Encodes an object into a vector. + Future serialize({dynamic hint}) => + BdkCore.instance.api.transactionBaseSerialize( + that: this, + ); + + ///Returns the regular byte-wise consensus-serialized size of this transaction. + Future size({dynamic hint}) => BdkCore.instance.api.transactionBaseSize( + that: this, + ); + + ///Computes the txid. For non-segwit transactions this will be identical to the output of wtxid(), + /// but for segwit transactions, this will give the correct txid (not including witnesses) while wtxid will also hash witnesses. + Future txid({dynamic hint}) => + BdkCore.instance.api.transactionBaseTxid( + that: this, + ); + + ///The protocol version, is currently expected to be 1 or 2 (BIP 68). + Future version({dynamic hint}) => + BdkCore.instance.api.transactionBaseVersion( + that: this, + ); + + ///Returns the “virtual size” (vsize) of this transaction. + /// + Future vsize({dynamic hint}) => + BdkCore.instance.api.transactionBaseVsize( + that: this, + ); + + ///Returns the regular byte-wise consensus-serialized size of this transaction. + Future weight({dynamic hint}) => + BdkCore.instance.api.transactionBaseWeight( + that: this, + ); + + @override + int get hashCode => inner.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is TransactionBase && + runtimeType == other.runtimeType && + inner == other.inner; +} + +///A wallet transaction +class TransactionDetails { + final TransactionBase? transaction; + + /// Transaction id. + final String txid; + + /// Received value (sats) + /// Sum of owned outputs of this transaction. + final int received; + + /// Sent value (sats) + /// Sum of owned inputs of this transaction. + final int sent; + + /// Fee value (sats) if confirmed. + /// The availability of the fee depends on the backend. It's never None with an Electrum + /// Server backend, but it could be None with a Bitcoin RPC node without txindex that receive + /// funds while offline. + final int? fee; + + /// If the transaction is confirmed, contains height and timestamp of the block containing the + /// transaction, unconfirmed transaction contains `None`. + final BlockTime? confirmationTime; + + const TransactionDetails({ + this.transaction, + required this.txid, + required this.received, + required this.sent, + this.fee, + this.confirmationTime, + }); + + @override + int get hashCode => + transaction.hashCode ^ + txid.hashCode ^ + received.hashCode ^ + sent.hashCode ^ + fee.hashCode ^ + confirmationTime.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is TransactionDetails && + runtimeType == other.runtimeType && + transaction == other.transaction && + txid == other.txid && + received == other.received && + sent == other.sent && + fee == other.fee && + confirmationTime == other.confirmationTime; +} + +class TxIn { + final OutPoint previousOutput; + final ScriptBufBase scriptSig; + final int sequence; + final List witness; + + const TxIn({ + required this.previousOutput, + required this.scriptSig, + required this.sequence, + required this.witness, + }); + + @override + int get hashCode => + previousOutput.hashCode ^ + scriptSig.hashCode ^ + sequence.hashCode ^ + witness.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is TxIn && + runtimeType == other.runtimeType && + previousOutput == other.previousOutput && + scriptSig == other.scriptSig && + sequence == other.sequence && + witness == other.witness; +} + +///A transaction output, which defines new coins to be created from old ones. +class TxOut { + /// The value of the output, in satoshis. + final int value; + + /// The address of the output. + final ScriptBufBase scriptPubkey; + + const TxOut({ + required this.value, + required this.scriptPubkey, + }); + + @override + int get hashCode => value.hashCode ^ scriptPubkey.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is TxOut && + runtimeType == other.runtimeType && + value == other.value && + scriptPubkey == other.scriptPubkey; +} + +enum Variant { + bech32, + bech32M, +} + +enum WitnessVersion { + /// Initial version of witness program. Used for P2WPKH and P2WPK outputs + v0, + + /// Version of witness program used for Taproot P2TR outputs. + v1, + + /// Future (unsupported) version of witness program. + v2, + + /// Future (unsupported) version of witness program. + v3, + + /// Future (unsupported) version of witness program. + v4, + + /// Future (unsupported) version of witness program. + v5, + + /// Future (unsupported) version of witness program. + v6, + + /// Future (unsupported) version of witness program. + v7, + + /// Future (unsupported) version of witness program. + v8, + + /// Future (unsupported) version of witness program. + v9, + + /// Future (unsupported) version of witness program. + v10, + + /// Future (unsupported) version of witness program. + v11, + + /// Future (unsupported) version of witness program. + v12, + + /// Future (unsupported) version of witness program. + v13, + + /// Future (unsupported) version of witness program. + v14, + + /// Future (unsupported) version of witness program. + v15, + + /// Future (unsupported) version of witness program. + v16, +} + +///Type describing entropy length (aka word count) in the mnemonic +enum WordCount { + ///12 words mnemonic (128 bits entropy) + words12, + + ///18 words mnemonic (192 bits entropy) + words18, + + ///24 words mnemonic (256 bits entropy) + words24, +} diff --git a/lib/src/generated/api/types.freezed.dart b/lib/src/generated/api/types.freezed.dart new file mode 100644 index 00000000..90dffd16 --- /dev/null +++ b/lib/src/generated/api/types.freezed.dart @@ -0,0 +1,1888 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'types.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +/// @nodoc +mixin _$AddressIndex { + @optionalTypeArgs + TResult when({ + required TResult Function() increase, + required TResult Function() lastUnused, + required TResult Function(int index) peek, + required TResult Function(int index) reset, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? increase, + TResult? Function()? lastUnused, + TResult? Function(int index)? peek, + TResult? Function(int index)? reset, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? increase, + TResult Function()? lastUnused, + TResult Function(int index)? peek, + TResult Function(int index)? reset, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(AddressIndex_Increase value) increase, + required TResult Function(AddressIndex_LastUnused value) lastUnused, + required TResult Function(AddressIndex_Peek value) peek, + required TResult Function(AddressIndex_Reset value) reset, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressIndex_Increase value)? increase, + TResult? Function(AddressIndex_LastUnused value)? lastUnused, + TResult? Function(AddressIndex_Peek value)? peek, + TResult? Function(AddressIndex_Reset value)? reset, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressIndex_Increase value)? increase, + TResult Function(AddressIndex_LastUnused value)? lastUnused, + TResult Function(AddressIndex_Peek value)? peek, + TResult Function(AddressIndex_Reset value)? reset, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AddressIndexCopyWith<$Res> { + factory $AddressIndexCopyWith( + AddressIndex value, $Res Function(AddressIndex) then) = + _$AddressIndexCopyWithImpl<$Res, AddressIndex>; +} + +/// @nodoc +class _$AddressIndexCopyWithImpl<$Res, $Val extends AddressIndex> + implements $AddressIndexCopyWith<$Res> { + _$AddressIndexCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$AddressIndex_IncreaseImplCopyWith<$Res> { + factory _$$AddressIndex_IncreaseImplCopyWith( + _$AddressIndex_IncreaseImpl value, + $Res Function(_$AddressIndex_IncreaseImpl) then) = + __$$AddressIndex_IncreaseImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$AddressIndex_IncreaseImplCopyWithImpl<$Res> + extends _$AddressIndexCopyWithImpl<$Res, _$AddressIndex_IncreaseImpl> + implements _$$AddressIndex_IncreaseImplCopyWith<$Res> { + __$$AddressIndex_IncreaseImplCopyWithImpl(_$AddressIndex_IncreaseImpl _value, + $Res Function(_$AddressIndex_IncreaseImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$AddressIndex_IncreaseImpl implements AddressIndex_Increase { + const _$AddressIndex_IncreaseImpl(); + + @override + String toString() { + return 'AddressIndex.increase()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressIndex_IncreaseImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() increase, + required TResult Function() lastUnused, + required TResult Function(int index) peek, + required TResult Function(int index) reset, + }) { + return increase(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? increase, + TResult? Function()? lastUnused, + TResult? Function(int index)? peek, + TResult? Function(int index)? reset, + }) { + return increase?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? increase, + TResult Function()? lastUnused, + TResult Function(int index)? peek, + TResult Function(int index)? reset, + required TResult orElse(), + }) { + if (increase != null) { + return increase(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressIndex_Increase value) increase, + required TResult Function(AddressIndex_LastUnused value) lastUnused, + required TResult Function(AddressIndex_Peek value) peek, + required TResult Function(AddressIndex_Reset value) reset, + }) { + return increase(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressIndex_Increase value)? increase, + TResult? Function(AddressIndex_LastUnused value)? lastUnused, + TResult? Function(AddressIndex_Peek value)? peek, + TResult? Function(AddressIndex_Reset value)? reset, + }) { + return increase?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressIndex_Increase value)? increase, + TResult Function(AddressIndex_LastUnused value)? lastUnused, + TResult Function(AddressIndex_Peek value)? peek, + TResult Function(AddressIndex_Reset value)? reset, + required TResult orElse(), + }) { + if (increase != null) { + return increase(this); + } + return orElse(); + } +} + +abstract class AddressIndex_Increase implements AddressIndex { + const factory AddressIndex_Increase() = _$AddressIndex_IncreaseImpl; +} + +/// @nodoc +abstract class _$$AddressIndex_LastUnusedImplCopyWith<$Res> { + factory _$$AddressIndex_LastUnusedImplCopyWith( + _$AddressIndex_LastUnusedImpl value, + $Res Function(_$AddressIndex_LastUnusedImpl) then) = + __$$AddressIndex_LastUnusedImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$AddressIndex_LastUnusedImplCopyWithImpl<$Res> + extends _$AddressIndexCopyWithImpl<$Res, _$AddressIndex_LastUnusedImpl> + implements _$$AddressIndex_LastUnusedImplCopyWith<$Res> { + __$$AddressIndex_LastUnusedImplCopyWithImpl( + _$AddressIndex_LastUnusedImpl _value, + $Res Function(_$AddressIndex_LastUnusedImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$AddressIndex_LastUnusedImpl implements AddressIndex_LastUnused { + const _$AddressIndex_LastUnusedImpl(); + + @override + String toString() { + return 'AddressIndex.lastUnused()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressIndex_LastUnusedImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() increase, + required TResult Function() lastUnused, + required TResult Function(int index) peek, + required TResult Function(int index) reset, + }) { + return lastUnused(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? increase, + TResult? Function()? lastUnused, + TResult? Function(int index)? peek, + TResult? Function(int index)? reset, + }) { + return lastUnused?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? increase, + TResult Function()? lastUnused, + TResult Function(int index)? peek, + TResult Function(int index)? reset, + required TResult orElse(), + }) { + if (lastUnused != null) { + return lastUnused(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressIndex_Increase value) increase, + required TResult Function(AddressIndex_LastUnused value) lastUnused, + required TResult Function(AddressIndex_Peek value) peek, + required TResult Function(AddressIndex_Reset value) reset, + }) { + return lastUnused(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressIndex_Increase value)? increase, + TResult? Function(AddressIndex_LastUnused value)? lastUnused, + TResult? Function(AddressIndex_Peek value)? peek, + TResult? Function(AddressIndex_Reset value)? reset, + }) { + return lastUnused?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressIndex_Increase value)? increase, + TResult Function(AddressIndex_LastUnused value)? lastUnused, + TResult Function(AddressIndex_Peek value)? peek, + TResult Function(AddressIndex_Reset value)? reset, + required TResult orElse(), + }) { + if (lastUnused != null) { + return lastUnused(this); + } + return orElse(); + } +} + +abstract class AddressIndex_LastUnused implements AddressIndex { + const factory AddressIndex_LastUnused() = _$AddressIndex_LastUnusedImpl; +} + +/// @nodoc +abstract class _$$AddressIndex_PeekImplCopyWith<$Res> { + factory _$$AddressIndex_PeekImplCopyWith(_$AddressIndex_PeekImpl value, + $Res Function(_$AddressIndex_PeekImpl) then) = + __$$AddressIndex_PeekImplCopyWithImpl<$Res>; + @useResult + $Res call({int index}); +} + +/// @nodoc +class __$$AddressIndex_PeekImplCopyWithImpl<$Res> + extends _$AddressIndexCopyWithImpl<$Res, _$AddressIndex_PeekImpl> + implements _$$AddressIndex_PeekImplCopyWith<$Res> { + __$$AddressIndex_PeekImplCopyWithImpl(_$AddressIndex_PeekImpl _value, + $Res Function(_$AddressIndex_PeekImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? index = null, + }) { + return _then(_$AddressIndex_PeekImpl( + index: null == index + ? _value.index + : index // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$AddressIndex_PeekImpl implements AddressIndex_Peek { + const _$AddressIndex_PeekImpl({required this.index}); + + @override + final int index; + + @override + String toString() { + return 'AddressIndex.peek(index: $index)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressIndex_PeekImpl && + (identical(other.index, index) || other.index == index)); + } + + @override + int get hashCode => Object.hash(runtimeType, index); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AddressIndex_PeekImplCopyWith<_$AddressIndex_PeekImpl> get copyWith => + __$$AddressIndex_PeekImplCopyWithImpl<_$AddressIndex_PeekImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() increase, + required TResult Function() lastUnused, + required TResult Function(int index) peek, + required TResult Function(int index) reset, + }) { + return peek(index); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? increase, + TResult? Function()? lastUnused, + TResult? Function(int index)? peek, + TResult? Function(int index)? reset, + }) { + return peek?.call(index); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? increase, + TResult Function()? lastUnused, + TResult Function(int index)? peek, + TResult Function(int index)? reset, + required TResult orElse(), + }) { + if (peek != null) { + return peek(index); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressIndex_Increase value) increase, + required TResult Function(AddressIndex_LastUnused value) lastUnused, + required TResult Function(AddressIndex_Peek value) peek, + required TResult Function(AddressIndex_Reset value) reset, + }) { + return peek(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressIndex_Increase value)? increase, + TResult? Function(AddressIndex_LastUnused value)? lastUnused, + TResult? Function(AddressIndex_Peek value)? peek, + TResult? Function(AddressIndex_Reset value)? reset, + }) { + return peek?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressIndex_Increase value)? increase, + TResult Function(AddressIndex_LastUnused value)? lastUnused, + TResult Function(AddressIndex_Peek value)? peek, + TResult Function(AddressIndex_Reset value)? reset, + required TResult orElse(), + }) { + if (peek != null) { + return peek(this); + } + return orElse(); + } +} + +abstract class AddressIndex_Peek implements AddressIndex { + const factory AddressIndex_Peek({required final int index}) = + _$AddressIndex_PeekImpl; + + int get index; + @JsonKey(ignore: true) + _$$AddressIndex_PeekImplCopyWith<_$AddressIndex_PeekImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AddressIndex_ResetImplCopyWith<$Res> { + factory _$$AddressIndex_ResetImplCopyWith(_$AddressIndex_ResetImpl value, + $Res Function(_$AddressIndex_ResetImpl) then) = + __$$AddressIndex_ResetImplCopyWithImpl<$Res>; + @useResult + $Res call({int index}); +} + +/// @nodoc +class __$$AddressIndex_ResetImplCopyWithImpl<$Res> + extends _$AddressIndexCopyWithImpl<$Res, _$AddressIndex_ResetImpl> + implements _$$AddressIndex_ResetImplCopyWith<$Res> { + __$$AddressIndex_ResetImplCopyWithImpl(_$AddressIndex_ResetImpl _value, + $Res Function(_$AddressIndex_ResetImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? index = null, + }) { + return _then(_$AddressIndex_ResetImpl( + index: null == index + ? _value.index + : index // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$AddressIndex_ResetImpl implements AddressIndex_Reset { + const _$AddressIndex_ResetImpl({required this.index}); + + @override + final int index; + + @override + String toString() { + return 'AddressIndex.reset(index: $index)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AddressIndex_ResetImpl && + (identical(other.index, index) || other.index == index)); + } + + @override + int get hashCode => Object.hash(runtimeType, index); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AddressIndex_ResetImplCopyWith<_$AddressIndex_ResetImpl> get copyWith => + __$$AddressIndex_ResetImplCopyWithImpl<_$AddressIndex_ResetImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() increase, + required TResult Function() lastUnused, + required TResult Function(int index) peek, + required TResult Function(int index) reset, + }) { + return reset(index); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? increase, + TResult? Function()? lastUnused, + TResult? Function(int index)? peek, + TResult? Function(int index)? reset, + }) { + return reset?.call(index); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? increase, + TResult Function()? lastUnused, + TResult Function(int index)? peek, + TResult Function(int index)? reset, + required TResult orElse(), + }) { + if (reset != null) { + return reset(index); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AddressIndex_Increase value) increase, + required TResult Function(AddressIndex_LastUnused value) lastUnused, + required TResult Function(AddressIndex_Peek value) peek, + required TResult Function(AddressIndex_Reset value) reset, + }) { + return reset(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AddressIndex_Increase value)? increase, + TResult? Function(AddressIndex_LastUnused value)? lastUnused, + TResult? Function(AddressIndex_Peek value)? peek, + TResult? Function(AddressIndex_Reset value)? reset, + }) { + return reset?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AddressIndex_Increase value)? increase, + TResult Function(AddressIndex_LastUnused value)? lastUnused, + TResult Function(AddressIndex_Peek value)? peek, + TResult Function(AddressIndex_Reset value)? reset, + required TResult orElse(), + }) { + if (reset != null) { + return reset(this); + } + return orElse(); + } +} + +abstract class AddressIndex_Reset implements AddressIndex { + const factory AddressIndex_Reset({required final int index}) = + _$AddressIndex_ResetImpl; + + int get index; + @JsonKey(ignore: true) + _$$AddressIndex_ResetImplCopyWith<_$AddressIndex_ResetImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$DatabaseConfig { + @optionalTypeArgs + TResult when({ + required TResult Function() memory, + required TResult Function(SqliteDbConfiguration config) sqlite, + required TResult Function(SledDbConfiguration config) sled, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? memory, + TResult? Function(SqliteDbConfiguration config)? sqlite, + TResult? Function(SledDbConfiguration config)? sled, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? memory, + TResult Function(SqliteDbConfiguration config)? sqlite, + TResult Function(SledDbConfiguration config)? sled, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(DatabaseConfig_Memory value) memory, + required TResult Function(DatabaseConfig_Sqlite value) sqlite, + required TResult Function(DatabaseConfig_Sled value) sled, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DatabaseConfig_Memory value)? memory, + TResult? Function(DatabaseConfig_Sqlite value)? sqlite, + TResult? Function(DatabaseConfig_Sled value)? sled, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DatabaseConfig_Memory value)? memory, + TResult Function(DatabaseConfig_Sqlite value)? sqlite, + TResult Function(DatabaseConfig_Sled value)? sled, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $DatabaseConfigCopyWith<$Res> { + factory $DatabaseConfigCopyWith( + DatabaseConfig value, $Res Function(DatabaseConfig) then) = + _$DatabaseConfigCopyWithImpl<$Res, DatabaseConfig>; +} + +/// @nodoc +class _$DatabaseConfigCopyWithImpl<$Res, $Val extends DatabaseConfig> + implements $DatabaseConfigCopyWith<$Res> { + _$DatabaseConfigCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$DatabaseConfig_MemoryImplCopyWith<$Res> { + factory _$$DatabaseConfig_MemoryImplCopyWith( + _$DatabaseConfig_MemoryImpl value, + $Res Function(_$DatabaseConfig_MemoryImpl) then) = + __$$DatabaseConfig_MemoryImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$DatabaseConfig_MemoryImplCopyWithImpl<$Res> + extends _$DatabaseConfigCopyWithImpl<$Res, _$DatabaseConfig_MemoryImpl> + implements _$$DatabaseConfig_MemoryImplCopyWith<$Res> { + __$$DatabaseConfig_MemoryImplCopyWithImpl(_$DatabaseConfig_MemoryImpl _value, + $Res Function(_$DatabaseConfig_MemoryImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$DatabaseConfig_MemoryImpl implements DatabaseConfig_Memory { + const _$DatabaseConfig_MemoryImpl(); + + @override + String toString() { + return 'DatabaseConfig.memory()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DatabaseConfig_MemoryImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() memory, + required TResult Function(SqliteDbConfiguration config) sqlite, + required TResult Function(SledDbConfiguration config) sled, + }) { + return memory(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? memory, + TResult? Function(SqliteDbConfiguration config)? sqlite, + TResult? Function(SledDbConfiguration config)? sled, + }) { + return memory?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? memory, + TResult Function(SqliteDbConfiguration config)? sqlite, + TResult Function(SledDbConfiguration config)? sled, + required TResult orElse(), + }) { + if (memory != null) { + return memory(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DatabaseConfig_Memory value) memory, + required TResult Function(DatabaseConfig_Sqlite value) sqlite, + required TResult Function(DatabaseConfig_Sled value) sled, + }) { + return memory(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DatabaseConfig_Memory value)? memory, + TResult? Function(DatabaseConfig_Sqlite value)? sqlite, + TResult? Function(DatabaseConfig_Sled value)? sled, + }) { + return memory?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DatabaseConfig_Memory value)? memory, + TResult Function(DatabaseConfig_Sqlite value)? sqlite, + TResult Function(DatabaseConfig_Sled value)? sled, + required TResult orElse(), + }) { + if (memory != null) { + return memory(this); + } + return orElse(); + } +} + +abstract class DatabaseConfig_Memory implements DatabaseConfig { + const factory DatabaseConfig_Memory() = _$DatabaseConfig_MemoryImpl; +} + +/// @nodoc +abstract class _$$DatabaseConfig_SqliteImplCopyWith<$Res> { + factory _$$DatabaseConfig_SqliteImplCopyWith( + _$DatabaseConfig_SqliteImpl value, + $Res Function(_$DatabaseConfig_SqliteImpl) then) = + __$$DatabaseConfig_SqliteImplCopyWithImpl<$Res>; + @useResult + $Res call({SqliteDbConfiguration config}); +} + +/// @nodoc +class __$$DatabaseConfig_SqliteImplCopyWithImpl<$Res> + extends _$DatabaseConfigCopyWithImpl<$Res, _$DatabaseConfig_SqliteImpl> + implements _$$DatabaseConfig_SqliteImplCopyWith<$Res> { + __$$DatabaseConfig_SqliteImplCopyWithImpl(_$DatabaseConfig_SqliteImpl _value, + $Res Function(_$DatabaseConfig_SqliteImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? config = null, + }) { + return _then(_$DatabaseConfig_SqliteImpl( + config: null == config + ? _value.config + : config // ignore: cast_nullable_to_non_nullable + as SqliteDbConfiguration, + )); + } +} + +/// @nodoc + +class _$DatabaseConfig_SqliteImpl implements DatabaseConfig_Sqlite { + const _$DatabaseConfig_SqliteImpl({required this.config}); + + @override + final SqliteDbConfiguration config; + + @override + String toString() { + return 'DatabaseConfig.sqlite(config: $config)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DatabaseConfig_SqliteImpl && + (identical(other.config, config) || other.config == config)); + } + + @override + int get hashCode => Object.hash(runtimeType, config); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DatabaseConfig_SqliteImplCopyWith<_$DatabaseConfig_SqliteImpl> + get copyWith => __$$DatabaseConfig_SqliteImplCopyWithImpl< + _$DatabaseConfig_SqliteImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() memory, + required TResult Function(SqliteDbConfiguration config) sqlite, + required TResult Function(SledDbConfiguration config) sled, + }) { + return sqlite(config); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? memory, + TResult? Function(SqliteDbConfiguration config)? sqlite, + TResult? Function(SledDbConfiguration config)? sled, + }) { + return sqlite?.call(config); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? memory, + TResult Function(SqliteDbConfiguration config)? sqlite, + TResult Function(SledDbConfiguration config)? sled, + required TResult orElse(), + }) { + if (sqlite != null) { + return sqlite(config); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DatabaseConfig_Memory value) memory, + required TResult Function(DatabaseConfig_Sqlite value) sqlite, + required TResult Function(DatabaseConfig_Sled value) sled, + }) { + return sqlite(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DatabaseConfig_Memory value)? memory, + TResult? Function(DatabaseConfig_Sqlite value)? sqlite, + TResult? Function(DatabaseConfig_Sled value)? sled, + }) { + return sqlite?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DatabaseConfig_Memory value)? memory, + TResult Function(DatabaseConfig_Sqlite value)? sqlite, + TResult Function(DatabaseConfig_Sled value)? sled, + required TResult orElse(), + }) { + if (sqlite != null) { + return sqlite(this); + } + return orElse(); + } +} + +abstract class DatabaseConfig_Sqlite implements DatabaseConfig { + const factory DatabaseConfig_Sqlite( + {required final SqliteDbConfiguration config}) = + _$DatabaseConfig_SqliteImpl; + + SqliteDbConfiguration get config; + @JsonKey(ignore: true) + _$$DatabaseConfig_SqliteImplCopyWith<_$DatabaseConfig_SqliteImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$DatabaseConfig_SledImplCopyWith<$Res> { + factory _$$DatabaseConfig_SledImplCopyWith(_$DatabaseConfig_SledImpl value, + $Res Function(_$DatabaseConfig_SledImpl) then) = + __$$DatabaseConfig_SledImplCopyWithImpl<$Res>; + @useResult + $Res call({SledDbConfiguration config}); +} + +/// @nodoc +class __$$DatabaseConfig_SledImplCopyWithImpl<$Res> + extends _$DatabaseConfigCopyWithImpl<$Res, _$DatabaseConfig_SledImpl> + implements _$$DatabaseConfig_SledImplCopyWith<$Res> { + __$$DatabaseConfig_SledImplCopyWithImpl(_$DatabaseConfig_SledImpl _value, + $Res Function(_$DatabaseConfig_SledImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? config = null, + }) { + return _then(_$DatabaseConfig_SledImpl( + config: null == config + ? _value.config + : config // ignore: cast_nullable_to_non_nullable + as SledDbConfiguration, + )); + } +} + +/// @nodoc + +class _$DatabaseConfig_SledImpl implements DatabaseConfig_Sled { + const _$DatabaseConfig_SledImpl({required this.config}); + + @override + final SledDbConfiguration config; + + @override + String toString() { + return 'DatabaseConfig.sled(config: $config)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DatabaseConfig_SledImpl && + (identical(other.config, config) || other.config == config)); + } + + @override + int get hashCode => Object.hash(runtimeType, config); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DatabaseConfig_SledImplCopyWith<_$DatabaseConfig_SledImpl> get copyWith => + __$$DatabaseConfig_SledImplCopyWithImpl<_$DatabaseConfig_SledImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() memory, + required TResult Function(SqliteDbConfiguration config) sqlite, + required TResult Function(SledDbConfiguration config) sled, + }) { + return sled(config); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? memory, + TResult? Function(SqliteDbConfiguration config)? sqlite, + TResult? Function(SledDbConfiguration config)? sled, + }) { + return sled?.call(config); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? memory, + TResult Function(SqliteDbConfiguration config)? sqlite, + TResult Function(SledDbConfiguration config)? sled, + required TResult orElse(), + }) { + if (sled != null) { + return sled(config); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DatabaseConfig_Memory value) memory, + required TResult Function(DatabaseConfig_Sqlite value) sqlite, + required TResult Function(DatabaseConfig_Sled value) sled, + }) { + return sled(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DatabaseConfig_Memory value)? memory, + TResult? Function(DatabaseConfig_Sqlite value)? sqlite, + TResult? Function(DatabaseConfig_Sled value)? sled, + }) { + return sled?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DatabaseConfig_Memory value)? memory, + TResult Function(DatabaseConfig_Sqlite value)? sqlite, + TResult Function(DatabaseConfig_Sled value)? sled, + required TResult orElse(), + }) { + if (sled != null) { + return sled(this); + } + return orElse(); + } +} + +abstract class DatabaseConfig_Sled implements DatabaseConfig { + const factory DatabaseConfig_Sled( + {required final SledDbConfiguration config}) = _$DatabaseConfig_SledImpl; + + SledDbConfiguration get config; + @JsonKey(ignore: true) + _$$DatabaseConfig_SledImplCopyWith<_$DatabaseConfig_SledImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$Payload { + @optionalTypeArgs + TResult when({ + required TResult Function(String pubkeyHash) pubkeyHash, + required TResult Function(String scriptHash) scriptHash, + required TResult Function(WitnessVersion version, Uint8List program) + witnessProgram, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String pubkeyHash)? pubkeyHash, + TResult? Function(String scriptHash)? scriptHash, + TResult? Function(WitnessVersion version, Uint8List program)? + witnessProgram, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String pubkeyHash)? pubkeyHash, + TResult Function(String scriptHash)? scriptHash, + TResult Function(WitnessVersion version, Uint8List program)? witnessProgram, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(Payload_PubkeyHash value) pubkeyHash, + required TResult Function(Payload_ScriptHash value) scriptHash, + required TResult Function(Payload_WitnessProgram value) witnessProgram, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(Payload_PubkeyHash value)? pubkeyHash, + TResult? Function(Payload_ScriptHash value)? scriptHash, + TResult? Function(Payload_WitnessProgram value)? witnessProgram, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Payload_PubkeyHash value)? pubkeyHash, + TResult Function(Payload_ScriptHash value)? scriptHash, + TResult Function(Payload_WitnessProgram value)? witnessProgram, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PayloadCopyWith<$Res> { + factory $PayloadCopyWith(Payload value, $Res Function(Payload) then) = + _$PayloadCopyWithImpl<$Res, Payload>; +} + +/// @nodoc +class _$PayloadCopyWithImpl<$Res, $Val extends Payload> + implements $PayloadCopyWith<$Res> { + _$PayloadCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$Payload_PubkeyHashImplCopyWith<$Res> { + factory _$$Payload_PubkeyHashImplCopyWith(_$Payload_PubkeyHashImpl value, + $Res Function(_$Payload_PubkeyHashImpl) then) = + __$$Payload_PubkeyHashImplCopyWithImpl<$Res>; + @useResult + $Res call({String pubkeyHash}); +} + +/// @nodoc +class __$$Payload_PubkeyHashImplCopyWithImpl<$Res> + extends _$PayloadCopyWithImpl<$Res, _$Payload_PubkeyHashImpl> + implements _$$Payload_PubkeyHashImplCopyWith<$Res> { + __$$Payload_PubkeyHashImplCopyWithImpl(_$Payload_PubkeyHashImpl _value, + $Res Function(_$Payload_PubkeyHashImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? pubkeyHash = null, + }) { + return _then(_$Payload_PubkeyHashImpl( + pubkeyHash: null == pubkeyHash + ? _value.pubkeyHash + : pubkeyHash // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$Payload_PubkeyHashImpl implements Payload_PubkeyHash { + const _$Payload_PubkeyHashImpl({required this.pubkeyHash}); + + @override + final String pubkeyHash; + + @override + String toString() { + return 'Payload.pubkeyHash(pubkeyHash: $pubkeyHash)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$Payload_PubkeyHashImpl && + (identical(other.pubkeyHash, pubkeyHash) || + other.pubkeyHash == pubkeyHash)); + } + + @override + int get hashCode => Object.hash(runtimeType, pubkeyHash); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$Payload_PubkeyHashImplCopyWith<_$Payload_PubkeyHashImpl> get copyWith => + __$$Payload_PubkeyHashImplCopyWithImpl<_$Payload_PubkeyHashImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String pubkeyHash) pubkeyHash, + required TResult Function(String scriptHash) scriptHash, + required TResult Function(WitnessVersion version, Uint8List program) + witnessProgram, + }) { + return pubkeyHash(this.pubkeyHash); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String pubkeyHash)? pubkeyHash, + TResult? Function(String scriptHash)? scriptHash, + TResult? Function(WitnessVersion version, Uint8List program)? + witnessProgram, + }) { + return pubkeyHash?.call(this.pubkeyHash); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String pubkeyHash)? pubkeyHash, + TResult Function(String scriptHash)? scriptHash, + TResult Function(WitnessVersion version, Uint8List program)? witnessProgram, + required TResult orElse(), + }) { + if (pubkeyHash != null) { + return pubkeyHash(this.pubkeyHash); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(Payload_PubkeyHash value) pubkeyHash, + required TResult Function(Payload_ScriptHash value) scriptHash, + required TResult Function(Payload_WitnessProgram value) witnessProgram, + }) { + return pubkeyHash(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(Payload_PubkeyHash value)? pubkeyHash, + TResult? Function(Payload_ScriptHash value)? scriptHash, + TResult? Function(Payload_WitnessProgram value)? witnessProgram, + }) { + return pubkeyHash?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Payload_PubkeyHash value)? pubkeyHash, + TResult Function(Payload_ScriptHash value)? scriptHash, + TResult Function(Payload_WitnessProgram value)? witnessProgram, + required TResult orElse(), + }) { + if (pubkeyHash != null) { + return pubkeyHash(this); + } + return orElse(); + } +} + +abstract class Payload_PubkeyHash implements Payload { + const factory Payload_PubkeyHash({required final String pubkeyHash}) = + _$Payload_PubkeyHashImpl; + + String get pubkeyHash; + @JsonKey(ignore: true) + _$$Payload_PubkeyHashImplCopyWith<_$Payload_PubkeyHashImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$Payload_ScriptHashImplCopyWith<$Res> { + factory _$$Payload_ScriptHashImplCopyWith(_$Payload_ScriptHashImpl value, + $Res Function(_$Payload_ScriptHashImpl) then) = + __$$Payload_ScriptHashImplCopyWithImpl<$Res>; + @useResult + $Res call({String scriptHash}); +} + +/// @nodoc +class __$$Payload_ScriptHashImplCopyWithImpl<$Res> + extends _$PayloadCopyWithImpl<$Res, _$Payload_ScriptHashImpl> + implements _$$Payload_ScriptHashImplCopyWith<$Res> { + __$$Payload_ScriptHashImplCopyWithImpl(_$Payload_ScriptHashImpl _value, + $Res Function(_$Payload_ScriptHashImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? scriptHash = null, + }) { + return _then(_$Payload_ScriptHashImpl( + scriptHash: null == scriptHash + ? _value.scriptHash + : scriptHash // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$Payload_ScriptHashImpl implements Payload_ScriptHash { + const _$Payload_ScriptHashImpl({required this.scriptHash}); + + @override + final String scriptHash; + + @override + String toString() { + return 'Payload.scriptHash(scriptHash: $scriptHash)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$Payload_ScriptHashImpl && + (identical(other.scriptHash, scriptHash) || + other.scriptHash == scriptHash)); + } + + @override + int get hashCode => Object.hash(runtimeType, scriptHash); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$Payload_ScriptHashImplCopyWith<_$Payload_ScriptHashImpl> get copyWith => + __$$Payload_ScriptHashImplCopyWithImpl<_$Payload_ScriptHashImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String pubkeyHash) pubkeyHash, + required TResult Function(String scriptHash) scriptHash, + required TResult Function(WitnessVersion version, Uint8List program) + witnessProgram, + }) { + return scriptHash(this.scriptHash); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String pubkeyHash)? pubkeyHash, + TResult? Function(String scriptHash)? scriptHash, + TResult? Function(WitnessVersion version, Uint8List program)? + witnessProgram, + }) { + return scriptHash?.call(this.scriptHash); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String pubkeyHash)? pubkeyHash, + TResult Function(String scriptHash)? scriptHash, + TResult Function(WitnessVersion version, Uint8List program)? witnessProgram, + required TResult orElse(), + }) { + if (scriptHash != null) { + return scriptHash(this.scriptHash); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(Payload_PubkeyHash value) pubkeyHash, + required TResult Function(Payload_ScriptHash value) scriptHash, + required TResult Function(Payload_WitnessProgram value) witnessProgram, + }) { + return scriptHash(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(Payload_PubkeyHash value)? pubkeyHash, + TResult? Function(Payload_ScriptHash value)? scriptHash, + TResult? Function(Payload_WitnessProgram value)? witnessProgram, + }) { + return scriptHash?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Payload_PubkeyHash value)? pubkeyHash, + TResult Function(Payload_ScriptHash value)? scriptHash, + TResult Function(Payload_WitnessProgram value)? witnessProgram, + required TResult orElse(), + }) { + if (scriptHash != null) { + return scriptHash(this); + } + return orElse(); + } +} + +abstract class Payload_ScriptHash implements Payload { + const factory Payload_ScriptHash({required final String scriptHash}) = + _$Payload_ScriptHashImpl; + + String get scriptHash; + @JsonKey(ignore: true) + _$$Payload_ScriptHashImplCopyWith<_$Payload_ScriptHashImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$Payload_WitnessProgramImplCopyWith<$Res> { + factory _$$Payload_WitnessProgramImplCopyWith( + _$Payload_WitnessProgramImpl value, + $Res Function(_$Payload_WitnessProgramImpl) then) = + __$$Payload_WitnessProgramImplCopyWithImpl<$Res>; + @useResult + $Res call({WitnessVersion version, Uint8List program}); +} + +/// @nodoc +class __$$Payload_WitnessProgramImplCopyWithImpl<$Res> + extends _$PayloadCopyWithImpl<$Res, _$Payload_WitnessProgramImpl> + implements _$$Payload_WitnessProgramImplCopyWith<$Res> { + __$$Payload_WitnessProgramImplCopyWithImpl( + _$Payload_WitnessProgramImpl _value, + $Res Function(_$Payload_WitnessProgramImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? version = null, + Object? program = null, + }) { + return _then(_$Payload_WitnessProgramImpl( + version: null == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as WitnessVersion, + program: null == program + ? _value.program + : program // ignore: cast_nullable_to_non_nullable + as Uint8List, + )); + } +} + +/// @nodoc + +class _$Payload_WitnessProgramImpl implements Payload_WitnessProgram { + const _$Payload_WitnessProgramImpl( + {required this.version, required this.program}); + + /// The witness program version. + @override + final WitnessVersion version; + + /// The witness program. + @override + final Uint8List program; + + @override + String toString() { + return 'Payload.witnessProgram(version: $version, program: $program)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$Payload_WitnessProgramImpl && + (identical(other.version, version) || other.version == version) && + const DeepCollectionEquality().equals(other.program, program)); + } + + @override + int get hashCode => Object.hash( + runtimeType, version, const DeepCollectionEquality().hash(program)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$Payload_WitnessProgramImplCopyWith<_$Payload_WitnessProgramImpl> + get copyWith => __$$Payload_WitnessProgramImplCopyWithImpl< + _$Payload_WitnessProgramImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String pubkeyHash) pubkeyHash, + required TResult Function(String scriptHash) scriptHash, + required TResult Function(WitnessVersion version, Uint8List program) + witnessProgram, + }) { + return witnessProgram(version, program); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String pubkeyHash)? pubkeyHash, + TResult? Function(String scriptHash)? scriptHash, + TResult? Function(WitnessVersion version, Uint8List program)? + witnessProgram, + }) { + return witnessProgram?.call(version, program); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String pubkeyHash)? pubkeyHash, + TResult Function(String scriptHash)? scriptHash, + TResult Function(WitnessVersion version, Uint8List program)? witnessProgram, + required TResult orElse(), + }) { + if (witnessProgram != null) { + return witnessProgram(version, program); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(Payload_PubkeyHash value) pubkeyHash, + required TResult Function(Payload_ScriptHash value) scriptHash, + required TResult Function(Payload_WitnessProgram value) witnessProgram, + }) { + return witnessProgram(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(Payload_PubkeyHash value)? pubkeyHash, + TResult? Function(Payload_ScriptHash value)? scriptHash, + TResult? Function(Payload_WitnessProgram value)? witnessProgram, + }) { + return witnessProgram?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Payload_PubkeyHash value)? pubkeyHash, + TResult Function(Payload_ScriptHash value)? scriptHash, + TResult Function(Payload_WitnessProgram value)? witnessProgram, + required TResult orElse(), + }) { + if (witnessProgram != null) { + return witnessProgram(this); + } + return orElse(); + } +} + +abstract class Payload_WitnessProgram implements Payload { + const factory Payload_WitnessProgram( + {required final WitnessVersion version, + required final Uint8List program}) = _$Payload_WitnessProgramImpl; + + /// The witness program version. + WitnessVersion get version; + + /// The witness program. + Uint8List get program; + @JsonKey(ignore: true) + _$$Payload_WitnessProgramImplCopyWith<_$Payload_WitnessProgramImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$RbfValue { + @optionalTypeArgs + TResult when({ + required TResult Function() rbfDefault, + required TResult Function(int field0) value, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? rbfDefault, + TResult? Function(int field0)? value, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? rbfDefault, + TResult Function(int field0)? value, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(RbfValue_RbfDefault value) rbfDefault, + required TResult Function(RbfValue_Value value) value, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RbfValue_RbfDefault value)? rbfDefault, + TResult? Function(RbfValue_Value value)? value, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RbfValue_RbfDefault value)? rbfDefault, + TResult Function(RbfValue_Value value)? value, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RbfValueCopyWith<$Res> { + factory $RbfValueCopyWith(RbfValue value, $Res Function(RbfValue) then) = + _$RbfValueCopyWithImpl<$Res, RbfValue>; +} + +/// @nodoc +class _$RbfValueCopyWithImpl<$Res, $Val extends RbfValue> + implements $RbfValueCopyWith<$Res> { + _$RbfValueCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$RbfValue_RbfDefaultImplCopyWith<$Res> { + factory _$$RbfValue_RbfDefaultImplCopyWith(_$RbfValue_RbfDefaultImpl value, + $Res Function(_$RbfValue_RbfDefaultImpl) then) = + __$$RbfValue_RbfDefaultImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$RbfValue_RbfDefaultImplCopyWithImpl<$Res> + extends _$RbfValueCopyWithImpl<$Res, _$RbfValue_RbfDefaultImpl> + implements _$$RbfValue_RbfDefaultImplCopyWith<$Res> { + __$$RbfValue_RbfDefaultImplCopyWithImpl(_$RbfValue_RbfDefaultImpl _value, + $Res Function(_$RbfValue_RbfDefaultImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$RbfValue_RbfDefaultImpl implements RbfValue_RbfDefault { + const _$RbfValue_RbfDefaultImpl(); + + @override + String toString() { + return 'RbfValue.rbfDefault()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RbfValue_RbfDefaultImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() rbfDefault, + required TResult Function(int field0) value, + }) { + return rbfDefault(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? rbfDefault, + TResult? Function(int field0)? value, + }) { + return rbfDefault?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? rbfDefault, + TResult Function(int field0)? value, + required TResult orElse(), + }) { + if (rbfDefault != null) { + return rbfDefault(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RbfValue_RbfDefault value) rbfDefault, + required TResult Function(RbfValue_Value value) value, + }) { + return rbfDefault(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RbfValue_RbfDefault value)? rbfDefault, + TResult? Function(RbfValue_Value value)? value, + }) { + return rbfDefault?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RbfValue_RbfDefault value)? rbfDefault, + TResult Function(RbfValue_Value value)? value, + required TResult orElse(), + }) { + if (rbfDefault != null) { + return rbfDefault(this); + } + return orElse(); + } +} + +abstract class RbfValue_RbfDefault implements RbfValue { + const factory RbfValue_RbfDefault() = _$RbfValue_RbfDefaultImpl; +} + +/// @nodoc +abstract class _$$RbfValue_ValueImplCopyWith<$Res> { + factory _$$RbfValue_ValueImplCopyWith(_$RbfValue_ValueImpl value, + $Res Function(_$RbfValue_ValueImpl) then) = + __$$RbfValue_ValueImplCopyWithImpl<$Res>; + @useResult + $Res call({int field0}); +} + +/// @nodoc +class __$$RbfValue_ValueImplCopyWithImpl<$Res> + extends _$RbfValueCopyWithImpl<$Res, _$RbfValue_ValueImpl> + implements _$$RbfValue_ValueImplCopyWith<$Res> { + __$$RbfValue_ValueImplCopyWithImpl( + _$RbfValue_ValueImpl _value, $Res Function(_$RbfValue_ValueImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$RbfValue_ValueImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$RbfValue_ValueImpl implements RbfValue_Value { + const _$RbfValue_ValueImpl(this.field0); + + @override + final int field0; + + @override + String toString() { + return 'RbfValue.value(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RbfValue_ValueImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$RbfValue_ValueImplCopyWith<_$RbfValue_ValueImpl> get copyWith => + __$$RbfValue_ValueImplCopyWithImpl<_$RbfValue_ValueImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() rbfDefault, + required TResult Function(int field0) value, + }) { + return value(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? rbfDefault, + TResult? Function(int field0)? value, + }) { + return value?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? rbfDefault, + TResult Function(int field0)? value, + required TResult orElse(), + }) { + if (value != null) { + return value(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RbfValue_RbfDefault value) rbfDefault, + required TResult Function(RbfValue_Value value) value, + }) { + return value(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RbfValue_RbfDefault value)? rbfDefault, + TResult? Function(RbfValue_Value value)? value, + }) { + return value?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RbfValue_RbfDefault value)? rbfDefault, + TResult Function(RbfValue_Value value)? value, + required TResult orElse(), + }) { + if (value != null) { + return value(this); + } + return orElse(); + } +} + +abstract class RbfValue_Value implements RbfValue { + const factory RbfValue_Value(final int field0) = _$RbfValue_ValueImpl; + + int get field0; + @JsonKey(ignore: true) + _$$RbfValue_ValueImplCopyWith<_$RbfValue_ValueImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/src/generated/api/wallet.dart b/lib/src/generated/api/wallet.dart new file mode 100644 index 00000000..34e4530f --- /dev/null +++ b/lib/src/generated/api/wallet.dart @@ -0,0 +1,214 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.28. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../frb_generated.dart'; +import 'blockchain.dart'; +import 'descriptor.dart'; +import 'error.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +import 'psbt.dart'; +import 'types.dart'; + +Future<(PsbtBase, TransactionDetails)> finishBumpFeeTxBuilder( + {required String txid, + required double feeRate, + AddressBase? allowShrinking, + required WalletBase wallet, + required bool enableRbf, + int? nSequence, + dynamic hint}) => + BdkCore.instance.api.finishBumpFeeTxBuilder( + txid: txid, + feeRate: feeRate, + allowShrinking: allowShrinking, + wallet: wallet, + enableRbf: enableRbf, + nSequence: nSequence, + hint: hint); + +Future<(PsbtBase, TransactionDetails)> txBuilderFinish( + {required WalletBase wallet, + required List recipients, + required List utxos, + (OutPoint, Input, int)? foreignUtxo, + required List unSpendable, + required ChangeSpendPolicy changePolicy, + required bool manuallySelectedOnly, + double? feeRate, + int? feeAbsolute, + required bool drainWallet, + ScriptBufBase? drainTo, + RbfValue? rbf, + required List data, + dynamic hint}) => + BdkCore.instance.api.txBuilderFinish( + wallet: wallet, + recipients: recipients, + utxos: utxos, + foreignUtxo: foreignUtxo, + unSpendable: unSpendable, + changePolicy: changePolicy, + manuallySelectedOnly: manuallySelectedOnly, + feeRate: feeRate, + feeAbsolute: feeAbsolute, + drainWallet: drainWallet, + drainTo: drainTo, + rbf: rbf, + data: data, + hint: hint); + +// Rust type: RustOpaqueNom >> +@sealed +class MutexBdkWalletAnyDatabase extends RustOpaque { + MutexBdkWalletAnyDatabase.dcoDecode(List wire) + : super.dcoDecode(wire, _kStaticData); + + MutexBdkWalletAnyDatabase.sseDecode(int ptr, int externalSizeOnNative) + : super.sseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: BdkCore + .instance.api.rust_arc_increment_strong_count_MutexBdkWalletAnyDatabase, + rustArcDecrementStrongCount: BdkCore + .instance.api.rust_arc_decrement_strong_count_MutexBdkWalletAnyDatabase, + rustArcDecrementStrongCountPtr: BdkCore.instance.api + .rust_arc_decrement_strong_count_MutexBdkWalletAnyDatabasePtr, + ); +} + +class WalletBase { + final MutexBdkWalletAnyDatabase ptr; + + const WalletBase({ + required this.ptr, + }); + + /// Return a derived address using the external descriptor, see AddressIndex for available address index selection + /// strategies. If none of the keys in the descriptor are derivable (i.e. the descriptor does not end with a * character) + /// then the same address will always be returned for any AddressIndex. + Future getAddress( + {required AddressIndex addressIndex, dynamic hint}) => + BdkCore.instance.api.walletBaseGetAddress( + that: this, + addressIndex: addressIndex, + ); + + /// Return the balance, meaning the sum of this wallet’s unspent outputs’ values. Note that this method only operates + /// on the internal database, which first needs to be Wallet.sync manually. + Future getBalance({dynamic hint}) => + BdkCore.instance.api.walletBaseGetBalance( + that: this, + ); + + ///Returns the descriptor used to create addresses for a particular keychain. + static Future getDescriptorForKeychain( + {required WalletBase ptr, + required KeychainKind keychain, + dynamic hint}) => + BdkCore.instance.api.walletBaseGetDescriptorForKeychain( + ptr: ptr, keychain: keychain, hint: hint); + + /// Return a derived address using the internal (change) descriptor. + /// + /// If the wallet doesn't have an internal descriptor it will use the external descriptor. + /// + /// see [AddressIndex] for available address index selection strategies. If none of the keys + /// in the descriptor are derivable (i.e. does not end with /*) then the same address will always + /// be returned for any [AddressIndex]. + Future getInternalAddress( + {required AddressIndex addressIndex, dynamic hint}) => + BdkCore.instance.api.walletBaseGetInternalAddress( + that: this, + addressIndex: addressIndex, + ); + + ///get the corresponding PSBT Input for a LocalUtxo + Future getPsbtInput( + {required LocalUtxo utxo, + required bool onlyWitnessUtxo, + PsbtSigHashType? sighashType, + dynamic hint}) => + BdkCore.instance.api.walletBaseGetPsbtInput( + that: this, + utxo: utxo, + onlyWitnessUtxo: onlyWitnessUtxo, + sighashType: sighashType, + ); + + /// Return whether or not a script is part of this wallet (either internal or external). + Future isMine({required ScriptBufBase script, dynamic hint}) => + BdkCore.instance.api.walletBaseIsMine( + that: this, + script: script, + ); + + /// Return the list of transactions made and received by the wallet. Note that this method only operate on the internal database, which first needs to be [Wallet.sync] manually. + Future> listTransactions( + {required bool includeRaw, dynamic hint}) => + BdkCore.instance.api.walletBaseListTransactions( + that: this, + includeRaw: includeRaw, + ); + + /// Return the list of unspent outputs of this wallet. Note that this method only operates on the internal database, + /// which first needs to be Wallet.sync manually. + Future> listUnspent({dynamic hint}) => + BdkCore.instance.api.walletBaseListUnspent( + that: this, + ); + + /// Get the Bitcoin network the wallet is using. + Future network({dynamic hint}) => + BdkCore.instance.api.walletBaseNetwork( + that: this, + ); + + // HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class. + static Future newInstance( + {required DescriptorBase descriptor, + DescriptorBase? changeDescriptor, + required Network network, + required DatabaseConfig databaseConfig, + dynamic hint}) => + BdkCore.instance.api.walletBaseNew( + descriptor: descriptor, + changeDescriptor: changeDescriptor, + network: network, + databaseConfig: databaseConfig, + hint: hint); + + /// Sign a transaction with all the wallet's signers. This function returns an encapsulated bool that + /// has the value true if the PSBT was finalized, or false otherwise. + /// + /// The [SignOptions] can be used to tweak the behavior of the software signers, and the way + /// the transaction is finalized at the end. Note that it can't be guaranteed that *every* + /// signers will follow the options, but the "software signers" (WIF keys and `xprv`) defined + /// in this library will. + static Future sign( + {required WalletBase ptr, + required PsbtBase psbt, + SignOptions? signOptions, + dynamic hint}) => + BdkCore.instance.api.walletBaseSign( + ptr: ptr, psbt: psbt, signOptions: signOptions, hint: hint); + + /// Sync the internal database with the blockchain. + static Future sync( + {required WalletBase ptr, + required BlockchainBase blockchain, + dynamic hint}) => + BdkCore.instance.api + .walletBaseSync(ptr: ptr, blockchain: blockchain, hint: hint); + + @override + int get hashCode => ptr.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is WalletBase && + runtimeType == other.runtimeType && + ptr == other.ptr; +} diff --git a/lib/src/generated/bindings.dart b/lib/src/generated/bindings.dart deleted file mode 100644 index 9d3d6924..00000000 --- a/lib/src/generated/bindings.dart +++ /dev/null @@ -1,4918 +0,0 @@ -// AUTO GENERATED FILE, DO NOT EDIT. -// Generated by `flutter_rust_bridge`@ 1.82.6. -// ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, unnecessary_import, prefer_single_quotes, prefer_const_constructors, use_super_parameters, always_use_package_imports, annotate_overrides, invalid_use_of_protected_member, constant_identifier_names, invalid_use_of_internal_member, prefer_is_empty, unnecessary_const - -import "bridge_definitions.dart"; -import 'dart:convert'; -import 'dart:async'; -import 'package:meta/meta.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge.dart'; -import 'package:uuid/uuid.dart'; - -import 'dart:convert'; -import 'dart:async'; -import 'package:meta/meta.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge.dart'; -import 'package:uuid/uuid.dart'; - -import 'dart:ffi' as ffi; - -class RustBdkFfiImpl implements RustBdkFfi { - final RustBdkFfiPlatform _platform; - factory RustBdkFfiImpl(ExternalLibrary dylib) => - RustBdkFfiImpl.raw(RustBdkFfiPlatform(dylib)); - - /// Only valid on web/WASM platforms. - factory RustBdkFfiImpl.wasm(FutureOr module) => - RustBdkFfiImpl(module as ExternalLibrary); - RustBdkFfiImpl.raw(this._platform); - Future createBlockchainStaticMethodApi( - {required BlockchainConfig config, dynamic hint}) { - var arg0 = _platform.api2wire_box_autoadd_blockchain_config(config); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_create_blockchain__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kCreateBlockchainStaticMethodApiConstMeta, - argValues: [config], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kCreateBlockchainStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "create_blockchain__static_method__Api", - argNames: ["config"], - ); - - Future getHeightStaticMethodApi( - {required String blockchainId, dynamic hint}) { - var arg0 = _platform.api2wire_String(blockchainId); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_get_height__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_u32, - parseErrorData: _wire2api_error, - constMeta: kGetHeightStaticMethodApiConstMeta, - argValues: [blockchainId], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kGetHeightStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "get_height__static_method__Api", - argNames: ["blockchainId"], - ); - - Future getBlockchainHashStaticMethodApi( - {required int blockchainHeight, - required String blockchainId, - dynamic hint}) { - var arg0 = api2wire_u32(blockchainHeight); - var arg1 = _platform.api2wire_String(blockchainId); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_get_blockchain_hash__static_method__Api(port_, arg0, arg1), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kGetBlockchainHashStaticMethodApiConstMeta, - argValues: [blockchainHeight, blockchainId], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kGetBlockchainHashStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "get_blockchain_hash__static_method__Api", - argNames: ["blockchainHeight", "blockchainId"], - ); - - Future estimateFeeStaticMethodApi( - {required int target, required String blockchainId, dynamic hint}) { - var arg0 = _platform.api2wire_u64(target); - var arg1 = _platform.api2wire_String(blockchainId); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_estimate_fee__static_method__Api(port_, arg0, arg1), - parseSuccessData: _wire2api_f32, - parseErrorData: _wire2api_error, - constMeta: kEstimateFeeStaticMethodApiConstMeta, - argValues: [target, blockchainId], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kEstimateFeeStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "estimate_fee__static_method__Api", - argNames: ["target", "blockchainId"], - ); - - Future broadcastStaticMethodApi( - {required String tx, required String blockchainId, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - var arg1 = _platform.api2wire_String(blockchainId); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_broadcast__static_method__Api(port_, arg0, arg1), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kBroadcastStaticMethodApiConstMeta, - argValues: [tx, blockchainId], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kBroadcastStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "broadcast__static_method__Api", - argNames: ["tx", "blockchainId"], - ); - - Future createTransactionStaticMethodApi( - {required Uint8List tx, dynamic hint}) { - var arg0 = _platform.api2wire_uint_8_list(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_create_transaction__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kCreateTransactionStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kCreateTransactionStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "create_transaction__static_method__Api", - argNames: ["tx"], - ); - - Future txTxidStaticMethodApi({required String tx, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_tx_txid__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kTxTxidStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kTxTxidStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "tx_txid__static_method__Api", - argNames: ["tx"], - ); - - Future weightStaticMethodApi({required String tx, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_weight__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_u64, - parseErrorData: null, - constMeta: kWeightStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kWeightStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "weight__static_method__Api", - argNames: ["tx"], - ); - - Future sizeStaticMethodApi({required String tx, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_size__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_u64, - parseErrorData: null, - constMeta: kSizeStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kSizeStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "size__static_method__Api", - argNames: ["tx"], - ); - - Future vsizeStaticMethodApi({required String tx, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_vsize__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_u64, - parseErrorData: null, - constMeta: kVsizeStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kVsizeStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "vsize__static_method__Api", - argNames: ["tx"], - ); - - Future serializeTxStaticMethodApi( - {required String tx, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_serialize_tx__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_uint_8_list, - parseErrorData: null, - constMeta: kSerializeTxStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kSerializeTxStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "serialize_tx__static_method__Api", - argNames: ["tx"], - ); - - Future isCoinBaseStaticMethodApi({required String tx, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_is_coin_base__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_bool, - parseErrorData: null, - constMeta: kIsCoinBaseStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kIsCoinBaseStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "is_coin_base__static_method__Api", - argNames: ["tx"], - ); - - Future isExplicitlyRbfStaticMethodApi( - {required String tx, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_is_explicitly_rbf__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_bool, - parseErrorData: null, - constMeta: kIsExplicitlyRbfStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kIsExplicitlyRbfStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "is_explicitly_rbf__static_method__Api", - argNames: ["tx"], - ); - - Future isLockTimeEnabledStaticMethodApi( - {required String tx, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_is_lock_time_enabled__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_bool, - parseErrorData: null, - constMeta: kIsLockTimeEnabledStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kIsLockTimeEnabledStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "is_lock_time_enabled__static_method__Api", - argNames: ["tx"], - ); - - Future versionStaticMethodApi({required String tx, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_version__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_i32, - parseErrorData: null, - constMeta: kVersionStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kVersionStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "version__static_method__Api", - argNames: ["tx"], - ); - - Future lockTimeStaticMethodApi({required String tx, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_lock_time__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_u32, - parseErrorData: null, - constMeta: kLockTimeStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kLockTimeStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "lock_time__static_method__Api", - argNames: ["tx"], - ); - - Future> inputStaticMethodApi({required String tx, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_input__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_list_tx_in, - parseErrorData: null, - constMeta: kInputStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kInputStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "input__static_method__Api", - argNames: ["tx"], - ); - - Future> outputStaticMethodApi( - {required String tx, dynamic hint}) { - var arg0 = _platform.api2wire_String(tx); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_output__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_list_tx_out, - parseErrorData: null, - constMeta: kOutputStaticMethodApiConstMeta, - argValues: [tx], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kOutputStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "output__static_method__Api", - argNames: ["tx"], - ); - - Future serializePsbtStaticMethodApi( - {required String psbtStr, dynamic hint}) { - var arg0 = _platform.api2wire_String(psbtStr); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_serialize_psbt__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kSerializePsbtStaticMethodApiConstMeta, - argValues: [psbtStr], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kSerializePsbtStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "serialize_psbt__static_method__Api", - argNames: ["psbtStr"], - ); - - Future psbtTxidStaticMethodApi( - {required String psbtStr, dynamic hint}) { - var arg0 = _platform.api2wire_String(psbtStr); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_psbt_txid__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kPsbtTxidStaticMethodApiConstMeta, - argValues: [psbtStr], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kPsbtTxidStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "psbt_txid__static_method__Api", - argNames: ["psbtStr"], - ); - - Future extractTxStaticMethodApi( - {required String psbtStr, dynamic hint}) { - var arg0 = _platform.api2wire_String(psbtStr); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_extract_tx__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kExtractTxStaticMethodApiConstMeta, - argValues: [psbtStr], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kExtractTxStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "extract_tx__static_method__Api", - argNames: ["psbtStr"], - ); - - Future psbtFeeRateStaticMethodApi( - {required String psbtStr, dynamic hint}) { - var arg0 = _platform.api2wire_String(psbtStr); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_psbt_fee_rate__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_opt_box_autoadd_f32, - parseErrorData: null, - constMeta: kPsbtFeeRateStaticMethodApiConstMeta, - argValues: [psbtStr], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kPsbtFeeRateStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "psbt_fee_rate__static_method__Api", - argNames: ["psbtStr"], - ); - - Future psbtFeeAmountStaticMethodApi( - {required String psbtStr, dynamic hint}) { - var arg0 = _platform.api2wire_String(psbtStr); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_psbt_fee_amount__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_opt_box_autoadd_u64, - parseErrorData: null, - constMeta: kPsbtFeeAmountStaticMethodApiConstMeta, - argValues: [psbtStr], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kPsbtFeeAmountStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "psbt_fee_amount__static_method__Api", - argNames: ["psbtStr"], - ); - - Future combinePsbtStaticMethodApi( - {required String psbtStr, required String other, dynamic hint}) { - var arg0 = _platform.api2wire_String(psbtStr); - var arg1 = _platform.api2wire_String(other); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_combine_psbt__static_method__Api(port_, arg0, arg1), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kCombinePsbtStaticMethodApiConstMeta, - argValues: [psbtStr, other], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kCombinePsbtStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "combine_psbt__static_method__Api", - argNames: ["psbtStr", "other"], - ); - - Future jsonSerializeStaticMethodApi( - {required String psbtStr, dynamic hint}) { - var arg0 = _platform.api2wire_String(psbtStr); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - _platform.inner.wire_json_serialize__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kJsonSerializeStaticMethodApiConstMeta, - argValues: [psbtStr], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kJsonSerializeStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "json_serialize__static_method__Api", - argNames: ["psbtStr"], - ); - - Future<(String, TransactionDetails)> txBuilderFinishStaticMethodApi( - {required String walletId, - required List recipients, - required List utxos, - (OutPoint, String, int)? foreignUtxo, - required List unspendable, - required ChangeSpendPolicy changePolicy, - required bool manuallySelectedOnly, - double? feeRate, - int? feeAbsolute, - required bool drainWallet, - Script? drainTo, - RbfValue? rbf, - required Uint8List data, - dynamic hint}) { - var arg0 = _platform.api2wire_String(walletId); - var arg1 = _platform.api2wire_list_script_amount(recipients); - var arg2 = _platform.api2wire_list_out_point(utxos); - var arg3 = _platform - .api2wire_opt_box_autoadd___record__out_point_String_usize(foreignUtxo); - var arg4 = _platform.api2wire_list_out_point(unspendable); - var arg5 = api2wire_change_spend_policy(changePolicy); - var arg6 = manuallySelectedOnly; - var arg7 = _platform.api2wire_opt_box_autoadd_f32(feeRate); - var arg8 = _platform.api2wire_opt_box_autoadd_u64(feeAbsolute); - var arg9 = drainWallet; - var arg10 = _platform.api2wire_opt_box_autoadd_script(drainTo); - var arg11 = _platform.api2wire_opt_box_autoadd_rbf_value(rbf); - var arg12 = _platform.api2wire_uint_8_list(data); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_tx_builder_finish__static_method__Api(port_, arg0, arg1, arg2, - arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12), - parseSuccessData: _wire2api___record__String_transaction_details, - parseErrorData: _wire2api_error, - constMeta: kTxBuilderFinishStaticMethodApiConstMeta, - argValues: [ - walletId, - recipients, - utxos, - foreignUtxo, - unspendable, - changePolicy, - manuallySelectedOnly, - feeRate, - feeAbsolute, - drainWallet, - drainTo, - rbf, - data - ], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kTxBuilderFinishStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "tx_builder_finish__static_method__Api", - argNames: [ - "walletId", - "recipients", - "utxos", - "foreignUtxo", - "unspendable", - "changePolicy", - "manuallySelectedOnly", - "feeRate", - "feeAbsolute", - "drainWallet", - "drainTo", - "rbf", - "data" - ], - ); - - Future<(String, TransactionDetails)> bumpFeeTxBuilderFinishStaticMethodApi( - {required String txid, - required double feeRate, - String? allowShrinking, - required String walletId, - required bool enableRbf, - int? nSequence, - dynamic hint}) { - var arg0 = _platform.api2wire_String(txid); - var arg1 = api2wire_f32(feeRate); - var arg2 = _platform.api2wire_opt_String(allowShrinking); - var arg3 = _platform.api2wire_String(walletId); - var arg4 = enableRbf; - var arg5 = _platform.api2wire_opt_box_autoadd_u32(nSequence); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_bump_fee_tx_builder_finish__static_method__Api( - port_, arg0, arg1, arg2, arg3, arg4, arg5), - parseSuccessData: _wire2api___record__String_transaction_details, - parseErrorData: _wire2api_error, - constMeta: kBumpFeeTxBuilderFinishStaticMethodApiConstMeta, - argValues: [ - txid, - feeRate, - allowShrinking, - walletId, - enableRbf, - nSequence - ], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kBumpFeeTxBuilderFinishStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "bump_fee_tx_builder_finish__static_method__Api", - argNames: [ - "txid", - "feeRate", - "allowShrinking", - "walletId", - "enableRbf", - "nSequence" - ], - ); - - Future createDescriptorStaticMethodApi( - {required String descriptor, required Network network, dynamic hint}) { - var arg0 = _platform.api2wire_String(descriptor); - var arg1 = api2wire_network(network); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_create_descriptor__static_method__Api(port_, arg0, arg1), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kCreateDescriptorStaticMethodApiConstMeta, - argValues: [descriptor, network], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kCreateDescriptorStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "create_descriptor__static_method__Api", - argNames: ["descriptor", "network"], - ); - - Future newBip44DescriptorStaticMethodApi( - {required KeychainKind keyChainKind, - required String secretKey, - required Network network, - dynamic hint}) { - var arg0 = api2wire_keychain_kind(keyChainKind); - var arg1 = _platform.api2wire_String(secretKey); - var arg2 = api2wire_network(network); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_new_bip44_descriptor__static_method__Api( - port_, arg0, arg1, arg2), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kNewBip44DescriptorStaticMethodApiConstMeta, - argValues: [keyChainKind, secretKey, network], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kNewBip44DescriptorStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "new_bip44_descriptor__static_method__Api", - argNames: ["keyChainKind", "secretKey", "network"], - ); - - Future newBip44PublicStaticMethodApi( - {required KeychainKind keyChainKind, - required String publicKey, - required Network network, - required String fingerprint, - dynamic hint}) { - var arg0 = api2wire_keychain_kind(keyChainKind); - var arg1 = _platform.api2wire_String(publicKey); - var arg2 = api2wire_network(network); - var arg3 = _platform.api2wire_String(fingerprint); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_new_bip44_public__static_method__Api( - port_, arg0, arg1, arg2, arg3), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kNewBip44PublicStaticMethodApiConstMeta, - argValues: [keyChainKind, publicKey, network, fingerprint], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kNewBip44PublicStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "new_bip44_public__static_method__Api", - argNames: ["keyChainKind", "publicKey", "network", "fingerprint"], - ); - - Future newBip49DescriptorStaticMethodApi( - {required KeychainKind keyChainKind, - required String secretKey, - required Network network, - dynamic hint}) { - var arg0 = api2wire_keychain_kind(keyChainKind); - var arg1 = _platform.api2wire_String(secretKey); - var arg2 = api2wire_network(network); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_new_bip49_descriptor__static_method__Api( - port_, arg0, arg1, arg2), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kNewBip49DescriptorStaticMethodApiConstMeta, - argValues: [keyChainKind, secretKey, network], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kNewBip49DescriptorStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "new_bip49_descriptor__static_method__Api", - argNames: ["keyChainKind", "secretKey", "network"], - ); - - Future newBip49PublicStaticMethodApi( - {required KeychainKind keyChainKind, - required String publicKey, - required Network network, - required String fingerprint, - dynamic hint}) { - var arg0 = api2wire_keychain_kind(keyChainKind); - var arg1 = _platform.api2wire_String(publicKey); - var arg2 = api2wire_network(network); - var arg3 = _platform.api2wire_String(fingerprint); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_new_bip49_public__static_method__Api( - port_, arg0, arg1, arg2, arg3), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kNewBip49PublicStaticMethodApiConstMeta, - argValues: [keyChainKind, publicKey, network, fingerprint], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kNewBip49PublicStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "new_bip49_public__static_method__Api", - argNames: ["keyChainKind", "publicKey", "network", "fingerprint"], - ); - - Future newBip84DescriptorStaticMethodApi( - {required KeychainKind keyChainKind, - required String secretKey, - required Network network, - dynamic hint}) { - var arg0 = api2wire_keychain_kind(keyChainKind); - var arg1 = _platform.api2wire_String(secretKey); - var arg2 = api2wire_network(network); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_new_bip84_descriptor__static_method__Api( - port_, arg0, arg1, arg2), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kNewBip84DescriptorStaticMethodApiConstMeta, - argValues: [keyChainKind, secretKey, network], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kNewBip84DescriptorStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "new_bip84_descriptor__static_method__Api", - argNames: ["keyChainKind", "secretKey", "network"], - ); - - Future newBip84PublicStaticMethodApi( - {required KeychainKind keyChainKind, - required String publicKey, - required Network network, - required String fingerprint, - dynamic hint}) { - var arg0 = api2wire_keychain_kind(keyChainKind); - var arg1 = _platform.api2wire_String(publicKey); - var arg2 = api2wire_network(network); - var arg3 = _platform.api2wire_String(fingerprint); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_new_bip84_public__static_method__Api( - port_, arg0, arg1, arg2, arg3), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kNewBip84PublicStaticMethodApiConstMeta, - argValues: [keyChainKind, publicKey, network, fingerprint], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kNewBip84PublicStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "new_bip84_public__static_method__Api", - argNames: ["keyChainKind", "publicKey", "network", "fingerprint"], - ); - - Future newBip86DescriptorStaticMethodApi( - {required KeychainKind keyChainKind, - required String secretKey, - required Network network, - dynamic hint}) { - var arg0 = api2wire_keychain_kind(keyChainKind); - var arg1 = _platform.api2wire_String(secretKey); - var arg2 = api2wire_network(network); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_new_bip86_descriptor__static_method__Api( - port_, arg0, arg1, arg2), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kNewBip86DescriptorStaticMethodApiConstMeta, - argValues: [keyChainKind, secretKey, network], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kNewBip86DescriptorStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "new_bip86_descriptor__static_method__Api", - argNames: ["keyChainKind", "secretKey", "network"], - ); - - Future newBip86PublicStaticMethodApi( - {required KeychainKind keyChainKind, - required String publicKey, - required Network network, - required String fingerprint, - dynamic hint}) { - var arg0 = api2wire_keychain_kind(keyChainKind); - var arg1 = _platform.api2wire_String(publicKey); - var arg2 = api2wire_network(network); - var arg3 = _platform.api2wire_String(fingerprint); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_new_bip86_public__static_method__Api( - port_, arg0, arg1, arg2, arg3), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kNewBip86PublicStaticMethodApiConstMeta, - argValues: [keyChainKind, publicKey, network, fingerprint], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta get kNewBip86PublicStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "new_bip86_public__static_method__Api", - argNames: ["keyChainKind", "publicKey", "network", "fingerprint"], - ); - - Future descriptorAsStringPrivateStaticMethodApi( - {required String descriptor, required Network network, dynamic hint}) { - var arg0 = _platform.api2wire_String(descriptor); - var arg1 = api2wire_network(network); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_descriptor_as_string_private__static_method__Api( - port_, arg0, arg1), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kDescriptorAsStringPrivateStaticMethodApiConstMeta, - argValues: [descriptor, network], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kDescriptorAsStringPrivateStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "descriptor_as_string_private__static_method__Api", - argNames: ["descriptor", "network"], - ); - - Future descriptorAsStringStaticMethodApi( - {required String descriptor, required Network network, dynamic hint}) { - var arg0 = _platform.api2wire_String(descriptor); - var arg1 = api2wire_network(network); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_descriptor_as_string__static_method__Api(port_, arg0, arg1), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kDescriptorAsStringStaticMethodApiConstMeta, - argValues: [descriptor, network], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kDescriptorAsStringStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "descriptor_as_string__static_method__Api", - argNames: ["descriptor", "network"], - ); - - Future maxSatisfactionWeightStaticMethodApi( - {required String descriptor, required Network network, dynamic hint}) { - var arg0 = _platform.api2wire_String(descriptor); - var arg1 = api2wire_network(network); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_max_satisfaction_weight__static_method__Api(port_, arg0, arg1), - parseSuccessData: _wire2api_usize, - parseErrorData: _wire2api_error, - constMeta: kMaxSatisfactionWeightStaticMethodApiConstMeta, - argValues: [descriptor, network], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kMaxSatisfactionWeightStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "max_satisfaction_weight__static_method__Api", - argNames: ["descriptor", "network"], - ); - - Future createDescriptorSecretStaticMethodApi( - {required Network network, - required String mnemonic, - String? password, - dynamic hint}) { - var arg0 = api2wire_network(network); - var arg1 = _platform.api2wire_String(mnemonic); - var arg2 = _platform.api2wire_opt_String(password); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_create_descriptor_secret__static_method__Api( - port_, arg0, arg1, arg2), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kCreateDescriptorSecretStaticMethodApiConstMeta, - argValues: [network, mnemonic, password], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kCreateDescriptorSecretStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "create_descriptor_secret__static_method__Api", - argNames: ["network", "mnemonic", "password"], - ); - - Future descriptorSecretFromStringStaticMethodApi( - {required String secret, dynamic hint}) { - var arg0 = _platform.api2wire_String(secret); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_descriptor_secret_from_string__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_FrbAnyhowException, - constMeta: kDescriptorSecretFromStringStaticMethodApiConstMeta, - argValues: [secret], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kDescriptorSecretFromStringStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "descriptor_secret_from_string__static_method__Api", - argNames: ["secret"], - ); - - Future extendDescriptorSecretStaticMethodApi( - {required String secret, required String path, dynamic hint}) { - var arg0 = _platform.api2wire_String(secret); - var arg1 = _platform.api2wire_String(path); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_extend_descriptor_secret__static_method__Api(port_, arg0, arg1), - parseSuccessData: _wire2api_String, - parseErrorData: null, - constMeta: kExtendDescriptorSecretStaticMethodApiConstMeta, - argValues: [secret, path], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kExtendDescriptorSecretStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "extend_descriptor_secret__static_method__Api", - argNames: ["secret", "path"], - ); - - Future deriveDescriptorSecretStaticMethodApi( - {required String secret, required String path, dynamic hint}) { - var arg0 = _platform.api2wire_String(secret); - var arg1 = _platform.api2wire_String(path); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_derive_descriptor_secret__static_method__Api(port_, arg0, arg1), - parseSuccessData: _wire2api_String, - parseErrorData: null, - constMeta: kDeriveDescriptorSecretStaticMethodApiConstMeta, - argValues: [secret, path], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kDeriveDescriptorSecretStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "derive_descriptor_secret__static_method__Api", - argNames: ["secret", "path"], - ); - - Future descriptorSecretAsSecretBytesStaticMethodApi( - {required String secret, dynamic hint}) { - var arg0 = _platform.api2wire_String(secret); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_descriptor_secret_as_secret_bytes__static_method__Api( - port_, arg0), - parseSuccessData: _wire2api_uint_8_list, - parseErrorData: _wire2api_error, - constMeta: kDescriptorSecretAsSecretBytesStaticMethodApiConstMeta, - argValues: [secret], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kDescriptorSecretAsSecretBytesStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "descriptor_secret_as_secret_bytes__static_method__Api", - argNames: ["secret"], - ); - - Future descriptorSecretAsPublicStaticMethodApi( - {required String secret, dynamic hint}) { - var arg0 = _platform.api2wire_String(secret); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_descriptor_secret_as_public__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kDescriptorSecretAsPublicStaticMethodApiConstMeta, - argValues: [secret], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kDescriptorSecretAsPublicStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "descriptor_secret_as_public__static_method__Api", - argNames: ["secret"], - ); - - Future createDerivationPathStaticMethodApi( - {required String path, dynamic hint}) { - var arg0 = _platform.api2wire_String(path); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_create_derivation_path__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kCreateDerivationPathStaticMethodApiConstMeta, - argValues: [path], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kCreateDerivationPathStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "create_derivation_path__static_method__Api", - argNames: ["path"], - ); - - Future descriptorPublicFromStringStaticMethodApi( - {required String publicKey, dynamic hint}) { - var arg0 = _platform.api2wire_String(publicKey); - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_descriptor_public_from_string__static_method__Api(port_, arg0), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kDescriptorPublicFromStringStaticMethodApiConstMeta, - argValues: [publicKey], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kDescriptorPublicFromStringStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "descriptor_public_from_string__static_method__Api", - argNames: ["publicKey"], - ); - - Future createDescriptorPublicStaticMethodApi( - {String? xpub, - required String path, - required bool derive, - dynamic hint}) { - var arg0 = _platform.api2wire_opt_String(xpub); - var arg1 = _platform.api2wire_String(path); - var arg2 = derive; - return _platform.executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => _platform.inner - .wire_create_descriptor_public__static_method__Api( - port_, arg0, arg1, arg2), - parseSuccessData: _wire2api_String, - parseErrorData: _wire2api_error, - constMeta: kCreateDescriptorPublicStaticMethodApiConstMeta, - argValues: [xpub, path, derive], - hint: hint, - )); - } - - FlutterRustBridgeTaskConstMeta - get kCreateDescriptorPublicStaticMethodApiConstMeta => - const FlutterRustBridgeTaskConstMeta( - debugName: "create_descriptor_public__static_method__Api", - argNames: ["xpub", "path", "derive"], - ); - - Future