diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index daf0840..29cfe3c 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -9,7 +9,7 @@ plugins { android { namespace = "io.bdk.f.bdk_flutter_example" compileSdk = flutter.compileSdkVersion - ndkVersion "25.1.8937393" + ndkVersion = "25.1.8937393" compileOptions { sourceCompatibility JavaVersion.VERSION_17 diff --git a/example/lib/bdk_library.dart b/example/lib/bdk_library.dart index db4ecce..702cf26 100644 --- a/example/lib/bdk_library.dart +++ b/example/lib/bdk_library.dart @@ -52,7 +52,7 @@ class BdkLibrary { Future getPsbtInput( Wallet wallet, LocalUtxo utxo, bool onlyWitnessUtxo) async { final input = - await wallet.getPsbtInput(utxo: utxo, onlyWitnessUtxo: onlyWitnessUtxo); + wallet.getPsbtInput(utxo: utxo, onlyWitnessUtxo: onlyWitnessUtxo); return input; } @@ -68,7 +68,6 @@ class BdkLibrary { List getConfirmedTransactions(Wallet wallet) { List confirmed = []; final res = wallet.listTransactions(includeRaw: true); - for (var e in res) { if (e.confirmationTime != null) confirmed.add(e); } @@ -103,7 +102,7 @@ class BdkLibrary { .addRecipient(script, BigInt.from(amountSat)) .feeRate(feeRate.satPerVb) .finish(wallet); - final isFinalized = await wallet.sign(psbt: psbt); + final isFinalized = wallet.sign(psbt: psbt); if (isFinalized) { final tx = psbt.extractTx(); final res = await blockchain.broadcast(transaction: tx); diff --git a/example/lib/wallet.dart b/example/lib/wallet.dart index 159e368..3e47532 100644 --- a/example/lib/wallet.dart +++ b/example/lib/wallet.dart @@ -64,7 +64,7 @@ class _ExampleWalletState extends State { displayText = "You have ${unConfirmed.length} unConfirmed transactions"; }); for (var e in unConfirmed) { - final txOut = await e.transaction!.output(); + final txOut = e.transaction!.output(); if (kDebugMode) { print(" txid: ${e.txid}"); print(" fee: ${e.fee}"); @@ -86,10 +86,11 @@ class _ExampleWalletState extends State { print(" txid: ${e.txid}"); print(" confirmationTime: ${e.confirmationTime?.timestamp}"); print(" confirmationTime Height: ${e.confirmationTime?.height}"); - final txIn = await e.transaction!.input(); - final txOut = await e.transaction!.output(); + final txIn = e.transaction!.input(); + final txOut = e.transaction!.output(); print("=============TxIn=============="); for (var e in txIn) { + print(" script: ${e.scriptSig}"); print(" previousOutout Txid: ${e.previousOutput.txid}"); print(" previousOutout vout: ${e.previousOutput.vout}"); print(" witness: ${e.witness}"); diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 78c676d..aa208fe 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -14,7 +14,7 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral SPEC CHECKSUMS: - bdk_flutter: d0437c6116753242241fed48270587542a636d40 + bdk_flutter: 6897321c2433d56f1fc780982b6d94d5894258dd FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 PODFILE CHECKSUM: 6acf97521436d16fc31cd5e1a02000905acdb3ae diff --git a/ios/Classes/frb_generated.h b/ios/Classes/frb_generated.h index 2430b24..cc868c1 100644 --- a/ios/Classes/frb_generated.h +++ b/ios/Classes/frb_generated.h @@ -171,27 +171,54 @@ typedef struct wire_cst_list_list_prim_u_8_strict { int32_t len; } wire_cst_list_list_prim_u_8_strict; -typedef struct wire_cst_tx_in { +typedef struct wire_cst_bdk_tx_in { struct wire_cst_out_point previous_output; - struct wire_cst_bdk_script_buf script_sig; + struct wire_cst_bdk_script_buf *script_sig; uint32_t sequence; struct wire_cst_list_list_prim_u_8_strict *witness; -} wire_cst_tx_in; +} wire_cst_bdk_tx_in; -typedef struct wire_cst_list_tx_in { - struct wire_cst_tx_in *ptr; +typedef struct wire_cst_list_bdk_tx_in { + struct wire_cst_bdk_tx_in *ptr; int32_t len; -} wire_cst_list_tx_in; +} wire_cst_list_bdk_tx_in; -typedef struct wire_cst_tx_out { +typedef struct wire_cst_bdk_tx_out { uint64_t value; struct wire_cst_bdk_script_buf script_pubkey; -} wire_cst_tx_out; +} wire_cst_bdk_tx_out; -typedef struct wire_cst_list_tx_out { - struct wire_cst_tx_out *ptr; +typedef struct wire_cst_list_bdk_tx_out { + struct wire_cst_bdk_tx_out *ptr; int32_t len; -} wire_cst_list_tx_out; +} wire_cst_list_bdk_tx_out; + +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_bdk_wallet { uintptr_t ptr; @@ -217,7 +244,7 @@ typedef struct wire_cst_address_index { typedef struct wire_cst_local_utxo { struct wire_cst_out_point outpoint; - struct wire_cst_tx_out txout; + struct wire_cst_bdk_tx_out txout; int32_t keychain; bool is_spent; } wire_cst_local_utxo; @@ -226,33 +253,6 @@ 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 trust_witness_utxo; uint32_t *assume_height; @@ -521,6 +521,20 @@ typedef struct wire_cst_list_bdk_policy { int32_t len; } wire_cst_list_bdk_policy; +typedef struct wire_cst_bdk_transaction_details { + struct wire_cst_bdk_transaction *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_bdk_transaction_details; + +typedef struct wire_cst_list_bdk_transaction_details { + struct wire_cst_bdk_transaction_details *ptr; + int32_t len; +} wire_cst_list_bdk_transaction_details; + typedef struct wire_cst_list_condition { struct wire_cst_condition *ptr; int32_t len; @@ -561,20 +575,6 @@ typedef struct wire_cst_list_record_u_32_list_condition { int32_t len; } wire_cst_list_record_u_32_list_condition; -typedef struct wire_cst_transaction_details { - struct wire_cst_bdk_transaction *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_balance { uint64_t immature; uint64_t trusted_pending; @@ -804,10 +804,10 @@ typedef struct wire_cst_record_bdk_address_u_32 { uint32_t field1; } wire_cst_record_bdk_address_u_32; -typedef struct wire_cst_record_bdk_psbt_transaction_details { +typedef struct wire_cst_record_bdk_psbt_bdk_transaction_details { struct wire_cst_bdk_psbt field0; - struct wire_cst_transaction_details field1; -} wire_cst_record_bdk_psbt_transaction_details; + struct wire_cst_bdk_transaction_details field1; +} wire_cst_record_bdk_psbt_bdk_transaction_details; typedef struct wire_cst_Satisfaction_Partial { uint64_t n; @@ -925,92 +925,76 @@ void frbgen_bdk_flutter_wire__crate__api__blockchain__bdk_blockchain_get_height( WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_as_string(struct wire_cst_bdk_descriptor *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_create(struct wire_cst_list_prim_u_8_strict *descriptor, + int32_t network); + WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_max_satisfaction_weight(struct wire_cst_bdk_descriptor *that); -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new(int64_t port_, - struct wire_cst_list_prim_u_8_strict *descriptor, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44(int64_t port_, - struct wire_cst_bdk_descriptor_secret_key *secret_key, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44_public(int64_t port_, - struct wire_cst_bdk_descriptor_public_key *public_key, - struct wire_cst_list_prim_u_8_strict *fingerprint, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49(int64_t port_, - struct wire_cst_bdk_descriptor_secret_key *secret_key, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49_public(int64_t port_, - struct wire_cst_bdk_descriptor_public_key *public_key, - struct wire_cst_list_prim_u_8_strict *fingerprint, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip84(int64_t port_, - struct wire_cst_bdk_descriptor_secret_key *secret_key, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip84_public(int64_t port_, - struct wire_cst_bdk_descriptor_public_key *public_key, - struct wire_cst_list_prim_u_8_strict *fingerprint, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip86(int64_t port_, - struct wire_cst_bdk_descriptor_secret_key *secret_key, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip86_public(int64_t port_, - struct wire_cst_bdk_descriptor_public_key *public_key, - struct wire_cst_list_prim_u_8_strict *fingerprint, - int32_t keychain_kind, - int32_t network); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44(struct wire_cst_bdk_descriptor_secret_key *secret_key, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44_public(struct wire_cst_bdk_descriptor_public_key *public_key, + struct wire_cst_list_prim_u_8_strict *fingerprint, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49(struct wire_cst_bdk_descriptor_secret_key *secret_key, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49_public(struct wire_cst_bdk_descriptor_public_key *public_key, + struct wire_cst_list_prim_u_8_strict *fingerprint, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip84(struct wire_cst_bdk_descriptor_secret_key *secret_key, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip84_public(struct wire_cst_bdk_descriptor_public_key *public_key, + struct wire_cst_list_prim_u_8_strict *fingerprint, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip86(struct wire_cst_bdk_descriptor_secret_key *secret_key, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip86_public(struct wire_cst_bdk_descriptor_public_key *public_key, + struct wire_cst_list_prim_u_8_strict *fingerprint, + int32_t keychain_kind, + int32_t network); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_to_string_private(struct wire_cst_bdk_descriptor *that); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_derivation_path_as_string(struct wire_cst_bdk_derivation_path *that); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_derivation_path_from_string(int64_t port_, - struct wire_cst_list_prim_u_8_strict *path); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_derivation_path_from_string(struct wire_cst_list_prim_u_8_strict *path); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_as_string(struct wire_cst_bdk_descriptor_public_key *that); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_derive(int64_t port_, - struct wire_cst_bdk_descriptor_public_key *ptr, - struct wire_cst_bdk_derivation_path *path); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_derive(struct wire_cst_bdk_descriptor_public_key *ptr, + struct wire_cst_bdk_derivation_path *path); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_extend(int64_t port_, - struct wire_cst_bdk_descriptor_public_key *ptr, - struct wire_cst_bdk_derivation_path *path); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_extend(struct wire_cst_bdk_descriptor_public_key *ptr, + struct wire_cst_bdk_derivation_path *path); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_from_string(int64_t port_, - struct wire_cst_list_prim_u_8_strict *public_key); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_from_string(struct wire_cst_list_prim_u_8_strict *public_key); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_as_public(struct wire_cst_bdk_descriptor_secret_key *ptr); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_as_string(struct wire_cst_bdk_descriptor_secret_key *that); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_create(int64_t port_, - int32_t network, - struct wire_cst_bdk_mnemonic *mnemonic, - struct wire_cst_list_prim_u_8_strict *password); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_create(int32_t network, + struct wire_cst_bdk_mnemonic *mnemonic, + struct wire_cst_list_prim_u_8_strict *password); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_derive(int64_t port_, - struct wire_cst_bdk_descriptor_secret_key *ptr, - struct wire_cst_bdk_derivation_path *path); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_derive(struct wire_cst_bdk_descriptor_secret_key *ptr, + struct wire_cst_bdk_derivation_path *path); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_extend(int64_t port_, - struct wire_cst_bdk_descriptor_secret_key *ptr, - struct wire_cst_bdk_derivation_path *path); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_extend(struct wire_cst_bdk_descriptor_secret_key *ptr, + struct wire_cst_bdk_derivation_path *path); void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_from_string(int64_t port_, struct wire_cst_list_prim_u_8_strict *secret_key); @@ -1019,19 +1003,16 @@ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_se WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_as_string(struct wire_cst_bdk_mnemonic *that); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_entropy(int64_t port_, - struct wire_cst_list_prim_u_8_loose *entropy); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_create(int32_t word_count); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_string(int64_t port_, - struct wire_cst_list_prim_u_8_strict *mnemonic); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_entropy(struct wire_cst_list_prim_u_8_loose *entropy); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_new(int64_t port_, int32_t word_count); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_string(struct wire_cst_list_prim_u_8_strict *mnemonic); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_as_string(struct wire_cst_bdk_psbt *that); -void frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_combine(int64_t port_, - struct wire_cst_bdk_psbt *ptr, - struct wire_cst_bdk_psbt *other); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_combine(struct wire_cst_bdk_psbt *ptr, + struct wire_cst_bdk_psbt *other); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_extract_tx(struct wire_cst_bdk_psbt *ptr); @@ -1039,8 +1020,7 @@ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_fee_amo WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_fee_rate(struct wire_cst_bdk_psbt *that); -void frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_from_str(int64_t port_, - struct wire_cst_list_prim_u_8_strict *psbt_base64); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_from_str(struct wire_cst_list_prim_u_8_strict *psbt_base64); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_json_serialize(struct wire_cst_bdk_psbt *that); @@ -1050,13 +1030,11 @@ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_txid(st WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_address_as_string(struct wire_cst_bdk_address *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_address_from_script(int64_t port_, - struct wire_cst_bdk_script_buf *script, - int32_t network); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_address_from_script(struct wire_cst_bdk_script_buf *script, + int32_t network); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_address_from_string(int64_t port_, - struct wire_cst_list_prim_u_8_strict *address, - int32_t network); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_address_from_string(struct wire_cst_list_prim_u_8_strict *address, + int32_t network); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_address_is_valid_for_network(struct wire_cst_bdk_address *that, int32_t network); @@ -1085,56 +1063,46 @@ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_empty(void); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_from_hex(int64_t port_, - struct wire_cst_list_prim_u_8_strict *s); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_from_hex(struct wire_cst_list_prim_u_8_strict *s); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_with_capacity(uintptr_t capacity); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_with_capacity(int64_t port_, - uintptr_t capacity); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_create(int32_t version, + struct wire_cst_lock_time *lock_time, + struct wire_cst_list_bdk_tx_in *input, + struct wire_cst_list_bdk_tx_out *output); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_from_bytes(int64_t port_, - struct wire_cst_list_prim_u_8_loose *transaction_bytes); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_from_bytes(struct wire_cst_list_prim_u_8_loose *transaction_bytes); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_input(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_input(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_coin_base(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_coin_base(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_explicitly_rbf(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_explicitly_rbf(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_lock_time_enabled(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_lock_time_enabled(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_lock_time(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_lock_time(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_new(int64_t port_, - int32_t version, - struct wire_cst_lock_time *lock_time, - struct wire_cst_list_tx_in *input, - struct wire_cst_list_tx_out *output); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_output(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_output(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_serialize(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_serialize(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_size(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_size(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_txid(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_txid(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_version(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_version(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_vsize(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_vsize(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_weight(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_weight(int64_t port_, - struct wire_cst_bdk_transaction *that); +void frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_create(int64_t port_, + struct wire_cst_bdk_descriptor *descriptor, + struct wire_cst_bdk_descriptor *change_descriptor, + int32_t network, + struct wire_cst_database_config *database_config); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_address(struct wire_cst_bdk_wallet *ptr, struct wire_cst_address_index *address_index); @@ -1147,11 +1115,10 @@ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_internal_address(struct wire_cst_bdk_wallet *ptr, struct wire_cst_address_index *address_index); -void frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_psbt_input(int64_t port_, - struct wire_cst_bdk_wallet *that, - struct wire_cst_local_utxo *utxo, - bool only_witness_utxo, - struct wire_cst_psbt_sig_hash_type *sighash_type); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_psbt_input(struct wire_cst_bdk_wallet *that, + struct wire_cst_local_utxo *utxo, + bool only_witness_utxo, + struct wire_cst_psbt_sig_hash_type *sighash_type); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_is_mine(struct wire_cst_bdk_wallet *ptr, struct wire_cst_bdk_script_buf *script); @@ -1163,19 +1130,12 @@ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_lis WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_network(struct wire_cst_bdk_wallet *that); -void frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_new(int64_t port_, - struct wire_cst_bdk_descriptor *descriptor, - struct wire_cst_bdk_descriptor *change_descriptor, - int32_t network, - struct wire_cst_database_config *database_config); - WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_policies(struct wire_cst_bdk_wallet *ptr, int32_t keychain); -void frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_sign(int64_t port_, - struct wire_cst_bdk_wallet *ptr, - struct wire_cst_bdk_psbt *psbt, - struct wire_cst_sign_options *sign_options); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_sign(struct wire_cst_bdk_wallet *ptr, + struct wire_cst_bdk_psbt *psbt, + struct wire_cst_sign_options *sign_options); void frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_sync(int64_t port_, struct wire_cst_bdk_wallet *ptr, @@ -1334,6 +1294,12 @@ uint8_t *frbgen_bdk_flutter_cst_new_box_autoadd_u_8(uint8_t value); struct wire_cst_list_bdk_policy *frbgen_bdk_flutter_cst_new_list_bdk_policy(int32_t len); +struct wire_cst_list_bdk_transaction_details *frbgen_bdk_flutter_cst_new_list_bdk_transaction_details(int32_t len); + +struct wire_cst_list_bdk_tx_in *frbgen_bdk_flutter_cst_new_list_bdk_tx_in(int32_t len); + +struct wire_cst_list_bdk_tx_out *frbgen_bdk_flutter_cst_new_list_bdk_tx_out(int32_t len); + struct wire_cst_list_condition *frbgen_bdk_flutter_cst_new_list_condition(int32_t len); struct wire_cst_list_list_prim_u_8_strict *frbgen_bdk_flutter_cst_new_list_list_prim_u_8_strict(int32_t len); @@ -1359,12 +1325,6 @@ struct wire_cst_list_record_string_list_prim_u_32_strict *frbgen_bdk_flutter_cst struct wire_cst_list_record_u_32_list_condition *frbgen_bdk_flutter_cst_new_list_record_u_32_list_condition(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_error); @@ -1409,6 +1369,9 @@ static int64_t dummy_method_to_enforce_bundling(void) { 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_list_bdk_policy); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_bdk_transaction_details); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_bdk_tx_in); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_bdk_tx_out); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_condition); 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); @@ -1422,9 +1385,6 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_record_string_list_prim_u_32_strict); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_record_u_32_list_condition); 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_bdkbitcoinAddress); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_bdkbitcoinbip32DerivationPath); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_bdkblockchainAnyBlockchain); @@ -1453,8 +1413,8 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__blockchain__bdk_blockchain_get_block_hash); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__blockchain__bdk_blockchain_get_height); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_as_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_create); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_max_satisfaction_weight); - dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44_public); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49); @@ -1478,9 +1438,9 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_from_string); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_secret_bytes); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_as_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_create); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_entropy); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_string); - dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_new); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_as_string); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_combine); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_extract_tx); @@ -1508,13 +1468,13 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_empty); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_from_hex); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_with_capacity); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_create); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_from_bytes); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_input); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_coin_base); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_explicitly_rbf); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_lock_time_enabled); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_lock_time); - dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_new); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_output); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_serialize); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_size); @@ -1522,6 +1482,7 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_version); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_vsize); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_weight); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_create); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_address); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_balance); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_descriptor_for_keychain); @@ -1531,7 +1492,6 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_list_transactions); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_list_unspent); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_network); - dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_new); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_policies); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_sign); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_sync); diff --git a/lib/bdk_flutter.dart b/lib/bdk_flutter.dart index 3f8a045..1e3341d 100644 --- a/lib/bdk_flutter.dart +++ b/lib/bdk_flutter.dart @@ -21,7 +21,6 @@ export './src/generated/api/types.dart' FeeRate, Input, KeychainKind, - LocalUtxo, LockTime, Network, OutPoint, @@ -37,8 +36,6 @@ export './src/generated/api/types.dart' Variant, WitnessVersion, WordCount; -export './src/generated/api/wallet.dart' - hide BdkWallet, finishBumpFeeTxBuilder, txBuilderFinish; export './src/root.dart'; export 'src/utils/exceptions.dart' hide diff --git a/lib/src/generated/api/descriptor.dart b/lib/src/generated/api/descriptor.dart index 83ace5c..a2ba36f 100644 --- a/lib/src/generated/api/descriptor.dart +++ b/lib/src/generated/api/descriptor.dart @@ -26,25 +26,24 @@ class BdkDescriptor { that: this, ); + static BdkDescriptor create( + {required String descriptor, required Network network}) => + core.instance.api.crateApiDescriptorBdkDescriptorCreate( + descriptor: descriptor, network: network); + BigInt maxSatisfactionWeight() => core.instance.api.crateApiDescriptorBdkDescriptorMaxSatisfactionWeight( 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}) => - core.instance.api.crateApiDescriptorBdkDescriptorNew( - descriptor: descriptor, network: network); - - static Future newBip44( + static BdkDescriptor newBip44( {required BdkDescriptorSecretKey secretKey, required KeychainKind keychainKind, required Network network}) => core.instance.api.crateApiDescriptorBdkDescriptorNewBip44( secretKey: secretKey, keychainKind: keychainKind, network: network); - static Future newBip44Public( + static BdkDescriptor newBip44Public( {required BdkDescriptorPublicKey publicKey, required String fingerprint, required KeychainKind keychainKind, @@ -55,14 +54,14 @@ class BdkDescriptor { keychainKind: keychainKind, network: network); - static Future newBip49( + static BdkDescriptor newBip49( {required BdkDescriptorSecretKey secretKey, required KeychainKind keychainKind, required Network network}) => core.instance.api.crateApiDescriptorBdkDescriptorNewBip49( secretKey: secretKey, keychainKind: keychainKind, network: network); - static Future newBip49Public( + static BdkDescriptor newBip49Public( {required BdkDescriptorPublicKey publicKey, required String fingerprint, required KeychainKind keychainKind, @@ -73,14 +72,14 @@ class BdkDescriptor { keychainKind: keychainKind, network: network); - static Future newBip84( + static BdkDescriptor newBip84( {required BdkDescriptorSecretKey secretKey, required KeychainKind keychainKind, required Network network}) => core.instance.api.crateApiDescriptorBdkDescriptorNewBip84( secretKey: secretKey, keychainKind: keychainKind, network: network); - static Future newBip84Public( + static BdkDescriptor newBip84Public( {required BdkDescriptorPublicKey publicKey, required String fingerprint, required KeychainKind keychainKind, @@ -91,14 +90,14 @@ class BdkDescriptor { keychainKind: keychainKind, network: network); - static Future newBip86( + static BdkDescriptor newBip86( {required BdkDescriptorSecretKey secretKey, required KeychainKind keychainKind, required Network network}) => core.instance.api.crateApiDescriptorBdkDescriptorNewBip86( secretKey: secretKey, keychainKind: keychainKind, network: network); - static Future newBip86Public( + static BdkDescriptor newBip86Public( {required BdkDescriptorPublicKey publicKey, required String fingerprint, required KeychainKind keychainKind, diff --git a/lib/src/generated/api/key.dart b/lib/src/generated/api/key.dart index 627cde7..4a84a6c 100644 --- a/lib/src/generated/api/key.dart +++ b/lib/src/generated/api/key.dart @@ -22,7 +22,7 @@ class BdkDerivationPath { that: this, ); - static Future fromString({required String path}) => + static BdkDerivationPath fromString({required String path}) => core.instance.api.crateApiKeyBdkDerivationPathFromString(path: path); @override @@ -48,20 +48,19 @@ class BdkDescriptorPublicKey { that: this, ); - static Future derive( + static BdkDescriptorPublicKey derive( {required BdkDescriptorPublicKey ptr, required BdkDerivationPath path}) => core.instance.api .crateApiKeyBdkDescriptorPublicKeyDerive(ptr: ptr, path: path); - static Future extend( + static BdkDescriptorPublicKey extend( {required BdkDescriptorPublicKey ptr, required BdkDerivationPath path}) => core.instance.api .crateApiKeyBdkDescriptorPublicKeyExtend(ptr: ptr, path: path); - static Future fromString( - {required String publicKey}) => + static BdkDescriptorPublicKey fromString({required String publicKey}) => core.instance.api .crateApiKeyBdkDescriptorPublicKeyFromString(publicKey: publicKey); @@ -92,20 +91,20 @@ class BdkDescriptorSecretKey { that: this, ); - static Future create( + static BdkDescriptorSecretKey create( {required Network network, required BdkMnemonic mnemonic, String? password}) => core.instance.api.crateApiKeyBdkDescriptorSecretKeyCreate( network: network, mnemonic: mnemonic, password: password); - static Future derive( + static BdkDescriptorSecretKey derive( {required BdkDescriptorSecretKey ptr, required BdkDerivationPath path}) => core.instance.api .crateApiKeyBdkDescriptorSecretKeyDerive(ptr: ptr, path: path); - static Future extend( + static BdkDescriptorSecretKey extend( {required BdkDescriptorSecretKey ptr, required BdkDerivationPath path}) => core.instance.api @@ -144,20 +143,19 @@ class BdkMnemonic { that: this, ); + /// Generates Mnemonic with a random entropy + static BdkMnemonic create({required WordCount wordCount}) => + core.instance.api.crateApiKeyBdkMnemonicCreate(wordCount: wordCount); + /// 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}) => + static BdkMnemonic fromEntropy({required List entropy}) => core.instance.api.crateApiKeyBdkMnemonicFromEntropy(entropy: entropy); /// Parse a Mnemonic with given string - static Future fromString({required String mnemonic}) => + static BdkMnemonic fromString({required String mnemonic}) => core.instance.api.crateApiKeyBdkMnemonicFromString(mnemonic: mnemonic); - // 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}) => - core.instance.api.crateApiKeyBdkMnemonicNew(wordCount: wordCount); - @override int get hashCode => ptr.hashCode; diff --git a/lib/src/generated/api/psbt.dart b/lib/src/generated/api/psbt.dart index 2ca20ac..f55768b 100644 --- a/lib/src/generated/api/psbt.dart +++ b/lib/src/generated/api/psbt.dart @@ -25,8 +25,7 @@ class BdkPsbt { /// 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 BdkPsbt ptr, required BdkPsbt other}) => + static BdkPsbt combine({required BdkPsbt ptr, required BdkPsbt other}) => core.instance.api.crateApiPsbtBdkPsbtCombine(ptr: ptr, other: other); /// Return the transaction. @@ -47,7 +46,7 @@ class BdkPsbt { that: this, ); - static Future fromStr({required String psbtBase64}) => + static BdkPsbt fromStr({required String psbtBase64}) => core.instance.api.crateApiPsbtBdkPsbtFromStr(psbtBase64: psbtBase64); /// Serialize the PSBT data structure as a String of JSON. diff --git a/lib/src/generated/api/types.dart b/lib/src/generated/api/types.dart index 1b642cb..02f82e6 100644 --- a/lib/src/generated/api/types.dart +++ b/lib/src/generated/api/types.dart @@ -104,12 +104,12 @@ class BdkAddress { that: this, ); - static Future fromScript( + static BdkAddress fromScript( {required BdkScriptBuf script, required Network network}) => core.instance.api .crateApiTypesBdkAddressFromScript(script: script, network: network); - static Future fromString( + static BdkAddress fromString( {required String address, required Network network}) => core.instance.api.crateApiTypesBdkAddressFromString( address: address, network: network); @@ -202,11 +202,11 @@ class BdkScriptBuf { static BdkScriptBuf empty() => core.instance.api.crateApiTypesBdkScriptBufEmpty(); - static Future fromHex({required String s}) => + static BdkScriptBuf fromHex({required String s}) => core.instance.api.crateApiTypesBdkScriptBufFromHex(s: s); ///Creates a new empty script with pre-allocated capacity. - static Future withCapacity({required BigInt capacity}) => + static BdkScriptBuf withCapacity({required BigInt capacity}) => core.instance.api .crateApiTypesBdkScriptBufWithCapacity(capacity: capacity); @@ -228,88 +228,82 @@ class BdkTransaction { required this.s, }); - static Future fromBytes( - {required List transactionBytes}) => - core.instance.api.crateApiTypesBdkTransactionFromBytes( - transactionBytes: transactionBytes); + static BdkTransaction create( + {required int version, + required LockTime lockTime, + required List input, + required List output}) => + core.instance.api.crateApiTypesBdkTransactionCreate( + version: version, lockTime: lockTime, input: input, output: output); + + static BdkTransaction fromBytes({required List transactionBytes}) => core + .instance.api + .crateApiTypesBdkTransactionFromBytes(transactionBytes: transactionBytes); ///List of transaction inputs. - Future> input() => - core.instance.api.crateApiTypesBdkTransactionInput( + List input() => core.instance.api.crateApiTypesBdkTransactionInput( that: this, ); ///Is this a coin base transaction? - Future isCoinBase() => - core.instance.api.crateApiTypesBdkTransactionIsCoinBase( + bool isCoinBase() => core.instance.api.crateApiTypesBdkTransactionIsCoinBase( 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() => + bool isExplicitlyRbf() => core.instance.api.crateApiTypesBdkTransactionIsExplicitlyRbf( that: this, ); ///Returns true if this transactions nLockTime is enabled (BIP-65 ). - Future isLockTimeEnabled() => + bool isLockTimeEnabled() => core.instance.api.crateApiTypesBdkTransactionIsLockTimeEnabled( that: this, ); ///Block height or timestamp. Transaction cannot be included in a block until this height/time. - Future lockTime() => - core.instance.api.crateApiTypesBdkTransactionLockTime( + LockTime lockTime() => core.instance.api.crateApiTypesBdkTransactionLockTime( that: this, ); - // HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class. - static Future newInstance( - {required int version, - required LockTime lockTime, - required List input, - required List output}) => - core.instance.api.crateApiTypesBdkTransactionNew( - version: version, lockTime: lockTime, input: input, output: output); - ///List of transaction outputs. - Future> output() => + List output() => core.instance.api.crateApiTypesBdkTransactionOutput( that: this, ); ///Encodes an object into a vector. - Future serialize() => + Uint8List serialize() => core.instance.api.crateApiTypesBdkTransactionSerialize( that: this, ); ///Returns the regular byte-wise consensus-serialized size of this transaction. - Future size() => core.instance.api.crateApiTypesBdkTransactionSize( + BigInt size() => core.instance.api.crateApiTypesBdkTransactionSize( 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() => core.instance.api.crateApiTypesBdkTransactionTxid( + String txid() => core.instance.api.crateApiTypesBdkTransactionTxid( that: this, ); ///The protocol version, is currently expected to be 1 or 2 (BIP 68). - Future version() => core.instance.api.crateApiTypesBdkTransactionVersion( + int version() => core.instance.api.crateApiTypesBdkTransactionVersion( that: this, ); ///Returns the “virtual size” (vsize) of this transaction. /// - Future vsize() => core.instance.api.crateApiTypesBdkTransactionVsize( + BigInt vsize() => core.instance.api.crateApiTypesBdkTransactionVsize( that: this, ); ///Returns the regular byte-wise consensus-serialized size of this transaction. - Future weight() => - core.instance.api.crateApiTypesBdkTransactionWeight( + BigInt weight() => core.instance.api.crateApiTypesBdkTransactionWeight( that: this, ); @@ -324,6 +318,118 @@ class BdkTransaction { s == other.s; } +///A wallet transaction +class BdkTransactionDetails { + final BdkTransaction? transaction; + + /// Transaction id. + final String txid; + + /// Received value (sats) + /// Sum of owned outputs of this transaction. + final BigInt received; + + /// Sent value (sats) + /// Sum of owned inputs of this transaction. + final BigInt 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 BigInt? fee; + + /// If the transaction is confirmed, contains height and timestamp of the block containing the + /// transaction, unconfirmed transaction contains `None`. + final BlockTime? confirmationTime; + + const BdkTransactionDetails({ + 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 BdkTransactionDetails && + runtimeType == other.runtimeType && + transaction == other.transaction && + txid == other.txid && + received == other.received && + sent == other.sent && + fee == other.fee && + confirmationTime == other.confirmationTime; +} + +class BdkTxIn { + final OutPoint previousOutput; + final BdkScriptBuf? scriptSig; + final int sequence; + final List witness; + + const BdkTxIn({ + required this.previousOutput, + 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 BdkTxIn && + 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 BdkTxOut { + /// The value of the output, in satoshis. + final BigInt value; + + /// The address of the output. + final BdkScriptBuf scriptPubkey; + + const BdkTxOut({ + required this.value, + required this.scriptPubkey, + }); + + @override + int get hashCode => value.hashCode ^ scriptPubkey.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is BdkTxOut && + runtimeType == other.runtimeType && + value == other.value && + scriptPubkey == other.scriptPubkey; +} + ///Block height and timestamp of a block class BlockTime { ///Confirmation block height @@ -441,7 +547,7 @@ enum KeychainKind { ///Unspent outputs of this wallet class LocalUtxo { final OutPoint outpoint; - final TxOut txout; + final BdkTxOut txout; final KeychainKind keychain; final bool isSpent; @@ -805,118 +911,6 @@ class SqliteDbConfiguration { path == other.path; } -///A wallet transaction -class TransactionDetails { - final BdkTransaction? transaction; - - /// Transaction id. - final String txid; - - /// Received value (sats) - /// Sum of owned outputs of this transaction. - final BigInt received; - - /// Sent value (sats) - /// Sum of owned inputs of this transaction. - final BigInt 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 BigInt? 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 BdkScriptBuf 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 BigInt value; - - /// The address of the output. - final BdkScriptBuf 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, diff --git a/lib/src/generated/api/wallet.dart b/lib/src/generated/api/wallet.dart index e3a5ff3..474d9b5 100644 --- a/lib/src/generated/api/wallet.dart +++ b/lib/src/generated/api/wallet.dart @@ -14,7 +14,7 @@ import 'types.dart'; // These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `fmt` -Future<(BdkPsbt, TransactionDetails)> finishBumpFeeTxBuilder( +Future<(BdkPsbt, BdkTransactionDetails)> finishBumpFeeTxBuilder( {required String txid, required double feeRate, BdkAddress? allowShrinking, @@ -29,7 +29,7 @@ Future<(BdkPsbt, TransactionDetails)> finishBumpFeeTxBuilder( enableRbf: enableRbf, nSequence: nSequence); -Future<(BdkPsbt, TransactionDetails)> txBuilderFinish( +Future<(BdkPsbt, BdkTransactionDetails)> txBuilderFinish( {required BdkWallet wallet, required List recipients, required List utxos, @@ -69,6 +69,17 @@ class BdkWallet { required this.ptr, }); + static Future create( + {required BdkDescriptor descriptor, + BdkDescriptor? changeDescriptor, + required Network network, + required DatabaseConfig databaseConfig}) => + core.instance.api.crateApiWalletBdkWalletCreate( + descriptor: descriptor, + changeDescriptor: changeDescriptor, + network: network, + databaseConfig: databaseConfig); + /// 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. @@ -102,7 +113,7 @@ class BdkWallet { ptr: ptr, addressIndex: addressIndex); ///get the corresponding PSBT Input for a LocalUtxo - Future getPsbtInput( + Input getPsbtInput( {required LocalUtxo utxo, required bool onlyWitnessUtxo, PsbtSigHashType? sighashType}) => @@ -116,7 +127,7 @@ class BdkWallet { core.instance.api.crateApiWalletBdkWalletIsMine(ptr: ptr, 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. - List listTransactions({required bool includeRaw}) => + List listTransactions({required bool includeRaw}) => core.instance.api.crateApiWalletBdkWalletListTransactions( that: this, includeRaw: includeRaw); @@ -132,18 +143,6 @@ class BdkWallet { that: this, ); - // HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class. - static Future newInstance( - {required BdkDescriptor descriptor, - BdkDescriptor? changeDescriptor, - required Network network, - required DatabaseConfig databaseConfig}) => - core.instance.api.crateApiWalletBdkWalletNew( - descriptor: descriptor, - changeDescriptor: changeDescriptor, - network: network, - databaseConfig: databaseConfig); - static BdkPolicy? policies( {required BdkWallet ptr, required KeychainKind keychain}) => core.instance.api @@ -156,7 +155,7 @@ class BdkWallet { /// 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( + static bool sign( {required BdkWallet ptr, required BdkPsbt psbt, SignOptions? signOptions}) => diff --git a/lib/src/generated/frb_generated.dart b/lib/src/generated/frb_generated.dart index 8d2b34e..71a887e 100644 --- a/lib/src/generated/frb_generated.dart +++ b/lib/src/generated/frb_generated.dart @@ -62,7 +62,7 @@ class core extends BaseEntrypoint { String get codegenVersion => '2.0.0'; @override - int get rustContentHash => -321771070; + int get rustContentHash => -418359953; static const kDefaultExternalLibraryLoaderConfig = ExternalLibraryLoaderConfig( @@ -90,51 +90,51 @@ abstract class coreApi extends BaseApi { String crateApiDescriptorBdkDescriptorAsString({required BdkDescriptor that}); + BdkDescriptor crateApiDescriptorBdkDescriptorCreate( + {required String descriptor, required Network network}); + BigInt crateApiDescriptorBdkDescriptorMaxSatisfactionWeight( {required BdkDescriptor that}); - Future crateApiDescriptorBdkDescriptorNew( - {required String descriptor, required Network network}); - - Future crateApiDescriptorBdkDescriptorNewBip44( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip44( {required BdkDescriptorSecretKey secretKey, required KeychainKind keychainKind, required Network network}); - Future crateApiDescriptorBdkDescriptorNewBip44Public( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip44Public( {required BdkDescriptorPublicKey publicKey, required String fingerprint, required KeychainKind keychainKind, required Network network}); - Future crateApiDescriptorBdkDescriptorNewBip49( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip49( {required BdkDescriptorSecretKey secretKey, required KeychainKind keychainKind, required Network network}); - Future crateApiDescriptorBdkDescriptorNewBip49Public( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip49Public( {required BdkDescriptorPublicKey publicKey, required String fingerprint, required KeychainKind keychainKind, required Network network}); - Future crateApiDescriptorBdkDescriptorNewBip84( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip84( {required BdkDescriptorSecretKey secretKey, required KeychainKind keychainKind, required Network network}); - Future crateApiDescriptorBdkDescriptorNewBip84Public( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip84Public( {required BdkDescriptorPublicKey publicKey, required String fingerprint, required KeychainKind keychainKind, required Network network}); - Future crateApiDescriptorBdkDescriptorNewBip86( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip86( {required BdkDescriptorSecretKey secretKey, required KeychainKind keychainKind, required Network network}); - Future crateApiDescriptorBdkDescriptorNewBip86Public( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip86Public( {required BdkDescriptorPublicKey publicKey, required String fingerprint, required KeychainKind keychainKind, @@ -146,19 +146,19 @@ abstract class coreApi extends BaseApi { String crateApiKeyBdkDerivationPathAsString( {required BdkDerivationPath that}); - Future crateApiKeyBdkDerivationPathFromString( + BdkDerivationPath crateApiKeyBdkDerivationPathFromString( {required String path}); String crateApiKeyBdkDescriptorPublicKeyAsString( {required BdkDescriptorPublicKey that}); - Future crateApiKeyBdkDescriptorPublicKeyDerive( + BdkDescriptorPublicKey crateApiKeyBdkDescriptorPublicKeyDerive( {required BdkDescriptorPublicKey ptr, required BdkDerivationPath path}); - Future crateApiKeyBdkDescriptorPublicKeyExtend( + BdkDescriptorPublicKey crateApiKeyBdkDescriptorPublicKeyExtend( {required BdkDescriptorPublicKey ptr, required BdkDerivationPath path}); - Future crateApiKeyBdkDescriptorPublicKeyFromString( + BdkDescriptorPublicKey crateApiKeyBdkDescriptorPublicKeyFromString( {required String publicKey}); BdkDescriptorPublicKey crateApiKeyBdkDescriptorSecretKeyAsPublic( @@ -167,15 +167,15 @@ abstract class coreApi extends BaseApi { String crateApiKeyBdkDescriptorSecretKeyAsString( {required BdkDescriptorSecretKey that}); - Future crateApiKeyBdkDescriptorSecretKeyCreate( + BdkDescriptorSecretKey crateApiKeyBdkDescriptorSecretKeyCreate( {required Network network, required BdkMnemonic mnemonic, String? password}); - Future crateApiKeyBdkDescriptorSecretKeyDerive( + BdkDescriptorSecretKey crateApiKeyBdkDescriptorSecretKeyDerive( {required BdkDescriptorSecretKey ptr, required BdkDerivationPath path}); - Future crateApiKeyBdkDescriptorSecretKeyExtend( + BdkDescriptorSecretKey crateApiKeyBdkDescriptorSecretKeyExtend( {required BdkDescriptorSecretKey ptr, required BdkDerivationPath path}); Future crateApiKeyBdkDescriptorSecretKeyFromString( @@ -186,17 +186,15 @@ abstract class coreApi extends BaseApi { String crateApiKeyBdkMnemonicAsString({required BdkMnemonic that}); - Future crateApiKeyBdkMnemonicFromEntropy( - {required List entropy}); + BdkMnemonic crateApiKeyBdkMnemonicCreate({required WordCount wordCount}); - Future crateApiKeyBdkMnemonicFromString( - {required String mnemonic}); + BdkMnemonic crateApiKeyBdkMnemonicFromEntropy({required List entropy}); - Future crateApiKeyBdkMnemonicNew({required WordCount wordCount}); + BdkMnemonic crateApiKeyBdkMnemonicFromString({required String mnemonic}); String crateApiPsbtBdkPsbtAsString({required BdkPsbt that}); - Future crateApiPsbtBdkPsbtCombine( + BdkPsbt crateApiPsbtBdkPsbtCombine( {required BdkPsbt ptr, required BdkPsbt other}); BdkTransaction crateApiPsbtBdkPsbtExtractTx({required BdkPsbt ptr}); @@ -205,7 +203,7 @@ abstract class coreApi extends BaseApi { FeeRate? crateApiPsbtBdkPsbtFeeRate({required BdkPsbt that}); - Future crateApiPsbtBdkPsbtFromStr({required String psbtBase64}); + BdkPsbt crateApiPsbtBdkPsbtFromStr({required String psbtBase64}); String crateApiPsbtBdkPsbtJsonSerialize({required BdkPsbt that}); @@ -215,10 +213,10 @@ abstract class coreApi extends BaseApi { String crateApiTypesBdkAddressAsString({required BdkAddress that}); - Future crateApiTypesBdkAddressFromScript( + BdkAddress crateApiTypesBdkAddressFromScript( {required BdkScriptBuf script, required Network network}); - Future crateApiTypesBdkAddressFromString( + BdkAddress crateApiTypesBdkAddressFromString( {required String address, required Network network}); bool crateApiTypesBdkAddressIsValidForNetwork( @@ -248,55 +246,54 @@ abstract class coreApi extends BaseApi { BdkScriptBuf crateApiTypesBdkScriptBufEmpty(); - Future crateApiTypesBdkScriptBufFromHex({required String s}); + BdkScriptBuf crateApiTypesBdkScriptBufFromHex({required String s}); - Future crateApiTypesBdkScriptBufWithCapacity( + BdkScriptBuf crateApiTypesBdkScriptBufWithCapacity( {required BigInt capacity}); - Future crateApiTypesBdkTransactionFromBytes( - {required List transactionBytes}); + BdkTransaction crateApiTypesBdkTransactionCreate( + {required int version, + required LockTime lockTime, + required List input, + required List output}); - Future> crateApiTypesBdkTransactionInput( - {required BdkTransaction that}); + BdkTransaction crateApiTypesBdkTransactionFromBytes( + {required List transactionBytes}); - Future crateApiTypesBdkTransactionIsCoinBase( + List crateApiTypesBdkTransactionInput( {required BdkTransaction that}); - Future crateApiTypesBdkTransactionIsExplicitlyRbf( - {required BdkTransaction that}); + bool crateApiTypesBdkTransactionIsCoinBase({required BdkTransaction that}); - Future crateApiTypesBdkTransactionIsLockTimeEnabled( + bool crateApiTypesBdkTransactionIsExplicitlyRbf( {required BdkTransaction that}); - Future crateApiTypesBdkTransactionLockTime( + bool crateApiTypesBdkTransactionIsLockTimeEnabled( {required BdkTransaction that}); - Future crateApiTypesBdkTransactionNew( - {required int version, - required LockTime lockTime, - required List input, - required List output}); + LockTime crateApiTypesBdkTransactionLockTime({required BdkTransaction that}); - Future> crateApiTypesBdkTransactionOutput( + List crateApiTypesBdkTransactionOutput( {required BdkTransaction that}); - Future crateApiTypesBdkTransactionSerialize( + Uint8List crateApiTypesBdkTransactionSerialize( {required BdkTransaction that}); - Future crateApiTypesBdkTransactionSize( - {required BdkTransaction that}); + BigInt crateApiTypesBdkTransactionSize({required BdkTransaction that}); - Future crateApiTypesBdkTransactionTxid( - {required BdkTransaction that}); + String crateApiTypesBdkTransactionTxid({required BdkTransaction that}); - Future crateApiTypesBdkTransactionVersion( - {required BdkTransaction that}); + int crateApiTypesBdkTransactionVersion({required BdkTransaction that}); - Future crateApiTypesBdkTransactionVsize( - {required BdkTransaction that}); + BigInt crateApiTypesBdkTransactionVsize({required BdkTransaction that}); - Future crateApiTypesBdkTransactionWeight( - {required BdkTransaction that}); + BigInt crateApiTypesBdkTransactionWeight({required BdkTransaction that}); + + Future crateApiWalletBdkWalletCreate( + {required BdkDescriptor descriptor, + BdkDescriptor? changeDescriptor, + required Network network, + required DatabaseConfig databaseConfig}); (BdkAddress, int) crateApiWalletBdkWalletGetAddress( {required BdkWallet ptr, required AddressIndex addressIndex}); @@ -309,7 +306,7 @@ abstract class coreApi extends BaseApi { (BdkAddress, int) crateApiWalletBdkWalletGetInternalAddress( {required BdkWallet ptr, required AddressIndex addressIndex}); - Future crateApiWalletBdkWalletGetPsbtInput( + Input crateApiWalletBdkWalletGetPsbtInput( {required BdkWallet that, required LocalUtxo utxo, required bool onlyWitnessUtxo, @@ -318,23 +315,17 @@ abstract class coreApi extends BaseApi { bool crateApiWalletBdkWalletIsMine( {required BdkWallet ptr, required BdkScriptBuf script}); - List crateApiWalletBdkWalletListTransactions( + List crateApiWalletBdkWalletListTransactions( {required BdkWallet that, required bool includeRaw}); List crateApiWalletBdkWalletListUnspent({required BdkWallet that}); Network crateApiWalletBdkWalletNetwork({required BdkWallet that}); - Future crateApiWalletBdkWalletNew( - {required BdkDescriptor descriptor, - BdkDescriptor? changeDescriptor, - required Network network, - required DatabaseConfig databaseConfig}); - BdkPolicy? crateApiWalletBdkWalletPolicies( {required BdkWallet ptr, required KeychainKind keychain}); - Future crateApiWalletBdkWalletSign( + bool crateApiWalletBdkWalletSign( {required BdkWallet ptr, required BdkPsbt psbt, SignOptions? signOptions}); @@ -342,7 +333,7 @@ abstract class coreApi extends BaseApi { Future crateApiWalletBdkWalletSync( {required BdkWallet ptr, required BdkBlockchain blockchain}); - Future<(BdkPsbt, TransactionDetails)> crateApiWalletFinishBumpFeeTxBuilder( + Future<(BdkPsbt, BdkTransactionDetails)> crateApiWalletFinishBumpFeeTxBuilder( {required String txid, required double feeRate, BdkAddress? allowShrinking, @@ -350,7 +341,7 @@ abstract class coreApi extends BaseApi { required bool enableRbf, int? nSequence}); - Future<(BdkPsbt, TransactionDetails)> crateApiWalletTxBuilderFinish( + Future<(BdkPsbt, BdkTransactionDetails)> crateApiWalletTxBuilderFinish( {required BdkWallet wallet, required List recipients, required List utxos, @@ -618,6 +609,32 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { argNames: ["that"], ); + @override + BdkDescriptor crateApiDescriptorBdkDescriptorCreate( + {required String descriptor, required Network network}) { + return handler.executeSync(SyncTask( + callFfi: () { + var arg0 = cst_encode_String(descriptor); + var arg1 = cst_encode_network(network); + return wire.wire__crate__api__descriptor__bdk_descriptor_create( + arg0, arg1); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_bdk_descriptor, + decodeErrorData: dco_decode_bdk_error, + ), + constMeta: kCrateApiDescriptorBdkDescriptorCreateConstMeta, + argValues: [descriptor, network], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiDescriptorBdkDescriptorCreateConstMeta => + const TaskConstMeta( + debugName: "bdk_descriptor_create", + argNames: ["descriptor", "network"], + ); + @override BigInt crateApiDescriptorBdkDescriptorMaxSatisfactionWeight( {required BdkDescriptor that}) { @@ -646,43 +663,17 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiDescriptorBdkDescriptorNew( - {required String descriptor, required Network network}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { - var arg0 = cst_encode_String(descriptor); - var arg1 = cst_encode_network(network); - return wire.wire__crate__api__descriptor__bdk_descriptor_new( - port_, arg0, arg1); - }, - codec: DcoCodec( - decodeSuccessData: dco_decode_bdk_descriptor, - decodeErrorData: dco_decode_bdk_error, - ), - constMeta: kCrateApiDescriptorBdkDescriptorNewConstMeta, - argValues: [descriptor, network], - apiImpl: this, - )); - } - - TaskConstMeta get kCrateApiDescriptorBdkDescriptorNewConstMeta => - const TaskConstMeta( - debugName: "bdk_descriptor_new", - argNames: ["descriptor", "network"], - ); - - @override - Future crateApiDescriptorBdkDescriptorNewBip44( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip44( {required BdkDescriptorSecretKey secretKey, required KeychainKind keychainKind, required Network network}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_descriptor_secret_key(secretKey); var arg1 = cst_encode_keychain_kind(keychainKind); var arg2 = cst_encode_network(network); return wire.wire__crate__api__descriptor__bdk_descriptor_new_bip44( - port_, arg0, arg1, arg2); + arg0, arg1, arg2); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor, @@ -701,20 +692,20 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiDescriptorBdkDescriptorNewBip44Public( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip44Public( {required BdkDescriptorPublicKey publicKey, required String fingerprint, required KeychainKind keychainKind, required Network network}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_descriptor_public_key(publicKey); var arg1 = cst_encode_String(fingerprint); var arg2 = cst_encode_keychain_kind(keychainKind); var arg3 = cst_encode_network(network); return wire .wire__crate__api__descriptor__bdk_descriptor_new_bip44_public( - port_, arg0, arg1, arg2, arg3); + arg0, arg1, arg2, arg3); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor, @@ -733,17 +724,17 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiDescriptorBdkDescriptorNewBip49( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip49( {required BdkDescriptorSecretKey secretKey, required KeychainKind keychainKind, required Network network}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_descriptor_secret_key(secretKey); var arg1 = cst_encode_keychain_kind(keychainKind); var arg2 = cst_encode_network(network); return wire.wire__crate__api__descriptor__bdk_descriptor_new_bip49( - port_, arg0, arg1, arg2); + arg0, arg1, arg2); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor, @@ -762,20 +753,20 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiDescriptorBdkDescriptorNewBip49Public( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip49Public( {required BdkDescriptorPublicKey publicKey, required String fingerprint, required KeychainKind keychainKind, required Network network}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_descriptor_public_key(publicKey); var arg1 = cst_encode_String(fingerprint); var arg2 = cst_encode_keychain_kind(keychainKind); var arg3 = cst_encode_network(network); return wire .wire__crate__api__descriptor__bdk_descriptor_new_bip49_public( - port_, arg0, arg1, arg2, arg3); + arg0, arg1, arg2, arg3); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor, @@ -794,17 +785,17 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiDescriptorBdkDescriptorNewBip84( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip84( {required BdkDescriptorSecretKey secretKey, required KeychainKind keychainKind, required Network network}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_descriptor_secret_key(secretKey); var arg1 = cst_encode_keychain_kind(keychainKind); var arg2 = cst_encode_network(network); return wire.wire__crate__api__descriptor__bdk_descriptor_new_bip84( - port_, arg0, arg1, arg2); + arg0, arg1, arg2); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor, @@ -823,20 +814,20 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiDescriptorBdkDescriptorNewBip84Public( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip84Public( {required BdkDescriptorPublicKey publicKey, required String fingerprint, required KeychainKind keychainKind, required Network network}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_descriptor_public_key(publicKey); var arg1 = cst_encode_String(fingerprint); var arg2 = cst_encode_keychain_kind(keychainKind); var arg3 = cst_encode_network(network); return wire .wire__crate__api__descriptor__bdk_descriptor_new_bip84_public( - port_, arg0, arg1, arg2, arg3); + arg0, arg1, arg2, arg3); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor, @@ -855,17 +846,17 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiDescriptorBdkDescriptorNewBip86( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip86( {required BdkDescriptorSecretKey secretKey, required KeychainKind keychainKind, required Network network}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_descriptor_secret_key(secretKey); var arg1 = cst_encode_keychain_kind(keychainKind); var arg2 = cst_encode_network(network); return wire.wire__crate__api__descriptor__bdk_descriptor_new_bip86( - port_, arg0, arg1, arg2); + arg0, arg1, arg2); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor, @@ -884,20 +875,20 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiDescriptorBdkDescriptorNewBip86Public( + BdkDescriptor crateApiDescriptorBdkDescriptorNewBip86Public( {required BdkDescriptorPublicKey publicKey, required String fingerprint, required KeychainKind keychainKind, required Network network}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_descriptor_public_key(publicKey); var arg1 = cst_encode_String(fingerprint); var arg2 = cst_encode_keychain_kind(keychainKind); var arg3 = cst_encode_network(network); return wire .wire__crate__api__descriptor__bdk_descriptor_new_bip86_public( - port_, arg0, arg1, arg2, arg3); + arg0, arg1, arg2, arg3); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor, @@ -966,13 +957,13 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiKeyBdkDerivationPathFromString( + BdkDerivationPath crateApiKeyBdkDerivationPathFromString( {required String path}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_String(path); - return wire.wire__crate__api__key__bdk_derivation_path_from_string( - port_, arg0); + return wire + .wire__crate__api__key__bdk_derivation_path_from_string(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_derivation_path, @@ -1016,14 +1007,14 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiKeyBdkDescriptorPublicKeyDerive( + BdkDescriptorPublicKey crateApiKeyBdkDescriptorPublicKeyDerive( {required BdkDescriptorPublicKey ptr, required BdkDerivationPath path}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_descriptor_public_key(ptr); var arg1 = cst_encode_box_autoadd_bdk_derivation_path(path); return wire.wire__crate__api__key__bdk_descriptor_public_key_derive( - port_, arg0, arg1); + arg0, arg1); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor_public_key, @@ -1042,14 +1033,14 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiKeyBdkDescriptorPublicKeyExtend( + BdkDescriptorPublicKey crateApiKeyBdkDescriptorPublicKeyExtend( {required BdkDescriptorPublicKey ptr, required BdkDerivationPath path}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_descriptor_public_key(ptr); var arg1 = cst_encode_box_autoadd_bdk_derivation_path(path); return wire.wire__crate__api__key__bdk_descriptor_public_key_extend( - port_, arg0, arg1); + arg0, arg1); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor_public_key, @@ -1068,14 +1059,13 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiKeyBdkDescriptorPublicKeyFromString( + BdkDescriptorPublicKey crateApiKeyBdkDescriptorPublicKeyFromString( {required String publicKey}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_String(publicKey); return wire - .wire__crate__api__key__bdk_descriptor_public_key_from_string( - port_, arg0); + .wire__crate__api__key__bdk_descriptor_public_key_from_string(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor_public_key, @@ -1144,17 +1134,17 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiKeyBdkDescriptorSecretKeyCreate( + BdkDescriptorSecretKey crateApiKeyBdkDescriptorSecretKeyCreate( {required Network network, required BdkMnemonic mnemonic, String? password}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_network(network); var arg1 = cst_encode_box_autoadd_bdk_mnemonic(mnemonic); var arg2 = cst_encode_opt_String(password); return wire.wire__crate__api__key__bdk_descriptor_secret_key_create( - port_, arg0, arg1, arg2); + arg0, arg1, arg2); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor_secret_key, @@ -1173,14 +1163,14 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiKeyBdkDescriptorSecretKeyDerive( + BdkDescriptorSecretKey crateApiKeyBdkDescriptorSecretKeyDerive( {required BdkDescriptorSecretKey ptr, required BdkDerivationPath path}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_descriptor_secret_key(ptr); var arg1 = cst_encode_box_autoadd_bdk_derivation_path(path); return wire.wire__crate__api__key__bdk_descriptor_secret_key_derive( - port_, arg0, arg1); + arg0, arg1); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor_secret_key, @@ -1199,14 +1189,14 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiKeyBdkDescriptorSecretKeyExtend( + BdkDescriptorSecretKey crateApiKeyBdkDescriptorSecretKeyExtend( {required BdkDescriptorSecretKey ptr, required BdkDerivationPath path}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_descriptor_secret_key(ptr); var arg1 = cst_encode_box_autoadd_bdk_derivation_path(path); return wire.wire__crate__api__key__bdk_descriptor_secret_key_extend( - port_, arg0, arg1); + arg0, arg1); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_descriptor_secret_key, @@ -1300,76 +1290,72 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiKeyBdkMnemonicFromEntropy( - {required List entropy}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { - var arg0 = cst_encode_list_prim_u_8_loose(entropy); - return wire.wire__crate__api__key__bdk_mnemonic_from_entropy( - port_, arg0); + BdkMnemonic crateApiKeyBdkMnemonicCreate({required WordCount wordCount}) { + return handler.executeSync(SyncTask( + callFfi: () { + var arg0 = cst_encode_word_count(wordCount); + return wire.wire__crate__api__key__bdk_mnemonic_create(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_mnemonic, decodeErrorData: dco_decode_bdk_error, ), - constMeta: kCrateApiKeyBdkMnemonicFromEntropyConstMeta, - argValues: [entropy], + constMeta: kCrateApiKeyBdkMnemonicCreateConstMeta, + argValues: [wordCount], apiImpl: this, )); } - TaskConstMeta get kCrateApiKeyBdkMnemonicFromEntropyConstMeta => + TaskConstMeta get kCrateApiKeyBdkMnemonicCreateConstMeta => const TaskConstMeta( - debugName: "bdk_mnemonic_from_entropy", - argNames: ["entropy"], + debugName: "bdk_mnemonic_create", + argNames: ["wordCount"], ); @override - Future crateApiKeyBdkMnemonicFromString( - {required String mnemonic}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { - var arg0 = cst_encode_String(mnemonic); - return wire.wire__crate__api__key__bdk_mnemonic_from_string( - port_, arg0); + BdkMnemonic crateApiKeyBdkMnemonicFromEntropy({required List entropy}) { + return handler.executeSync(SyncTask( + callFfi: () { + var arg0 = cst_encode_list_prim_u_8_loose(entropy); + return wire.wire__crate__api__key__bdk_mnemonic_from_entropy(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_mnemonic, decodeErrorData: dco_decode_bdk_error, ), - constMeta: kCrateApiKeyBdkMnemonicFromStringConstMeta, - argValues: [mnemonic], + constMeta: kCrateApiKeyBdkMnemonicFromEntropyConstMeta, + argValues: [entropy], apiImpl: this, )); } - TaskConstMeta get kCrateApiKeyBdkMnemonicFromStringConstMeta => + TaskConstMeta get kCrateApiKeyBdkMnemonicFromEntropyConstMeta => const TaskConstMeta( - debugName: "bdk_mnemonic_from_string", - argNames: ["mnemonic"], + debugName: "bdk_mnemonic_from_entropy", + argNames: ["entropy"], ); @override - Future crateApiKeyBdkMnemonicNew( - {required WordCount wordCount}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { - var arg0 = cst_encode_word_count(wordCount); - return wire.wire__crate__api__key__bdk_mnemonic_new(port_, arg0); + BdkMnemonic crateApiKeyBdkMnemonicFromString({required String mnemonic}) { + return handler.executeSync(SyncTask( + callFfi: () { + var arg0 = cst_encode_String(mnemonic); + return wire.wire__crate__api__key__bdk_mnemonic_from_string(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_mnemonic, decodeErrorData: dco_decode_bdk_error, ), - constMeta: kCrateApiKeyBdkMnemonicNewConstMeta, - argValues: [wordCount], + constMeta: kCrateApiKeyBdkMnemonicFromStringConstMeta, + argValues: [mnemonic], apiImpl: this, )); } - TaskConstMeta get kCrateApiKeyBdkMnemonicNewConstMeta => const TaskConstMeta( - debugName: "bdk_mnemonic_new", - argNames: ["wordCount"], + TaskConstMeta get kCrateApiKeyBdkMnemonicFromStringConstMeta => + const TaskConstMeta( + debugName: "bdk_mnemonic_from_string", + argNames: ["mnemonic"], ); @override @@ -1396,13 +1382,13 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiPsbtBdkPsbtCombine( + BdkPsbt crateApiPsbtBdkPsbtCombine( {required BdkPsbt ptr, required BdkPsbt other}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_psbt(ptr); var arg1 = cst_encode_box_autoadd_bdk_psbt(other); - return wire.wire__crate__api__psbt__bdk_psbt_combine(port_, arg0, arg1); + return wire.wire__crate__api__psbt__bdk_psbt_combine(arg0, arg1); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_psbt, @@ -1488,11 +1474,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiPsbtBdkPsbtFromStr({required String psbtBase64}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + BdkPsbt crateApiPsbtBdkPsbtFromStr({required String psbtBase64}) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_String(psbtBase64); - return wire.wire__crate__api__psbt__bdk_psbt_from_str(port_, arg0); + return wire.wire__crate__api__psbt__bdk_psbt_from_str(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_psbt, @@ -1601,14 +1587,14 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkAddressFromScript( + BdkAddress crateApiTypesBdkAddressFromScript( {required BdkScriptBuf script, required Network network}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_script_buf(script); var arg1 = cst_encode_network(network); return wire.wire__crate__api__types__bdk_address_from_script( - port_, arg0, arg1); + arg0, arg1); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_address, @@ -1627,14 +1613,14 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkAddressFromString( + BdkAddress crateApiTypesBdkAddressFromString( {required String address, required Network network}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_String(address); var arg1 = cst_encode_network(network); return wire.wire__crate__api__types__bdk_address_from_string( - port_, arg0, arg1); + arg0, arg1); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_address, @@ -1952,12 +1938,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkScriptBufFromHex({required String s}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + BdkScriptBuf crateApiTypesBdkScriptBufFromHex({required String s}) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_String(s); - return wire.wire__crate__api__types__bdk_script_buf_from_hex( - port_, arg0); + return wire.wire__crate__api__types__bdk_script_buf_from_hex(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_script_buf, @@ -1976,13 +1961,12 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkScriptBufWithCapacity( + BdkScriptBuf crateApiTypesBdkScriptBufWithCapacity( {required BigInt capacity}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_usize(capacity); - return wire.wire__crate__api__types__bdk_script_buf_with_capacity( - port_, arg0); + return wire.wire__crate__api__types__bdk_script_buf_with_capacity(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_script_buf, @@ -2001,13 +1985,43 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkTransactionFromBytes( + BdkTransaction crateApiTypesBdkTransactionCreate( + {required int version, + required LockTime lockTime, + required List input, + required List output}) { + return handler.executeSync(SyncTask( + callFfi: () { + var arg0 = cst_encode_i_32(version); + var arg1 = cst_encode_box_autoadd_lock_time(lockTime); + var arg2 = cst_encode_list_bdk_tx_in(input); + var arg3 = cst_encode_list_bdk_tx_out(output); + return wire.wire__crate__api__types__bdk_transaction_create( + arg0, arg1, arg2, arg3); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_bdk_transaction, + decodeErrorData: dco_decode_bdk_error, + ), + constMeta: kCrateApiTypesBdkTransactionCreateConstMeta, + argValues: [version, lockTime, input, output], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiTypesBdkTransactionCreateConstMeta => + const TaskConstMeta( + debugName: "bdk_transaction_create", + argNames: ["version", "lockTime", "input", "output"], + ); + + @override + BdkTransaction crateApiTypesBdkTransactionFromBytes( {required List transactionBytes}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_list_prim_u_8_loose(transactionBytes); - return wire.wire__crate__api__types__bdk_transaction_from_bytes( - port_, arg0); + return wire.wire__crate__api__types__bdk_transaction_from_bytes(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_bdk_transaction, @@ -2026,15 +2040,15 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future> crateApiTypesBdkTransactionInput( + List crateApiTypesBdkTransactionInput( {required BdkTransaction that}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_transaction(that); - return wire.wire__crate__api__types__bdk_transaction_input(port_, arg0); + return wire.wire__crate__api__types__bdk_transaction_input(arg0); }, codec: DcoCodec( - decodeSuccessData: dco_decode_list_tx_in, + decodeSuccessData: dco_decode_list_bdk_tx_in, decodeErrorData: dco_decode_bdk_error, ), constMeta: kCrateApiTypesBdkTransactionInputConstMeta, @@ -2050,13 +2064,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkTransactionIsCoinBase( - {required BdkTransaction that}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + bool crateApiTypesBdkTransactionIsCoinBase({required BdkTransaction that}) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_transaction(that); - return wire.wire__crate__api__types__bdk_transaction_is_coin_base( - port_, arg0); + return wire.wire__crate__api__types__bdk_transaction_is_coin_base(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_bool, @@ -2075,13 +2087,13 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkTransactionIsExplicitlyRbf( + bool crateApiTypesBdkTransactionIsExplicitlyRbf( {required BdkTransaction that}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_transaction(that); - return wire.wire__crate__api__types__bdk_transaction_is_explicitly_rbf( - port_, arg0); + return wire + .wire__crate__api__types__bdk_transaction_is_explicitly_rbf(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_bool, @@ -2100,14 +2112,14 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkTransactionIsLockTimeEnabled( + bool crateApiTypesBdkTransactionIsLockTimeEnabled( {required BdkTransaction that}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_transaction(that); return wire .wire__crate__api__types__bdk_transaction_is_lock_time_enabled( - port_, arg0); + arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_bool, @@ -2126,13 +2138,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkTransactionLockTime( - {required BdkTransaction that}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + LockTime crateApiTypesBdkTransactionLockTime({required BdkTransaction that}) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_transaction(that); - return wire.wire__crate__api__types__bdk_transaction_lock_time( - port_, arg0); + return wire.wire__crate__api__types__bdk_transaction_lock_time(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_lock_time, @@ -2151,47 +2161,15 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkTransactionNew( - {required int version, - required LockTime lockTime, - required List input, - required List output}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { - var arg0 = cst_encode_i_32(version); - var arg1 = cst_encode_box_autoadd_lock_time(lockTime); - var arg2 = cst_encode_list_tx_in(input); - var arg3 = cst_encode_list_tx_out(output); - return wire.wire__crate__api__types__bdk_transaction_new( - port_, arg0, arg1, arg2, arg3); - }, - codec: DcoCodec( - decodeSuccessData: dco_decode_bdk_transaction, - decodeErrorData: dco_decode_bdk_error, - ), - constMeta: kCrateApiTypesBdkTransactionNewConstMeta, - argValues: [version, lockTime, input, output], - apiImpl: this, - )); - } - - TaskConstMeta get kCrateApiTypesBdkTransactionNewConstMeta => - const TaskConstMeta( - debugName: "bdk_transaction_new", - argNames: ["version", "lockTime", "input", "output"], - ); - - @override - Future> crateApiTypesBdkTransactionOutput( + List crateApiTypesBdkTransactionOutput( {required BdkTransaction that}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_transaction(that); - return wire.wire__crate__api__types__bdk_transaction_output( - port_, arg0); + return wire.wire__crate__api__types__bdk_transaction_output(arg0); }, codec: DcoCodec( - decodeSuccessData: dco_decode_list_tx_out, + decodeSuccessData: dco_decode_list_bdk_tx_out, decodeErrorData: dco_decode_bdk_error, ), constMeta: kCrateApiTypesBdkTransactionOutputConstMeta, @@ -2207,13 +2185,12 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkTransactionSerialize( + Uint8List crateApiTypesBdkTransactionSerialize( {required BdkTransaction that}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_transaction(that); - return wire.wire__crate__api__types__bdk_transaction_serialize( - port_, arg0); + return wire.wire__crate__api__types__bdk_transaction_serialize(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_list_prim_u_8_strict, @@ -2232,12 +2209,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkTransactionSize( - {required BdkTransaction that}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + BigInt crateApiTypesBdkTransactionSize({required BdkTransaction that}) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_transaction(that); - return wire.wire__crate__api__types__bdk_transaction_size(port_, arg0); + return wire.wire__crate__api__types__bdk_transaction_size(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_u_64, @@ -2256,12 +2232,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkTransactionTxid( - {required BdkTransaction that}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + String crateApiTypesBdkTransactionTxid({required BdkTransaction that}) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_transaction(that); - return wire.wire__crate__api__types__bdk_transaction_txid(port_, arg0); + return wire.wire__crate__api__types__bdk_transaction_txid(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_String, @@ -2280,13 +2255,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkTransactionVersion( - {required BdkTransaction that}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + int crateApiTypesBdkTransactionVersion({required BdkTransaction that}) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_transaction(that); - return wire.wire__crate__api__types__bdk_transaction_version( - port_, arg0); + return wire.wire__crate__api__types__bdk_transaction_version(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_i_32, @@ -2305,12 +2278,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkTransactionVsize( - {required BdkTransaction that}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + BigInt crateApiTypesBdkTransactionVsize({required BdkTransaction that}) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_transaction(that); - return wire.wire__crate__api__types__bdk_transaction_vsize(port_, arg0); + return wire.wire__crate__api__types__bdk_transaction_vsize(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_u_64, @@ -2329,13 +2301,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiTypesBdkTransactionWeight( - {required BdkTransaction that}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + BigInt crateApiTypesBdkTransactionWeight({required BdkTransaction that}) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_transaction(that); - return wire.wire__crate__api__types__bdk_transaction_weight( - port_, arg0); + return wire.wire__crate__api__types__bdk_transaction_weight(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_u_64, @@ -2353,6 +2323,42 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { argNames: ["that"], ); + @override + Future crateApiWalletBdkWalletCreate( + {required BdkDescriptor descriptor, + BdkDescriptor? changeDescriptor, + required Network network, + required DatabaseConfig databaseConfig}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + var arg0 = cst_encode_box_autoadd_bdk_descriptor(descriptor); + var arg1 = cst_encode_opt_box_autoadd_bdk_descriptor(changeDescriptor); + var arg2 = cst_encode_network(network); + var arg3 = cst_encode_box_autoadd_database_config(databaseConfig); + return wire.wire__crate__api__wallet__bdk_wallet_create( + port_, arg0, arg1, arg2, arg3); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_bdk_wallet, + decodeErrorData: dco_decode_bdk_error, + ), + constMeta: kCrateApiWalletBdkWalletCreateConstMeta, + argValues: [descriptor, changeDescriptor, network, databaseConfig], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiWalletBdkWalletCreateConstMeta => + const TaskConstMeta( + debugName: "bdk_wallet_create", + argNames: [ + "descriptor", + "changeDescriptor", + "network", + "databaseConfig" + ], + ); + @override (BdkAddress, int) crateApiWalletBdkWalletGetAddress( {required BdkWallet ptr, required AddressIndex addressIndex}) { @@ -2456,19 +2462,19 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiWalletBdkWalletGetPsbtInput( + Input crateApiWalletBdkWalletGetPsbtInput( {required BdkWallet that, required LocalUtxo utxo, required bool onlyWitnessUtxo, PsbtSigHashType? sighashType}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_wallet(that); var arg1 = cst_encode_box_autoadd_local_utxo(utxo); var arg2 = cst_encode_bool(onlyWitnessUtxo); var arg3 = cst_encode_opt_box_autoadd_psbt_sig_hash_type(sighashType); return wire.wire__crate__api__wallet__bdk_wallet_get_psbt_input( - port_, arg0, arg1, arg2, arg3); + arg0, arg1, arg2, arg3); }, codec: DcoCodec( decodeSuccessData: dco_decode_input, @@ -2512,7 +2518,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - List crateApiWalletBdkWalletListTransactions( + List crateApiWalletBdkWalletListTransactions( {required BdkWallet that, required bool includeRaw}) { return handler.executeSync(SyncTask( callFfi: () { @@ -2522,7 +2528,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { arg0, arg1); }, codec: DcoCodec( - decodeSuccessData: dco_decode_list_transaction_details, + decodeSuccessData: dco_decode_list_bdk_transaction_details, decodeErrorData: dco_decode_bdk_error, ), constMeta: kCrateApiWalletBdkWalletListTransactionsConstMeta, @@ -2584,41 +2590,6 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { argNames: ["that"], ); - @override - Future crateApiWalletBdkWalletNew( - {required BdkDescriptor descriptor, - BdkDescriptor? changeDescriptor, - required Network network, - required DatabaseConfig databaseConfig}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_bdk_descriptor(descriptor); - var arg1 = cst_encode_opt_box_autoadd_bdk_descriptor(changeDescriptor); - var arg2 = cst_encode_network(network); - var arg3 = cst_encode_box_autoadd_database_config(databaseConfig); - return wire.wire__crate__api__wallet__bdk_wallet_new( - port_, arg0, arg1, arg2, arg3); - }, - codec: DcoCodec( - decodeSuccessData: dco_decode_bdk_wallet, - decodeErrorData: dco_decode_bdk_error, - ), - constMeta: kCrateApiWalletBdkWalletNewConstMeta, - argValues: [descriptor, changeDescriptor, network, databaseConfig], - apiImpl: this, - )); - } - - TaskConstMeta get kCrateApiWalletBdkWalletNewConstMeta => const TaskConstMeta( - debugName: "bdk_wallet_new", - argNames: [ - "descriptor", - "changeDescriptor", - "network", - "databaseConfig" - ], - ); - @override BdkPolicy? crateApiWalletBdkWalletPolicies( {required BdkWallet ptr, required KeychainKind keychain}) { @@ -2645,17 +2616,16 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiWalletBdkWalletSign( + bool crateApiWalletBdkWalletSign( {required BdkWallet ptr, required BdkPsbt psbt, SignOptions? signOptions}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_box_autoadd_bdk_wallet(ptr); var arg1 = cst_encode_box_autoadd_bdk_psbt(psbt); var arg2 = cst_encode_opt_box_autoadd_sign_options(signOptions); - return wire.wire__crate__api__wallet__bdk_wallet_sign( - port_, arg0, arg1, arg2); + return wire.wire__crate__api__wallet__bdk_wallet_sign(arg0, arg1, arg2); }, codec: DcoCodec( decodeSuccessData: dco_decode_bool, @@ -2700,7 +2670,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future<(BdkPsbt, TransactionDetails)> crateApiWalletFinishBumpFeeTxBuilder( + Future<(BdkPsbt, BdkTransactionDetails)> crateApiWalletFinishBumpFeeTxBuilder( {required String txid, required double feeRate, BdkAddress? allowShrinking, @@ -2719,7 +2689,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { port_, arg0, arg1, arg2, arg3, arg4, arg5); }, codec: DcoCodec( - decodeSuccessData: dco_decode_record_bdk_psbt_transaction_details, + decodeSuccessData: dco_decode_record_bdk_psbt_bdk_transaction_details, decodeErrorData: dco_decode_bdk_error, ), constMeta: kCrateApiWalletFinishBumpFeeTxBuilderConstMeta, @@ -2742,7 +2712,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future<(BdkPsbt, TransactionDetails)> crateApiWalletTxBuilderFinish( + Future<(BdkPsbt, BdkTransactionDetails)> crateApiWalletTxBuilderFinish( {required BdkWallet wallet, required List recipients, required List utxos, @@ -2797,7 +2767,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { arg14); }, codec: DcoCodec( - decodeSuccessData: dco_decode_record_bdk_psbt_transaction_details, + decodeSuccessData: dco_decode_record_bdk_psbt_bdk_transaction_details, decodeErrorData: dco_decode_bdk_error, ), constMeta: kCrateApiWalletTxBuilderFinishConstMeta, @@ -3457,6 +3427,48 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); } + @protected + BdkTransactionDetails dco_decode_bdk_transaction_details(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 6) + throw Exception('unexpected arr length: expect 6 but see ${arr.length}'); + return BdkTransactionDetails( + transaction: dco_decode_opt_box_autoadd_bdk_transaction(arr[0]), + txid: dco_decode_String(arr[1]), + received: dco_decode_u_64(arr[2]), + sent: dco_decode_u_64(arr[3]), + fee: dco_decode_opt_box_autoadd_u_64(arr[4]), + confirmationTime: dco_decode_opt_box_autoadd_block_time(arr[5]), + ); + } + + @protected + BdkTxIn dco_decode_bdk_tx_in(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 4) + throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); + return BdkTxIn( + previousOutput: dco_decode_out_point(arr[0]), + scriptSig: dco_decode_opt_box_autoadd_bdk_script_buf(arr[1]), + sequence: dco_decode_u_32(arr[2]), + witness: dco_decode_list_list_prim_u_8_strict(arr[3]), + ); + } + + @protected + BdkTxOut dco_decode_bdk_tx_out(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 2) + throw Exception('unexpected arr length: expect 2 but see ${arr.length}'); + return BdkTxOut( + value: dco_decode_u_64(arr[0]), + scriptPubkey: dco_decode_bdk_script_buf(arr[1]), + ); + } + @protected BdkWallet dco_decode_bdk_wallet(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -3977,6 +3989,27 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { return (raw as List).map(dco_decode_bdk_policy).toList(); } + @protected + List dco_decode_list_bdk_transaction_details( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List) + .map(dco_decode_bdk_transaction_details) + .toList(); + } + + @protected + List dco_decode_list_bdk_tx_in(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_bdk_tx_in).toList(); + } + + @protected + List dco_decode_list_bdk_tx_out(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_bdk_tx_out).toList(); + } + @protected List dco_decode_list_condition(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -4059,27 +4092,9 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } @protected - List dco_decode_list_script_amount(dynamic raw) { - // Codec=Dco (DartCObject based), see doc to use other codecs - return (raw as List).map(dco_decode_script_amount).toList(); - } - - @protected - List dco_decode_list_transaction_details(dynamic raw) { - // Codec=Dco (DartCObject based), see doc to use other codecs - return (raw as List).map(dco_decode_transaction_details).toList(); - } - - @protected - List dco_decode_list_tx_in(dynamic raw) { - // Codec=Dco (DartCObject based), see doc to use other codecs - return (raw as List).map(dco_decode_tx_in).toList(); - } - - @protected - List dco_decode_list_tx_out(dynamic raw) { + List dco_decode_list_script_amount(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs - return (raw as List).map(dco_decode_tx_out).toList(); + return (raw as List).map(dco_decode_script_amount).toList(); } @protected @@ -4090,7 +4105,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); return LocalUtxo( outpoint: dco_decode_out_point(arr[0]), - txout: dco_decode_tx_out(arr[1]), + txout: dco_decode_bdk_tx_out(arr[1]), keychain: dco_decode_keychain_kind(arr[2]), isSpent: dco_decode_bool(arr[3]), ); @@ -4340,8 +4355,8 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } @protected - (BdkPsbt, TransactionDetails) dco_decode_record_bdk_psbt_transaction_details( - dynamic raw) { + (BdkPsbt, BdkTransactionDetails) + dco_decode_record_bdk_psbt_bdk_transaction_details(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs final arr = raw as List; if (arr.length != 2) { @@ -4349,7 +4364,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } return ( dco_decode_bdk_psbt(arr[0]), - dco_decode_transaction_details(arr[1]), + dco_decode_bdk_transaction_details(arr[1]), ); } @@ -4575,48 +4590,6 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); } - @protected - TransactionDetails dco_decode_transaction_details(dynamic raw) { - // Codec=Dco (DartCObject based), see doc to use other codecs - final arr = raw as List; - if (arr.length != 6) - throw Exception('unexpected arr length: expect 6 but see ${arr.length}'); - return TransactionDetails( - transaction: dco_decode_opt_box_autoadd_bdk_transaction(arr[0]), - txid: dco_decode_String(arr[1]), - received: dco_decode_u_64(arr[2]), - sent: dco_decode_u_64(arr[3]), - fee: dco_decode_opt_box_autoadd_u_64(arr[4]), - confirmationTime: dco_decode_opt_box_autoadd_block_time(arr[5]), - ); - } - - @protected - TxIn dco_decode_tx_in(dynamic raw) { - // Codec=Dco (DartCObject based), see doc to use other codecs - final arr = raw as List; - if (arr.length != 4) - throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); - return TxIn( - previousOutput: dco_decode_out_point(arr[0]), - scriptSig: dco_decode_bdk_script_buf(arr[1]), - sequence: dco_decode_u_32(arr[2]), - witness: dco_decode_list_list_prim_u_8_strict(arr[3]), - ); - } - - @protected - TxOut dco_decode_tx_out(dynamic raw) { - // Codec=Dco (DartCObject based), see doc to use other codecs - final arr = raw as List; - if (arr.length != 2) - throw Exception('unexpected arr length: expect 2 but see ${arr.length}'); - return TxOut( - value: dco_decode_u_64(arr[0]), - scriptPubkey: dco_decode_bdk_script_buf(arr[1]), - ); - } - @protected int dco_decode_u_32(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -5143,6 +5116,49 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { return BdkTransaction(s: var_s); } + @protected + BdkTransactionDetails sse_decode_bdk_transaction_details( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_transaction = + sse_decode_opt_box_autoadd_bdk_transaction(deserializer); + var var_txid = sse_decode_String(deserializer); + var var_received = sse_decode_u_64(deserializer); + var var_sent = sse_decode_u_64(deserializer); + var var_fee = sse_decode_opt_box_autoadd_u_64(deserializer); + var var_confirmationTime = + sse_decode_opt_box_autoadd_block_time(deserializer); + return BdkTransactionDetails( + transaction: var_transaction, + txid: var_txid, + received: var_received, + sent: var_sent, + fee: var_fee, + confirmationTime: var_confirmationTime); + } + + @protected + BdkTxIn sse_decode_bdk_tx_in(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_previousOutput = sse_decode_out_point(deserializer); + var var_scriptSig = sse_decode_opt_box_autoadd_bdk_script_buf(deserializer); + var var_sequence = sse_decode_u_32(deserializer); + var var_witness = sse_decode_list_list_prim_u_8_strict(deserializer); + return BdkTxIn( + previousOutput: var_previousOutput, + scriptSig: var_scriptSig, + sequence: var_sequence, + witness: var_witness); + } + + @protected + BdkTxOut sse_decode_bdk_tx_out(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_value = sse_decode_u_64(deserializer); + var var_scriptPubkey = sse_decode_bdk_script_buf(deserializer); + return BdkTxOut(value: var_value, scriptPubkey: var_scriptPubkey); + } + @protected BdkWallet sse_decode_bdk_wallet(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -5666,6 +5682,43 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { return ans_; } + @protected + List sse_decode_list_bdk_transaction_details( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_bdk_transaction_details(deserializer)); + } + return ans_; + } + + @protected + List sse_decode_list_bdk_tx_in(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_bdk_tx_in(deserializer)); + } + return ans_; + } + + @protected + List sse_decode_list_bdk_tx_out(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_bdk_tx_out(deserializer)); + } + return ans_; + } + @protected List sse_decode_list_condition(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -5810,48 +5863,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { return ans_; } - @protected - List sse_decode_list_transaction_details( - SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - - var len_ = sse_decode_i_32(deserializer); - var ans_ = []; - for (var idx_ = 0; idx_ < len_; ++idx_) { - ans_.add(sse_decode_transaction_details(deserializer)); - } - return ans_; - } - - @protected - List sse_decode_list_tx_in(SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - - var len_ = sse_decode_i_32(deserializer); - var ans_ = []; - for (var idx_ = 0; idx_ < len_; ++idx_) { - ans_.add(sse_decode_tx_in(deserializer)); - } - return ans_; - } - - @protected - List sse_decode_list_tx_out(SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - - var len_ = sse_decode_i_32(deserializer); - var ans_ = []; - for (var idx_ = 0; idx_ < len_; ++idx_) { - ans_.add(sse_decode_tx_out(deserializer)); - } - return ans_; - } - @protected LocalUtxo sse_decode_local_utxo(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs var var_outpoint = sse_decode_out_point(deserializer); - var var_txout = sse_decode_tx_out(deserializer); + var var_txout = sse_decode_bdk_tx_out(deserializer); var var_keychain = sse_decode_keychain_kind(deserializer); var var_isSpent = sse_decode_bool(deserializer); return LocalUtxo( @@ -6201,11 +6217,12 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } @protected - (BdkPsbt, TransactionDetails) sse_decode_record_bdk_psbt_transaction_details( - SseDeserializer deserializer) { + (BdkPsbt, BdkTransactionDetails) + sse_decode_record_bdk_psbt_bdk_transaction_details( + SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs var var_field0 = sse_decode_bdk_psbt(deserializer); - var var_field1 = sse_decode_transaction_details(deserializer); + var var_field1 = sse_decode_bdk_transaction_details(deserializer); return (var_field0, var_field1); } @@ -6410,49 +6427,6 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { return SqliteDbConfiguration(path: var_path); } - @protected - TransactionDetails sse_decode_transaction_details( - SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - var var_transaction = - sse_decode_opt_box_autoadd_bdk_transaction(deserializer); - var var_txid = sse_decode_String(deserializer); - var var_received = sse_decode_u_64(deserializer); - var var_sent = sse_decode_u_64(deserializer); - var var_fee = sse_decode_opt_box_autoadd_u_64(deserializer); - var var_confirmationTime = - sse_decode_opt_box_autoadd_block_time(deserializer); - return TransactionDetails( - transaction: var_transaction, - txid: var_txid, - received: var_received, - sent: var_sent, - fee: var_fee, - confirmationTime: var_confirmationTime); - } - - @protected - TxIn sse_decode_tx_in(SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - var var_previousOutput = sse_decode_out_point(deserializer); - var var_scriptSig = sse_decode_bdk_script_buf(deserializer); - var var_sequence = sse_decode_u_32(deserializer); - var var_witness = sse_decode_list_list_prim_u_8_strict(deserializer); - return TxIn( - previousOutput: var_previousOutput, - scriptSig: var_scriptSig, - sequence: var_sequence, - witness: var_witness); - } - - @protected - TxOut sse_decode_tx_out(SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - var var_value = sse_decode_u_64(deserializer); - var var_scriptPubkey = sse_decode_bdk_script_buf(deserializer); - return TxOut(value: var_value, scriptPubkey: var_scriptPubkey); - } - @protected int sse_decode_u_32(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -7119,6 +7093,34 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { sse_encode_String(self.s, serializer); } + @protected + void sse_encode_bdk_transaction_details( + BdkTransactionDetails self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_box_autoadd_bdk_transaction(self.transaction, serializer); + sse_encode_String(self.txid, serializer); + sse_encode_u_64(self.received, serializer); + sse_encode_u_64(self.sent, serializer); + sse_encode_opt_box_autoadd_u_64(self.fee, serializer); + sse_encode_opt_box_autoadd_block_time(self.confirmationTime, serializer); + } + + @protected + void sse_encode_bdk_tx_in(BdkTxIn self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_out_point(self.previousOutput, serializer); + sse_encode_opt_box_autoadd_bdk_script_buf(self.scriptSig, serializer); + sse_encode_u_32(self.sequence, serializer); + sse_encode_list_list_prim_u_8_strict(self.witness, serializer); + } + + @protected + void sse_encode_bdk_tx_out(BdkTxOut self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_u_64(self.value, serializer); + sse_encode_bdk_script_buf(self.scriptPubkey, serializer); + } + @protected void sse_encode_bdk_wallet(BdkWallet self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -7627,6 +7629,35 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } } + @protected + void sse_encode_list_bdk_transaction_details( + List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_bdk_transaction_details(item, serializer); + } + } + + @protected + void sse_encode_list_bdk_tx_in(List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_bdk_tx_in(item, serializer); + } + } + + @protected + void sse_encode_list_bdk_tx_out( + List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_bdk_tx_out(item, serializer); + } + } + @protected void sse_encode_list_condition( List self, SseSerializer serializer) { @@ -7749,39 +7780,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } } - @protected - void sse_encode_list_transaction_details( - List self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_i_32(self.length, serializer); - for (final item in self) { - sse_encode_transaction_details(item, serializer); - } - } - - @protected - void sse_encode_list_tx_in(List self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_i_32(self.length, serializer); - for (final item in self) { - sse_encode_tx_in(item, serializer); - } - } - - @protected - void sse_encode_list_tx_out(List self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_i_32(self.length, serializer); - for (final item in self) { - sse_encode_tx_out(item, serializer); - } - } - @protected void sse_encode_local_utxo(LocalUtxo self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs sse_encode_out_point(self.outpoint, serializer); - sse_encode_tx_out(self.txout, serializer); + sse_encode_bdk_tx_out(self.txout, serializer); sse_encode_keychain_kind(self.keychain, serializer); sse_encode_bool(self.isSpent, serializer); } @@ -8098,11 +8101,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } @protected - void sse_encode_record_bdk_psbt_transaction_details( - (BdkPsbt, TransactionDetails) self, SseSerializer serializer) { + void sse_encode_record_bdk_psbt_bdk_transaction_details( + (BdkPsbt, BdkTransactionDetails) self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs sse_encode_bdk_psbt(self.$1, serializer); - sse_encode_transaction_details(self.$2, serializer); + sse_encode_bdk_transaction_details(self.$2, serializer); } @protected @@ -8282,34 +8285,6 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { sse_encode_String(self.path, serializer); } - @protected - void sse_encode_transaction_details( - TransactionDetails self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_opt_box_autoadd_bdk_transaction(self.transaction, serializer); - sse_encode_String(self.txid, serializer); - sse_encode_u_64(self.received, serializer); - sse_encode_u_64(self.sent, serializer); - sse_encode_opt_box_autoadd_u_64(self.fee, serializer); - sse_encode_opt_box_autoadd_block_time(self.confirmationTime, serializer); - } - - @protected - void sse_encode_tx_in(TxIn self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_out_point(self.previousOutput, serializer); - sse_encode_bdk_script_buf(self.scriptSig, serializer); - sse_encode_u_32(self.sequence, serializer); - sse_encode_list_list_prim_u_8_strict(self.witness, serializer); - } - - @protected - void sse_encode_tx_out(TxOut self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_u_64(self.value, serializer); - sse_encode_bdk_script_buf(self.scriptPubkey, serializer); - } - @protected void sse_encode_u_32(int self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs diff --git a/lib/src/generated/frb_generated.io.dart b/lib/src/generated/frb_generated.io.dart index 2b17a14..484caad 100644 --- a/lib/src/generated/frb_generated.io.dart +++ b/lib/src/generated/frb_generated.io.dart @@ -168,6 +168,15 @@ abstract class coreApiImplPlatform extends BaseApiImpl { @protected BdkTransaction dco_decode_bdk_transaction(dynamic raw); + @protected + BdkTransactionDetails dco_decode_bdk_transaction_details(dynamic raw); + + @protected + BdkTxIn dco_decode_bdk_tx_in(dynamic raw); + + @protected + BdkTxOut dco_decode_bdk_tx_out(dynamic raw); + @protected BdkWallet dco_decode_bdk_wallet(dynamic raw); @@ -349,6 +358,16 @@ abstract class coreApiImplPlatform extends BaseApiImpl { @protected List dco_decode_list_bdk_policy(dynamic raw); + @protected + List dco_decode_list_bdk_transaction_details( + dynamic raw); + + @protected + List dco_decode_list_bdk_tx_in(dynamic raw); + + @protected + List dco_decode_list_bdk_tx_out(dynamic raw); + @protected List dco_decode_list_condition(dynamic raw); @@ -391,15 +410,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { @protected List dco_decode_list_script_amount(dynamic raw); - @protected - List dco_decode_list_transaction_details(dynamic raw); - - @protected - List dco_decode_list_tx_in(dynamic raw); - - @protected - List dco_decode_list_tx_out(dynamic raw); - @protected LocalUtxo dco_decode_local_utxo(dynamic raw); @@ -490,8 +500,8 @@ abstract class coreApiImplPlatform extends BaseApiImpl { (BdkAddress, int) dco_decode_record_bdk_address_u_32(dynamic raw); @protected - (BdkPsbt, TransactionDetails) dco_decode_record_bdk_psbt_transaction_details( - dynamic raw); + (BdkPsbt, BdkTransactionDetails) + dco_decode_record_bdk_psbt_bdk_transaction_details(dynamic raw); @protected (Uint32List, List) @@ -532,15 +542,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { @protected SqliteDbConfiguration dco_decode_sqlite_db_configuration(dynamic raw); - @protected - TransactionDetails dco_decode_transaction_details(dynamic raw); - - @protected - TxIn dco_decode_tx_in(dynamic raw); - - @protected - TxOut dco_decode_tx_out(dynamic raw); - @protected int dco_decode_u_32(dynamic raw); @@ -679,6 +680,16 @@ abstract class coreApiImplPlatform extends BaseApiImpl { @protected BdkTransaction sse_decode_bdk_transaction(SseDeserializer deserializer); + @protected + BdkTransactionDetails sse_decode_bdk_transaction_details( + SseDeserializer deserializer); + + @protected + BdkTxIn sse_decode_bdk_tx_in(SseDeserializer deserializer); + + @protected + BdkTxOut sse_decode_bdk_tx_out(SseDeserializer deserializer); + @protected BdkWallet sse_decode_bdk_wallet(SseDeserializer deserializer); @@ -877,6 +888,16 @@ abstract class coreApiImplPlatform extends BaseApiImpl { @protected List sse_decode_list_bdk_policy(SseDeserializer deserializer); + @protected + List sse_decode_list_bdk_transaction_details( + SseDeserializer deserializer); + + @protected + List sse_decode_list_bdk_tx_in(SseDeserializer deserializer); + + @protected + List sse_decode_list_bdk_tx_out(SseDeserializer deserializer); + @protected List sse_decode_list_condition(SseDeserializer deserializer); @@ -923,16 +944,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { List sse_decode_list_script_amount( SseDeserializer deserializer); - @protected - List sse_decode_list_transaction_details( - SseDeserializer deserializer); - - @protected - List sse_decode_list_tx_in(SseDeserializer deserializer); - - @protected - List sse_decode_list_tx_out(SseDeserializer deserializer); - @protected LocalUtxo sse_decode_local_utxo(SseDeserializer deserializer); @@ -1034,8 +1045,9 @@ abstract class coreApiImplPlatform extends BaseApiImpl { SseDeserializer deserializer); @protected - (BdkPsbt, TransactionDetails) sse_decode_record_bdk_psbt_transaction_details( - SseDeserializer deserializer); + (BdkPsbt, BdkTransactionDetails) + sse_decode_record_bdk_psbt_bdk_transaction_details( + SseDeserializer deserializer); @protected (Uint32List, List) @@ -1080,16 +1092,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { SqliteDbConfiguration sse_decode_sqlite_db_configuration( SseDeserializer deserializer); - @protected - TransactionDetails sse_decode_transaction_details( - SseDeserializer deserializer); - - @protected - TxIn sse_decode_tx_in(SseDeserializer deserializer); - - @protected - TxOut sse_decode_tx_out(SseDeserializer deserializer); - @protected int sse_decode_u_32(SseDeserializer deserializer); @@ -1514,6 +1516,39 @@ abstract class coreApiImplPlatform extends BaseApiImpl { return ans; } + @protected + ffi.Pointer + cst_encode_list_bdk_transaction_details(List raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ans = wire.cst_new_list_bdk_transaction_details(raw.length); + for (var i = 0; i < raw.length; ++i) { + cst_api_fill_to_wire_bdk_transaction_details(raw[i], ans.ref.ptr[i]); + } + return ans; + } + + @protected + ffi.Pointer cst_encode_list_bdk_tx_in( + List raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ans = wire.cst_new_list_bdk_tx_in(raw.length); + for (var i = 0; i < raw.length; ++i) { + cst_api_fill_to_wire_bdk_tx_in(raw[i], ans.ref.ptr[i]); + } + return ans; + } + + @protected + ffi.Pointer cst_encode_list_bdk_tx_out( + List raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ans = wire.cst_new_list_bdk_tx_out(raw.length); + for (var i = 0; i < raw.length; ++i) { + cst_api_fill_to_wire_bdk_tx_out(raw[i], ans.ref.ptr[i]); + } + return ans; + } + @protected ffi.Pointer cst_encode_list_condition( List raw) { @@ -1655,37 +1690,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { return ans; } - @protected - ffi.Pointer - cst_encode_list_transaction_details(List raw) { - // Codec=Cst (C-struct based), see doc to use other codecs - final ans = wire.cst_new_list_transaction_details(raw.length); - for (var i = 0; i < raw.length; ++i) { - cst_api_fill_to_wire_transaction_details(raw[i], ans.ref.ptr[i]); - } - return ans; - } - - @protected - ffi.Pointer cst_encode_list_tx_in(List raw) { - // Codec=Cst (C-struct based), see doc to use other codecs - final ans = wire.cst_new_list_tx_in(raw.length); - for (var i = 0; i < raw.length; ++i) { - cst_api_fill_to_wire_tx_in(raw[i], ans.ref.ptr[i]); - } - return ans; - } - - @protected - ffi.Pointer cst_encode_list_tx_out(List raw) { - // Codec=Cst (C-struct based), see doc to use other codecs - final ans = wire.cst_new_list_tx_out(raw.length); - for (var i = 0; i < raw.length; ++i) { - cst_api_fill_to_wire_tx_out(raw[i], ans.ref.ptr[i]); - } - return ans; - } - @protected ffi.Pointer cst_encode_opt_Map_String_list_prim_u_32_strict( @@ -2345,6 +2349,38 @@ abstract class coreApiImplPlatform extends BaseApiImpl { wireObj.s = cst_encode_String(apiObj.s); } + @protected + void cst_api_fill_to_wire_bdk_transaction_details( + BdkTransactionDetails apiObj, wire_cst_bdk_transaction_details wireObj) { + wireObj.transaction = + cst_encode_opt_box_autoadd_bdk_transaction(apiObj.transaction); + wireObj.txid = cst_encode_String(apiObj.txid); + wireObj.received = cst_encode_u_64(apiObj.received); + wireObj.sent = cst_encode_u_64(apiObj.sent); + wireObj.fee = cst_encode_opt_box_autoadd_u_64(apiObj.fee); + wireObj.confirmation_time = + cst_encode_opt_box_autoadd_block_time(apiObj.confirmationTime); + } + + @protected + void cst_api_fill_to_wire_bdk_tx_in( + BdkTxIn apiObj, wire_cst_bdk_tx_in wireObj) { + cst_api_fill_to_wire_out_point( + apiObj.previousOutput, wireObj.previous_output); + wireObj.script_sig = + cst_encode_opt_box_autoadd_bdk_script_buf(apiObj.scriptSig); + wireObj.sequence = cst_encode_u_32(apiObj.sequence); + wireObj.witness = cst_encode_list_list_prim_u_8_strict(apiObj.witness); + } + + @protected + void cst_api_fill_to_wire_bdk_tx_out( + BdkTxOut apiObj, wire_cst_bdk_tx_out wireObj) { + wireObj.value = cst_encode_u_64(apiObj.value); + cst_api_fill_to_wire_bdk_script_buf( + apiObj.scriptPubkey, wireObj.script_pubkey); + } + @protected void cst_api_fill_to_wire_bdk_wallet( BdkWallet apiObj, wire_cst_bdk_wallet wireObj) { @@ -2810,7 +2846,7 @@ abstract class coreApiImplPlatform extends BaseApiImpl { void cst_api_fill_to_wire_local_utxo( LocalUtxo apiObj, wire_cst_local_utxo wireObj) { cst_api_fill_to_wire_out_point(apiObj.outpoint, wireObj.outpoint); - cst_api_fill_to_wire_tx_out(apiObj.txout, wireObj.txout); + cst_api_fill_to_wire_bdk_tx_out(apiObj.txout, wireObj.txout); wireObj.keychain = cst_encode_keychain_kind(apiObj.keychain); wireObj.is_spent = cst_encode_bool(apiObj.isSpent); } @@ -2914,11 +2950,11 @@ abstract class coreApiImplPlatform extends BaseApiImpl { } @protected - void cst_api_fill_to_wire_record_bdk_psbt_transaction_details( - (BdkPsbt, TransactionDetails) apiObj, - wire_cst_record_bdk_psbt_transaction_details wireObj) { + void cst_api_fill_to_wire_record_bdk_psbt_bdk_transaction_details( + (BdkPsbt, BdkTransactionDetails) apiObj, + wire_cst_record_bdk_psbt_bdk_transaction_details wireObj) { cst_api_fill_to_wire_bdk_psbt(apiObj.$1, wireObj.field0); - cst_api_fill_to_wire_transaction_details(apiObj.$2, wireObj.field1); + cst_api_fill_to_wire_bdk_transaction_details(apiObj.$2, wireObj.field1); } @protected @@ -3124,35 +3160,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { wireObj.path = cst_encode_String(apiObj.path); } - @protected - void cst_api_fill_to_wire_transaction_details( - TransactionDetails apiObj, wire_cst_transaction_details wireObj) { - wireObj.transaction = - cst_encode_opt_box_autoadd_bdk_transaction(apiObj.transaction); - wireObj.txid = cst_encode_String(apiObj.txid); - wireObj.received = cst_encode_u_64(apiObj.received); - wireObj.sent = cst_encode_u_64(apiObj.sent); - wireObj.fee = cst_encode_opt_box_autoadd_u_64(apiObj.fee); - wireObj.confirmation_time = - cst_encode_opt_box_autoadd_block_time(apiObj.confirmationTime); - } - - @protected - void cst_api_fill_to_wire_tx_in(TxIn apiObj, wire_cst_tx_in wireObj) { - cst_api_fill_to_wire_out_point( - apiObj.previousOutput, wireObj.previous_output); - cst_api_fill_to_wire_bdk_script_buf(apiObj.scriptSig, wireObj.script_sig); - wireObj.sequence = cst_encode_u_32(apiObj.sequence); - wireObj.witness = cst_encode_list_list_prim_u_8_strict(apiObj.witness); - } - - @protected - void cst_api_fill_to_wire_tx_out(TxOut apiObj, wire_cst_tx_out wireObj) { - wireObj.value = cst_encode_u_64(apiObj.value); - cst_api_fill_to_wire_bdk_script_buf( - apiObj.scriptPubkey, wireObj.script_pubkey); - } - @protected int cst_encode_RustOpaque_bdkbitcoinAddress(Address raw); @@ -3337,6 +3344,16 @@ abstract class coreApiImplPlatform extends BaseApiImpl { void sse_encode_bdk_transaction( BdkTransaction self, SseSerializer serializer); + @protected + void sse_encode_bdk_transaction_details( + BdkTransactionDetails self, SseSerializer serializer); + + @protected + void sse_encode_bdk_tx_in(BdkTxIn self, SseSerializer serializer); + + @protected + void sse_encode_bdk_tx_out(BdkTxOut self, SseSerializer serializer); + @protected void sse_encode_bdk_wallet(BdkWallet self, SseSerializer serializer); @@ -3554,6 +3571,17 @@ abstract class coreApiImplPlatform extends BaseApiImpl { void sse_encode_list_bdk_policy( List self, SseSerializer serializer); + @protected + void sse_encode_list_bdk_transaction_details( + List self, SseSerializer serializer); + + @protected + void sse_encode_list_bdk_tx_in(List self, SseSerializer serializer); + + @protected + void sse_encode_list_bdk_tx_out( + List self, SseSerializer serializer); + @protected void sse_encode_list_condition( List self, SseSerializer serializer); @@ -3603,16 +3631,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { void sse_encode_list_script_amount( List self, SseSerializer serializer); - @protected - void sse_encode_list_transaction_details( - List self, SseSerializer serializer); - - @protected - void sse_encode_list_tx_in(List self, SseSerializer serializer); - - @protected - void sse_encode_list_tx_out(List self, SseSerializer serializer); - @protected void sse_encode_local_utxo(LocalUtxo self, SseSerializer serializer); @@ -3717,8 +3735,8 @@ abstract class coreApiImplPlatform extends BaseApiImpl { (BdkAddress, int) self, SseSerializer serializer); @protected - void sse_encode_record_bdk_psbt_transaction_details( - (BdkPsbt, TransactionDetails) self, SseSerializer serializer); + void sse_encode_record_bdk_psbt_bdk_transaction_details( + (BdkPsbt, BdkTransactionDetails) self, SseSerializer serializer); @protected void sse_encode_record_list_prim_u_32_strict_list_condition( @@ -3763,16 +3781,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { void sse_encode_sqlite_db_configuration( SqliteDbConfiguration self, SseSerializer serializer); - @protected - void sse_encode_transaction_details( - TransactionDetails self, SseSerializer serializer); - - @protected - void sse_encode_tx_in(TxIn self, SseSerializer serializer); - - @protected - void sse_encode_tx_out(TxOut self, SseSerializer serializer); - @protected void sse_encode_u_32(int self, SseSerializer serializer); @@ -3965,6 +3973,26 @@ class coreWire implements BaseWire { WireSyncRust2DartDco Function( ffi.Pointer)>(); + WireSyncRust2DartDco wire__crate__api__descriptor__bdk_descriptor_create( + ffi.Pointer descriptor, + int network, + ) { + return _wire__crate__api__descriptor__bdk_descriptor_create( + descriptor, + network, + ); + } + + late final _wire__crate__api__descriptor__bdk_descriptor_createPtr = _lookup< + ffi.NativeFunction< + WireSyncRust2DartDco Function( + ffi.Pointer, ffi.Int32)>>( + 'frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_create'); + late final _wire__crate__api__descriptor__bdk_descriptor_create = + _wire__crate__api__descriptor__bdk_descriptor_createPtr.asFunction< + WireSyncRust2DartDco Function( + ffi.Pointer, int)>(); + WireSyncRust2DartDco wire__crate__api__descriptor__bdk_descriptor_max_satisfaction_weight( ffi.Pointer that, @@ -3986,36 +4014,12 @@ class coreWire implements BaseWire { WireSyncRust2DartDco Function( ffi.Pointer)>(); - void wire__crate__api__descriptor__bdk_descriptor_new( - int port_, - ffi.Pointer descriptor, - int network, - ) { - return _wire__crate__api__descriptor__bdk_descriptor_new( - port_, - descriptor, - network, - ); - } - - late final _wire__crate__api__descriptor__bdk_descriptor_newPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer, ffi.Int32)>>( - 'frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new'); - late final _wire__crate__api__descriptor__bdk_descriptor_new = - _wire__crate__api__descriptor__bdk_descriptor_newPtr.asFunction< - void Function( - int, ffi.Pointer, int)>(); - - void wire__crate__api__descriptor__bdk_descriptor_new_bip44( - int port_, + WireSyncRust2DartDco wire__crate__api__descriptor__bdk_descriptor_new_bip44( ffi.Pointer secret_key, int keychain_kind, int network, ) { return _wire__crate__api__descriptor__bdk_descriptor_new_bip44( - port_, secret_key, keychain_kind, network, @@ -4024,26 +4028,24 @@ class coreWire implements BaseWire { late final _wire__crate__api__descriptor__bdk_descriptor_new_bip44Ptr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Int32, ffi.Int32)>>( 'frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44'); late final _wire__crate__api__descriptor__bdk_descriptor_new_bip44 = _wire__crate__api__descriptor__bdk_descriptor_new_bip44Ptr.asFunction< - void Function(int, ffi.Pointer, - int, int)>(); + WireSyncRust2DartDco Function( + ffi.Pointer, int, int)>(); - void wire__crate__api__descriptor__bdk_descriptor_new_bip44_public( - int port_, + WireSyncRust2DartDco + wire__crate__api__descriptor__bdk_descriptor_new_bip44_public( ffi.Pointer public_key, ffi.Pointer fingerprint, int keychain_kind, int network, ) { return _wire__crate__api__descriptor__bdk_descriptor_new_bip44_public( - port_, public_key, fingerprint, keychain_kind, @@ -4054,8 +4056,7 @@ class coreWire implements BaseWire { late final _wire__crate__api__descriptor__bdk_descriptor_new_bip44_publicPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer, ffi.Int32, @@ -4064,21 +4065,18 @@ class coreWire implements BaseWire { late final _wire__crate__api__descriptor__bdk_descriptor_new_bip44_public = _wire__crate__api__descriptor__bdk_descriptor_new_bip44_publicPtr .asFunction< - void Function( - int, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer, int, int)>(); - void wire__crate__api__descriptor__bdk_descriptor_new_bip49( - int port_, + WireSyncRust2DartDco wire__crate__api__descriptor__bdk_descriptor_new_bip49( ffi.Pointer secret_key, int keychain_kind, int network, ) { return _wire__crate__api__descriptor__bdk_descriptor_new_bip49( - port_, secret_key, keychain_kind, network, @@ -4087,26 +4085,24 @@ class coreWire implements BaseWire { late final _wire__crate__api__descriptor__bdk_descriptor_new_bip49Ptr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Int32, ffi.Int32)>>( 'frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49'); late final _wire__crate__api__descriptor__bdk_descriptor_new_bip49 = _wire__crate__api__descriptor__bdk_descriptor_new_bip49Ptr.asFunction< - void Function(int, ffi.Pointer, - int, int)>(); + WireSyncRust2DartDco Function( + ffi.Pointer, int, int)>(); - void wire__crate__api__descriptor__bdk_descriptor_new_bip49_public( - int port_, + WireSyncRust2DartDco + wire__crate__api__descriptor__bdk_descriptor_new_bip49_public( ffi.Pointer public_key, ffi.Pointer fingerprint, int keychain_kind, int network, ) { return _wire__crate__api__descriptor__bdk_descriptor_new_bip49_public( - port_, public_key, fingerprint, keychain_kind, @@ -4117,8 +4113,7 @@ class coreWire implements BaseWire { late final _wire__crate__api__descriptor__bdk_descriptor_new_bip49_publicPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer, ffi.Int32, @@ -4127,21 +4122,18 @@ class coreWire implements BaseWire { late final _wire__crate__api__descriptor__bdk_descriptor_new_bip49_public = _wire__crate__api__descriptor__bdk_descriptor_new_bip49_publicPtr .asFunction< - void Function( - int, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer, int, int)>(); - void wire__crate__api__descriptor__bdk_descriptor_new_bip84( - int port_, + WireSyncRust2DartDco wire__crate__api__descriptor__bdk_descriptor_new_bip84( ffi.Pointer secret_key, int keychain_kind, int network, ) { return _wire__crate__api__descriptor__bdk_descriptor_new_bip84( - port_, secret_key, keychain_kind, network, @@ -4150,26 +4142,24 @@ class coreWire implements BaseWire { late final _wire__crate__api__descriptor__bdk_descriptor_new_bip84Ptr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Int32, ffi.Int32)>>( 'frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip84'); late final _wire__crate__api__descriptor__bdk_descriptor_new_bip84 = _wire__crate__api__descriptor__bdk_descriptor_new_bip84Ptr.asFunction< - void Function(int, ffi.Pointer, - int, int)>(); + WireSyncRust2DartDco Function( + ffi.Pointer, int, int)>(); - void wire__crate__api__descriptor__bdk_descriptor_new_bip84_public( - int port_, + WireSyncRust2DartDco + wire__crate__api__descriptor__bdk_descriptor_new_bip84_public( ffi.Pointer public_key, ffi.Pointer fingerprint, int keychain_kind, int network, ) { return _wire__crate__api__descriptor__bdk_descriptor_new_bip84_public( - port_, public_key, fingerprint, keychain_kind, @@ -4180,8 +4170,7 @@ class coreWire implements BaseWire { late final _wire__crate__api__descriptor__bdk_descriptor_new_bip84_publicPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer, ffi.Int32, @@ -4190,21 +4179,18 @@ class coreWire implements BaseWire { late final _wire__crate__api__descriptor__bdk_descriptor_new_bip84_public = _wire__crate__api__descriptor__bdk_descriptor_new_bip84_publicPtr .asFunction< - void Function( - int, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer, int, int)>(); - void wire__crate__api__descriptor__bdk_descriptor_new_bip86( - int port_, + WireSyncRust2DartDco wire__crate__api__descriptor__bdk_descriptor_new_bip86( ffi.Pointer secret_key, int keychain_kind, int network, ) { return _wire__crate__api__descriptor__bdk_descriptor_new_bip86( - port_, secret_key, keychain_kind, network, @@ -4213,26 +4199,24 @@ class coreWire implements BaseWire { late final _wire__crate__api__descriptor__bdk_descriptor_new_bip86Ptr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Int32, ffi.Int32)>>( 'frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip86'); late final _wire__crate__api__descriptor__bdk_descriptor_new_bip86 = _wire__crate__api__descriptor__bdk_descriptor_new_bip86Ptr.asFunction< - void Function(int, ffi.Pointer, - int, int)>(); + WireSyncRust2DartDco Function( + ffi.Pointer, int, int)>(); - void wire__crate__api__descriptor__bdk_descriptor_new_bip86_public( - int port_, + WireSyncRust2DartDco + wire__crate__api__descriptor__bdk_descriptor_new_bip86_public( ffi.Pointer public_key, ffi.Pointer fingerprint, int keychain_kind, int network, ) { return _wire__crate__api__descriptor__bdk_descriptor_new_bip86_public( - port_, public_key, fingerprint, keychain_kind, @@ -4243,8 +4227,7 @@ class coreWire implements BaseWire { late final _wire__crate__api__descriptor__bdk_descriptor_new_bip86_publicPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer, ffi.Int32, @@ -4253,8 +4236,7 @@ class coreWire implements BaseWire { late final _wire__crate__api__descriptor__bdk_descriptor_new_bip86_public = _wire__crate__api__descriptor__bdk_descriptor_new_bip86_publicPtr .asFunction< - void Function( - int, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer, int, @@ -4299,24 +4281,23 @@ class coreWire implements BaseWire { WireSyncRust2DartDco Function( ffi.Pointer)>(); - void wire__crate__api__key__bdk_derivation_path_from_string( - int port_, + WireSyncRust2DartDco wire__crate__api__key__bdk_derivation_path_from_string( ffi.Pointer path, ) { return _wire__crate__api__key__bdk_derivation_path_from_string( - port_, path, ); } late final _wire__crate__api__key__bdk_derivation_path_from_stringPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__key__bdk_derivation_path_from_string'); late final _wire__crate__api__key__bdk_derivation_path_from_string = _wire__crate__api__key__bdk_derivation_path_from_stringPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); WireSyncRust2DartDco wire__crate__api__key__bdk_descriptor_public_key_as_string( @@ -4338,13 +4319,11 @@ class coreWire implements BaseWire { WireSyncRust2DartDco Function( ffi.Pointer)>(); - void wire__crate__api__key__bdk_descriptor_public_key_derive( - int port_, + WireSyncRust2DartDco wire__crate__api__key__bdk_descriptor_public_key_derive( ffi.Pointer ptr, ffi.Pointer path, ) { return _wire__crate__api__key__bdk_descriptor_public_key_derive( - port_, ptr, path, ); @@ -4352,23 +4331,21 @@ class coreWire implements BaseWire { late final _wire__crate__api__key__bdk_descriptor_public_key_derivePtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_derive'); late final _wire__crate__api__key__bdk_descriptor_public_key_derive = _wire__crate__api__key__bdk_descriptor_public_key_derivePtr.asFunction< - void Function(int, ffi.Pointer, + WireSyncRust2DartDco Function( + ffi.Pointer, ffi.Pointer)>(); - void wire__crate__api__key__bdk_descriptor_public_key_extend( - int port_, + WireSyncRust2DartDco wire__crate__api__key__bdk_descriptor_public_key_extend( ffi.Pointer ptr, ffi.Pointer path, ) { return _wire__crate__api__key__bdk_descriptor_public_key_extend( - port_, ptr, path, ); @@ -4376,22 +4353,21 @@ class coreWire implements BaseWire { late final _wire__crate__api__key__bdk_descriptor_public_key_extendPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_extend'); late final _wire__crate__api__key__bdk_descriptor_public_key_extend = _wire__crate__api__key__bdk_descriptor_public_key_extendPtr.asFunction< - void Function(int, ffi.Pointer, + WireSyncRust2DartDco Function( + ffi.Pointer, ffi.Pointer)>(); - void wire__crate__api__key__bdk_descriptor_public_key_from_string( - int port_, + WireSyncRust2DartDco + wire__crate__api__key__bdk_descriptor_public_key_from_string( ffi.Pointer public_key, ) { return _wire__crate__api__key__bdk_descriptor_public_key_from_string( - port_, public_key, ); } @@ -4399,13 +4375,14 @@ class coreWire implements BaseWire { late final _wire__crate__api__key__bdk_descriptor_public_key_from_stringPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_from_string'); late final _wire__crate__api__key__bdk_descriptor_public_key_from_string = _wire__crate__api__key__bdk_descriptor_public_key_from_stringPtr .asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); WireSyncRust2DartDco wire__crate__api__key__bdk_descriptor_secret_key_as_public( @@ -4447,14 +4424,12 @@ class coreWire implements BaseWire { WireSyncRust2DartDco Function( ffi.Pointer)>(); - void wire__crate__api__key__bdk_descriptor_secret_key_create( - int port_, + WireSyncRust2DartDco wire__crate__api__key__bdk_descriptor_secret_key_create( int network, ffi.Pointer mnemonic, ffi.Pointer password, ) { return _wire__crate__api__key__bdk_descriptor_secret_key_create( - port_, network, mnemonic, password, @@ -4463,24 +4438,21 @@ class coreWire implements BaseWire { late final _wire__crate__api__key__bdk_descriptor_secret_key_createPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Int32, ffi.Pointer, ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_create'); late final _wire__crate__api__key__bdk_descriptor_secret_key_create = _wire__crate__api__key__bdk_descriptor_secret_key_createPtr.asFunction< - void Function(int, int, ffi.Pointer, + WireSyncRust2DartDco Function(int, ffi.Pointer, ffi.Pointer)>(); - void wire__crate__api__key__bdk_descriptor_secret_key_derive( - int port_, + WireSyncRust2DartDco wire__crate__api__key__bdk_descriptor_secret_key_derive( ffi.Pointer ptr, ffi.Pointer path, ) { return _wire__crate__api__key__bdk_descriptor_secret_key_derive( - port_, ptr, path, ); @@ -4488,23 +4460,21 @@ class coreWire implements BaseWire { late final _wire__crate__api__key__bdk_descriptor_secret_key_derivePtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_derive'); late final _wire__crate__api__key__bdk_descriptor_secret_key_derive = _wire__crate__api__key__bdk_descriptor_secret_key_derivePtr.asFunction< - void Function(int, ffi.Pointer, + WireSyncRust2DartDco Function( + ffi.Pointer, ffi.Pointer)>(); - void wire__crate__api__key__bdk_descriptor_secret_key_extend( - int port_, + WireSyncRust2DartDco wire__crate__api__key__bdk_descriptor_secret_key_extend( ffi.Pointer ptr, ffi.Pointer path, ) { return _wire__crate__api__key__bdk_descriptor_secret_key_extend( - port_, ptr, path, ); @@ -4512,14 +4482,14 @@ class coreWire implements BaseWire { late final _wire__crate__api__key__bdk_descriptor_secret_key_extendPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_extend'); late final _wire__crate__api__key__bdk_descriptor_secret_key_extend = _wire__crate__api__key__bdk_descriptor_secret_key_extendPtr.asFunction< - void Function(int, ffi.Pointer, + WireSyncRust2DartDco Function( + ffi.Pointer, ffi.Pointer)>(); void wire__crate__api__key__bdk_descriptor_secret_key_from_string( @@ -4581,60 +4551,56 @@ class coreWire implements BaseWire { _wire__crate__api__key__bdk_mnemonic_as_stringPtr.asFunction< WireSyncRust2DartDco Function(ffi.Pointer)>(); - void wire__crate__api__key__bdk_mnemonic_from_entropy( - int port_, + WireSyncRust2DartDco wire__crate__api__key__bdk_mnemonic_create( + int word_count, + ) { + return _wire__crate__api__key__bdk_mnemonic_create( + word_count, + ); + } + + late final _wire__crate__api__key__bdk_mnemonic_createPtr = + _lookup>( + 'frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_create'); + late final _wire__crate__api__key__bdk_mnemonic_create = + _wire__crate__api__key__bdk_mnemonic_createPtr + .asFunction(); + + WireSyncRust2DartDco wire__crate__api__key__bdk_mnemonic_from_entropy( ffi.Pointer entropy, ) { return _wire__crate__api__key__bdk_mnemonic_from_entropy( - port_, entropy, ); } late final _wire__crate__api__key__bdk_mnemonic_from_entropyPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_entropy'); late final _wire__crate__api__key__bdk_mnemonic_from_entropy = _wire__crate__api__key__bdk_mnemonic_from_entropyPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__key__bdk_mnemonic_from_string( - int port_, + WireSyncRust2DartDco wire__crate__api__key__bdk_mnemonic_from_string( ffi.Pointer mnemonic, ) { return _wire__crate__api__key__bdk_mnemonic_from_string( - port_, mnemonic, ); } late final _wire__crate__api__key__bdk_mnemonic_from_stringPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_string'); late final _wire__crate__api__key__bdk_mnemonic_from_string = _wire__crate__api__key__bdk_mnemonic_from_stringPtr.asFunction< - void Function(int, ffi.Pointer)>(); - - void wire__crate__api__key__bdk_mnemonic_new( - int port_, - int word_count, - ) { - return _wire__crate__api__key__bdk_mnemonic_new( - port_, - word_count, - ); - } - - late final _wire__crate__api__key__bdk_mnemonic_newPtr = - _lookup>( - 'frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_new'); - late final _wire__crate__api__key__bdk_mnemonic_new = - _wire__crate__api__key__bdk_mnemonic_newPtr - .asFunction(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); WireSyncRust2DartDco wire__crate__api__psbt__bdk_psbt_as_string( ffi.Pointer that, @@ -4652,13 +4618,11 @@ class coreWire implements BaseWire { _wire__crate__api__psbt__bdk_psbt_as_stringPtr.asFunction< WireSyncRust2DartDco Function(ffi.Pointer)>(); - void wire__crate__api__psbt__bdk_psbt_combine( - int port_, + WireSyncRust2DartDco wire__crate__api__psbt__bdk_psbt_combine( ffi.Pointer ptr, ffi.Pointer other, ) { return _wire__crate__api__psbt__bdk_psbt_combine( - port_, ptr, other, ); @@ -4666,12 +4630,12 @@ class coreWire implements BaseWire { late final _wire__crate__api__psbt__bdk_psbt_combinePtr = _lookup< ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, + WireSyncRust2DartDco Function(ffi.Pointer, ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_combine'); late final _wire__crate__api__psbt__bdk_psbt_combine = _wire__crate__api__psbt__bdk_psbt_combinePtr.asFunction< - void Function(int, ffi.Pointer, + WireSyncRust2DartDco Function(ffi.Pointer, ffi.Pointer)>(); WireSyncRust2DartDco wire__crate__api__psbt__bdk_psbt_extract_tx( @@ -4722,24 +4686,23 @@ class coreWire implements BaseWire { _wire__crate__api__psbt__bdk_psbt_fee_ratePtr.asFunction< WireSyncRust2DartDco Function(ffi.Pointer)>(); - void wire__crate__api__psbt__bdk_psbt_from_str( - int port_, + WireSyncRust2DartDco wire__crate__api__psbt__bdk_psbt_from_str( ffi.Pointer psbt_base64, ) { return _wire__crate__api__psbt__bdk_psbt_from_str( - port_, psbt_base64, ); } late final _wire__crate__api__psbt__bdk_psbt_from_strPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_from_str'); late final _wire__crate__api__psbt__bdk_psbt_from_str = _wire__crate__api__psbt__bdk_psbt_from_strPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); WireSyncRust2DartDco wire__crate__api__psbt__bdk_psbt_json_serialize( ffi.Pointer that, @@ -4806,13 +4769,11 @@ class coreWire implements BaseWire { _wire__crate__api__types__bdk_address_as_stringPtr.asFunction< WireSyncRust2DartDco Function(ffi.Pointer)>(); - void wire__crate__api__types__bdk_address_from_script( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_address_from_script( ffi.Pointer script, int network, ) { return _wire__crate__api__types__bdk_address_from_script( - port_, script, network, ); @@ -4820,20 +4781,19 @@ class coreWire implements BaseWire { late final _wire__crate__api__types__bdk_address_from_scriptPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer, ffi.Int32)>>( + WireSyncRust2DartDco Function( + ffi.Pointer, ffi.Int32)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_address_from_script'); late final _wire__crate__api__types__bdk_address_from_script = _wire__crate__api__types__bdk_address_from_scriptPtr.asFunction< - void Function(int, ffi.Pointer, int)>(); + WireSyncRust2DartDco Function( + ffi.Pointer, int)>(); - void wire__crate__api__types__bdk_address_from_string( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_address_from_string( ffi.Pointer address, int network, ) { return _wire__crate__api__types__bdk_address_from_string( - port_, address, network, ); @@ -4841,13 +4801,13 @@ class coreWire implements BaseWire { late final _wire__crate__api__types__bdk_address_from_stringPtr = _lookup< ffi.NativeFunction< - ffi.Void Function(ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Int32)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_address_from_string'); late final _wire__crate__api__types__bdk_address_from_string = _wire__crate__api__types__bdk_address_from_stringPtr.asFunction< - void Function( - int, ffi.Pointer, int)>(); + WireSyncRust2DartDco Function( + ffi.Pointer, int)>(); WireSyncRust2DartDco wire__crate__api__types__bdk_address_is_valid_for_network( @@ -5064,105 +5024,128 @@ class coreWire implements BaseWire { _wire__crate__api__types__bdk_script_buf_emptyPtr .asFunction(); - void wire__crate__api__types__bdk_script_buf_from_hex( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_script_buf_from_hex( ffi.Pointer s, ) { return _wire__crate__api__types__bdk_script_buf_from_hex( - port_, s, ); } late final _wire__crate__api__types__bdk_script_buf_from_hexPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_from_hex'); late final _wire__crate__api__types__bdk_script_buf_from_hex = _wire__crate__api__types__bdk_script_buf_from_hexPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_script_buf_with_capacity( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_script_buf_with_capacity( int capacity, ) { return _wire__crate__api__types__bdk_script_buf_with_capacity( - port_, capacity, ); } late final _wire__crate__api__types__bdk_script_buf_with_capacityPtr = _lookup< - ffi.NativeFunction>( + ffi.NativeFunction>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_with_capacity'); late final _wire__crate__api__types__bdk_script_buf_with_capacity = _wire__crate__api__types__bdk_script_buf_with_capacityPtr - .asFunction(); + .asFunction(); - void wire__crate__api__types__bdk_transaction_from_bytes( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_transaction_create( + int version, + ffi.Pointer lock_time, + ffi.Pointer input, + ffi.Pointer output, + ) { + return _wire__crate__api__types__bdk_transaction_create( + version, + lock_time, + input, + output, + ); + } + + late final _wire__crate__api__types__bdk_transaction_createPtr = _lookup< + ffi.NativeFunction< + WireSyncRust2DartDco Function( + ffi.Int32, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>( + 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_create'); + late final _wire__crate__api__types__bdk_transaction_create = + _wire__crate__api__types__bdk_transaction_createPtr.asFunction< + WireSyncRust2DartDco Function( + int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); + + WireSyncRust2DartDco wire__crate__api__types__bdk_transaction_from_bytes( ffi.Pointer transaction_bytes, ) { return _wire__crate__api__types__bdk_transaction_from_bytes( - port_, transaction_bytes, ); } late final _wire__crate__api__types__bdk_transaction_from_bytesPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_from_bytes'); late final _wire__crate__api__types__bdk_transaction_from_bytes = _wire__crate__api__types__bdk_transaction_from_bytesPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_transaction_input( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_transaction_input( ffi.Pointer that, ) { return _wire__crate__api__types__bdk_transaction_input( - port_, that, ); } late final _wire__crate__api__types__bdk_transaction_inputPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_input'); late final _wire__crate__api__types__bdk_transaction_input = _wire__crate__api__types__bdk_transaction_inputPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_transaction_is_coin_base( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_transaction_is_coin_base( ffi.Pointer that, ) { return _wire__crate__api__types__bdk_transaction_is_coin_base( - port_, that, ); } late final _wire__crate__api__types__bdk_transaction_is_coin_basePtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_coin_base'); late final _wire__crate__api__types__bdk_transaction_is_coin_base = _wire__crate__api__types__bdk_transaction_is_coin_basePtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_transaction_is_explicitly_rbf( - int port_, + WireSyncRust2DartDco + wire__crate__api__types__bdk_transaction_is_explicitly_rbf( ffi.Pointer that, ) { return _wire__crate__api__types__bdk_transaction_is_explicitly_rbf( - port_, that, ); } @@ -5170,19 +5153,19 @@ class coreWire implements BaseWire { late final _wire__crate__api__types__bdk_transaction_is_explicitly_rbfPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_explicitly_rbf'); late final _wire__crate__api__types__bdk_transaction_is_explicitly_rbf = _wire__crate__api__types__bdk_transaction_is_explicitly_rbfPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_transaction_is_lock_time_enabled( - int port_, + WireSyncRust2DartDco + wire__crate__api__types__bdk_transaction_is_lock_time_enabled( ffi.Pointer that, ) { return _wire__crate__api__types__bdk_transaction_is_lock_time_enabled( - port_, that, ); } @@ -5190,199 +5173,192 @@ class coreWire implements BaseWire { late final _wire__crate__api__types__bdk_transaction_is_lock_time_enabledPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_lock_time_enabled'); late final _wire__crate__api__types__bdk_transaction_is_lock_time_enabled = _wire__crate__api__types__bdk_transaction_is_lock_time_enabledPtr .asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_transaction_lock_time( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_transaction_lock_time( ffi.Pointer that, ) { return _wire__crate__api__types__bdk_transaction_lock_time( - port_, that, ); } late final _wire__crate__api__types__bdk_transaction_lock_timePtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_lock_time'); late final _wire__crate__api__types__bdk_transaction_lock_time = _wire__crate__api__types__bdk_transaction_lock_timePtr.asFunction< - void Function(int, ffi.Pointer)>(); - - void wire__crate__api__types__bdk_transaction_new( - int port_, - int version, - ffi.Pointer lock_time, - ffi.Pointer input, - ffi.Pointer output, - ) { - return _wire__crate__api__types__bdk_transaction_new( - port_, - version, - lock_time, - input, - output, - ); - } - - late final _wire__crate__api__types__bdk_transaction_newPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Int32, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>( - 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_new'); - late final _wire__crate__api__types__bdk_transaction_new = - _wire__crate__api__types__bdk_transaction_newPtr.asFunction< - void Function( - int, - int, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_transaction_output( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_transaction_output( ffi.Pointer that, ) { return _wire__crate__api__types__bdk_transaction_output( - port_, that, ); } late final _wire__crate__api__types__bdk_transaction_outputPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_output'); late final _wire__crate__api__types__bdk_transaction_output = _wire__crate__api__types__bdk_transaction_outputPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_transaction_serialize( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_transaction_serialize( ffi.Pointer that, ) { return _wire__crate__api__types__bdk_transaction_serialize( - port_, that, ); } late final _wire__crate__api__types__bdk_transaction_serializePtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_serialize'); late final _wire__crate__api__types__bdk_transaction_serialize = _wire__crate__api__types__bdk_transaction_serializePtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_transaction_size( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_transaction_size( ffi.Pointer that, ) { return _wire__crate__api__types__bdk_transaction_size( - port_, that, ); } late final _wire__crate__api__types__bdk_transaction_sizePtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_size'); late final _wire__crate__api__types__bdk_transaction_size = _wire__crate__api__types__bdk_transaction_sizePtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_transaction_txid( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_transaction_txid( ffi.Pointer that, ) { return _wire__crate__api__types__bdk_transaction_txid( - port_, that, ); } late final _wire__crate__api__types__bdk_transaction_txidPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_txid'); late final _wire__crate__api__types__bdk_transaction_txid = _wire__crate__api__types__bdk_transaction_txidPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_transaction_version( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_transaction_version( ffi.Pointer that, ) { return _wire__crate__api__types__bdk_transaction_version( - port_, that, ); } late final _wire__crate__api__types__bdk_transaction_versionPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_version'); late final _wire__crate__api__types__bdk_transaction_version = _wire__crate__api__types__bdk_transaction_versionPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_transaction_vsize( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_transaction_vsize( ffi.Pointer that, ) { return _wire__crate__api__types__bdk_transaction_vsize( - port_, that, ); } late final _wire__crate__api__types__bdk_transaction_vsizePtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_vsize'); late final _wire__crate__api__types__bdk_transaction_vsize = _wire__crate__api__types__bdk_transaction_vsizePtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); - void wire__crate__api__types__bdk_transaction_weight( - int port_, + WireSyncRust2DartDco wire__crate__api__types__bdk_transaction_weight( ffi.Pointer that, ) { return _wire__crate__api__types__bdk_transaction_weight( - port_, that, ); } late final _wire__crate__api__types__bdk_transaction_weightPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_weight'); late final _wire__crate__api__types__bdk_transaction_weight = _wire__crate__api__types__bdk_transaction_weightPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); + + void wire__crate__api__wallet__bdk_wallet_create( + int port_, + ffi.Pointer descriptor, + ffi.Pointer change_descriptor, + int network, + ffi.Pointer database_config, + ) { + return _wire__crate__api__wallet__bdk_wallet_create( + port_, + descriptor, + change_descriptor, + network, + database_config, + ); + } + + late final _wire__crate__api__wallet__bdk_wallet_createPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + ffi.Pointer)>>( + 'frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_create'); + late final _wire__crate__api__wallet__bdk_wallet_create = + _wire__crate__api__wallet__bdk_wallet_createPtr.asFunction< + void Function( + int, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); WireSyncRust2DartDco wire__crate__api__wallet__bdk_wallet_get_address( ffi.Pointer ptr, @@ -5466,15 +5442,13 @@ class coreWire implements BaseWire { WireSyncRust2DartDco Function(ffi.Pointer, ffi.Pointer)>(); - void wire__crate__api__wallet__bdk_wallet_get_psbt_input( - int port_, + WireSyncRust2DartDco wire__crate__api__wallet__bdk_wallet_get_psbt_input( ffi.Pointer that, ffi.Pointer utxo, bool only_witness_utxo, ffi.Pointer sighash_type, ) { return _wire__crate__api__wallet__bdk_wallet_get_psbt_input( - port_, that, utxo, only_witness_utxo, @@ -5484,8 +5458,7 @@ class coreWire implements BaseWire { late final _wire__crate__api__wallet__bdk_wallet_get_psbt_inputPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer, ffi.Bool, @@ -5493,8 +5466,7 @@ class coreWire implements BaseWire { 'frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_psbt_input'); late final _wire__crate__api__wallet__bdk_wallet_get_psbt_input = _wire__crate__api__wallet__bdk_wallet_get_psbt_inputPtr.asFunction< - void Function( - int, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer, bool, @@ -5572,40 +5544,6 @@ class coreWire implements BaseWire { _wire__crate__api__wallet__bdk_wallet_networkPtr.asFunction< WireSyncRust2DartDco Function(ffi.Pointer)>(); - void wire__crate__api__wallet__bdk_wallet_new( - int port_, - ffi.Pointer descriptor, - ffi.Pointer change_descriptor, - int network, - ffi.Pointer database_config, - ) { - return _wire__crate__api__wallet__bdk_wallet_new( - port_, - descriptor, - change_descriptor, - network, - database_config, - ); - } - - late final _wire__crate__api__wallet__bdk_wallet_newPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Pointer, - ffi.Int32, - ffi.Pointer)>>( - 'frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_new'); - late final _wire__crate__api__wallet__bdk_wallet_new = - _wire__crate__api__wallet__bdk_wallet_newPtr.asFunction< - void Function( - int, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(); - WireSyncRust2DartDco wire__crate__api__wallet__bdk_wallet_policies( ffi.Pointer ptr, int keychain, @@ -5626,14 +5564,12 @@ class coreWire implements BaseWire { WireSyncRust2DartDco Function( ffi.Pointer, int)>(); - void wire__crate__api__wallet__bdk_wallet_sign( - int port_, + WireSyncRust2DartDco wire__crate__api__wallet__bdk_wallet_sign( ffi.Pointer ptr, ffi.Pointer psbt, ffi.Pointer sign_options, ) { return _wire__crate__api__wallet__bdk_wallet_sign( - port_, ptr, psbt, sign_options, @@ -5642,16 +5578,14 @@ class coreWire implements BaseWire { late final _wire__crate__api__wallet__bdk_wallet_signPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer, ffi.Pointer)>>( 'frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_sign'); late final _wire__crate__api__wallet__bdk_wallet_sign = _wire__crate__api__wallet__bdk_wallet_signPtr.asFunction< - void Function( - int, + WireSyncRust2DartDco Function( ffi.Pointer, ffi.Pointer, ffi.Pointer)>(); @@ -6630,6 +6564,54 @@ class coreWire implements BaseWire { late final _cst_new_list_bdk_policy = _cst_new_list_bdk_policyPtr .asFunction Function(int)>(); + ffi.Pointer + cst_new_list_bdk_transaction_details( + int len, + ) { + return _cst_new_list_bdk_transaction_details( + len, + ); + } + + late final _cst_new_list_bdk_transaction_detailsPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int32)>>( + 'frbgen_bdk_flutter_cst_new_list_bdk_transaction_details'); + late final _cst_new_list_bdk_transaction_details = + _cst_new_list_bdk_transaction_detailsPtr.asFunction< + ffi.Pointer Function(int)>(); + + ffi.Pointer cst_new_list_bdk_tx_in( + int len, + ) { + return _cst_new_list_bdk_tx_in( + len, + ); + } + + late final _cst_new_list_bdk_tx_inPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int32)>>('frbgen_bdk_flutter_cst_new_list_bdk_tx_in'); + late final _cst_new_list_bdk_tx_in = _cst_new_list_bdk_tx_inPtr + .asFunction Function(int)>(); + + ffi.Pointer cst_new_list_bdk_tx_out( + int len, + ) { + return _cst_new_list_bdk_tx_out( + len, + ); + } + + late final _cst_new_list_bdk_tx_outPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int32)>>('frbgen_bdk_flutter_cst_new_list_bdk_tx_out'); + late final _cst_new_list_bdk_tx_out = _cst_new_list_bdk_tx_outPtr + .asFunction Function(int)>(); + ffi.Pointer cst_new_list_condition( int len, ) { @@ -6841,54 +6823,6 @@ class coreWire implements BaseWire { late final _cst_new_list_script_amount = _cst_new_list_script_amountPtr .asFunction Function(int)>(); - ffi.Pointer - cst_new_list_transaction_details( - int len, - ) { - return _cst_new_list_transaction_details( - len, - ); - } - - late final _cst_new_list_transaction_detailsPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Int32)>>( - 'frbgen_bdk_flutter_cst_new_list_transaction_details'); - late final _cst_new_list_transaction_details = - _cst_new_list_transaction_detailsPtr.asFunction< - ffi.Pointer Function(int)>(); - - ffi.Pointer cst_new_list_tx_in( - int len, - ) { - return _cst_new_list_tx_in( - len, - ); - } - - late final _cst_new_list_tx_inPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Int32)>>('frbgen_bdk_flutter_cst_new_list_tx_in'); - late final _cst_new_list_tx_in = _cst_new_list_tx_inPtr - .asFunction Function(int)>(); - - ffi.Pointer cst_new_list_tx_out( - int len, - ) { - return _cst_new_list_tx_out( - len, - ); - } - - late final _cst_new_list_tx_outPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Int32)>>('frbgen_bdk_flutter_cst_new_list_tx_out'); - late final _cst_new_list_tx_out = _cst_new_list_tx_outPtr - .asFunction Function(int)>(); - int dummy_method_to_enforce_bundling() { return _dummy_method_to_enforce_bundling(); } @@ -7123,10 +7057,10 @@ final class wire_cst_list_list_prim_u_8_strict extends ffi.Struct { external int len; } -final class wire_cst_tx_in extends ffi.Struct { +final class wire_cst_bdk_tx_in extends ffi.Struct { external wire_cst_out_point previous_output; - external wire_cst_bdk_script_buf script_sig; + external ffi.Pointer script_sig; @ffi.Uint32() external int sequence; @@ -7134,27 +7068,58 @@ final class wire_cst_tx_in extends ffi.Struct { external ffi.Pointer witness; } -final class wire_cst_list_tx_in extends ffi.Struct { - external ffi.Pointer ptr; +final class wire_cst_list_bdk_tx_in extends ffi.Struct { + external ffi.Pointer ptr; @ffi.Int32() external int len; } -final class wire_cst_tx_out extends ffi.Struct { +final class wire_cst_bdk_tx_out extends ffi.Struct { @ffi.Uint64() external int value; external wire_cst_bdk_script_buf script_pubkey; } -final class wire_cst_list_tx_out extends ffi.Struct { - external ffi.Pointer ptr; +final class wire_cst_list_bdk_tx_out extends ffi.Struct { + external ffi.Pointer ptr; @ffi.Int32() external int len; } +final class wire_cst_sqlite_db_configuration extends ffi.Struct { + external ffi.Pointer path; +} + +final class wire_cst_DatabaseConfig_Sqlite extends ffi.Struct { + external ffi.Pointer config; +} + +final class wire_cst_sled_db_configuration extends ffi.Struct { + external ffi.Pointer path; + + external ffi.Pointer tree_name; +} + +final class wire_cst_DatabaseConfig_Sled extends ffi.Struct { + external ffi.Pointer config; +} + +final class DatabaseConfigKind extends ffi.Union { + external wire_cst_DatabaseConfig_Sqlite Sqlite; + + external wire_cst_DatabaseConfig_Sled Sled; +} + +final class wire_cst_database_config extends ffi.Struct { + @ffi.Int32() + external int tag; + + external DatabaseConfigKind kind; +} + final class wire_cst_bdk_wallet extends ffi.Struct { @ffi.UintPtr() external int ptr; @@ -7186,7 +7151,7 @@ final class wire_cst_address_index extends ffi.Struct { final class wire_cst_local_utxo extends ffi.Struct { external wire_cst_out_point outpoint; - external wire_cst_tx_out txout; + external wire_cst_bdk_tx_out txout; @ffi.Int32() external int keychain; @@ -7200,37 +7165,6 @@ final class wire_cst_psbt_sig_hash_type extends ffi.Struct { external int inner; } -final class wire_cst_sqlite_db_configuration extends ffi.Struct { - external ffi.Pointer path; -} - -final class wire_cst_DatabaseConfig_Sqlite extends ffi.Struct { - external ffi.Pointer config; -} - -final class wire_cst_sled_db_configuration extends ffi.Struct { - external ffi.Pointer path; - - external ffi.Pointer tree_name; -} - -final class wire_cst_DatabaseConfig_Sled extends ffi.Struct { - external ffi.Pointer config; -} - -final class DatabaseConfigKind extends ffi.Union { - external wire_cst_DatabaseConfig_Sqlite Sqlite; - - external wire_cst_DatabaseConfig_Sled Sled; -} - -final class wire_cst_database_config extends ffi.Struct { - @ffi.Int32() - external int tag; - - external DatabaseConfigKind kind; -} - final class wire_cst_sign_options extends ffi.Struct { @ffi.Bool() external bool trust_witness_utxo; @@ -7599,6 +7533,29 @@ final class wire_cst_list_bdk_policy extends ffi.Struct { external int len; } +final class wire_cst_bdk_transaction_details extends ffi.Struct { + external ffi.Pointer transaction; + + external ffi.Pointer txid; + + @ffi.Uint64() + external int received; + + @ffi.Uint64() + external int sent; + + external ffi.Pointer fee; + + external ffi.Pointer confirmation_time; +} + +final class wire_cst_list_bdk_transaction_details extends ffi.Struct { + external ffi.Pointer ptr; + + @ffi.Int32() + external int len; +} + final class wire_cst_list_condition extends ffi.Struct { external ffi.Pointer ptr; @@ -7657,29 +7614,6 @@ final class wire_cst_list_record_u_32_list_condition extends ffi.Struct { external int len; } -final class wire_cst_transaction_details extends ffi.Struct { - external ffi.Pointer transaction; - - external ffi.Pointer txid; - - @ffi.Uint64() - external int received; - - @ffi.Uint64() - external int sent; - - external ffi.Pointer fee; - - external ffi.Pointer confirmation_time; -} - -final class wire_cst_list_transaction_details extends ffi.Struct { - external ffi.Pointer ptr; - - @ffi.Int32() - external int len; -} - final class wire_cst_balance extends ffi.Struct { @ffi.Uint64() external int immature; @@ -7978,10 +7912,11 @@ final class wire_cst_record_bdk_address_u_32 extends ffi.Struct { external int field1; } -final class wire_cst_record_bdk_psbt_transaction_details extends ffi.Struct { +final class wire_cst_record_bdk_psbt_bdk_transaction_details + extends ffi.Struct { external wire_cst_bdk_psbt field0; - external wire_cst_transaction_details field1; + external wire_cst_bdk_transaction_details field1; } final class wire_cst_Satisfaction_Partial extends ffi.Struct { diff --git a/lib/src/root.dart b/lib/src/root.dart index fe73e4f..9770691 100644 --- a/lib/src/root.dart +++ b/lib/src/root.dart @@ -18,9 +18,9 @@ class Address extends types.BdkAddress { {required ScriptBuf script, required types.Network network}) async { try { await Api.initialize(); - final res = - await types.BdkAddress.fromScript(script: script, network: network); - return Address._(ptr: res.ptr); + return Address._( + ptr: types.BdkAddress.fromScript(script: script, network: network) + .ptr); } on BdkError catch (e) { throw mapBdkError(e); } @@ -31,9 +31,8 @@ class Address extends types.BdkAddress { {required String s, required types.Network network}) async { try { await Api.initialize(); - final res = - await types.BdkAddress.fromString(address: s, network: network); - return Address._(ptr: res.ptr); + return Address._( + ptr: types.BdkAddress.fromString(address: s, network: network).ptr); } on BdkError catch (e) { throw mapBdkError(e); } @@ -148,7 +147,7 @@ class Blockchain extends BdkBlockchain { @override Future estimateFee({required BigInt target, hint}) async { try { - return super.estimateFee(target: target); + return await super.estimateFee(target: target); } on BdkError catch (e) { throw mapBdkError(e); } @@ -157,7 +156,7 @@ class Blockchain extends BdkBlockchain { ///The function for broadcasting a transaction Future broadcast({required Transaction transaction, hint}) async { try { - return BdkBlockchain.broadcast(ptr: this, transaction: transaction); + return await BdkBlockchain.broadcast(ptr: this, transaction: transaction); } on BdkError catch (e) { throw mapBdkError(e); } @@ -167,7 +166,7 @@ class Blockchain extends BdkBlockchain { @override Future getBlockHash({required int height, hint}) async { try { - return super.getBlockHash(height: height); + return await super.getBlockHash(height: height); } on BdkError catch (e) { throw mapBdkError(e); } @@ -175,9 +174,9 @@ class Blockchain extends BdkBlockchain { ///The function for getting the current height of the blockchain. @override - Future getHeight({hint}) { + Future getHeight({hint}) async { try { - return super.getHeight(); + return await super.getHeight(); } on BdkError catch (e) { throw mapBdkError(e); } @@ -236,10 +235,8 @@ class BumpFeeTxBuilder { allowShrinking: _allowShrinking); return ( PartiallySignedTransaction._(ptr: res.$1.ptr), - TransactionDetails( - transaction: (res.$2.transaction?.s == null) - ? null - : Transaction._(s: res.$2.transaction!.s), + TransactionDetails._( + transaction: res.$2.transaction, txid: res.$2.txid, received: res.$2.received, sent: res.$2.sent, @@ -259,8 +256,8 @@ class DerivationPath extends BdkDerivationPath { static Future create({required String path}) async { try { await Api.initialize(); - final res = await BdkDerivationPath.fromString(path: path); - return DerivationPath._(ptr: res.ptr); + return DerivationPath._( + ptr: BdkDerivationPath.fromString(path: path).ptr); } on BdkError catch (e) { throw mapBdkError(e); } @@ -281,8 +278,8 @@ class Descriptor extends BdkDescriptor { {required String descriptor, required types.Network network}) async { try { await Api.initialize(); - final res = await BdkDescriptor.newInstance( - descriptor: descriptor, network: network); + final res = + BdkDescriptor.create(descriptor: descriptor, network: network); return Descriptor._( extendedDescriptor: res.extendedDescriptor, keyMap: res.keyMap); } on BdkError catch (e) { @@ -299,7 +296,7 @@ class Descriptor extends BdkDescriptor { required types.KeychainKind keychain}) async { try { await Api.initialize(); - final res = await BdkDescriptor.newBip44( + final res = BdkDescriptor.newBip44( secretKey: secretKey, network: network, keychainKind: keychain); return Descriptor._( extendedDescriptor: res.extendedDescriptor, keyMap: res.keyMap); @@ -320,7 +317,7 @@ class Descriptor extends BdkDescriptor { required types.KeychainKind keychain}) async { try { await Api.initialize(); - final res = await BdkDescriptor.newBip44Public( + final res = BdkDescriptor.newBip44Public( network: network, keychainKind: keychain, publicKey: publicKey, @@ -341,7 +338,7 @@ class Descriptor extends BdkDescriptor { required types.KeychainKind keychain}) async { try { await Api.initialize(); - final res = await BdkDescriptor.newBip49( + final res = BdkDescriptor.newBip49( secretKey: secretKey, network: network, keychainKind: keychain); return Descriptor._( extendedDescriptor: res.extendedDescriptor, keyMap: res.keyMap); @@ -362,7 +359,7 @@ class Descriptor extends BdkDescriptor { required types.KeychainKind keychain}) async { try { await Api.initialize(); - final res = await BdkDescriptor.newBip49Public( + final res = BdkDescriptor.newBip49Public( network: network, keychainKind: keychain, publicKey: publicKey, @@ -383,7 +380,7 @@ class Descriptor extends BdkDescriptor { required types.KeychainKind keychain}) async { try { await Api.initialize(); - final res = await BdkDescriptor.newBip84( + final res = BdkDescriptor.newBip84( secretKey: secretKey, network: network, keychainKind: keychain); return Descriptor._( extendedDescriptor: res.extendedDescriptor, keyMap: res.keyMap); @@ -404,7 +401,7 @@ class Descriptor extends BdkDescriptor { required types.KeychainKind keychain}) async { try { await Api.initialize(); - final res = await BdkDescriptor.newBip84Public( + final res = BdkDescriptor.newBip84Public( network: network, keychainKind: keychain, publicKey: publicKey, @@ -425,7 +422,7 @@ class Descriptor extends BdkDescriptor { required types.KeychainKind keychain}) async { try { await Api.initialize(); - final res = await BdkDescriptor.newBip86( + final res = BdkDescriptor.newBip86( secretKey: secretKey, network: network, keychainKind: keychain); return Descriptor._( extendedDescriptor: res.extendedDescriptor, keyMap: res.keyMap); @@ -446,7 +443,7 @@ class Descriptor extends BdkDescriptor { required types.KeychainKind keychain}) async { try { await Api.initialize(); - final res = await BdkDescriptor.newBip86Public( + final res = BdkDescriptor.newBip86Public( network: network, keychainKind: keychain, publicKey: publicKey, @@ -493,7 +490,7 @@ class DescriptorPublicKey extends BdkDescriptorPublicKey { static Future fromString(String publicKey) async { try { await Api.initialize(); - final res = await BdkDescriptorPublicKey.fromString(publicKey: publicKey); + final res = BdkDescriptorPublicKey.fromString(publicKey: publicKey); return DescriptorPublicKey._(ptr: res.ptr); } on BdkError catch (e) { throw mapBdkError(e); @@ -507,10 +504,9 @@ class DescriptorPublicKey extends BdkDescriptorPublicKey { } ///Derive a public descriptor at a given path. - Future derive( - {required DerivationPath path, hint}) async { + DescriptorPublicKey derive({required DerivationPath path, hint}) { try { - final res = await BdkDescriptorPublicKey.derive(ptr: this, path: path); + final res = BdkDescriptorPublicKey.derive(ptr: this, path: path); return DescriptorPublicKey._(ptr: res.ptr); } on BdkError catch (e) { throw mapBdkError(e); @@ -518,10 +514,9 @@ class DescriptorPublicKey extends BdkDescriptorPublicKey { } ///Extend the public descriptor with a custom path. - Future extend( - {required DerivationPath path, hint}) async { + DescriptorPublicKey extend({required DerivationPath path, hint}) { try { - final res = await BdkDescriptorPublicKey.extend(ptr: this, path: path); + final res = BdkDescriptorPublicKey.extend(ptr: this, path: path); return DescriptorPublicKey._(ptr: res.ptr); } on BdkError catch (e) { throw mapBdkError(e); @@ -551,7 +546,7 @@ class DescriptorSecretKey extends BdkDescriptorSecretKey { String? password}) async { try { await Api.initialize(); - final res = await BdkDescriptorSecretKey.create( + final res = BdkDescriptorSecretKey.create( network: network, mnemonic: mnemonic, password: password); return DescriptorSecretKey._(ptr: res.ptr); } on BdkError catch (e) { @@ -560,9 +555,9 @@ class DescriptorSecretKey extends BdkDescriptorSecretKey { } ///Derived the XPrv using the derivation path - Future derive(DerivationPath path) async { + DescriptorSecretKey derive(DerivationPath path) { try { - final res = await BdkDescriptorSecretKey.derive(ptr: this, path: path); + final res = BdkDescriptorSecretKey.derive(ptr: this, path: path); return DescriptorSecretKey._(ptr: res.ptr); } on BdkError catch (e) { throw mapBdkError(e); @@ -570,9 +565,9 @@ class DescriptorSecretKey extends BdkDescriptorSecretKey { } ///Extends the XPrv using the derivation path - Future extend(DerivationPath path) async { + DescriptorSecretKey extend(DerivationPath path) { try { - final res = await BdkDescriptorSecretKey.extend(ptr: this, path: path); + final res = BdkDescriptorSecretKey.extend(ptr: this, path: path); return DescriptorSecretKey._(ptr: res.ptr); } on BdkError catch (e) { throw mapBdkError(e); @@ -616,7 +611,7 @@ class Mnemonic extends BdkMnemonic { static Future create(types.WordCount wordCount) async { try { await Api.initialize(); - final res = await BdkMnemonic.newInstance(wordCount: wordCount); + final res = BdkMnemonic.create(wordCount: wordCount); return Mnemonic._(ptr: res.ptr); } on BdkError catch (e) { throw mapBdkError(e); @@ -630,7 +625,7 @@ class Mnemonic extends BdkMnemonic { static Future fromEntropy(List entropy) async { try { await Api.initialize(); - final res = await BdkMnemonic.fromEntropy(entropy: entropy); + final res = BdkMnemonic.fromEntropy(entropy: entropy); return Mnemonic._(ptr: res.ptr); } on BdkError catch (e) { throw mapBdkError(e); @@ -643,7 +638,7 @@ class Mnemonic extends BdkMnemonic { static Future fromString(String mnemonic) async { try { await Api.initialize(); - final res = await BdkMnemonic.fromString(mnemonic: mnemonic); + final res = BdkMnemonic.fromString(mnemonic: mnemonic); return Mnemonic._(ptr: res.ptr); } on BdkError catch (e) { throw mapBdkError(e); @@ -668,7 +663,7 @@ class PartiallySignedTransaction extends BdkPsbt { String psbtBase64) async { try { await Api.initialize(); - final res = await BdkPsbt.fromStr(psbtBase64: psbtBase64); + final res = BdkPsbt.fromStr(psbtBase64: psbtBase64); return PartiallySignedTransaction._(ptr: res.ptr); } on BdkError catch (e) { throw mapBdkError(e); @@ -730,10 +725,9 @@ class PartiallySignedTransaction extends BdkPsbt { } ///Combines this [PartiallySignedTransaction] with other PSBT as described by BIP 174. - Future combine( - PartiallySignedTransaction other) async { + PartiallySignedTransaction combine(PartiallySignedTransaction other) { try { - final res = await BdkPsbt.combine(ptr: this, other: other); + final res = BdkPsbt.combine(ptr: this, other: other); return PartiallySignedTransaction._(ptr: res.ptr); } on BdkError catch (e) { throw mapBdkError(e); @@ -833,8 +827,8 @@ class ScriptBuf extends types.BdkScriptBuf { static Future withCapacity(BigInt capacity) async { try { await Api.initialize(); - final res = await types.BdkScriptBuf.withCapacity(capacity: capacity); - return ScriptBuf(bytes: res.bytes); + return ScriptBuf( + bytes: types.BdkScriptBuf.withCapacity(capacity: capacity).bytes); } on BdkError catch (e) { throw mapBdkError(e); } @@ -844,8 +838,7 @@ class ScriptBuf extends types.BdkScriptBuf { static Future fromHex(String s) async { try { await Api.initialize(); - final res = await types.BdkScriptBuf.fromHex(s: s); - return ScriptBuf(bytes: res.bytes); + return ScriptBuf(bytes: types.BdkScriptBuf.fromHex(s: s).bytes); } on BdkError catch (e) { throw mapBdkError(e); } @@ -869,8 +862,8 @@ class Transaction extends types.BdkTransaction { }) async { try { await Api.initialize(); - final res = await types.BdkTransaction.fromBytes( - transactionBytes: transactionBytes); + final res = + types.BdkTransaction.fromBytes(transactionBytes: transactionBytes); return Transaction._(s: res.s); } on BdkError catch (e) { throw mapBdkError(e); @@ -881,6 +874,36 @@ class Transaction extends types.BdkTransaction { String toString() { return s; } + + ///List of transaction inputs. + @override + List input({hint}) { + try { + final res = super.input(); + return res + .map((e) => TxIn._( + previousOutput: e.previousOutput, + scriptSig: e.scriptSig, + sequence: e.sequence, + witness: e.witness)) + .toList(); + } on BdkError catch (e) { + throw mapBdkError(e); + } + } + + ///List of transaction outputs. + @override + List output({hint}) { + try { + return super + .output() + .map((e) => TxOut._(scriptPubkey: e.scriptPubkey, value: e.value)) + .toList(); + } on BdkError catch (e) { + throw mapBdkError(e); + } + } } ///A transaction builder @@ -1101,10 +1124,8 @@ class TxBuilder { return ( PartiallySignedTransaction._(ptr: res.$1.ptr), - TransactionDetails( - transaction: (res.$2.transaction?.s == null) - ? null - : Transaction._(s: res.$2.transaction!.s), + TransactionDetails._( + transaction: res.$2.transaction, txid: res.$2.txid, received: res.$2.received, sent: res.$2.sent, @@ -1136,7 +1157,7 @@ class Wallet extends BdkWallet { }) async { try { await Api.initialize(); - final res = await BdkWallet.newInstance( + final res = await BdkWallet.create( descriptor: descriptor, changeDescriptor: changeDescriptor, network: network, @@ -1205,11 +1226,11 @@ class Wallet extends BdkWallet { ///get the corresponding PSBT Input for a LocalUtxo @override - Future getPsbtInput( + types.Input getPsbtInput( {required types.LocalUtxo utxo, required bool onlyWitnessUtxo, types.PsbtSigHashType? sighashType, - hint}) async { + hint}) { try { return super.getPsbtInput( utxo: utxo, @@ -1235,10 +1256,8 @@ class Wallet extends BdkWallet { try { return super .listTransactions(includeRaw: includeRaw) - .map((e) => TransactionDetails( - transaction: (e.transaction?.s == null) - ? null - : Transaction._(s: e.transaction!.s), + .map((e) => TransactionDetails._( + transaction: e.transaction, txid: e.txid, received: e.received, sent: e.sent, @@ -1251,11 +1270,20 @@ class Wallet extends BdkWallet { /// 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. - /// TODO; Update; create custom LocalUtxo + /// @override - List listUnspent({hint}) { + List listUnspent({hint}) { try { - return super.listUnspent(); + return super + .listUnspent() + .map((e) => LocalUtxo( + outpoint: e.outpoint, + txout: TxOut( + value: e.txout.value, + scriptPubkey: ScriptBuf(bytes: e.txout.scriptPubkey.bytes)), + keychain: e.keychain, + isSpent: e.isSpent)) + .toList(); } on BdkError catch (e) { throw mapBdkError(e); } @@ -1278,13 +1306,13 @@ class Wallet extends BdkWallet { /// 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. - Future sign( + bool sign( {required PartiallySignedTransaction psbt, types.SignOptions? signOptions, - hint}) async { + hint}) { try { final res = - await BdkWallet.sign(ptr: this, psbt: psbt, signOptions: signOptions); + BdkWallet.sign(ptr: this, psbt: psbt, signOptions: signOptions); return res; } on BdkError catch (e) { throw mapBdkError(e); @@ -1295,8 +1323,7 @@ class Wallet extends BdkWallet { Future sync({required Blockchain blockchain, hint}) async { try { - final res = await BdkWallet.sync(ptr: this, blockchain: blockchain); - return res; + return await BdkWallet.sync(ptr: this, blockchain: blockchain); } on BdkError catch (e) { throw mapBdkError(e); } @@ -1342,22 +1369,34 @@ class AddressInfo { AddressInfo(this.index, this.address); } -class TxIn extends types.TxIn { +class TxIn extends types.BdkTxIn { TxIn( {required super.previousOutput, - required ScriptBuf scriptSig, + ScriptBuf? scriptSig, required super.sequence, required super.witness}) : super(scriptSig: scriptSig); + TxIn._( + {required super.previousOutput, + required super.scriptSig, + required super.sequence, + required super.witness}); + @override + ScriptBuf? get scriptSig => + super.scriptSig != null ? ScriptBuf(bytes: super.scriptSig!.bytes) : null; } ///A transaction output, which defines new coins to be created from old ones. -class TxOut extends types.TxOut { +class TxOut extends types.BdkTxOut { TxOut({required super.value, required ScriptBuf scriptPubkey}) : super(scriptPubkey: scriptPubkey); + + TxOut._({required super.value, required super.scriptPubkey}); + @override + ScriptBuf get scriptPubkey => ScriptBuf(bytes: super.scriptPubkey.bytes); } -class TransactionDetails extends types.TransactionDetails { +class TransactionDetails extends types.BdkTransactionDetails { TransactionDetails( {Transaction? transaction, required super.txid, @@ -1366,4 +1405,27 @@ class TransactionDetails extends types.TransactionDetails { super.confirmationTime, super.fee}) : super(transaction: transaction); + + TransactionDetails._( + {super.transaction, + required super.txid, + required super.received, + required super.sent, + super.confirmationTime, + super.fee}); + @override + Transaction? get transaction => + super.transaction != null ? Transaction._(s: super.transaction!.s) : null; +} + +class LocalUtxo extends types.LocalUtxo { + LocalUtxo( + {required super.outpoint, + required TxOut txout, + required super.keychain, + required super.isSpent}) + : super(txout: txout); + @override + TxOut get txout => + TxOut._(value: super.txout.value, scriptPubkey: super.txout.scriptPubkey); } diff --git a/macos/Classes/frb_generated.h b/macos/Classes/frb_generated.h index 2430b24..cc868c1 100644 --- a/macos/Classes/frb_generated.h +++ b/macos/Classes/frb_generated.h @@ -171,27 +171,54 @@ typedef struct wire_cst_list_list_prim_u_8_strict { int32_t len; } wire_cst_list_list_prim_u_8_strict; -typedef struct wire_cst_tx_in { +typedef struct wire_cst_bdk_tx_in { struct wire_cst_out_point previous_output; - struct wire_cst_bdk_script_buf script_sig; + struct wire_cst_bdk_script_buf *script_sig; uint32_t sequence; struct wire_cst_list_list_prim_u_8_strict *witness; -} wire_cst_tx_in; +} wire_cst_bdk_tx_in; -typedef struct wire_cst_list_tx_in { - struct wire_cst_tx_in *ptr; +typedef struct wire_cst_list_bdk_tx_in { + struct wire_cst_bdk_tx_in *ptr; int32_t len; -} wire_cst_list_tx_in; +} wire_cst_list_bdk_tx_in; -typedef struct wire_cst_tx_out { +typedef struct wire_cst_bdk_tx_out { uint64_t value; struct wire_cst_bdk_script_buf script_pubkey; -} wire_cst_tx_out; +} wire_cst_bdk_tx_out; -typedef struct wire_cst_list_tx_out { - struct wire_cst_tx_out *ptr; +typedef struct wire_cst_list_bdk_tx_out { + struct wire_cst_bdk_tx_out *ptr; int32_t len; -} wire_cst_list_tx_out; +} wire_cst_list_bdk_tx_out; + +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_bdk_wallet { uintptr_t ptr; @@ -217,7 +244,7 @@ typedef struct wire_cst_address_index { typedef struct wire_cst_local_utxo { struct wire_cst_out_point outpoint; - struct wire_cst_tx_out txout; + struct wire_cst_bdk_tx_out txout; int32_t keychain; bool is_spent; } wire_cst_local_utxo; @@ -226,33 +253,6 @@ 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 trust_witness_utxo; uint32_t *assume_height; @@ -521,6 +521,20 @@ typedef struct wire_cst_list_bdk_policy { int32_t len; } wire_cst_list_bdk_policy; +typedef struct wire_cst_bdk_transaction_details { + struct wire_cst_bdk_transaction *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_bdk_transaction_details; + +typedef struct wire_cst_list_bdk_transaction_details { + struct wire_cst_bdk_transaction_details *ptr; + int32_t len; +} wire_cst_list_bdk_transaction_details; + typedef struct wire_cst_list_condition { struct wire_cst_condition *ptr; int32_t len; @@ -561,20 +575,6 @@ typedef struct wire_cst_list_record_u_32_list_condition { int32_t len; } wire_cst_list_record_u_32_list_condition; -typedef struct wire_cst_transaction_details { - struct wire_cst_bdk_transaction *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_balance { uint64_t immature; uint64_t trusted_pending; @@ -804,10 +804,10 @@ typedef struct wire_cst_record_bdk_address_u_32 { uint32_t field1; } wire_cst_record_bdk_address_u_32; -typedef struct wire_cst_record_bdk_psbt_transaction_details { +typedef struct wire_cst_record_bdk_psbt_bdk_transaction_details { struct wire_cst_bdk_psbt field0; - struct wire_cst_transaction_details field1; -} wire_cst_record_bdk_psbt_transaction_details; + struct wire_cst_bdk_transaction_details field1; +} wire_cst_record_bdk_psbt_bdk_transaction_details; typedef struct wire_cst_Satisfaction_Partial { uint64_t n; @@ -925,92 +925,76 @@ void frbgen_bdk_flutter_wire__crate__api__blockchain__bdk_blockchain_get_height( WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_as_string(struct wire_cst_bdk_descriptor *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_create(struct wire_cst_list_prim_u_8_strict *descriptor, + int32_t network); + WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_max_satisfaction_weight(struct wire_cst_bdk_descriptor *that); -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new(int64_t port_, - struct wire_cst_list_prim_u_8_strict *descriptor, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44(int64_t port_, - struct wire_cst_bdk_descriptor_secret_key *secret_key, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44_public(int64_t port_, - struct wire_cst_bdk_descriptor_public_key *public_key, - struct wire_cst_list_prim_u_8_strict *fingerprint, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49(int64_t port_, - struct wire_cst_bdk_descriptor_secret_key *secret_key, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49_public(int64_t port_, - struct wire_cst_bdk_descriptor_public_key *public_key, - struct wire_cst_list_prim_u_8_strict *fingerprint, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip84(int64_t port_, - struct wire_cst_bdk_descriptor_secret_key *secret_key, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip84_public(int64_t port_, - struct wire_cst_bdk_descriptor_public_key *public_key, - struct wire_cst_list_prim_u_8_strict *fingerprint, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip86(int64_t port_, - struct wire_cst_bdk_descriptor_secret_key *secret_key, - int32_t keychain_kind, - int32_t network); - -void frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip86_public(int64_t port_, - struct wire_cst_bdk_descriptor_public_key *public_key, - struct wire_cst_list_prim_u_8_strict *fingerprint, - int32_t keychain_kind, - int32_t network); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44(struct wire_cst_bdk_descriptor_secret_key *secret_key, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44_public(struct wire_cst_bdk_descriptor_public_key *public_key, + struct wire_cst_list_prim_u_8_strict *fingerprint, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49(struct wire_cst_bdk_descriptor_secret_key *secret_key, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49_public(struct wire_cst_bdk_descriptor_public_key *public_key, + struct wire_cst_list_prim_u_8_strict *fingerprint, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip84(struct wire_cst_bdk_descriptor_secret_key *secret_key, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip84_public(struct wire_cst_bdk_descriptor_public_key *public_key, + struct wire_cst_list_prim_u_8_strict *fingerprint, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip86(struct wire_cst_bdk_descriptor_secret_key *secret_key, + int32_t keychain_kind, + int32_t network); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip86_public(struct wire_cst_bdk_descriptor_public_key *public_key, + struct wire_cst_list_prim_u_8_strict *fingerprint, + int32_t keychain_kind, + int32_t network); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_to_string_private(struct wire_cst_bdk_descriptor *that); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_derivation_path_as_string(struct wire_cst_bdk_derivation_path *that); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_derivation_path_from_string(int64_t port_, - struct wire_cst_list_prim_u_8_strict *path); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_derivation_path_from_string(struct wire_cst_list_prim_u_8_strict *path); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_as_string(struct wire_cst_bdk_descriptor_public_key *that); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_derive(int64_t port_, - struct wire_cst_bdk_descriptor_public_key *ptr, - struct wire_cst_bdk_derivation_path *path); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_derive(struct wire_cst_bdk_descriptor_public_key *ptr, + struct wire_cst_bdk_derivation_path *path); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_extend(int64_t port_, - struct wire_cst_bdk_descriptor_public_key *ptr, - struct wire_cst_bdk_derivation_path *path); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_extend(struct wire_cst_bdk_descriptor_public_key *ptr, + struct wire_cst_bdk_derivation_path *path); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_from_string(int64_t port_, - struct wire_cst_list_prim_u_8_strict *public_key); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_from_string(struct wire_cst_list_prim_u_8_strict *public_key); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_as_public(struct wire_cst_bdk_descriptor_secret_key *ptr); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_as_string(struct wire_cst_bdk_descriptor_secret_key *that); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_create(int64_t port_, - int32_t network, - struct wire_cst_bdk_mnemonic *mnemonic, - struct wire_cst_list_prim_u_8_strict *password); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_create(int32_t network, + struct wire_cst_bdk_mnemonic *mnemonic, + struct wire_cst_list_prim_u_8_strict *password); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_derive(int64_t port_, - struct wire_cst_bdk_descriptor_secret_key *ptr, - struct wire_cst_bdk_derivation_path *path); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_derive(struct wire_cst_bdk_descriptor_secret_key *ptr, + struct wire_cst_bdk_derivation_path *path); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_extend(int64_t port_, - struct wire_cst_bdk_descriptor_secret_key *ptr, - struct wire_cst_bdk_derivation_path *path); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_extend(struct wire_cst_bdk_descriptor_secret_key *ptr, + struct wire_cst_bdk_derivation_path *path); void frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_from_string(int64_t port_, struct wire_cst_list_prim_u_8_strict *secret_key); @@ -1019,19 +1003,16 @@ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_se WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_as_string(struct wire_cst_bdk_mnemonic *that); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_entropy(int64_t port_, - struct wire_cst_list_prim_u_8_loose *entropy); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_create(int32_t word_count); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_string(int64_t port_, - struct wire_cst_list_prim_u_8_strict *mnemonic); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_entropy(struct wire_cst_list_prim_u_8_loose *entropy); -void frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_new(int64_t port_, int32_t word_count); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_string(struct wire_cst_list_prim_u_8_strict *mnemonic); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_as_string(struct wire_cst_bdk_psbt *that); -void frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_combine(int64_t port_, - struct wire_cst_bdk_psbt *ptr, - struct wire_cst_bdk_psbt *other); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_combine(struct wire_cst_bdk_psbt *ptr, + struct wire_cst_bdk_psbt *other); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_extract_tx(struct wire_cst_bdk_psbt *ptr); @@ -1039,8 +1020,7 @@ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_fee_amo WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_fee_rate(struct wire_cst_bdk_psbt *that); -void frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_from_str(int64_t port_, - struct wire_cst_list_prim_u_8_strict *psbt_base64); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_from_str(struct wire_cst_list_prim_u_8_strict *psbt_base64); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_json_serialize(struct wire_cst_bdk_psbt *that); @@ -1050,13 +1030,11 @@ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_txid(st WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_address_as_string(struct wire_cst_bdk_address *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_address_from_script(int64_t port_, - struct wire_cst_bdk_script_buf *script, - int32_t network); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_address_from_script(struct wire_cst_bdk_script_buf *script, + int32_t network); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_address_from_string(int64_t port_, - struct wire_cst_list_prim_u_8_strict *address, - int32_t network); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_address_from_string(struct wire_cst_list_prim_u_8_strict *address, + int32_t network); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_address_is_valid_for_network(struct wire_cst_bdk_address *that, int32_t network); @@ -1085,56 +1063,46 @@ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_empty(void); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_from_hex(int64_t port_, - struct wire_cst_list_prim_u_8_strict *s); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_from_hex(struct wire_cst_list_prim_u_8_strict *s); + +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_with_capacity(uintptr_t capacity); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_with_capacity(int64_t port_, - uintptr_t capacity); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_create(int32_t version, + struct wire_cst_lock_time *lock_time, + struct wire_cst_list_bdk_tx_in *input, + struct wire_cst_list_bdk_tx_out *output); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_from_bytes(int64_t port_, - struct wire_cst_list_prim_u_8_loose *transaction_bytes); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_from_bytes(struct wire_cst_list_prim_u_8_loose *transaction_bytes); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_input(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_input(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_coin_base(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_coin_base(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_explicitly_rbf(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_explicitly_rbf(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_lock_time_enabled(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_lock_time_enabled(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_lock_time(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_lock_time(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_new(int64_t port_, - int32_t version, - struct wire_cst_lock_time *lock_time, - struct wire_cst_list_tx_in *input, - struct wire_cst_list_tx_out *output); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_output(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_output(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_serialize(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_serialize(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_size(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_size(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_txid(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_txid(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_version(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_version(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_vsize(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_vsize(int64_t port_, - struct wire_cst_bdk_transaction *that); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_weight(struct wire_cst_bdk_transaction *that); -void frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_weight(int64_t port_, - struct wire_cst_bdk_transaction *that); +void frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_create(int64_t port_, + struct wire_cst_bdk_descriptor *descriptor, + struct wire_cst_bdk_descriptor *change_descriptor, + int32_t network, + struct wire_cst_database_config *database_config); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_address(struct wire_cst_bdk_wallet *ptr, struct wire_cst_address_index *address_index); @@ -1147,11 +1115,10 @@ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_internal_address(struct wire_cst_bdk_wallet *ptr, struct wire_cst_address_index *address_index); -void frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_psbt_input(int64_t port_, - struct wire_cst_bdk_wallet *that, - struct wire_cst_local_utxo *utxo, - bool only_witness_utxo, - struct wire_cst_psbt_sig_hash_type *sighash_type); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_psbt_input(struct wire_cst_bdk_wallet *that, + struct wire_cst_local_utxo *utxo, + bool only_witness_utxo, + struct wire_cst_psbt_sig_hash_type *sighash_type); WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_is_mine(struct wire_cst_bdk_wallet *ptr, struct wire_cst_bdk_script_buf *script); @@ -1163,19 +1130,12 @@ WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_lis WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_network(struct wire_cst_bdk_wallet *that); -void frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_new(int64_t port_, - struct wire_cst_bdk_descriptor *descriptor, - struct wire_cst_bdk_descriptor *change_descriptor, - int32_t network, - struct wire_cst_database_config *database_config); - WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_policies(struct wire_cst_bdk_wallet *ptr, int32_t keychain); -void frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_sign(int64_t port_, - struct wire_cst_bdk_wallet *ptr, - struct wire_cst_bdk_psbt *psbt, - struct wire_cst_sign_options *sign_options); +WireSyncRust2DartDco frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_sign(struct wire_cst_bdk_wallet *ptr, + struct wire_cst_bdk_psbt *psbt, + struct wire_cst_sign_options *sign_options); void frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_sync(int64_t port_, struct wire_cst_bdk_wallet *ptr, @@ -1334,6 +1294,12 @@ uint8_t *frbgen_bdk_flutter_cst_new_box_autoadd_u_8(uint8_t value); struct wire_cst_list_bdk_policy *frbgen_bdk_flutter_cst_new_list_bdk_policy(int32_t len); +struct wire_cst_list_bdk_transaction_details *frbgen_bdk_flutter_cst_new_list_bdk_transaction_details(int32_t len); + +struct wire_cst_list_bdk_tx_in *frbgen_bdk_flutter_cst_new_list_bdk_tx_in(int32_t len); + +struct wire_cst_list_bdk_tx_out *frbgen_bdk_flutter_cst_new_list_bdk_tx_out(int32_t len); + struct wire_cst_list_condition *frbgen_bdk_flutter_cst_new_list_condition(int32_t len); struct wire_cst_list_list_prim_u_8_strict *frbgen_bdk_flutter_cst_new_list_list_prim_u_8_strict(int32_t len); @@ -1359,12 +1325,6 @@ struct wire_cst_list_record_string_list_prim_u_32_strict *frbgen_bdk_flutter_cst struct wire_cst_list_record_u_32_list_condition *frbgen_bdk_flutter_cst_new_list_record_u_32_list_condition(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_error); @@ -1409,6 +1369,9 @@ static int64_t dummy_method_to_enforce_bundling(void) { 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_list_bdk_policy); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_bdk_transaction_details); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_bdk_tx_in); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_bdk_tx_out); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_condition); 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); @@ -1422,9 +1385,6 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_record_string_list_prim_u_32_strict); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_cst_new_list_record_u_32_list_condition); 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_bdkbitcoinAddress); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_bdkbitcoinbip32DerivationPath); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_rust_arc_decrement_strong_count_RustOpaque_bdkblockchainAnyBlockchain); @@ -1453,8 +1413,8 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__blockchain__bdk_blockchain_get_block_hash); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__blockchain__bdk_blockchain_get_height); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_as_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_create); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_max_satisfaction_weight); - dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44_public); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49); @@ -1478,9 +1438,9 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_from_string); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_secret_bytes); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_as_string); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_create); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_entropy); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_string); - dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_new); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_as_string); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_combine); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_extract_tx); @@ -1508,13 +1468,13 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_empty); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_from_hex); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_with_capacity); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_create); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_from_bytes); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_input); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_coin_base); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_explicitly_rbf); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_lock_time_enabled); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_lock_time); - dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_new); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_output); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_serialize); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_size); @@ -1522,6 +1482,7 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_version); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_vsize); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_weight); + dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_create); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_address); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_balance); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_descriptor_for_keychain); @@ -1531,7 +1492,6 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_list_transactions); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_list_unspent); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_network); - dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_new); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_policies); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_sign); dummy_var ^= ((int64_t) (void*) frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_sync); diff --git a/makefile b/makefile index a003e3c..41f561a 100644 --- a/makefile +++ b/makefile @@ -18,7 +18,7 @@ all: init generate-bindings generate-bindings: @echo "[GENERATING FRB CODE] $@" - flutter_rust_bridge_codegen generate + flutter_rust_bridge_codegen generate && flutter pub run build_runner build @echo "[Done ✅]" diff --git a/rust/src/api/descriptor.rs b/rust/src/api/descriptor.rs index e7f6f0d..cde406a 100644 --- a/rust/src/api/descriptor.rs +++ b/rust/src/api/descriptor.rs @@ -20,7 +20,8 @@ pub struct BdkDescriptor { } impl BdkDescriptor { - pub fn new(descriptor: String, network: Network) -> Result { + #[frb(sync)] + pub fn create(descriptor: String, network: Network) -> Result { let secp = Secp256k1::new(); let (extended_descriptor, key_map) = descriptor.into_wallet_descriptor(&secp, network.into())?; @@ -29,7 +30,7 @@ impl BdkDescriptor { key_map: RustOpaque::new(key_map), }) } - + #[frb(sync)] pub fn new_bip44( secret_key: BdkDescriptorSecretKey, keychain_kind: KeychainKind, @@ -54,7 +55,7 @@ impl BdkDescriptor { )), } } - + #[frb(sync)] pub fn new_bip44_public( public_key: BdkDescriptorPublicKey, fingerprint: String, @@ -84,7 +85,7 @@ impl BdkDescriptor { )), } } - + #[frb(sync)] pub fn new_bip49( secret_key: BdkDescriptorSecretKey, keychain_kind: KeychainKind, @@ -109,7 +110,7 @@ impl BdkDescriptor { )), } } - + #[frb(sync)] pub fn new_bip49_public( public_key: BdkDescriptorPublicKey, fingerprint: String, @@ -140,7 +141,7 @@ impl BdkDescriptor { )), } } - + #[frb(sync)] pub fn new_bip84( secret_key: BdkDescriptorSecretKey, keychain_kind: KeychainKind, @@ -165,7 +166,7 @@ impl BdkDescriptor { )), } } - + #[frb(sync)] pub fn new_bip84_public( public_key: BdkDescriptorPublicKey, fingerprint: String, @@ -196,7 +197,7 @@ impl BdkDescriptor { )), } } - + #[frb(sync)] pub fn new_bip86( secret_key: BdkDescriptorSecretKey, keychain_kind: KeychainKind, @@ -222,7 +223,7 @@ impl BdkDescriptor { )), } } - + #[frb(sync)] pub fn new_bip86_public( public_key: BdkDescriptorPublicKey, fingerprint: String, @@ -253,14 +254,12 @@ impl BdkDescriptor { )), } } - #[frb(sync)] pub fn to_string_private(&self) -> String { let descriptor = &self.extended_descriptor; let key_map = &*self.key_map; descriptor.to_string_with_secret(key_map) } - #[frb(sync)] pub fn as_string(&self) -> String { self.extended_descriptor.to_string() diff --git a/rust/src/api/key.rs b/rust/src/api/key.rs index ef55b4c..fbf00af 100644 --- a/rust/src/api/key.rs +++ b/rust/src/api/key.rs @@ -22,8 +22,9 @@ impl From for BdkMnemonic { } } impl BdkMnemonic { + #[frb(sync)] /// Generates Mnemonic with a random entropy - pub fn new(word_count: WordCount) -> Result { + pub fn create(word_count: WordCount) -> Result { let generated_key: keys::GeneratedKey<_, BareCtx> = (match keys::bip39::Mnemonic::generate((word_count.into(), Language::English)) { Ok(value) => Ok(value), @@ -35,14 +36,14 @@ impl BdkMnemonic { .map(|e| e.into()) .map_err(|e| BdkError::Bip39(e.to_string())) } - + #[frb(sync)] /// Parse a Mnemonic with given string pub fn from_string(mnemonic: String) -> Result { keys::bip39::Mnemonic::from_str(&mnemonic) .map(|m| m.into()) .map_err(|e| BdkError::Bip39(e.to_string())) } - + #[frb(sync)] /// 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. pub fn from_entropy(entropy: Vec) -> Result { @@ -50,7 +51,6 @@ impl BdkMnemonic { .map(|m| m.into()) .map_err(|e| BdkError::Bip39(e.to_string())) } - #[frb(sync)] pub fn as_string(&self) -> String { self.ptr.to_string() @@ -69,6 +69,7 @@ impl From for BdkDerivationPath { } impl BdkDerivationPath { + #[frb(sync)] pub fn from_string(path: String) -> Result { bitcoin::bip32::DerivationPath::from_str(&path) .map(|e| e.into()) @@ -92,6 +93,7 @@ impl From for BdkDescriptorSecretKey { } } impl BdkDescriptorSecretKey { + #[frb(sync)] pub fn create( network: Network, mnemonic: BdkMnemonic, @@ -116,7 +118,7 @@ impl BdkDescriptorSecretKey { }); Ok(descriptor_secret_key.into()) } - + #[frb(sync)] pub fn derive(ptr: BdkDescriptorSecretKey, path: BdkDerivationPath) -> Result { let secp = Secp256k1::new(); let descriptor_secret_key = (*ptr.ptr).clone(); @@ -152,6 +154,7 @@ impl BdkDescriptorSecretKey { )), } } + #[frb(sync)] pub fn extend(ptr: BdkDescriptorSecretKey, path: BdkDerivationPath) -> Result { let descriptor_secret_key = (*ptr.ptr).clone(); match descriptor_secret_key { @@ -199,7 +202,6 @@ impl BdkDescriptorSecretKey { )), } } - pub fn from_string(secret_key: String) -> Result { let key = keys::DescriptorSecretKey::from_str(&*secret_key) .map_err(|e| BdkError::Generic(e.to_string()))?; @@ -223,11 +225,13 @@ impl From for BdkDescriptorPublicKey { } impl BdkDescriptorPublicKey { + #[frb(sync)] pub fn from_string(public_key: String) -> Result { keys::DescriptorPublicKey::from_str(public_key.as_str()) .map_err(|e| BdkError::Generic(e.to_string())) .map(|e| e.into()) } + #[frb(sync)] pub fn derive(ptr: BdkDescriptorPublicKey, path: BdkDerivationPath) -> Result { let secp = Secp256k1::new(); let descriptor_public_key = (*ptr.ptr).clone(); @@ -262,7 +266,7 @@ impl BdkDescriptorPublicKey { )), } } - + #[frb(sync)] pub fn extend(ptr: BdkDescriptorPublicKey, path: BdkDerivationPath) -> Result { let descriptor_public_key = (*ptr.ptr).clone(); match descriptor_public_key { @@ -289,7 +293,6 @@ impl BdkDescriptorPublicKey { )), } } - #[frb(sync)] pub fn as_string(&self) -> String { self.ptr.to_string() diff --git a/rust/src/api/psbt.rs b/rust/src/api/psbt.rs index c31e952..606a668 100644 --- a/rust/src/api/psbt.rs +++ b/rust/src/api/psbt.rs @@ -23,17 +23,16 @@ impl From for BdkPsbt { } } impl BdkPsbt { + #[frb(sync)] pub fn from_str(psbt_base64: String) -> Result { let psbt: bdk::bitcoin::psbt::PartiallySignedTransaction = bdk::bitcoin::psbt::PartiallySignedTransaction::from_str(&psbt_base64)?; Ok(psbt.into()) } - #[frb(sync)] pub fn as_string(&self) -> Result { execute_with_lock(&self.ptr, |psbt| psbt.to_string()) } - ///Computes the `Txid`. /// Hashes the transaction excluding the segwit data (i. e. the marker, flag bytes, and the witness fields themselves). /// For non-segwit transactions which do not have any segwit data, this will be equal to transaction.wtxid(). @@ -43,7 +42,6 @@ impl BdkPsbt { psbt.to_owned().extract_tx().txid().to_string() }) } - /// Return the transaction. #[frb(sync)] pub fn extract_tx(ptr: BdkPsbt) -> Result { @@ -52,7 +50,7 @@ impl BdkPsbt { tx.try_into() })? } - + #[frb(sync)] /// 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)` @@ -69,14 +67,12 @@ impl BdkPsbt { original_psbt.combine(other_psbt)?; Ok(original_psbt.to_owned().into()) } - /// 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. #[frb(sync)] pub fn fee_amount(&self) -> Result, BdkError> { execute_with_lock(&self.ptr, |psbt| psbt.fee_amount()) } - /// 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. @@ -85,7 +81,6 @@ impl BdkPsbt { pub fn fee_rate(&self) -> Result, BdkError> { execute_with_lock(&self.ptr, |psbt| psbt.fee_rate().map(|e| e.into())) } - ///Serialize as raw binary data #[frb(sync)] pub fn serialize(&self) -> Result, BdkError> { diff --git a/rust/src/api/types.rs b/rust/src/api/types.rs index a721c5c..97bf64c 100644 --- a/rust/src/api/types.rs +++ b/rust/src/api/types.rs @@ -40,19 +40,22 @@ impl From for OutPoint { } } #[derive(Debug, Clone)] -pub struct TxIn { +pub struct BdkTxIn { pub previous_output: OutPoint, - pub script_sig: BdkScriptBuf, + pub script_sig: Option, pub sequence: u32, pub witness: Vec>, } -impl TryFrom<&TxIn> for bdk::bitcoin::TxIn { +impl TryFrom<&BdkTxIn> for bdk::bitcoin::TxIn { type Error = BdkError; - fn try_from(x: &TxIn) -> Result { + fn try_from(x: &BdkTxIn) -> Result { Ok(bdk::bitcoin::TxIn { previous_output: (&x.previous_output).try_into()?, - script_sig: x.clone().script_sig.into(), + script_sig: x + .script_sig + .as_ref() + .map_or_else(|| BdkScriptBuf::empty().into(), |e| e.clone().into()), sequence: bdk::bitcoin::blockdata::transaction::Sequence::from_consensus( x.sequence.clone(), ), @@ -62,41 +65,43 @@ impl TryFrom<&TxIn> for bdk::bitcoin::TxIn { }) } } -impl From<&bdk::bitcoin::TxIn> for TxIn { +impl From<&bdk::bitcoin::TxIn> for BdkTxIn { fn from(x: &bdk::bitcoin::TxIn) -> Self { - TxIn { + BdkTxIn { previous_output: x.previous_output.into(), - script_sig: x.clone().script_sig.into(), + script_sig: (!x.script_sig.is_empty()) + .then(|| Some(x.script_sig.clone().into())) + .unwrap_or_else(|| None), sequence: x.clone().sequence.0, witness: x.witness.to_vec(), } } } ///A transaction output, which defines new coins to be created from old ones. -pub struct TxOut { +pub struct BdkTxOut { /// The value of the output, in satoshis. pub value: u64, /// The address of the output. pub script_pubkey: BdkScriptBuf, } -impl From for bdk::bitcoin::TxOut { - fn from(value: TxOut) -> Self { +impl From for bdk::bitcoin::TxOut { + fn from(value: BdkTxOut) -> Self { Self { value: value.value, script_pubkey: value.script_pubkey.into(), } } } -impl From<&bdk::bitcoin::TxOut> for TxOut { +impl From<&bdk::bitcoin::TxOut> for BdkTxOut { fn from(x: &bdk::bitcoin::TxOut) -> Self { - TxOut { + BdkTxOut { value: x.clone().value, script_pubkey: x.clone().script_pubkey.into(), } } } -impl From<&TxOut> for bdk::bitcoin::TxOut { - fn from(x: &TxOut) -> Self { +impl From<&BdkTxOut> for bdk::bitcoin::TxOut { + fn from(x: &BdkTxOut) -> Self { Self { value: x.value, script_pubkey: x.script_pubkey.clone().into(), @@ -125,11 +130,12 @@ impl BdkScriptBuf { pub fn empty() -> BdkScriptBuf { bdk::bitcoin::ScriptBuf::new().into() } + #[frb(sync)] ///Creates a new empty script with pre-allocated capacity. pub fn with_capacity(capacity: usize) -> BdkScriptBuf { bdk::bitcoin::ScriptBuf::with_capacity(capacity).into() } - + #[frb(sync)] pub fn from_hex(s: String) -> Result { bdk::bitcoin::ScriptBuf::from_hex(s.as_str()) .map(|e| e.into()) @@ -215,7 +221,7 @@ impl From for bdk::wallet::AddressIndex { } #[derive(Debug, Clone, PartialEq, Eq)] ///A wallet transaction -pub struct TransactionDetails { +pub struct BdkTransactionDetails { pub transaction: Option, /// Transaction id. pub txid: String, @@ -235,7 +241,7 @@ pub struct TransactionDetails { pub confirmation_time: Option, } /// A wallet transaction -impl TryFrom<&bdk::TransactionDetails> for TransactionDetails { +impl TryFrom<&bdk::TransactionDetails> for BdkTransactionDetails { type Error = BdkError; fn try_from(x: &bdk::TransactionDetails) -> Result { @@ -244,7 +250,7 @@ impl TryFrom<&bdk::TransactionDetails> for TransactionDetails { } else { None }; - Ok(TransactionDetails { + Ok(BdkTransactionDetails { transaction, fee: x.clone().fee, txid: x.clone().txid.to_string(), @@ -254,7 +260,7 @@ impl TryFrom<&bdk::TransactionDetails> for TransactionDetails { }) } } -impl TryFrom for TransactionDetails { +impl TryFrom for BdkTransactionDetails { type Error = BdkError; fn try_from(x: bdk::TransactionDetails) -> Result { @@ -263,7 +269,7 @@ impl TryFrom for TransactionDetails { } else { None }; - Ok(TransactionDetails { + Ok(BdkTransactionDetails { transaction, fee: x.fee, txid: x.txid.to_string(), @@ -465,6 +471,7 @@ impl From<&BdkAddress> for bdk::bitcoin::Address { } } impl BdkAddress { + #[frb(sync)] pub fn from_string(address: String, network: Network) -> Result { match bdk::bitcoin::Address::from_str(address.as_str()) { Ok(e) => match e.require_network(network.into()) { @@ -474,7 +481,7 @@ impl BdkAddress { Err(e) => Err(e.into()), } } - + #[frb(sync)] pub fn from_script(script: BdkScriptBuf, network: Network) -> Result { bdk::bitcoin::Address::from_script( >::into(script).as_script(), @@ -499,12 +506,10 @@ impl BdkAddress { _ => unreachable!(), } } - #[frb(sync)] pub fn to_qr_uri(&self) -> String { self.ptr.to_qr_uri() } - #[frb(sync)] pub fn network(&self) -> Network { self.ptr.network.into() @@ -513,7 +518,6 @@ impl BdkAddress { pub fn script(ptr: BdkAddress) -> BdkScriptBuf { ptr.ptr.script_pubkey().into() } - #[frb(sync)] pub fn is_valid_for_network(&self, network: Network) -> bool { if let Ok(unchecked_address) = self @@ -589,11 +593,12 @@ pub struct BdkTransaction { pub s: String, } impl BdkTransaction { - pub fn new( + #[frb(sync)] + pub fn create( version: i32, lock_time: LockTime, - input: Vec, - output: Vec, + input: Vec, + output: Vec, ) -> Result { let mut inputs: Vec = vec![]; for e in input.iter() { @@ -601,7 +606,7 @@ impl BdkTransaction { } let output = output .into_iter() - .map(|e| <&TxOut as Into>::into(&e)) + .map(|e| <&BdkTxOut as Into>::into(&e)) .collect(); (bdk::bitcoin::Transaction { @@ -612,28 +617,33 @@ impl BdkTransaction { }) .try_into() } + #[frb(sync)] pub fn from_bytes(transaction_bytes: Vec) -> Result { let mut decoder = Cursor::new(transaction_bytes); let tx: bdk::bitcoin::transaction::Transaction = bdk::bitcoin::transaction::Transaction::consensus_decode(&mut decoder)?; tx.try_into() } + #[frb(sync)] ///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. pub fn txid(&self) -> Result { self.try_into() .map(|e: bdk::bitcoin::Transaction| e.txid().to_string()) } + #[frb(sync)] ///Returns the regular byte-wise consensus-serialized size of this transaction. pub fn weight(&self) -> Result { self.try_into() .map(|e: bdk::bitcoin::Transaction| e.weight().to_wu()) } + #[frb(sync)] ///Returns the regular byte-wise consensus-serialized size of this transaction. pub fn size(&self) -> Result { self.try_into() .map(|e: bdk::bitcoin::Transaction| e.size() as u64) } + #[frb(sync)] ///Returns the “virtual size” (vsize) of this transaction. /// // Will be ceil(weight / 4.0). Note this implements the virtual size as per BIP141, which is different to what is implemented in Bitcoin Core. @@ -642,44 +652,53 @@ impl BdkTransaction { self.try_into() .map(|e: bdk::bitcoin::Transaction| e.vsize() as u64) } + #[frb(sync)] ///Encodes an object into a vector. pub fn serialize(&self) -> Result, BdkError> { self.try_into() .map(|e: bdk::bitcoin::Transaction| serialize(&e)) } + #[frb(sync)] ///Is this a coin base transaction? pub fn is_coin_base(&self) -> Result { self.try_into() .map(|e: bdk::bitcoin::Transaction| e.is_coin_base()) } + #[frb(sync)] ///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. pub fn is_explicitly_rbf(&self) -> Result { self.try_into() .map(|e: bdk::bitcoin::Transaction| e.is_explicitly_rbf()) } + #[frb(sync)] ///Returns true if this transactions nLockTime is enabled (BIP-65 ). pub fn is_lock_time_enabled(&self) -> Result { self.try_into() .map(|e: bdk::bitcoin::Transaction| e.is_lock_time_enabled()) } + #[frb(sync)] ///The protocol version, is currently expected to be 1 or 2 (BIP 68). pub fn version(&self) -> Result { self.try_into() .map(|e: bdk::bitcoin::Transaction| e.version) } + #[frb(sync)] ///Block height or timestamp. Transaction cannot be included in a block until this height/time. pub fn lock_time(&self) -> Result { self.try_into() .map(|e: bdk::bitcoin::Transaction| e.lock_time.into()) } + #[frb(sync)] ///List of transaction inputs. - pub fn input(&self) -> Result, BdkError> { + pub fn input(&self) -> Result, BdkError> { self.try_into() .map(|e: bdk::bitcoin::Transaction| e.input.iter().map(|x| x.into()).collect()) } + + #[frb(sync)] ///List of transaction outputs. - pub fn output(&self) -> Result, BdkError> { + pub fn output(&self) -> Result, BdkError> { self.try_into() .map(|e: bdk::bitcoin::Transaction| e.output.iter().map(|x| x.into()).collect()) } @@ -744,7 +763,6 @@ impl From for AnyDatabaseConfig { } } } - #[derive(Debug, Clone)] ///Types of keychains pub enum KeychainKind { @@ -771,7 +789,7 @@ impl From for bdk::KeychainKind { ///Unspent outputs of this wallet pub struct LocalUtxo { pub outpoint: OutPoint, - pub txout: TxOut, + pub txout: BdkTxOut, pub keychain: KeychainKind, pub is_spent: bool, } @@ -782,7 +800,7 @@ impl From for LocalUtxo { txid: local_utxo.outpoint.txid.to_string(), vout: local_utxo.outpoint.vout, }, - txout: TxOut { + txout: BdkTxOut { value: local_utxo.txout.value, script_pubkey: BdkScriptBuf { bytes: local_utxo.txout.script_pubkey.into_bytes(), diff --git a/rust/src/api/wallet.rs b/rust/src/api/wallet.rs index dcbcf2c..ffacf25 100644 --- a/rust/src/api/wallet.rs +++ b/rust/src/api/wallet.rs @@ -1,8 +1,8 @@ use crate::api::descriptor::BdkDescriptor; use crate::api::types::{ - AddressIndex, Balance, BdkAddress, BdkScriptBuf, ChangeSpendPolicy, DatabaseConfig, Input, - KeychainKind, LocalUtxo, Network, OutPoint, PsbtSigHashType, RbfValue, ScriptAmount, - SignOptions, TransactionDetails, + AddressIndex, Balance, BdkAddress, BdkScriptBuf, BdkTransactionDetails, ChangeSpendPolicy, + DatabaseConfig, Input, KeychainKind, LocalUtxo, Network, OutPoint, PsbtSigHashType, RbfValue, + ScriptAmount, SignOptions, }; use std::collections::{BTreeMap, HashMap}; use std::ops::Deref; @@ -27,7 +27,7 @@ pub struct BdkWallet { pub ptr: RustOpaque>>, } impl BdkWallet { - pub fn new( + pub fn create( descriptor: BdkDescriptor, change_descriptor: Option, network: Network, @@ -47,7 +47,6 @@ impl BdkWallet { ptr: RustOpaque::new(std::sync::Mutex::new(wallet)), }) } - /// Get the Bitcoin network the wallet is using. #[frb(sync)] pub fn network(&self) -> Result { @@ -74,7 +73,6 @@ impl BdkWallet { .map_err(|e| e.into()) })? } - /// Return a derived address using the internal (change) descriptor. /// /// If the wallet doesn't have an internal descriptor it will use the external descriptor. @@ -93,7 +91,6 @@ impl BdkWallet { .map_err(|e| e.into()) })? } - /// 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. #[frb(sync)] @@ -107,7 +104,7 @@ impl BdkWallet { pub fn list_transactions( &self, include_raw: bool, - ) -> Result, BdkError> { + ) -> Result, BdkError> { execute_with_lock(&self.ptr, |wallet| { let mut transaction_details = vec![]; @@ -119,7 +116,6 @@ impl BdkWallet { Ok(transaction_details) })? } - /// 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. #[frb(sync)] @@ -129,7 +125,7 @@ impl BdkWallet { Ok(unspent.into_iter().map(LocalUtxo::from).collect()) })? } - + #[frb(sync)] /// 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. /// @@ -161,7 +157,7 @@ impl BdkWallet { .map_err(|e| e.into()) })? } - + #[frb(sync)] ///get the corresponding PSBT Input for a LocalUtxo pub fn get_psbt_input( &self, @@ -186,7 +182,7 @@ impl BdkWallet { ) -> anyhow::Result { execute_with_lock(&ptr.ptr, |w| { let extended_descriptor = w.get_descriptor_for_keychain(keychain.into()); - BdkDescriptor::new(extended_descriptor.to_string(), w.network().into()) + BdkDescriptor::create(extended_descriptor.to_string(), w.network().into()) })? } #[frb(sync)] @@ -206,7 +202,7 @@ pub fn finish_bump_fee_tx_builder( wallet: BdkWallet, enable_rbf: bool, n_sequence: Option, -) -> anyhow::Result<(BdkPsbt, TransactionDetails), BdkError> { +) -> anyhow::Result<(BdkPsbt, BdkTransactionDetails), BdkError> { let txid = Txid::from_str(txid.as_str()).map_err(|e| BdkError::PsbtParse(e.to_string()))?; execute_with_lock(&wallet.ptr, |w| { let mut tx_builder = w.build_fee_bump(txid)?; @@ -223,7 +219,7 @@ pub fn finish_bump_fee_tx_builder( tx_builder.enable_rbf(); } return match tx_builder.finish() { - Ok(e) => Ok((e.0.into(), TransactionDetails::try_from(e.1)?)), + Ok(e) => Ok((e.0.into(), BdkTransactionDetails::try_from(e.1)?)), Err(e) => Err(e.into()), }; })? @@ -245,7 +241,7 @@ pub fn tx_builder_finish( internal_policy_path: Option>>, external_policy_path: Option>>, data: Vec, -) -> anyhow::Result<(BdkPsbt, TransactionDetails), BdkError> { +) -> anyhow::Result<(BdkPsbt, BdkTransactionDetails), BdkError> { execute_with_lock(&wallet.ptr, |w| { let mut tx_builder = w.build_tx(); if let Some(path) = internal_policy_path { @@ -322,7 +318,7 @@ pub fn tx_builder_finish( } return match tx_builder.finish() { - Ok(e) => Ok((e.0.into(), TransactionDetails::try_from(&e.1)?)), + Ok(e) => Ok((e.0.into(), BdkTransactionDetails::try_from(&e.1)?)), Err(e) => Err(e.into()), }; })? diff --git a/rust/src/frb_generated.io.rs b/rust/src/frb_generated.io.rs index e823f8d..1f32d85 100644 --- a/rust/src/frb_generated.io.rs +++ b/rust/src/frb_generated.io.rs @@ -503,6 +503,39 @@ impl CstDecode for wire_cst_bdk_transaction { } } } +impl CstDecode for wire_cst_bdk_transaction_details { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::api::types::BdkTransactionDetails { + crate::api::types::BdkTransactionDetails { + transaction: self.transaction.cst_decode(), + txid: self.txid.cst_decode(), + received: self.received.cst_decode(), + sent: self.sent.cst_decode(), + fee: self.fee.cst_decode(), + confirmation_time: self.confirmation_time.cst_decode(), + } + } +} +impl CstDecode for wire_cst_bdk_tx_in { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::api::types::BdkTxIn { + crate::api::types::BdkTxIn { + previous_output: self.previous_output.cst_decode(), + script_sig: self.script_sig.cst_decode(), + sequence: self.sequence.cst_decode(), + witness: self.witness.cst_decode(), + } + } +} +impl CstDecode for wire_cst_bdk_tx_out { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::api::types::BdkTxOut { + crate::api::types::BdkTxOut { + value: self.value.cst_decode(), + script_pubkey: self.script_pubkey.cst_decode(), + } + } +} impl CstDecode for wire_cst_bdk_wallet { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::api::wallet::BdkWallet { @@ -1022,6 +1055,38 @@ impl CstDecode> for *mut wire_cst_list_bdk_pol vec.into_iter().map(CstDecode::cst_decode).collect() } } +impl CstDecode> + for *mut wire_cst_list_bdk_transaction_details +{ + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> Vec { + let vec = unsafe { + let wrap = flutter_rust_bridge::for_generated::box_from_leak_ptr(self); + flutter_rust_bridge::for_generated::vec_from_leak_ptr(wrap.ptr, wrap.len) + }; + vec.into_iter().map(CstDecode::cst_decode).collect() + } +} +impl CstDecode> for *mut wire_cst_list_bdk_tx_in { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> Vec { + let vec = unsafe { + let wrap = flutter_rust_bridge::for_generated::box_from_leak_ptr(self); + flutter_rust_bridge::for_generated::vec_from_leak_ptr(wrap.ptr, wrap.len) + }; + vec.into_iter().map(CstDecode::cst_decode).collect() + } +} +impl CstDecode> for *mut wire_cst_list_bdk_tx_out { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> Vec { + let vec = unsafe { + let wrap = flutter_rust_bridge::for_generated::box_from_leak_ptr(self); + flutter_rust_bridge::for_generated::vec_from_leak_ptr(wrap.ptr, wrap.len) + }; + vec.into_iter().map(CstDecode::cst_decode).collect() + } +} impl CstDecode> for *mut wire_cst_list_condition { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> Vec { @@ -1152,38 +1217,6 @@ impl CstDecode> for *mut wire_cst_list_scri vec.into_iter().map(CstDecode::cst_decode).collect() } } -impl CstDecode> - for *mut wire_cst_list_transaction_details -{ - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> Vec { - let vec = unsafe { - let wrap = flutter_rust_bridge::for_generated::box_from_leak_ptr(self); - flutter_rust_bridge::for_generated::vec_from_leak_ptr(wrap.ptr, wrap.len) - }; - vec.into_iter().map(CstDecode::cst_decode).collect() - } -} -impl CstDecode> for *mut wire_cst_list_tx_in { - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> Vec { - let vec = unsafe { - let wrap = flutter_rust_bridge::for_generated::box_from_leak_ptr(self); - flutter_rust_bridge::for_generated::vec_from_leak_ptr(wrap.ptr, wrap.len) - }; - vec.into_iter().map(CstDecode::cst_decode).collect() - } -} -impl CstDecode> for *mut wire_cst_list_tx_out { - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> Vec { - let vec = unsafe { - let wrap = flutter_rust_bridge::for_generated::box_from_leak_ptr(self); - flutter_rust_bridge::for_generated::vec_from_leak_ptr(wrap.ptr, wrap.len) - }; - vec.into_iter().map(CstDecode::cst_decode).collect() - } -} impl CstDecode for wire_cst_local_utxo { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::api::types::LocalUtxo { @@ -1303,15 +1336,15 @@ impl CstDecode<(crate::api::types::BdkAddress, u32)> for wire_cst_record_bdk_add impl CstDecode<( crate::api::psbt::BdkPsbt, - crate::api::types::TransactionDetails, - )> for wire_cst_record_bdk_psbt_transaction_details + crate::api::types::BdkTransactionDetails, + )> for wire_cst_record_bdk_psbt_bdk_transaction_details { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode( self, ) -> ( crate::api::psbt::BdkPsbt, - crate::api::types::TransactionDetails, + crate::api::types::BdkTransactionDetails, ) { (self.field0.cst_decode(), self.field1.cst_decode()) } @@ -1521,39 +1554,6 @@ impl CstDecode for wire_cst_sqlite_db_ } } } -impl CstDecode for wire_cst_transaction_details { - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> crate::api::types::TransactionDetails { - crate::api::types::TransactionDetails { - transaction: self.transaction.cst_decode(), - txid: self.txid.cst_decode(), - received: self.received.cst_decode(), - sent: self.sent.cst_decode(), - fee: self.fee.cst_decode(), - confirmation_time: self.confirmation_time.cst_decode(), - } - } -} -impl CstDecode for wire_cst_tx_in { - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> crate::api::types::TxIn { - crate::api::types::TxIn { - previous_output: self.previous_output.cst_decode(), - script_sig: self.script_sig.cst_decode(), - sequence: self.sequence.cst_decode(), - witness: self.witness.cst_decode(), - } - } -} -impl CstDecode for wire_cst_tx_out { - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> crate::api::types::TxOut { - crate::api::types::TxOut { - value: self.value.cst_decode(), - script_pubkey: self.script_pubkey.cst_decode(), - } - } -} impl CstDecode<[u8; 4]> for *mut wire_cst_list_prim_u_8_strict { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> [u8; 4] { @@ -1763,6 +1763,51 @@ impl Default for wire_cst_bdk_transaction { Self::new_with_null_ptr() } } +impl NewWithNullPtr for wire_cst_bdk_transaction_details { + fn new_with_null_ptr() -> Self { + Self { + transaction: core::ptr::null_mut(), + txid: core::ptr::null_mut(), + received: Default::default(), + sent: Default::default(), + fee: core::ptr::null_mut(), + confirmation_time: core::ptr::null_mut(), + } + } +} +impl Default for wire_cst_bdk_transaction_details { + fn default() -> Self { + Self::new_with_null_ptr() + } +} +impl NewWithNullPtr for wire_cst_bdk_tx_in { + fn new_with_null_ptr() -> Self { + Self { + previous_output: Default::default(), + script_sig: core::ptr::null_mut(), + sequence: Default::default(), + witness: core::ptr::null_mut(), + } + } +} +impl Default for wire_cst_bdk_tx_in { + fn default() -> Self { + Self::new_with_null_ptr() + } +} +impl NewWithNullPtr for wire_cst_bdk_tx_out { + fn new_with_null_ptr() -> Self { + Self { + value: Default::default(), + script_pubkey: Default::default(), + } + } +} +impl Default for wire_cst_bdk_tx_out { + fn default() -> Self { + Self::new_with_null_ptr() + } +} impl NewWithNullPtr for wire_cst_bdk_wallet { fn new_with_null_ptr() -> Self { Self { @@ -2028,7 +2073,7 @@ impl Default for wire_cst_record_bdk_address_u_32 { Self::new_with_null_ptr() } } -impl NewWithNullPtr for wire_cst_record_bdk_psbt_transaction_details { +impl NewWithNullPtr for wire_cst_record_bdk_psbt_bdk_transaction_details { fn new_with_null_ptr() -> Self { Self { field0: Default::default(), @@ -2036,7 +2081,7 @@ impl NewWithNullPtr for wire_cst_record_bdk_psbt_transaction_details { } } } -impl Default for wire_cst_record_bdk_psbt_transaction_details { +impl Default for wire_cst_record_bdk_psbt_bdk_transaction_details { fn default() -> Self { Self::new_with_null_ptr() } @@ -2207,51 +2252,6 @@ impl Default for wire_cst_sqlite_db_configuration { Self::new_with_null_ptr() } } -impl NewWithNullPtr for wire_cst_transaction_details { - fn new_with_null_ptr() -> Self { - Self { - transaction: core::ptr::null_mut(), - txid: core::ptr::null_mut(), - received: Default::default(), - sent: Default::default(), - fee: core::ptr::null_mut(), - confirmation_time: core::ptr::null_mut(), - } - } -} -impl Default for wire_cst_transaction_details { - fn default() -> Self { - Self::new_with_null_ptr() - } -} -impl NewWithNullPtr for wire_cst_tx_in { - fn new_with_null_ptr() -> Self { - Self { - previous_output: Default::default(), - script_sig: Default::default(), - sequence: Default::default(), - witness: core::ptr::null_mut(), - } - } -} -impl Default for wire_cst_tx_in { - fn default() -> Self { - Self::new_with_null_ptr() - } -} -impl NewWithNullPtr for wire_cst_tx_out { - fn new_with_null_ptr() -> Self { - Self { - value: Default::default(), - script_pubkey: Default::default(), - } - } -} -impl Default for wire_cst_tx_out { - fn default() -> Self { - Self::new_with_null_ptr() - } -} #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__blockchain__bdk_blockchain_broadcast( @@ -2304,46 +2304,37 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descripto } #[no_mangle] -pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_max_satisfaction_weight( - that: *mut wire_cst_bdk_descriptor, +pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_create( + descriptor: *mut wire_cst_list_prim_u_8_strict, + network: i32, ) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { - wire__crate__api__descriptor__bdk_descriptor_max_satisfaction_weight_impl(that) + wire__crate__api__descriptor__bdk_descriptor_create_impl(descriptor, network) } #[no_mangle] -pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new( - port_: i64, - descriptor: *mut wire_cst_list_prim_u_8_strict, - network: i32, -) { - wire__crate__api__descriptor__bdk_descriptor_new_impl(port_, descriptor, network) +pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_max_satisfaction_weight( + that: *mut wire_cst_bdk_descriptor, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__descriptor__bdk_descriptor_max_satisfaction_weight_impl(that) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44( - port_: i64, secret_key: *mut wire_cst_bdk_descriptor_secret_key, keychain_kind: i32, network: i32, -) { - wire__crate__api__descriptor__bdk_descriptor_new_bip44_impl( - port_, - secret_key, - keychain_kind, - network, - ) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__descriptor__bdk_descriptor_new_bip44_impl(secret_key, keychain_kind, network) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip44_public( - port_: i64, public_key: *mut wire_cst_bdk_descriptor_public_key, fingerprint: *mut wire_cst_list_prim_u_8_strict, keychain_kind: i32, network: i32, -) { +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { wire__crate__api__descriptor__bdk_descriptor_new_bip44_public_impl( - port_, public_key, fingerprint, keychain_kind, @@ -2353,29 +2344,21 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descripto #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49( - port_: i64, secret_key: *mut wire_cst_bdk_descriptor_secret_key, keychain_kind: i32, network: i32, -) { - wire__crate__api__descriptor__bdk_descriptor_new_bip49_impl( - port_, - secret_key, - keychain_kind, - network, - ) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__descriptor__bdk_descriptor_new_bip49_impl(secret_key, keychain_kind, network) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip49_public( - port_: i64, public_key: *mut wire_cst_bdk_descriptor_public_key, fingerprint: *mut wire_cst_list_prim_u_8_strict, keychain_kind: i32, network: i32, -) { +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { wire__crate__api__descriptor__bdk_descriptor_new_bip49_public_impl( - port_, public_key, fingerprint, keychain_kind, @@ -2385,29 +2368,21 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descripto #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip84( - port_: i64, secret_key: *mut wire_cst_bdk_descriptor_secret_key, keychain_kind: i32, network: i32, -) { - wire__crate__api__descriptor__bdk_descriptor_new_bip84_impl( - port_, - secret_key, - keychain_kind, - network, - ) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__descriptor__bdk_descriptor_new_bip84_impl(secret_key, keychain_kind, network) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip84_public( - port_: i64, public_key: *mut wire_cst_bdk_descriptor_public_key, fingerprint: *mut wire_cst_list_prim_u_8_strict, keychain_kind: i32, network: i32, -) { +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { wire__crate__api__descriptor__bdk_descriptor_new_bip84_public_impl( - port_, public_key, fingerprint, keychain_kind, @@ -2417,29 +2392,21 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descripto #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip86( - port_: i64, secret_key: *mut wire_cst_bdk_descriptor_secret_key, keychain_kind: i32, network: i32, -) { - wire__crate__api__descriptor__bdk_descriptor_new_bip86_impl( - port_, - secret_key, - keychain_kind, - network, - ) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__descriptor__bdk_descriptor_new_bip86_impl(secret_key, keychain_kind, network) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__descriptor__bdk_descriptor_new_bip86_public( - port_: i64, public_key: *mut wire_cst_bdk_descriptor_public_key, fingerprint: *mut wire_cst_list_prim_u_8_strict, keychain_kind: i32, network: i32, -) { +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { wire__crate__api__descriptor__bdk_descriptor_new_bip86_public_impl( - port_, public_key, fingerprint, keychain_kind, @@ -2463,10 +2430,9 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_derivation_path_ #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_derivation_path_from_string( - port_: i64, path: *mut wire_cst_list_prim_u_8_strict, -) { - wire__crate__api__key__bdk_derivation_path_from_string_impl(port_, path) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__key__bdk_derivation_path_from_string_impl(path) } #[no_mangle] @@ -2478,28 +2444,25 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_publi #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_derive( - port_: i64, ptr: *mut wire_cst_bdk_descriptor_public_key, path: *mut wire_cst_bdk_derivation_path, -) { - wire__crate__api__key__bdk_descriptor_public_key_derive_impl(port_, ptr, path) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__key__bdk_descriptor_public_key_derive_impl(ptr, path) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_extend( - port_: i64, ptr: *mut wire_cst_bdk_descriptor_public_key, path: *mut wire_cst_bdk_derivation_path, -) { - wire__crate__api__key__bdk_descriptor_public_key_extend_impl(port_, ptr, path) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__key__bdk_descriptor_public_key_extend_impl(ptr, path) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_public_key_from_string( - port_: i64, public_key: *mut wire_cst_list_prim_u_8_strict, -) { - wire__crate__api__key__bdk_descriptor_public_key_from_string_impl(port_, public_key) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__key__bdk_descriptor_public_key_from_string_impl(public_key) } #[no_mangle] @@ -2518,30 +2481,27 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secre #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_create( - port_: i64, network: i32, mnemonic: *mut wire_cst_bdk_mnemonic, password: *mut wire_cst_list_prim_u_8_strict, -) { - wire__crate__api__key__bdk_descriptor_secret_key_create_impl(port_, network, mnemonic, password) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__key__bdk_descriptor_secret_key_create_impl(network, mnemonic, password) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_derive( - port_: i64, ptr: *mut wire_cst_bdk_descriptor_secret_key, path: *mut wire_cst_bdk_derivation_path, -) { - wire__crate__api__key__bdk_descriptor_secret_key_derive_impl(port_, ptr, path) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__key__bdk_descriptor_secret_key_derive_impl(ptr, path) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_descriptor_secret_key_extend( - port_: i64, ptr: *mut wire_cst_bdk_descriptor_secret_key, path: *mut wire_cst_bdk_derivation_path, -) { - wire__crate__api__key__bdk_descriptor_secret_key_extend_impl(port_, ptr, path) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__key__bdk_descriptor_secret_key_extend_impl(ptr, path) } #[no_mangle] @@ -2566,28 +2526,25 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_as_stri wire__crate__api__key__bdk_mnemonic_as_string_impl(that) } +#[no_mangle] +pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_create( + word_count: i32, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__key__bdk_mnemonic_create_impl(word_count) +} + #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_entropy( - port_: i64, entropy: *mut wire_cst_list_prim_u_8_loose, -) { - wire__crate__api__key__bdk_mnemonic_from_entropy_impl(port_, entropy) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__key__bdk_mnemonic_from_entropy_impl(entropy) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_from_string( - port_: i64, mnemonic: *mut wire_cst_list_prim_u_8_strict, -) { - wire__crate__api__key__bdk_mnemonic_from_string_impl(port_, mnemonic) -} - -#[no_mangle] -pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__key__bdk_mnemonic_new( - port_: i64, - word_count: i32, -) { - wire__crate__api__key__bdk_mnemonic_new_impl(port_, word_count) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__key__bdk_mnemonic_from_string_impl(mnemonic) } #[no_mangle] @@ -2599,11 +2556,10 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_as_string( #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_combine( - port_: i64, ptr: *mut wire_cst_bdk_psbt, other: *mut wire_cst_bdk_psbt, -) { - wire__crate__api__psbt__bdk_psbt_combine_impl(port_, ptr, other) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__psbt__bdk_psbt_combine_impl(ptr, other) } #[no_mangle] @@ -2629,10 +2585,9 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_fee_rate( #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__psbt__bdk_psbt_from_str( - port_: i64, psbt_base64: *mut wire_cst_list_prim_u_8_strict, -) { - wire__crate__api__psbt__bdk_psbt_from_str_impl(port_, psbt_base64) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__psbt__bdk_psbt_from_str_impl(psbt_base64) } #[no_mangle] @@ -2665,20 +2620,18 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_address_as_str #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_address_from_script( - port_: i64, script: *mut wire_cst_bdk_script_buf, network: i32, -) { - wire__crate__api__types__bdk_address_from_script_impl(port_, script, network) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_address_from_script_impl(script, network) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_address_from_string( - port_: i64, address: *mut wire_cst_list_prim_u_8_strict, network: i32, -) { - wire__crate__api__types__bdk_address_from_string_impl(port_, address, network) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_address_from_string_impl(address, network) } #[no_mangle] @@ -2774,133 +2727,134 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_emp #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_from_hex( - port_: i64, s: *mut wire_cst_list_prim_u_8_strict, -) { - wire__crate__api__types__bdk_script_buf_from_hex_impl(port_, s) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_script_buf_from_hex_impl(s) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_script_buf_with_capacity( - port_: i64, capacity: usize, -) { - wire__crate__api__types__bdk_script_buf_with_capacity_impl(port_, capacity) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_script_buf_with_capacity_impl(capacity) +} + +#[no_mangle] +pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_create( + version: i32, + lock_time: *mut wire_cst_lock_time, + input: *mut wire_cst_list_bdk_tx_in, + output: *mut wire_cst_list_bdk_tx_out, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_create_impl(version, lock_time, input, output) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_from_bytes( - port_: i64, transaction_bytes: *mut wire_cst_list_prim_u_8_loose, -) { - wire__crate__api__types__bdk_transaction_from_bytes_impl(port_, transaction_bytes) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_from_bytes_impl(transaction_bytes) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_input( - port_: i64, that: *mut wire_cst_bdk_transaction, -) { - wire__crate__api__types__bdk_transaction_input_impl(port_, that) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_input_impl(that) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_coin_base( - port_: i64, that: *mut wire_cst_bdk_transaction, -) { - wire__crate__api__types__bdk_transaction_is_coin_base_impl(port_, that) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_is_coin_base_impl(that) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_explicitly_rbf( - port_: i64, that: *mut wire_cst_bdk_transaction, -) { - wire__crate__api__types__bdk_transaction_is_explicitly_rbf_impl(port_, that) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_is_explicitly_rbf_impl(that) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_is_lock_time_enabled( - port_: i64, that: *mut wire_cst_bdk_transaction, -) { - wire__crate__api__types__bdk_transaction_is_lock_time_enabled_impl(port_, that) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_is_lock_time_enabled_impl(that) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_lock_time( - port_: i64, that: *mut wire_cst_bdk_transaction, -) { - wire__crate__api__types__bdk_transaction_lock_time_impl(port_, that) -} - -#[no_mangle] -pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_new( - port_: i64, - version: i32, - lock_time: *mut wire_cst_lock_time, - input: *mut wire_cst_list_tx_in, - output: *mut wire_cst_list_tx_out, -) { - wire__crate__api__types__bdk_transaction_new_impl(port_, version, lock_time, input, output) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_lock_time_impl(that) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_output( - port_: i64, that: *mut wire_cst_bdk_transaction, -) { - wire__crate__api__types__bdk_transaction_output_impl(port_, that) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_output_impl(that) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_serialize( - port_: i64, that: *mut wire_cst_bdk_transaction, -) { - wire__crate__api__types__bdk_transaction_serialize_impl(port_, that) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_serialize_impl(that) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_size( - port_: i64, that: *mut wire_cst_bdk_transaction, -) { - wire__crate__api__types__bdk_transaction_size_impl(port_, that) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_size_impl(that) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_txid( - port_: i64, that: *mut wire_cst_bdk_transaction, -) { - wire__crate__api__types__bdk_transaction_txid_impl(port_, that) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_txid_impl(that) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_version( - port_: i64, that: *mut wire_cst_bdk_transaction, -) { - wire__crate__api__types__bdk_transaction_version_impl(port_, that) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_version_impl(that) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_vsize( - port_: i64, that: *mut wire_cst_bdk_transaction, -) { - wire__crate__api__types__bdk_transaction_vsize_impl(port_, that) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_vsize_impl(that) } #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__types__bdk_transaction_weight( - port_: i64, that: *mut wire_cst_bdk_transaction, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__types__bdk_transaction_weight_impl(that) +} + +#[no_mangle] +pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_create( + port_: i64, + descriptor: *mut wire_cst_bdk_descriptor, + change_descriptor: *mut wire_cst_bdk_descriptor, + network: i32, + database_config: *mut wire_cst_database_config, ) { - wire__crate__api__types__bdk_transaction_weight_impl(port_, that) + wire__crate__api__wallet__bdk_wallet_create_impl( + port_, + descriptor, + change_descriptor, + network, + database_config, + ) } #[no_mangle] @@ -2936,14 +2890,12 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_in #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_get_psbt_input( - port_: i64, that: *mut wire_cst_bdk_wallet, utxo: *mut wire_cst_local_utxo, only_witness_utxo: bool, sighash_type: *mut wire_cst_psbt_sig_hash_type, -) { +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { wire__crate__api__wallet__bdk_wallet_get_psbt_input_impl( - port_, that, utxo, only_witness_utxo, @@ -2981,23 +2933,6 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_networ wire__crate__api__wallet__bdk_wallet_network_impl(that) } -#[no_mangle] -pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_new( - port_: i64, - descriptor: *mut wire_cst_bdk_descriptor, - change_descriptor: *mut wire_cst_bdk_descriptor, - network: i32, - database_config: *mut wire_cst_database_config, -) { - wire__crate__api__wallet__bdk_wallet_new_impl( - port_, - descriptor, - change_descriptor, - network, - database_config, - ) -} - #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_policies( ptr: *mut wire_cst_bdk_wallet, @@ -3008,12 +2943,11 @@ pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_polici #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_wire__crate__api__wallet__bdk_wallet_sign( - port_: i64, ptr: *mut wire_cst_bdk_wallet, psbt: *mut wire_cst_bdk_psbt, sign_options: *mut wire_cst_sign_options, -) { - wire__crate__api__wallet__bdk_wallet_sign_impl(port_, ptr, psbt, sign_options) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__wallet__bdk_wallet_sign_impl(ptr, psbt, sign_options) } #[no_mangle] @@ -3565,6 +3499,48 @@ pub extern "C" fn frbgen_bdk_flutter_cst_new_list_bdk_policy( flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) } +#[no_mangle] +pub extern "C" fn frbgen_bdk_flutter_cst_new_list_bdk_transaction_details( + len: i32, +) -> *mut wire_cst_list_bdk_transaction_details { + let wrap = wire_cst_list_bdk_transaction_details { + ptr: flutter_rust_bridge::for_generated::new_leak_vec_ptr( + ::new_with_null_ptr(), + len, + ), + len, + }; + flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) +} + +#[no_mangle] +pub extern "C" fn frbgen_bdk_flutter_cst_new_list_bdk_tx_in( + len: i32, +) -> *mut wire_cst_list_bdk_tx_in { + let wrap = wire_cst_list_bdk_tx_in { + ptr: flutter_rust_bridge::for_generated::new_leak_vec_ptr( + ::new_with_null_ptr(), + len, + ), + len, + }; + flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) +} + +#[no_mangle] +pub extern "C" fn frbgen_bdk_flutter_cst_new_list_bdk_tx_out( + len: i32, +) -> *mut wire_cst_list_bdk_tx_out { + let wrap = wire_cst_list_bdk_tx_out { + ptr: flutter_rust_bridge::for_generated::new_leak_vec_ptr( + ::new_with_null_ptr(), + len, + ), + len, + }; + flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) +} + #[no_mangle] pub extern "C" fn frbgen_bdk_flutter_cst_new_list_condition( len: i32, @@ -3733,44 +3709,6 @@ pub extern "C" fn frbgen_bdk_flutter_cst_new_list_script_amount( flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) } -#[no_mangle] -pub extern "C" fn frbgen_bdk_flutter_cst_new_list_transaction_details( - len: i32, -) -> *mut wire_cst_list_transaction_details { - let wrap = wire_cst_list_transaction_details { - ptr: flutter_rust_bridge::for_generated::new_leak_vec_ptr( - ::new_with_null_ptr(), - len, - ), - len, - }; - flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) -} - -#[no_mangle] -pub extern "C" fn frbgen_bdk_flutter_cst_new_list_tx_in(len: i32) -> *mut wire_cst_list_tx_in { - let wrap = wire_cst_list_tx_in { - ptr: flutter_rust_bridge::for_generated::new_leak_vec_ptr( - ::new_with_null_ptr(), - len, - ), - len, - }; - flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) -} - -#[no_mangle] -pub extern "C" fn frbgen_bdk_flutter_cst_new_list_tx_out(len: i32) -> *mut wire_cst_list_tx_out { - let wrap = wire_cst_list_tx_out { - ptr: flutter_rust_bridge::for_generated::new_leak_vec_ptr( - ::new_with_null_ptr(), - len, - ), - len, - }; - flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) -} - #[repr(C)] #[derive(Clone, Copy)] pub struct wire_cst_address_error { @@ -4184,6 +4122,30 @@ pub struct wire_cst_bdk_transaction { } #[repr(C)] #[derive(Clone, Copy)] +pub struct wire_cst_bdk_transaction_details { + transaction: *mut wire_cst_bdk_transaction, + txid: *mut wire_cst_list_prim_u_8_strict, + received: u64, + sent: u64, + fee: *mut u64, + confirmation_time: *mut wire_cst_block_time, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_bdk_tx_in { + previous_output: wire_cst_out_point, + script_sig: *mut wire_cst_bdk_script_buf, + sequence: u32, + witness: *mut wire_cst_list_list_prim_u_8_strict, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_bdk_tx_out { + value: u64, + script_pubkey: wire_cst_bdk_script_buf, +} +#[repr(C)] +#[derive(Clone, Copy)] pub struct wire_cst_bdk_wallet { ptr: usize, } @@ -4420,6 +4382,24 @@ pub struct wire_cst_list_bdk_policy { } #[repr(C)] #[derive(Clone, Copy)] +pub struct wire_cst_list_bdk_transaction_details { + ptr: *mut wire_cst_bdk_transaction_details, + len: i32, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_list_bdk_tx_in { + ptr: *mut wire_cst_bdk_tx_in, + len: i32, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_list_bdk_tx_out { + ptr: *mut wire_cst_bdk_tx_out, + len: i32, +} +#[repr(C)] +#[derive(Clone, Copy)] pub struct wire_cst_list_condition { ptr: *mut wire_cst_condition, len: i32, @@ -4498,27 +4478,9 @@ pub struct wire_cst_list_script_amount { } #[repr(C)] #[derive(Clone, Copy)] -pub struct wire_cst_list_transaction_details { - ptr: *mut wire_cst_transaction_details, - len: i32, -} -#[repr(C)] -#[derive(Clone, Copy)] -pub struct wire_cst_list_tx_in { - ptr: *mut wire_cst_tx_in, - len: i32, -} -#[repr(C)] -#[derive(Clone, Copy)] -pub struct wire_cst_list_tx_out { - ptr: *mut wire_cst_tx_out, - len: i32, -} -#[repr(C)] -#[derive(Clone, Copy)] pub struct wire_cst_local_utxo { outpoint: wire_cst_out_point, - txout: wire_cst_tx_out, + txout: wire_cst_bdk_tx_out, keychain: i32, is_spent: bool, } @@ -4640,9 +4602,9 @@ pub struct wire_cst_record_bdk_address_u_32 { } #[repr(C)] #[derive(Clone, Copy)] -pub struct wire_cst_record_bdk_psbt_transaction_details { +pub struct wire_cst_record_bdk_psbt_bdk_transaction_details { field0: wire_cst_bdk_psbt, - field1: wire_cst_transaction_details, + field1: wire_cst_bdk_transaction_details, } #[repr(C)] #[derive(Clone, Copy)] @@ -4830,27 +4792,3 @@ pub struct wire_cst_sled_db_configuration { pub struct wire_cst_sqlite_db_configuration { path: *mut wire_cst_list_prim_u_8_strict, } -#[repr(C)] -#[derive(Clone, Copy)] -pub struct wire_cst_transaction_details { - transaction: *mut wire_cst_bdk_transaction, - txid: *mut wire_cst_list_prim_u_8_strict, - received: u64, - sent: u64, - fee: *mut u64, - confirmation_time: *mut wire_cst_block_time, -} -#[repr(C)] -#[derive(Clone, Copy)] -pub struct wire_cst_tx_in { - previous_output: wire_cst_out_point, - script_sig: wire_cst_bdk_script_buf, - sequence: u32, - witness: *mut wire_cst_list_list_prim_u_8_strict, -} -#[repr(C)] -#[derive(Clone, Copy)] -pub struct wire_cst_tx_out { - value: u64, - script_pubkey: wire_cst_bdk_script_buf, -} diff --git a/rust/src/frb_generated.rs b/rust/src/frb_generated.rs index cfe6c5e..5350ab1 100644 --- a/rust/src/frb_generated.rs +++ b/rust/src/frb_generated.rs @@ -38,7 +38,7 @@ flutter_rust_bridge::frb_generated_boilerplate!( default_rust_auto_opaque = RustAutoOpaqueNom, ); pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.0.0"; -pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = -321771070; +pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = -418359953; // Section: executor @@ -184,290 +184,263 @@ fn wire__crate__api__descriptor__bdk_descriptor_as_string_impl( }, ) } -fn wire__crate__api__descriptor__bdk_descriptor_max_satisfaction_weight_impl( - that: impl CstDecode, +fn wire__crate__api__descriptor__bdk_descriptor_create_impl( + descriptor: impl CstDecode, + network: impl CstDecode, ) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { - debug_name: "bdk_descriptor_max_satisfaction_weight", + debug_name: "bdk_descriptor_create", port: None, mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { - let api_that = that.cst_decode(); + let api_descriptor = descriptor.cst_decode(); + let api_network = network.cst_decode(); transform_result_dco::<_, _, crate::api::error::BdkError>((move || { let output_ok = - crate::api::descriptor::BdkDescriptor::max_satisfaction_weight(&api_that)?; + crate::api::descriptor::BdkDescriptor::create(api_descriptor, api_network)?; Ok(output_ok) })()) }, ) } -fn wire__crate__api__descriptor__bdk_descriptor_new_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, - descriptor: impl CstDecode, - network: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +fn wire__crate__api__descriptor__bdk_descriptor_max_satisfaction_weight_impl( + that: impl CstDecode, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { - debug_name: "bdk_descriptor_new", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + debug_name: "bdk_descriptor_max_satisfaction_weight", + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { - let api_descriptor = descriptor.cst_decode(); - let api_network = network.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = - crate::api::descriptor::BdkDescriptor::new(api_descriptor, api_network)?; - Ok(output_ok) - })()) - } + let api_that = that.cst_decode(); + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = + crate::api::descriptor::BdkDescriptor::max_satisfaction_weight(&api_that)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__descriptor__bdk_descriptor_new_bip44_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, secret_key: impl CstDecode, keychain_kind: impl CstDecode, network: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_new_bip44", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_secret_key = secret_key.cst_decode(); let api_keychain_kind = keychain_kind.cst_decode(); let api_network = network.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::descriptor::BdkDescriptor::new_bip44( - api_secret_key, - api_keychain_kind, - api_network, - )?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::descriptor::BdkDescriptor::new_bip44( + api_secret_key, + api_keychain_kind, + api_network, + )?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__descriptor__bdk_descriptor_new_bip44_public_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, public_key: impl CstDecode, fingerprint: impl CstDecode, keychain_kind: impl CstDecode, network: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_new_bip44_public", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_public_key = public_key.cst_decode(); let api_fingerprint = fingerprint.cst_decode(); let api_keychain_kind = keychain_kind.cst_decode(); let api_network = network.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::descriptor::BdkDescriptor::new_bip44_public( - api_public_key, - api_fingerprint, - api_keychain_kind, - api_network, - )?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::descriptor::BdkDescriptor::new_bip44_public( + api_public_key, + api_fingerprint, + api_keychain_kind, + api_network, + )?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__descriptor__bdk_descriptor_new_bip49_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, secret_key: impl CstDecode, keychain_kind: impl CstDecode, network: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_new_bip49", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_secret_key = secret_key.cst_decode(); let api_keychain_kind = keychain_kind.cst_decode(); let api_network = network.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::descriptor::BdkDescriptor::new_bip49( - api_secret_key, - api_keychain_kind, - api_network, - )?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::descriptor::BdkDescriptor::new_bip49( + api_secret_key, + api_keychain_kind, + api_network, + )?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__descriptor__bdk_descriptor_new_bip49_public_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, public_key: impl CstDecode, fingerprint: impl CstDecode, keychain_kind: impl CstDecode, network: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_new_bip49_public", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_public_key = public_key.cst_decode(); let api_fingerprint = fingerprint.cst_decode(); let api_keychain_kind = keychain_kind.cst_decode(); let api_network = network.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::descriptor::BdkDescriptor::new_bip49_public( - api_public_key, - api_fingerprint, - api_keychain_kind, - api_network, - )?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::descriptor::BdkDescriptor::new_bip49_public( + api_public_key, + api_fingerprint, + api_keychain_kind, + api_network, + )?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__descriptor__bdk_descriptor_new_bip84_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, secret_key: impl CstDecode, keychain_kind: impl CstDecode, network: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_new_bip84", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_secret_key = secret_key.cst_decode(); let api_keychain_kind = keychain_kind.cst_decode(); let api_network = network.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::descriptor::BdkDescriptor::new_bip84( - api_secret_key, - api_keychain_kind, - api_network, - )?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::descriptor::BdkDescriptor::new_bip84( + api_secret_key, + api_keychain_kind, + api_network, + )?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__descriptor__bdk_descriptor_new_bip84_public_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, public_key: impl CstDecode, fingerprint: impl CstDecode, keychain_kind: impl CstDecode, network: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_new_bip84_public", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_public_key = public_key.cst_decode(); let api_fingerprint = fingerprint.cst_decode(); let api_keychain_kind = keychain_kind.cst_decode(); let api_network = network.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::descriptor::BdkDescriptor::new_bip84_public( - api_public_key, - api_fingerprint, - api_keychain_kind, - api_network, - )?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::descriptor::BdkDescriptor::new_bip84_public( + api_public_key, + api_fingerprint, + api_keychain_kind, + api_network, + )?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__descriptor__bdk_descriptor_new_bip86_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, secret_key: impl CstDecode, keychain_kind: impl CstDecode, network: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_new_bip86", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_secret_key = secret_key.cst_decode(); let api_keychain_kind = keychain_kind.cst_decode(); let api_network = network.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::descriptor::BdkDescriptor::new_bip86( - api_secret_key, - api_keychain_kind, - api_network, - )?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::descriptor::BdkDescriptor::new_bip86( + api_secret_key, + api_keychain_kind, + api_network, + )?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__descriptor__bdk_descriptor_new_bip86_public_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, public_key: impl CstDecode, fingerprint: impl CstDecode, keychain_kind: impl CstDecode, network: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_new_bip86_public", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_public_key = public_key.cst_decode(); let api_fingerprint = fingerprint.cst_decode(); let api_keychain_kind = keychain_kind.cst_decode(); let api_network = network.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::descriptor::BdkDescriptor::new_bip86_public( - api_public_key, - api_fingerprint, - api_keychain_kind, - api_network, - )?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::descriptor::BdkDescriptor::new_bip86_public( + api_public_key, + api_fingerprint, + api_keychain_kind, + api_network, + )?; + Ok(output_ok) + })()) }, ) } @@ -511,23 +484,20 @@ fn wire__crate__api__key__bdk_derivation_path_as_string_impl( ) } fn wire__crate__api__key__bdk_derivation_path_from_string_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, path: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_derivation_path_from_string", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_path = path.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::key::BdkDerivationPath::from_string(api_path)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::key::BdkDerivationPath::from_string(api_path)?; + Ok(output_ok) + })()) }, ) } @@ -552,72 +522,61 @@ fn wire__crate__api__key__bdk_descriptor_public_key_as_string_impl( ) } fn wire__crate__api__key__bdk_descriptor_public_key_derive_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, ptr: impl CstDecode, path: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_public_key_derive", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_ptr = ptr.cst_decode(); let api_path = path.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = - crate::api::key::BdkDescriptorPublicKey::derive(api_ptr, api_path)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::key::BdkDescriptorPublicKey::derive(api_ptr, api_path)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__key__bdk_descriptor_public_key_extend_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, ptr: impl CstDecode, path: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_public_key_extend", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_ptr = ptr.cst_decode(); let api_path = path.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = - crate::api::key::BdkDescriptorPublicKey::extend(api_ptr, api_path)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::key::BdkDescriptorPublicKey::extend(api_ptr, api_path)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__key__bdk_descriptor_public_key_from_string_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, public_key: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_public_key_from_string", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_public_key = public_key.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = - crate::api::key::BdkDescriptorPublicKey::from_string(api_public_key)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = + crate::api::key::BdkDescriptorPublicKey::from_string(api_public_key)?; + Ok(output_ok) + })()) }, ) } @@ -660,79 +619,68 @@ fn wire__crate__api__key__bdk_descriptor_secret_key_as_string_impl( ) } fn wire__crate__api__key__bdk_descriptor_secret_key_create_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, network: impl CstDecode, mnemonic: impl CstDecode, password: impl CstDecode>, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_secret_key_create", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_network = network.cst_decode(); let api_mnemonic = mnemonic.cst_decode(); let api_password = password.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::key::BdkDescriptorSecretKey::create( - api_network, - api_mnemonic, - api_password, - )?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::key::BdkDescriptorSecretKey::create( + api_network, + api_mnemonic, + api_password, + )?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__key__bdk_descriptor_secret_key_derive_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, ptr: impl CstDecode, path: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_secret_key_derive", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_ptr = ptr.cst_decode(); let api_path = path.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = - crate::api::key::BdkDescriptorSecretKey::derive(api_ptr, api_path)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::key::BdkDescriptorSecretKey::derive(api_ptr, api_path)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__key__bdk_descriptor_secret_key_extend_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, ptr: impl CstDecode, path: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_descriptor_secret_key_extend", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_ptr = ptr.cst_decode(); let api_path = path.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = - crate::api::key::BdkDescriptorSecretKey::extend(api_ptr, api_path)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::key::BdkDescriptorSecretKey::extend(api_ptr, api_path)?; + Ok(output_ok) + })()) }, ) } @@ -795,66 +743,57 @@ fn wire__crate__api__key__bdk_mnemonic_as_string_impl( }, ) } +fn wire__crate__api__key__bdk_mnemonic_create_impl( + word_count: impl CstDecode, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "bdk_mnemonic_create", + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, + }, + move || { + let api_word_count = word_count.cst_decode(); + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::key::BdkMnemonic::create(api_word_count)?; + Ok(output_ok) + })()) + }, + ) +} fn wire__crate__api__key__bdk_mnemonic_from_entropy_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, entropy: impl CstDecode>, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_mnemonic_from_entropy", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_entropy = entropy.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::key::BdkMnemonic::from_entropy(api_entropy)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::key::BdkMnemonic::from_entropy(api_entropy)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__key__bdk_mnemonic_from_string_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, mnemonic: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_mnemonic_from_string", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_mnemonic = mnemonic.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::key::BdkMnemonic::from_string(api_mnemonic)?; - Ok(output_ok) - })()) - } - }, - ) -} -fn wire__crate__api__key__bdk_mnemonic_new_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, - word_count: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( - flutter_rust_bridge::for_generated::TaskInfo { - debug_name: "bdk_mnemonic_new", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, - }, - move || { - let api_word_count = word_count.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::key::BdkMnemonic::new(api_word_count)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::key::BdkMnemonic::from_string(api_mnemonic)?; + Ok(output_ok) + })()) }, ) } @@ -877,25 +816,22 @@ fn wire__crate__api__psbt__bdk_psbt_as_string_impl( ) } fn wire__crate__api__psbt__bdk_psbt_combine_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, ptr: impl CstDecode, other: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_psbt_combine", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_ptr = ptr.cst_decode(); let api_other = other.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::psbt::BdkPsbt::combine(api_ptr, api_other)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::psbt::BdkPsbt::combine(api_ptr, api_other)?; + Ok(output_ok) + })()) }, ) } @@ -954,23 +890,20 @@ fn wire__crate__api__psbt__bdk_psbt_fee_rate_impl( ) } fn wire__crate__api__psbt__bdk_psbt_from_str_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, psbt_base64: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_psbt_from_str", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_psbt_base64 = psbt_base64.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::psbt::BdkPsbt::from_str(api_psbt_base64)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::psbt::BdkPsbt::from_str(api_psbt_base64)?; + Ok(output_ok) + })()) }, ) } @@ -1048,50 +981,44 @@ fn wire__crate__api__types__bdk_address_as_string_impl( ) } fn wire__crate__api__types__bdk_address_from_script_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, script: impl CstDecode, network: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_address_from_script", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_script = script.cst_decode(); let api_network = network.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = - crate::api::types::BdkAddress::from_script(api_script, api_network)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = + crate::api::types::BdkAddress::from_script(api_script, api_network)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_address_from_string_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, address: impl CstDecode, network: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_address_from_string", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_address = address.cst_decode(); let api_network = network.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = - crate::api::types::BdkAddress::from_string(api_address, api_network)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = + crate::api::types::BdkAddress::from_string(api_address, api_network)?; + Ok(output_ok) + })()) }, ) } @@ -1340,351 +1267,333 @@ fn wire__crate__api__types__bdk_script_buf_empty_impl( ) } fn wire__crate__api__types__bdk_script_buf_from_hex_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, s: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_script_buf_from_hex", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_s = s.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::types::BdkScriptBuf::from_hex(api_s)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkScriptBuf::from_hex(api_s)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_script_buf_with_capacity_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, capacity: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_script_buf_with_capacity", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_capacity = capacity.cst_decode(); - move |context| { - transform_result_dco::<_, _, ()>((move || { - let output_ok = Result::<_, ()>::Ok( - crate::api::types::BdkScriptBuf::with_capacity(api_capacity), - )?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, ()>((move || { + let output_ok = Result::<_, ()>::Ok( + crate::api::types::BdkScriptBuf::with_capacity(api_capacity), + )?; + Ok(output_ok) + })()) + }, + ) +} +fn wire__crate__api__types__bdk_transaction_create_impl( + version: impl CstDecode, + lock_time: impl CstDecode, + input: impl CstDecode>, + output: impl CstDecode>, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "bdk_transaction_create", + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, + }, + move || { + let api_version = version.cst_decode(); + let api_lock_time = lock_time.cst_decode(); + let api_input = input.cst_decode(); + let api_output = output.cst_decode(); + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::create( + api_version, + api_lock_time, + api_input, + api_output, + )?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_from_bytes_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, transaction_bytes: impl CstDecode>, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_transaction_from_bytes", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_transaction_bytes = transaction_bytes.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = - crate::api::types::BdkTransaction::from_bytes(api_transaction_bytes)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = + crate::api::types::BdkTransaction::from_bytes(api_transaction_bytes)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_input_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_transaction_input", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_that = that.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::types::BdkTransaction::input(&api_that)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::input(&api_that)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_is_coin_base_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_transaction_is_coin_base", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_that = that.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::types::BdkTransaction::is_coin_base(&api_that)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::is_coin_base(&api_that)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_is_explicitly_rbf_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_transaction_is_explicitly_rbf", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_that = that.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = - crate::api::types::BdkTransaction::is_explicitly_rbf(&api_that)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::is_explicitly_rbf(&api_that)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_is_lock_time_enabled_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_transaction_is_lock_time_enabled", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_that = that.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = - crate::api::types::BdkTransaction::is_lock_time_enabled(&api_that)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::is_lock_time_enabled(&api_that)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_lock_time_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_transaction_lock_time", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_that = that.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::types::BdkTransaction::lock_time(&api_that)?; - Ok(output_ok) - })()) - } - }, - ) -} -fn wire__crate__api__types__bdk_transaction_new_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, - version: impl CstDecode, - lock_time: impl CstDecode, - input: impl CstDecode>, - output: impl CstDecode>, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( - flutter_rust_bridge::for_generated::TaskInfo { - debug_name: "bdk_transaction_new", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, - }, - move || { - let api_version = version.cst_decode(); - let api_lock_time = lock_time.cst_decode(); - let api_input = input.cst_decode(); - let api_output = output.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::types::BdkTransaction::new( - api_version, - api_lock_time, - api_input, - api_output, - )?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::lock_time(&api_that)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_output_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_transaction_output", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_that = that.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::types::BdkTransaction::output(&api_that)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::output(&api_that)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_serialize_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_transaction_serialize", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, - }, - move || { - let api_that = that.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::types::BdkTransaction::serialize(&api_that)?; - Ok(output_ok) - })()) - } + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, + }, + move || { + let api_that = that.cst_decode(); + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::serialize(&api_that)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_size_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_transaction_size", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_that = that.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::types::BdkTransaction::size(&api_that)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::size(&api_that)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_txid_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_transaction_txid", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_that = that.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::types::BdkTransaction::txid(&api_that)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::txid(&api_that)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_version_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_transaction_version", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_that = that.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::types::BdkTransaction::version(&api_that)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::version(&api_that)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_vsize_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_transaction_vsize", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_that = that.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::types::BdkTransaction::vsize(&api_that)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::vsize(&api_that)?; + Ok(output_ok) + })()) }, ) } fn wire__crate__api__types__bdk_transaction_weight_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "bdk_transaction_weight", + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, + }, + move || { + let api_that = that.cst_decode(); + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::types::BdkTransaction::weight(&api_that)?; + Ok(output_ok) + })()) + }, + ) +} +fn wire__crate__api__wallet__bdk_wallet_create_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + descriptor: impl CstDecode, + change_descriptor: impl CstDecode>, + network: impl CstDecode, + database_config: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( flutter_rust_bridge::for_generated::TaskInfo { - debug_name: "bdk_transaction_weight", + debug_name: "bdk_wallet_create", port: Some(port_), mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_that = that.cst_decode(); + let api_descriptor = descriptor.cst_decode(); + let api_change_descriptor = change_descriptor.cst_decode(); + let api_network = network.cst_decode(); + let api_database_config = database_config.cst_decode(); move |context| { transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::types::BdkTransaction::weight(&api_that)?; + let output_ok = crate::api::wallet::BdkWallet::create( + api_descriptor, + api_change_descriptor, + api_network, + api_database_config, + )?; Ok(output_ok) })()) } @@ -1777,34 +1686,31 @@ fn wire__crate__api__wallet__bdk_wallet_get_internal_address_impl( ) } fn wire__crate__api__wallet__bdk_wallet_get_psbt_input_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, utxo: impl CstDecode, only_witness_utxo: impl CstDecode, sighash_type: impl CstDecode>, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_wallet_get_psbt_input", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_that = that.cst_decode(); let api_utxo = utxo.cst_decode(); let api_only_witness_utxo = only_witness_utxo.cst_decode(); let api_sighash_type = sighash_type.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::wallet::BdkWallet::get_psbt_input( - &api_that, - api_utxo, - api_only_witness_utxo, - api_sighash_type, - )?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = crate::api::wallet::BdkWallet::get_psbt_input( + &api_that, + api_utxo, + api_only_witness_utxo, + api_sighash_type, + )?; + Ok(output_ok) + })()) }, ) } @@ -1885,38 +1791,6 @@ fn wire__crate__api__wallet__bdk_wallet_network_impl( }, ) } -fn wire__crate__api__wallet__bdk_wallet_new_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, - descriptor: impl CstDecode, - change_descriptor: impl CstDecode>, - network: impl CstDecode, - database_config: impl CstDecode, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( - flutter_rust_bridge::for_generated::TaskInfo { - debug_name: "bdk_wallet_new", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, - }, - move || { - let api_descriptor = descriptor.cst_decode(); - let api_change_descriptor = change_descriptor.cst_decode(); - let api_network = network.cst_decode(); - let api_database_config = database_config.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = crate::api::wallet::BdkWallet::new( - api_descriptor, - api_change_descriptor, - api_network, - api_database_config, - )?; - Ok(output_ok) - })()) - } - }, - ) -} fn wire__crate__api__wallet__bdk_wallet_policies_impl( ptr: impl CstDecode, keychain: impl CstDecode, @@ -1938,28 +1812,25 @@ fn wire__crate__api__wallet__bdk_wallet_policies_impl( ) } fn wire__crate__api__wallet__bdk_wallet_sign_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, ptr: impl CstDecode, psbt: impl CstDecode, sign_options: impl CstDecode>, -) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "bdk_wallet_sign", - port: Some(port_), - mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { let api_ptr = ptr.cst_decode(); let api_psbt = psbt.cst_decode(); let api_sign_options = sign_options.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::api::error::BdkError>((move || { - let output_ok = - crate::api::wallet::BdkWallet::sign(api_ptr, api_psbt, api_sign_options)?; - Ok(output_ok) - })()) - } + transform_result_dco::<_, _, crate::api::error::BdkError>((move || { + let output_ok = + crate::api::wallet::BdkWallet::sign(api_ptr, api_psbt, api_sign_options)?; + Ok(output_ok) + })()) }, ) } @@ -2775,6 +2646,56 @@ impl SseDecode for crate::api::types::BdkTransaction { } } +impl SseDecode for crate::api::types::BdkTransactionDetails { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_transaction = + >::sse_decode(deserializer); + let mut var_txid = ::sse_decode(deserializer); + let mut var_received = ::sse_decode(deserializer); + let mut var_sent = ::sse_decode(deserializer); + let mut var_fee = >::sse_decode(deserializer); + let mut var_confirmationTime = + >::sse_decode(deserializer); + return crate::api::types::BdkTransactionDetails { + transaction: var_transaction, + txid: var_txid, + received: var_received, + sent: var_sent, + fee: var_fee, + confirmation_time: var_confirmationTime, + }; + } +} + +impl SseDecode for crate::api::types::BdkTxIn { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_previousOutput = ::sse_decode(deserializer); + let mut var_scriptSig = >::sse_decode(deserializer); + let mut var_sequence = ::sse_decode(deserializer); + let mut var_witness = >>::sse_decode(deserializer); + return crate::api::types::BdkTxIn { + previous_output: var_previousOutput, + script_sig: var_scriptSig, + sequence: var_sequence, + witness: var_witness, + }; + } +} + +impl SseDecode for crate::api::types::BdkTxOut { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_value = ::sse_decode(deserializer); + let mut var_scriptPubkey = ::sse_decode(deserializer); + return crate::api::types::BdkTxOut { + value: var_value, + script_pubkey: var_scriptPubkey, + }; + } +} + impl SseDecode for crate::api::wallet::BdkWallet { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -3099,187 +3020,187 @@ impl SseDecode for Vec { } } -impl SseDecode for Vec { +impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(::sse_decode(deserializer)); + ans_.push(::sse_decode( + deserializer, + )); } return ans_; } } -impl SseDecode for Vec> { +impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(>::sse_decode(deserializer)); + ans_.push(::sse_decode(deserializer)); } return ans_; } } -impl SseDecode for Vec { +impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(::sse_decode(deserializer)); + ans_.push(::sse_decode(deserializer)); } return ans_; } } -impl SseDecode for Vec { +impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(::sse_decode(deserializer)); + ans_.push(::sse_decode(deserializer)); } return ans_; } } -impl SseDecode for Vec { +impl SseDecode for Vec> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(::sse_decode(deserializer)); + ans_.push(>::sse_decode(deserializer)); } return ans_; } } -impl SseDecode for Vec { +impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(::sse_decode(deserializer)); + ans_.push(::sse_decode(deserializer)); } return ans_; } } -impl SseDecode for Vec { +impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(::sse_decode(deserializer)); + ans_.push(::sse_decode(deserializer)); } return ans_; } } -impl SseDecode for Vec { +impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(::sse_decode(deserializer)); + ans_.push(::sse_decode(deserializer)); } return ans_; } } -impl SseDecode for Vec<(Vec, Vec)> { +impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(<(Vec, Vec)>::sse_decode( - deserializer, - )); + ans_.push(::sse_decode(deserializer)); } return ans_; } } -impl SseDecode for Vec<(String, Vec)> { +impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(<(String, Vec)>::sse_decode(deserializer)); + ans_.push(::sse_decode(deserializer)); } return ans_; } } -impl SseDecode for Vec<(u32, Vec)> { +impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(<(u32, Vec)>::sse_decode( - deserializer, - )); + ans_.push(::sse_decode(deserializer)); } return ans_; } } -impl SseDecode for Vec { +impl SseDecode for Vec<(Vec, Vec)> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(::sse_decode(deserializer)); + ans_.push(<(Vec, Vec)>::sse_decode( + deserializer, + )); } return ans_; } } -impl SseDecode for Vec { +impl SseDecode for Vec<(String, Vec)> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(::sse_decode( - deserializer, - )); + ans_.push(<(String, Vec)>::sse_decode(deserializer)); } return ans_; } } -impl SseDecode for Vec { +impl SseDecode for Vec<(u32, Vec)> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(::sse_decode(deserializer)); + ans_.push(<(u32, Vec)>::sse_decode( + deserializer, + )); } return ans_; } } -impl SseDecode for Vec { +impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut len_ = ::sse_decode(deserializer); let mut ans_ = vec![]; for idx_ in 0..len_ { - ans_.push(::sse_decode(deserializer)); + ans_.push(::sse_decode(deserializer)); } return ans_; } @@ -3289,7 +3210,7 @@ impl SseDecode for crate::api::types::LocalUtxo { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut var_outpoint = ::sse_decode(deserializer); - let mut var_txout = ::sse_decode(deserializer); + let mut var_txout = ::sse_decode(deserializer); let mut var_keychain = ::sse_decode(deserializer); let mut var_isSpent = ::sse_decode(deserializer); return crate::api::types::LocalUtxo { @@ -3676,13 +3597,13 @@ impl SseDecode for (crate::api::types::BdkAddress, u32) { impl SseDecode for ( crate::api::psbt::BdkPsbt, - crate::api::types::TransactionDetails, + crate::api::types::BdkTransactionDetails, ) { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut var_field0 = ::sse_decode(deserializer); - let mut var_field1 = ::sse_decode(deserializer); + let mut var_field1 = ::sse_decode(deserializer); return (var_field0, var_field1); } } @@ -3929,56 +3850,6 @@ impl SseDecode for crate::api::types::SqliteDbConfiguration { } } -impl SseDecode for crate::api::types::TransactionDetails { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { - let mut var_transaction = - >::sse_decode(deserializer); - let mut var_txid = ::sse_decode(deserializer); - let mut var_received = ::sse_decode(deserializer); - let mut var_sent = ::sse_decode(deserializer); - let mut var_fee = >::sse_decode(deserializer); - let mut var_confirmationTime = - >::sse_decode(deserializer); - return crate::api::types::TransactionDetails { - transaction: var_transaction, - txid: var_txid, - received: var_received, - sent: var_sent, - fee: var_fee, - confirmation_time: var_confirmationTime, - }; - } -} - -impl SseDecode for crate::api::types::TxIn { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { - let mut var_previousOutput = ::sse_decode(deserializer); - let mut var_scriptSig = ::sse_decode(deserializer); - let mut var_sequence = ::sse_decode(deserializer); - let mut var_witness = >>::sse_decode(deserializer); - return crate::api::types::TxIn { - previous_output: var_previousOutput, - script_sig: var_scriptSig, - sequence: var_sequence, - witness: var_witness, - }; - } -} - -impl SseDecode for crate::api::types::TxOut { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { - let mut var_value = ::sse_decode(deserializer); - let mut var_scriptPubkey = ::sse_decode(deserializer); - return crate::api::types::TxOut { - value: var_value, - script_pubkey: var_scriptPubkey, - }; - } -} - impl SseDecode for u32 { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -4564,6 +4435,67 @@ impl flutter_rust_bridge::IntoIntoDart } } // Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::types::BdkTransactionDetails { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.transaction.into_into_dart().into_dart(), + self.txid.into_into_dart().into_dart(), + self.received.into_into_dart().into_dart(), + self.sent.into_into_dart().into_dart(), + self.fee.into_into_dart().into_dart(), + self.confirmation_time.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::types::BdkTransactionDetails +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::types::BdkTransactionDetails +{ + fn into_into_dart(self) -> crate::api::types::BdkTransactionDetails { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::types::BdkTxIn { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.previous_output.into_into_dart().into_dart(), + self.script_sig.into_into_dart().into_dart(), + self.sequence.into_into_dart().into_dart(), + self.witness.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for crate::api::types::BdkTxIn {} +impl flutter_rust_bridge::IntoIntoDart for crate::api::types::BdkTxIn { + fn into_into_dart(self) -> crate::api::types::BdkTxIn { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::types::BdkTxOut { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.value.into_into_dart().into_dart(), + self.script_pubkey.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for crate::api::types::BdkTxOut {} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::types::BdkTxOut +{ + fn into_into_dart(self) -> crate::api::types::BdkTxOut { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for crate::api::wallet::BdkWallet { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { [self.ptr.into_into_dart().into_dart()].into_dart() @@ -5332,65 +5264,6 @@ impl flutter_rust_bridge::IntoIntoDart } } // Codec=Dco (DartCObject based), see doc to use other codecs -impl flutter_rust_bridge::IntoDart for crate::api::types::TransactionDetails { - fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { - [ - self.transaction.into_into_dart().into_dart(), - self.txid.into_into_dart().into_dart(), - self.received.into_into_dart().into_dart(), - self.sent.into_into_dart().into_dart(), - self.fee.into_into_dart().into_dart(), - self.confirmation_time.into_into_dart().into_dart(), - ] - .into_dart() - } -} -impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive - for crate::api::types::TransactionDetails -{ -} -impl flutter_rust_bridge::IntoIntoDart - for crate::api::types::TransactionDetails -{ - fn into_into_dart(self) -> crate::api::types::TransactionDetails { - self - } -} -// Codec=Dco (DartCObject based), see doc to use other codecs -impl flutter_rust_bridge::IntoDart for crate::api::types::TxIn { - fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { - [ - self.previous_output.into_into_dart().into_dart(), - self.script_sig.into_into_dart().into_dart(), - self.sequence.into_into_dart().into_dart(), - self.witness.into_into_dart().into_dart(), - ] - .into_dart() - } -} -impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for crate::api::types::TxIn {} -impl flutter_rust_bridge::IntoIntoDart for crate::api::types::TxIn { - fn into_into_dart(self) -> crate::api::types::TxIn { - self - } -} -// Codec=Dco (DartCObject based), see doc to use other codecs -impl flutter_rust_bridge::IntoDart for crate::api::types::TxOut { - fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { - [ - self.value.into_into_dart().into_dart(), - self.script_pubkey.into_into_dart().into_dart(), - ] - .into_dart() - } -} -impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for crate::api::types::TxOut {} -impl flutter_rust_bridge::IntoIntoDart for crate::api::types::TxOut { - fn into_into_dart(self) -> crate::api::types::TxOut { - self - } -} -// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for crate::api::types::Variant { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { match self { @@ -5996,6 +5869,36 @@ impl SseEncode for crate::api::types::BdkTransaction { } } +impl SseEncode for crate::api::types::BdkTransactionDetails { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.transaction, serializer); + ::sse_encode(self.txid, serializer); + ::sse_encode(self.received, serializer); + ::sse_encode(self.sent, serializer); + >::sse_encode(self.fee, serializer); + >::sse_encode(self.confirmation_time, serializer); + } +} + +impl SseEncode for crate::api::types::BdkTxIn { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.previous_output, serializer); + >::sse_encode(self.script_sig, serializer); + ::sse_encode(self.sequence, serializer); + >>::sse_encode(self.witness, serializer); + } +} + +impl SseEncode for crate::api::types::BdkTxOut { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.value, serializer); + ::sse_encode(self.script_pubkey, serializer); + } +} + impl SseEncode for crate::api::wallet::BdkWallet { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -6282,152 +6185,152 @@ impl SseEncode for Vec { } } -impl SseEncode for Vec { +impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - ::sse_encode(item, serializer); + ::sse_encode(item, serializer); } } } -impl SseEncode for Vec> { +impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - >::sse_encode(item, serializer); + ::sse_encode(item, serializer); } } } -impl SseEncode for Vec { +impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - ::sse_encode(item, serializer); + ::sse_encode(item, serializer); } } } -impl SseEncode for Vec { +impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - ::sse_encode(item, serializer); + ::sse_encode(item, serializer); } } } -impl SseEncode for Vec { +impl SseEncode for Vec> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - ::sse_encode(item, serializer); + >::sse_encode(item, serializer); } } } -impl SseEncode for Vec { +impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - ::sse_encode(item, serializer); + ::sse_encode(item, serializer); } } } -impl SseEncode for Vec { +impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - ::sse_encode(item, serializer); + ::sse_encode(item, serializer); } } } -impl SseEncode for Vec { +impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - ::sse_encode(item, serializer); + ::sse_encode(item, serializer); } } } -impl SseEncode for Vec<(Vec, Vec)> { +impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - <(Vec, Vec)>::sse_encode(item, serializer); + ::sse_encode(item, serializer); } } } -impl SseEncode for Vec<(String, Vec)> { +impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - <(String, Vec)>::sse_encode(item, serializer); + ::sse_encode(item, serializer); } } } -impl SseEncode for Vec<(u32, Vec)> { +impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - <(u32, Vec)>::sse_encode(item, serializer); + ::sse_encode(item, serializer); } } } -impl SseEncode for Vec { +impl SseEncode for Vec<(Vec, Vec)> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - ::sse_encode(item, serializer); + <(Vec, Vec)>::sse_encode(item, serializer); } } } -impl SseEncode for Vec { +impl SseEncode for Vec<(String, Vec)> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - ::sse_encode(item, serializer); + <(String, Vec)>::sse_encode(item, serializer); } } } -impl SseEncode for Vec { +impl SseEncode for Vec<(u32, Vec)> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - ::sse_encode(item, serializer); + <(u32, Vec)>::sse_encode(item, serializer); } } } -impl SseEncode for Vec { +impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.len() as _, serializer); for item in self { - ::sse_encode(item, serializer); + ::sse_encode(item, serializer); } } } @@ -6436,7 +6339,7 @@ impl SseEncode for crate::api::types::LocalUtxo { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.outpoint, serializer); - ::sse_encode(self.txout, serializer); + ::sse_encode(self.txout, serializer); ::sse_encode(self.keychain, serializer); ::sse_encode(self.is_spent, serializer); } @@ -6772,13 +6675,13 @@ impl SseEncode for (crate::api::types::BdkAddress, u32) { impl SseEncode for ( crate::api::psbt::BdkPsbt, - crate::api::types::TransactionDetails, + crate::api::types::BdkTransactionDetails, ) { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode(self.0, serializer); - ::sse_encode(self.1, serializer); + ::sse_encode(self.1, serializer); } } @@ -6974,36 +6877,6 @@ impl SseEncode for crate::api::types::SqliteDbConfiguration { } } -impl SseEncode for crate::api::types::TransactionDetails { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - >::sse_encode(self.transaction, serializer); - ::sse_encode(self.txid, serializer); - ::sse_encode(self.received, serializer); - ::sse_encode(self.sent, serializer); - >::sse_encode(self.fee, serializer); - >::sse_encode(self.confirmation_time, serializer); - } -} - -impl SseEncode for crate::api::types::TxIn { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - ::sse_encode(self.previous_output, serializer); - ::sse_encode(self.script_sig, serializer); - ::sse_encode(self.sequence, serializer); - >>::sse_encode(self.witness, serializer); - } -} - -impl SseEncode for crate::api::types::TxOut { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - ::sse_encode(self.value, serializer); - ::sse_encode(self.script_pubkey, serializer); - } -} - impl SseEncode for u32 { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { diff --git a/test/bdk_flutter_test.mocks.dart b/test/bdk_flutter_test.mocks.dart index 86e4330..4446493 100644 --- a/test/bdk_flutter_test.mocks.dart +++ b/test/bdk_flutter_test.mocks.dart @@ -235,8 +235,8 @@ class _FakeDerivationPath_19 extends _i1.SmartFake ); } -class _FakeOutPoint_20 extends _i1.SmartFake implements _i4.OutPoint { - _FakeOutPoint_20( +class _FakeTxOut_20 extends _i1.SmartFake implements _i3.TxOut { + _FakeTxOut_20( Object parent, Invocation parentInvocation, ) : super( @@ -245,8 +245,8 @@ class _FakeOutPoint_20 extends _i1.SmartFake implements _i4.OutPoint { ); } -class _FakeTxOut_21 extends _i1.SmartFake implements _i4.TxOut { - _FakeTxOut_21( +class _FakeOutPoint_21 extends _i1.SmartFake implements _i4.OutPoint { + _FakeOutPoint_21( Object parent, Invocation parentInvocation, ) : super( @@ -413,7 +413,7 @@ class MockWallet extends _i1.Mock implements _i3.Wallet { ) as _i3.AddressInfo); @override - _i5.Future<_i4.Input> getPsbtInput({ + _i4.Input getPsbtInput({ required _i4.LocalUtxo? utxo, required bool? onlyWitnessUtxo, _i4.PsbtSigHashType? sighashType, @@ -430,7 +430,7 @@ class MockWallet extends _i1.Mock implements _i3.Wallet { #hint: hint, }, ), - returnValue: _i5.Future<_i4.Input>.value(_FakeInput_4( + returnValue: _FakeInput_4( this, Invocation.method( #getPsbtInput, @@ -442,8 +442,8 @@ class MockWallet extends _i1.Mock implements _i3.Wallet { #hint: hint, }, ), - )), - returnValueForMissingStub: _i5.Future<_i4.Input>.value(_FakeInput_4( + ), + returnValueForMissingStub: _FakeInput_4( this, Invocation.method( #getPsbtInput, @@ -455,8 +455,8 @@ class MockWallet extends _i1.Mock implements _i3.Wallet { #hint: hint, }, ), - )), - ) as _i5.Future<_i4.Input>); + ), + ) as _i4.Input); @override bool isMine({required _i3.ScriptBuf? script}) => (super.noSuchMethod( @@ -488,15 +488,15 @@ class MockWallet extends _i1.Mock implements _i3.Wallet { ) as List<_i3.TransactionDetails>); @override - List<_i4.LocalUtxo> listUnspent({dynamic hint}) => (super.noSuchMethod( + List<_i3.LocalUtxo> listUnspent({dynamic hint}) => (super.noSuchMethod( Invocation.method( #listUnspent, [], {#hint: hint}, ), - returnValue: <_i4.LocalUtxo>[], - returnValueForMissingStub: <_i4.LocalUtxo>[], - ) as List<_i4.LocalUtxo>); + returnValue: <_i3.LocalUtxo>[], + returnValueForMissingStub: <_i3.LocalUtxo>[], + ) as List<_i3.LocalUtxo>); @override _i4.Network network({dynamic hint}) => (super.noSuchMethod( @@ -510,7 +510,7 @@ class MockWallet extends _i1.Mock implements _i3.Wallet { ) as _i4.Network); @override - _i5.Future sign({ + bool sign({ required _i3.PartiallySignedTransaction? psbt, _i4.SignOptions? signOptions, dynamic hint, @@ -525,9 +525,9 @@ class MockWallet extends _i1.Mock implements _i3.Wallet { #hint: hint, }, ), - returnValue: _i5.Future.value(false), - returnValueForMissingStub: _i5.Future.value(false), - ) as _i5.Future); + returnValue: false, + returnValueForMissingStub: false, + ) as bool); @override _i5.Future sync({ @@ -575,193 +575,186 @@ class MockTransaction extends _i1.Mock implements _i3.Transaction { ) as String); @override - _i5.Future> input() => (super.noSuchMethod( + List<_i3.TxIn> input({dynamic hint}) => (super.noSuchMethod( Invocation.method( #input, [], + {#hint: hint}, ), - returnValue: _i5.Future>.value(<_i4.TxIn>[]), - returnValueForMissingStub: - _i5.Future>.value(<_i4.TxIn>[]), - ) as _i5.Future>); + returnValue: <_i3.TxIn>[], + returnValueForMissingStub: <_i3.TxIn>[], + ) as List<_i3.TxIn>); + + @override + List<_i3.TxOut> output({dynamic hint}) => (super.noSuchMethod( + Invocation.method( + #output, + [], + {#hint: hint}, + ), + returnValue: <_i3.TxOut>[], + returnValueForMissingStub: <_i3.TxOut>[], + ) as List<_i3.TxOut>); @override - _i5.Future isCoinBase() => (super.noSuchMethod( + bool isCoinBase() => (super.noSuchMethod( Invocation.method( #isCoinBase, [], ), - returnValue: _i5.Future.value(false), - returnValueForMissingStub: _i5.Future.value(false), - ) as _i5.Future); + returnValue: false, + returnValueForMissingStub: false, + ) as bool); @override - _i5.Future isExplicitlyRbf() => (super.noSuchMethod( + bool isExplicitlyRbf() => (super.noSuchMethod( Invocation.method( #isExplicitlyRbf, [], ), - returnValue: _i5.Future.value(false), - returnValueForMissingStub: _i5.Future.value(false), - ) as _i5.Future); + returnValue: false, + returnValueForMissingStub: false, + ) as bool); @override - _i5.Future isLockTimeEnabled() => (super.noSuchMethod( + bool isLockTimeEnabled() => (super.noSuchMethod( Invocation.method( #isLockTimeEnabled, [], ), - returnValue: _i5.Future.value(false), - returnValueForMissingStub: _i5.Future.value(false), - ) as _i5.Future); + returnValue: false, + returnValueForMissingStub: false, + ) as bool); @override - _i5.Future<_i4.LockTime> lockTime() => (super.noSuchMethod( + _i4.LockTime lockTime() => (super.noSuchMethod( Invocation.method( #lockTime, [], ), - returnValue: - _i5.Future<_i4.LockTime>.value(_i6.dummyValue<_i4.LockTime>( + returnValue: _i6.dummyValue<_i4.LockTime>( this, Invocation.method( #lockTime, [], ), - )), - returnValueForMissingStub: - _i5.Future<_i4.LockTime>.value(_i6.dummyValue<_i4.LockTime>( + ), + returnValueForMissingStub: _i6.dummyValue<_i4.LockTime>( this, Invocation.method( #lockTime, [], ), - )), - ) as _i5.Future<_i4.LockTime>); - - @override - _i5.Future> output() => (super.noSuchMethod( - Invocation.method( - #output, - [], ), - returnValue: _i5.Future>.value(<_i4.TxOut>[]), - returnValueForMissingStub: - _i5.Future>.value(<_i4.TxOut>[]), - ) as _i5.Future>); + ) as _i4.LockTime); @override - _i5.Future<_i7.Uint8List> serialize() => (super.noSuchMethod( + _i7.Uint8List serialize() => (super.noSuchMethod( Invocation.method( #serialize, [], ), - returnValue: _i5.Future<_i7.Uint8List>.value(_i7.Uint8List(0)), - returnValueForMissingStub: - _i5.Future<_i7.Uint8List>.value(_i7.Uint8List(0)), - ) as _i5.Future<_i7.Uint8List>); + returnValue: _i7.Uint8List(0), + returnValueForMissingStub: _i7.Uint8List(0), + ) as _i7.Uint8List); @override - _i5.Future size() => (super.noSuchMethod( + BigInt size() => (super.noSuchMethod( Invocation.method( #size, [], ), - returnValue: _i5.Future.value(_i6.dummyValue( + returnValue: _i6.dummyValue( this, Invocation.method( #size, [], ), - )), - returnValueForMissingStub: - _i5.Future.value(_i6.dummyValue( + ), + returnValueForMissingStub: _i6.dummyValue( this, Invocation.method( #size, [], ), - )), - ) as _i5.Future); + ), + ) as BigInt); @override - _i5.Future txid() => (super.noSuchMethod( + String txid() => (super.noSuchMethod( Invocation.method( #txid, [], ), - returnValue: _i5.Future.value(_i6.dummyValue( + returnValue: _i6.dummyValue( this, Invocation.method( #txid, [], ), - )), - returnValueForMissingStub: - _i5.Future.value(_i6.dummyValue( + ), + returnValueForMissingStub: _i6.dummyValue( this, Invocation.method( #txid, [], ), - )), - ) as _i5.Future); + ), + ) as String); @override - _i5.Future version() => (super.noSuchMethod( + int version() => (super.noSuchMethod( Invocation.method( #version, [], ), - returnValue: _i5.Future.value(0), - returnValueForMissingStub: _i5.Future.value(0), - ) as _i5.Future); + returnValue: 0, + returnValueForMissingStub: 0, + ) as int); @override - _i5.Future vsize() => (super.noSuchMethod( + BigInt vsize() => (super.noSuchMethod( Invocation.method( #vsize, [], ), - returnValue: _i5.Future.value(_i6.dummyValue( + returnValue: _i6.dummyValue( this, Invocation.method( #vsize, [], ), - )), - returnValueForMissingStub: - _i5.Future.value(_i6.dummyValue( + ), + returnValueForMissingStub: _i6.dummyValue( this, Invocation.method( #vsize, [], ), - )), - ) as _i5.Future); + ), + ) as BigInt); @override - _i5.Future weight() => (super.noSuchMethod( + BigInt weight() => (super.noSuchMethod( Invocation.method( #weight, [], ), - returnValue: _i5.Future.value(_i6.dummyValue( + returnValue: _i6.dummyValue( this, Invocation.method( #weight, [], ), - )), - returnValueForMissingStub: - _i5.Future.value(_i6.dummyValue( + ), + returnValueForMissingStub: _i6.dummyValue( this, Invocation.method( #weight, [], ), - )), - ) as _i5.Future); + ), + ) as BigInt); } /// A class which mocks [Blockchain]. @@ -928,54 +921,50 @@ class MockDescriptorSecretKey extends _i1.Mock ) as _i2.DescriptorSecretKey); @override - _i5.Future<_i3.DescriptorSecretKey> derive(_i3.DerivationPath? path) => + _i3.DescriptorSecretKey derive(_i3.DerivationPath? path) => (super.noSuchMethod( Invocation.method( #derive, [path], ), - returnValue: _i5.Future<_i3.DescriptorSecretKey>.value( - _FakeDescriptorSecretKey_8( + returnValue: _FakeDescriptorSecretKey_8( this, Invocation.method( #derive, [path], ), - )), - returnValueForMissingStub: _i5.Future<_i3.DescriptorSecretKey>.value( - _FakeDescriptorSecretKey_8( + ), + returnValueForMissingStub: _FakeDescriptorSecretKey_8( this, Invocation.method( #derive, [path], ), - )), - ) as _i5.Future<_i3.DescriptorSecretKey>); + ), + ) as _i3.DescriptorSecretKey); @override - _i5.Future<_i3.DescriptorSecretKey> extend(_i3.DerivationPath? path) => + _i3.DescriptorSecretKey extend(_i3.DerivationPath? path) => (super.noSuchMethod( Invocation.method( #extend, [path], ), - returnValue: _i5.Future<_i3.DescriptorSecretKey>.value( - _FakeDescriptorSecretKey_8( + returnValue: _FakeDescriptorSecretKey_8( this, Invocation.method( #extend, [path], ), - )), - returnValueForMissingStub: _i5.Future<_i3.DescriptorSecretKey>.value( - _FakeDescriptorSecretKey_8( + ), + returnValueForMissingStub: _FakeDescriptorSecretKey_8( this, Invocation.method( #extend, [path], ), - )), - ) as _i5.Future<_i3.DescriptorSecretKey>); + ), + ) as _i3.DescriptorSecretKey); @override _i3.DescriptorPublicKey toPublic() => (super.noSuchMethod( @@ -1052,7 +1041,7 @@ class MockDescriptorPublicKey extends _i1.Mock ) as _i2.DescriptorPublicKey); @override - _i5.Future<_i3.DescriptorPublicKey> derive({ + _i3.DescriptorPublicKey derive({ required _i3.DerivationPath? path, dynamic hint, }) => @@ -1065,8 +1054,7 @@ class MockDescriptorPublicKey extends _i1.Mock #hint: hint, }, ), - returnValue: _i5.Future<_i3.DescriptorPublicKey>.value( - _FakeDescriptorPublicKey_9( + returnValue: _FakeDescriptorPublicKey_9( this, Invocation.method( #derive, @@ -1076,9 +1064,8 @@ class MockDescriptorPublicKey extends _i1.Mock #hint: hint, }, ), - )), - returnValueForMissingStub: _i5.Future<_i3.DescriptorPublicKey>.value( - _FakeDescriptorPublicKey_9( + ), + returnValueForMissingStub: _FakeDescriptorPublicKey_9( this, Invocation.method( #derive, @@ -1088,11 +1075,11 @@ class MockDescriptorPublicKey extends _i1.Mock #hint: hint, }, ), - )), - ) as _i5.Future<_i3.DescriptorPublicKey>); + ), + ) as _i3.DescriptorPublicKey); @override - _i5.Future<_i3.DescriptorPublicKey> extend({ + _i3.DescriptorPublicKey extend({ required _i3.DerivationPath? path, dynamic hint, }) => @@ -1105,8 +1092,7 @@ class MockDescriptorPublicKey extends _i1.Mock #hint: hint, }, ), - returnValue: _i5.Future<_i3.DescriptorPublicKey>.value( - _FakeDescriptorPublicKey_9( + returnValue: _FakeDescriptorPublicKey_9( this, Invocation.method( #extend, @@ -1116,9 +1102,8 @@ class MockDescriptorPublicKey extends _i1.Mock #hint: hint, }, ), - )), - returnValueForMissingStub: _i5.Future<_i3.DescriptorPublicKey>.value( - _FakeDescriptorPublicKey_9( + ), + returnValueForMissingStub: _FakeDescriptorPublicKey_9( this, Invocation.method( #extend, @@ -1128,8 +1113,8 @@ class MockDescriptorPublicKey extends _i1.Mock #hint: hint, }, ), - )), - ) as _i5.Future<_i3.DescriptorPublicKey>); + ), + ) as _i3.DescriptorPublicKey); @override String asString() => (super.noSuchMethod( @@ -1231,31 +1216,28 @@ class MockPartiallySignedTransaction extends _i1.Mock ) as _i3.Transaction); @override - _i5.Future<_i3.PartiallySignedTransaction> combine( + _i3.PartiallySignedTransaction combine( _i3.PartiallySignedTransaction? other) => (super.noSuchMethod( Invocation.method( #combine, [other], ), - returnValue: _i5.Future<_i3.PartiallySignedTransaction>.value( - _FakePartiallySignedTransaction_13( + returnValue: _FakePartiallySignedTransaction_13( this, Invocation.method( #combine, [other], ), - )), - returnValueForMissingStub: - _i5.Future<_i3.PartiallySignedTransaction>.value( - _FakePartiallySignedTransaction_13( + ), + returnValueForMissingStub: _FakePartiallySignedTransaction_13( this, Invocation.method( #combine, [other], ), - )), - ) as _i5.Future<_i3.PartiallySignedTransaction>); + ), + ) as _i3.PartiallySignedTransaction); @override String txid({dynamic hint}) => (super.noSuchMethod( @@ -2155,32 +2137,32 @@ class MockFeeRate extends _i1.Mock implements _i4.FeeRate { /// A class which mocks [LocalUtxo]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocalUtxo extends _i1.Mock implements _i4.LocalUtxo { +class MockLocalUtxo extends _i1.Mock implements _i3.LocalUtxo { @override - _i4.OutPoint get outpoint => (super.noSuchMethod( - Invocation.getter(#outpoint), - returnValue: _FakeOutPoint_20( + _i3.TxOut get txout => (super.noSuchMethod( + Invocation.getter(#txout), + returnValue: _FakeTxOut_20( this, - Invocation.getter(#outpoint), + Invocation.getter(#txout), ), - returnValueForMissingStub: _FakeOutPoint_20( + returnValueForMissingStub: _FakeTxOut_20( this, - Invocation.getter(#outpoint), + Invocation.getter(#txout), ), - ) as _i4.OutPoint); + ) as _i3.TxOut); @override - _i4.TxOut get txout => (super.noSuchMethod( - Invocation.getter(#txout), - returnValue: _FakeTxOut_21( + _i4.OutPoint get outpoint => (super.noSuchMethod( + Invocation.getter(#outpoint), + returnValue: _FakeOutPoint_21( this, - Invocation.getter(#txout), + Invocation.getter(#outpoint), ), - returnValueForMissingStub: _FakeTxOut_21( + returnValueForMissingStub: _FakeOutPoint_21( this, - Invocation.getter(#txout), + Invocation.getter(#outpoint), ), - ) as _i4.TxOut); + ) as _i4.OutPoint); @override _i4.KeychainKind get keychain => (super.noSuchMethod(