diff --git a/example/integration_test/bdk_full_cycle_test.dart b/example/integration_test/bdk_full_cycle_test.dart index 42c4f30..d0d8c35 100644 --- a/example/integration_test/bdk_full_cycle_test.dart +++ b/example/integration_test/bdk_full_cycle_test.dart @@ -37,7 +37,7 @@ void main() { await sender.syncWallet(); // Sender create a funded PSBT (not broadcast) to address with amount given in the pjUri debugPrint("Sender Balance: ${sender.getBalance().toString()}"); - final uri = await pay_join_uri.Uri.fromString( + final uri = await pay_join_uri.Uri.fromStr( "${pjReceiverAddress.toQrUri()}?amount=${0.0083285}&pj=https://example.com"); final address = uri.address(); int amount = (((uri.amount()) ?? 0) * 100000000).toInt(); @@ -55,7 +55,7 @@ void main() { maxFeeContribution: BigInt.from(10000), minFeeRate: BigInt.zero, clampFeeContribution: false)) - .extractContextV1(); + .extractV1(); final headers = common.Headers(map: { 'content-type': 'text/plain', 'content-length': req.body.length.toString(), diff --git a/example/integration_test/bitcoin_core_full_cycle_test.dart b/example/integration_test/bitcoin_core_full_cycle_test.dart index 536aa44..dc44d99 100644 --- a/example/integration_test/bitcoin_core_full_cycle_test.dart +++ b/example/integration_test/bitcoin_core_full_cycle_test.dart @@ -30,7 +30,7 @@ void main() { final pjUri = await payJoinLib.buildPjUri(0.0083285, pjReceiverAddress); // Sender create a funded PSBT (not broadcast) to address with amount given in the pjUri debugPrint("Sender Balance: ${(await sender.getBalance()).toString()}"); - final uri = await pay_join_uri.Uri.fromString(pjUri); + final uri = await pay_join_uri.Uri.fromStr(pjUri); final address = await uri.address(); final amount = await uri.amount(); final senderPsbt = diff --git a/example/lib/main.dart b/example/lib/main.dart index 41db74b..4a8288f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -145,7 +145,7 @@ class _PayJoinState extends State { onPressed: () async { final balance = await sender.getBalance(); debugPrint("Sender Balance: ${balance.toString()}"); - final uri = await pay_join_uri.Uri.fromString(pjUri); + final uri = await pay_join_uri.Uri.fromStr(pjUri); final address = await uri.address(); int amount = (((await uri.amount()) ?? 0) * 100000000).toInt(); diff --git a/example/lib/payjoin_library.dart b/example/lib/payjoin_library.dart index 2a6d6f4..7945ee2 100644 --- a/example/lib/payjoin_library.dart +++ b/example/lib/payjoin_library.dart @@ -14,7 +14,7 @@ class PayJoinLibrary { Future buildPjUri(double amount, String address, {String? pj}) async { try { final pjUri = "$address?amount=$amount&pj=${pj ?? pjUrl}"; - await pj_uri.Uri.fromString(pjUri); + await pj_uri.Uri.fromStr(pjUri); return pjUri; } catch (e) { debugPrint(e.toString()); @@ -26,14 +26,14 @@ class PayJoinLibrary { String psbtBase64, String uriStr, Future Function(Uint8List) isOwned) async { - final uri = await pj_uri.Uri.fromString(uriStr); + final uri = await pj_uri.Uri.fromStr(uriStr); final (req, cxt) = await (await (await send.RequestBuilder.fromPsbtAndUri( psbtBase64: psbtBase64, pjUri: uri.checkPjSupported())) .buildWithAdditionalFee( maxFeeContribution: BigInt.from(10000), minFeeRate: BigInt.zero, clampFeeContribution: false)) - .extractContextV1(); + .extractV1(); final headers = common.Headers(map: { 'content-type': 'text/plain', 'content-length': req.body.length.toString(), diff --git a/ios/Classes/frb_generated.h b/ios/Classes/frb_generated.h index 14a4248..183ce1a 100644 --- a/ios/Classes/frb_generated.h +++ b/ios/Classes/frb_generated.h @@ -27,9 +27,9 @@ typedef struct wire_cst_list_prim_u_8_loose { int32_t len; } wire_cst_list_prim_u_8_loose; -typedef struct wire_cst_ffi_client_response { +typedef struct wire_cst_client_response { uintptr_t field0; -} wire_cst_ffi_client_response; +} wire_cst_client_response; typedef struct wire_cst_ffi_maybe_inputs_owned { uintptr_t field0; @@ -270,57 +270,58 @@ typedef struct wire_cst_payjoin_error { union PayjoinErrorKind kind; } wire_cst_payjoin_error; -typedef struct wire_cst_record_ffi_url_list_prim_u_8_strict { - struct wire_cst_ffi_url field0; - struct wire_cst_list_prim_u_8_strict *field1; -} wire_cst_record_ffi_url_list_prim_u_8_strict; +typedef struct wire_cst_request { + struct wire_cst_ffi_url url; + struct wire_cst_list_prim_u_8_strict *body; +} wire_cst_request; -typedef struct wire_cst_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response { - struct wire_cst_record_ffi_url_list_prim_u_8_strict field0; - struct wire_cst_ffi_client_response field1; -} wire_cst_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response; +typedef struct wire_cst_record_request_client_response { + struct wire_cst_request field0; + struct wire_cst_client_response field1; +} wire_cst_record_request_client_response; -typedef struct wire_cst_request_context_v_1 { - struct wire_cst_record_ffi_url_list_prim_u_8_strict request; - struct wire_cst_ffi_context_v_1 context_v1; -} wire_cst_request_context_v_1; +typedef struct wire_cst_record_request_ffi_context_v_1 { + struct wire_cst_request field0; + struct wire_cst_ffi_context_v_1 field1; +} wire_cst_record_request_ffi_context_v_1; -typedef struct wire_cst_request_context_v_2 { - struct wire_cst_record_ffi_url_list_prim_u_8_strict request; - struct wire_cst_ffi_context_v_2 context_v2; -} wire_cst_request_context_v_2; +typedef struct wire_cst_record_request_ffi_context_v_2 { + struct wire_cst_request field0; + struct wire_cst_ffi_context_v_2 field1; +} wire_cst_record_request_ffi_context_v_2; void frbgen_payjoin_flutter_wire__crate__api__io__fetch_ohttp_keys(int64_t port_, struct wire_cst_ffi_url *ohttp_relay, struct wire_cst_ffi_url *payjoin_directory); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_extract_req(int64_t port_, - struct wire_cst_ffi_active_session *ptr); + struct wire_cst_ffi_active_session *that); -WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_pj_uri_builder(struct wire_cst_ffi_active_session *ptr); +WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_pj_uri_builder(struct wire_cst_ffi_active_session *that); -WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_pj_url(struct wire_cst_ffi_active_session *ptr); +void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_pj_url(int64_t port_, + struct wire_cst_ffi_active_session *that); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_process_res(int64_t port_, struct wire_cst_ffi_active_session *that, struct wire_cst_list_prim_u_8_loose *body, - struct wire_cst_ffi_client_response *ctx); + struct wire_cst_client_response *ctx); WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_public_key(struct wire_cst_ffi_active_session *that); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_maybe_inputs_owned_check_inputs_not_owned(int64_t port_, - struct wire_cst_ffi_maybe_inputs_owned *ptr, + struct wire_cst_ffi_maybe_inputs_owned *that, const void *is_owned); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_maybe_inputs_seen_check_no_inputs_seen_before(int64_t port_, - struct wire_cst_ffi_maybe_inputs_seen *ptr, + struct wire_cst_ffi_maybe_inputs_seen *that, const void *is_known); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_maybe_mixed_input_scripts_check_no_mixed_input_scripts(int64_t port_, - struct wire_cst_ffi_maybe_mixed_input_scripts *ptr); + struct wire_cst_ffi_maybe_mixed_input_scripts *that); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_outputs_unknown_identify_receiver_outputs(int64_t port_, - struct wire_cst_ffi_outputs_unknown *ptr, + struct wire_cst_ffi_outputs_unknown *that, const void *is_receiver_output); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_payjoin_proposal_is_output_substitution_disabled(int64_t port_, @@ -346,9 +347,9 @@ void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_provisional_proposal_ struct wire_cst_out_point *outpoint); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_provisional_proposal_finalize_proposal(int64_t port_, - struct wire_cst_ffi_provisional_proposal *ptr, + struct wire_cst_ffi_provisional_proposal *that, const void *process_psbt, - uint64_t *min_feerate_sat_per_vb); + uint64_t *min_fee_rate_sat_per_vb); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_provisional_proposal_try_preserving_privacy(int64_t port_, struct wire_cst_ffi_provisional_proposal *that, @@ -359,7 +360,7 @@ void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_provisional_proposal_ const void *generate_script); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_session_initializer_extract_req(int64_t port_, - struct wire_cst_ffi_session_initializer *ptr); + struct wire_cst_ffi_session_initializer *that); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_session_initializer_new(int64_t port_, struct wire_cst_list_prim_u_8_strict *address, @@ -372,13 +373,13 @@ void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_session_initializer_n void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_session_initializer_process_res(int64_t port_, struct wire_cst_ffi_session_initializer *that, struct wire_cst_list_prim_u_8_loose *body, - struct wire_cst_ffi_client_response *ctx); + struct wire_cst_client_response *ctx); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_unchecked_proposal_assume_interactive_receiver(int64_t port_, - struct wire_cst_ffi_unchecked_proposal *ptr); + struct wire_cst_ffi_unchecked_proposal *that); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_unchecked_proposal_check_broadcast_suitability(int64_t port_, - struct wire_cst_ffi_unchecked_proposal *ptr, + struct wire_cst_ffi_unchecked_proposal *that, uint64_t *min_fee_rate, const void *can_broadcast); @@ -409,7 +410,7 @@ void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_payjoin_proposal_ struct wire_cst_ffi_v_2_payjoin_proposal *that); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_payjoin_proposal_extract_v2_req(int64_t port_, - struct wire_cst_ffi_v_2_payjoin_proposal *ptr); + struct wire_cst_ffi_v_2_payjoin_proposal *that); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_payjoin_proposal_is_output_substitution_disabled(int64_t port_, struct wire_cst_ffi_v_2_payjoin_proposal *that); @@ -420,7 +421,7 @@ void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_payjoin_proposal_ void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_payjoin_proposal_process_res(int64_t port_, struct wire_cst_ffi_v_2_payjoin_proposal *that, struct wire_cst_list_prim_u_8_loose *res, - struct wire_cst_ffi_client_response *ohttp_context); + struct wire_cst_client_response *ohttp_context); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_payjoin_proposal_psbt(int64_t port_, struct wire_cst_ffi_v_2_payjoin_proposal *that); @@ -441,7 +442,7 @@ void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_provisional_propo void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_provisional_proposal_finalize_proposal(int64_t port_, struct wire_cst_ffi_v_2_provisional_proposal *that, const void *process_psbt, - uint64_t *min_feerate_sat_per_vb); + uint64_t *min_fee_rate_sat_per_vb); void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_provisional_proposal_is_output_substitution_disabled(int64_t port_, struct wire_cst_ffi_v_2_provisional_proposal *that); @@ -497,10 +498,10 @@ void frbgen_payjoin_flutter_wire__crate__api__send__ffi_request_builder_from_psb struct wire_cst_ffi_pj_uri *pj_uri); void frbgen_payjoin_flutter_wire__crate__api__send__ffi_request_context_extract_v1(int64_t port_, - struct wire_cst_ffi_request_context *ptr); + struct wire_cst_ffi_request_context *that); void frbgen_payjoin_flutter_wire__crate__api__send__ffi_request_context_extract_v2(int64_t port_, - struct wire_cst_ffi_request_context *ptr, + struct wire_cst_ffi_request_context *that, struct wire_cst_ffi_url *ohttp_proxy_url); void frbgen_payjoin_flutter_wire__crate__api__uri__ffi_ohttp_keys_decode(int64_t port_, @@ -540,13 +541,11 @@ WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__uri__ffi_uri_as_st WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__uri__ffi_uri_check_pj_supported(struct wire_cst_ffi_uri *that); -void frbgen_payjoin_flutter_wire__crate__api__uri__ffi_uri_from_str(int64_t port_, - struct wire_cst_list_prim_u_8_strict *uri); +WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__uri__ffi_uri_from_str(struct wire_cst_list_prim_u_8_strict *uri); WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__uri__ffi_url_as_string(struct wire_cst_ffi_url *that); -void frbgen_payjoin_flutter_wire__crate__api__uri__ffi_url_from_str(int64_t port_, - struct wire_cst_list_prim_u_8_strict *url); +WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__uri__ffi_url_from_str(struct wire_cst_list_prim_u_8_strict *url); WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__uri__ffi_url_query(struct wire_cst_ffi_url *that); @@ -554,6 +553,10 @@ void frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_Arcpayjoi void frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffireceivev2V2PayjoinProposal(const void *ptr); +void frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1(const void *ptr); + +void frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1(const void *ptr); + void frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv2ContextV2(const void *ptr); void frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv2ContextV2(const void *ptr); @@ -618,10 +621,6 @@ void frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_f void frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffireceivev2V2UncheckedProposal(const void *ptr); -void frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1ContextV1(const void *ptr); - -void frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1ContextV1(const void *ptr); - void frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1RequestBuilder(const void *ptr); void frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1RequestBuilder(const void *ptr); @@ -654,12 +653,12 @@ void frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_stdsyncMu void frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_stdsyncMutexcoreoptionOptionohttpClientResponse(const void *ptr); +struct wire_cst_client_response *frbgen_payjoin_flutter_cst_new_box_autoadd_client_response(void); + double *frbgen_payjoin_flutter_cst_new_box_autoadd_f_64(double value); struct wire_cst_ffi_active_session *frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_active_session(void); -struct wire_cst_ffi_client_response *frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_client_response(void); - struct wire_cst_ffi_context_v_1 *frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_context_v_1(void); struct wire_cst_ffi_context_v_2 *frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_context_v_2(void); @@ -731,9 +730,9 @@ struct wire_cst_list_record_string_string *frbgen_payjoin_flutter_cst_new_list_r struct wire_cst_list_record_u_64_out_point *frbgen_payjoin_flutter_cst_new_list_record_u_64_out_point(int32_t len); static int64_t dummy_method_to_enforce_bundling(void) { int64_t dummy_var = 0; + dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_cst_new_box_autoadd_client_response); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_cst_new_box_autoadd_f_64); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_active_session); - dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_client_response); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_context_v_1); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_context_v_2); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_maybe_inputs_owned); @@ -770,6 +769,7 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_cst_new_list_record_string_string); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_cst_new_list_record_u_64_out_point); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffireceivev2V2PayjoinProposal); + dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv2ContextV2); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffireceivev1MaybeInputsOwned); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffireceivev1MaybeInputsSeen); @@ -786,7 +786,6 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffireceivev2V2OutputsUnknown); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffireceivev2V2ProvisionalProposal); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffireceivev2V2UncheckedProposal); - dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1ContextV1); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1RequestBuilder); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1RequestContext); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffitypesOhttpKeys); @@ -796,6 +795,7 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffiuriUrl); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_stdsyncMutexcoreoptionOptionohttpClientResponse); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffireceivev2V2PayjoinProposal); + dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv2ContextV2); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffireceivev1MaybeInputsOwned); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffireceivev1MaybeInputsSeen); @@ -812,7 +812,6 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffireceivev2V2OutputsUnknown); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffireceivev2V2ProvisionalProposal); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffireceivev2V2UncheckedProposal); - dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1ContextV1); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1RequestBuilder); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1RequestContext); dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffitypesOhttpKeys); diff --git a/lib/common.dart b/lib/common.dart index 045a825..70704bf 100644 --- a/lib/common.dart +++ b/lib/common.dart @@ -1,11 +1,2 @@ -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; -import 'package:payjoin_flutter/uri.dart'; - export 'src/exceptions.dart' hide mapPayjoinError, ExceptionBase; export 'src/generated/utils/types.dart'; - -class Request { - final Url url; - final Uint8List body; - Request(this.url, this.body); -} diff --git a/lib/receive/v1.dart b/lib/receive/v1.dart index 758fe1c..8677cff 100644 --- a/lib/receive/v1.dart +++ b/lib/receive/v1.dart @@ -40,13 +40,14 @@ class UncheckedProposal extends FfiUncheckedProposal { /// Receiver MUST check that the Original PSBT from the sender can be broadcast, i.e. testmempoolaccept bitcoind rpc returns { “allowed”: true,.. } for gettransactiontocheckbroadcast() before calling this method. /// Do this check if you generate bitcoin uri to receive Payjoin on sender request without manual human approval, like a payment processor. Such so called “non-interactive” receivers are otherwise vulnerable to probing attacks. If a sender can make requests at will, they can learn which bitcoin the receiver owns at no cost. Broadcasting the Original PSBT after some time in the failure case makes incurs sender cost and prevents probing. /// Call this after checking downstream. + @override Future checkBroadcastSuitability( {BigInt? minFeeRate, required FutureOr Function(Uint8List) canBroadcast, hint}) async { try { - final res = await FfiUncheckedProposal.checkBroadcastSuitability( - minFeeRate: minFeeRate, canBroadcast: canBroadcast, ptr: this); + final res = await super.checkBroadcastSuitability( + minFeeRate: minFeeRate, canBroadcast: canBroadcast); return MaybeInputsOwned._(field0: res.field0); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); @@ -56,10 +57,10 @@ class UncheckedProposal extends FfiUncheckedProposal { ///Call this method if the only way to initiate a `Payjoin` with this receiver requires manual intervention, as in most consumer wallets. /// So-called “non-interactive” receivers, like payment processors, /// that allow arbitrary requests are otherwise vulnerable to probing attacks. + @override Future assumeInteractiveReceiver() async { try { - final res = - await FfiUncheckedProposal.assumeInteractiveReceiver(ptr: this); + final res = await super.assumeInteractiveReceiver(); return MaybeInputsOwned._(field0: res.field0); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); @@ -69,11 +70,11 @@ class UncheckedProposal extends FfiUncheckedProposal { class MaybeInputsOwned extends FfiMaybeInputsOwned { MaybeInputsOwned._({required super.field0}); + @override Future checkInputsNotOwned( {required FutureOr Function(Uint8List) isOwned}) async { try { - final res = await FfiMaybeInputsOwned.checkInputsNotOwned( - ptr: this, isOwned: isOwned); + final res = await super.checkInputsNotOwned(isOwned: isOwned); return MaybeMixedInputScripts._(field0: res.field0); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); @@ -87,10 +88,10 @@ class MaybeMixedInputScripts extends FfiMaybeMixedInputScripts { /// Verify the original transaction did not have mixed input types Call this after checking downstream. /// /// Note: mixed spends do not necessarily indicate distinct wallet fingerprints. This check is intended to prevent some types of wallet fingerprinting. + @override Future checkNoMixedInputScripts() async { try { - final res = - await FfiMaybeMixedInputScripts.checkNoMixedInputScripts(ptr: this); + final res = await super.checkNoMixedInputScripts(); return MaybeInputsSeen._(field0: res.field0); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); @@ -100,11 +101,11 @@ class MaybeMixedInputScripts extends FfiMaybeMixedInputScripts { class MaybeInputsSeen extends FfiMaybeInputsSeen { MaybeInputsSeen._({required super.field0}); + @override Future checkNoInputsSeenBefore( {required FutureOr Function(OutPoint) isKnown}) async { try { - final res = await FfiMaybeInputsSeen.checkNoInputsSeenBefore( - ptr: this, isKnown: isKnown); + final res = await super.checkNoInputsSeenBefore(isKnown: isKnown); return OutputsUnknown._(field0: res.field0); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); @@ -114,11 +115,12 @@ class MaybeInputsSeen extends FfiMaybeInputsSeen { class OutputsUnknown extends FfiOutputsUnknown { OutputsUnknown._({required super.field0}); + @override Future identifyReceiverOutputs( - {required Future Function(Uint8List) isReceiverOutput}) async { + {required FutureOr Function(Uint8List) isReceiverOutput}) async { try { - final res = await FfiOutputsUnknown.identifyReceiverOutputs( - ptr: this, isReceiverOutput: isReceiverOutput); + final res = await super + .identifyReceiverOutputs(isReceiverOutput: isReceiverOutput); return ProvisionalProposal._(field0: res.field0); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); @@ -174,14 +176,16 @@ class ProvisionalProposal extends FfiProvisionalProposal { } } - Future finalizeProposal( - {required FutureOr Function(String) processPsbt, - BigInt? minFeeRateSatPerVb}) async { + @override + Future finalizeProposal({ + required FutureOr Function(String) processPsbt, + BigInt? minFeeRateSatPerVb, + }) async { try { - final res = await FfiProvisionalProposal.finalizeProposal( - processPsbt: processPsbt, - minFeerateSatPerVb: minFeeRateSatPerVb, - ptr: this); + final res = await super.finalizeProposal( + processPsbt: processPsbt, + minFeeRateSatPerVb: minFeeRateSatPerVb, + ); return PayjoinProposal._(field0: res.field0); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); diff --git a/lib/receive/v2.dart b/lib/receive/v2.dart index 951f939..d70947c 100644 --- a/lib/receive/v2.dart +++ b/lib/receive/v2.dart @@ -32,22 +32,26 @@ class SessionInitializer extends FfiSessionInitializer { } } - Future processResponse( - {required List body, required ClientResponse clientResponse}) async { + @override + Future processRes( + {required List body, required ClientResponse ctx}) async { try { - final res = await super.processRes(body: body, ctx: clientResponse); + final res = await super.processRes(body: body, ctx: ctx); return ActiveSession._(field0: res.field0); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); } } - Future<(Request, ClientResponse)> extractRequest({hint}) async { + @override + Future<(Request, ClientResponse)> extractReq() async { try { - final res = await FfiSessionInitializer.extractReq(ptr: this); - final request = - Request(await Url.fromString(res.$1.$1.asString()), res.$1.$2); - return (request, ClientResponse._(field0: res.$2.field0)); + final res = await super.extractReq(); + final request = Request( + url: await Url.fromStr(res.$1.url.asString()), + body: res.$1.body, + ); + return (request, res.$2); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); } @@ -56,21 +60,26 @@ class SessionInitializer extends FfiSessionInitializer { class ActiveSession extends FfiActiveSession { ActiveSession._({required super.field0}); - Future<(Request, ClientResponse)> extractRequest({hint}) async { + + @override + Future<(Request, ClientResponse)> extractReq() async { try { - final res = await FfiActiveSession.extractReq(ptr: this); - final request = - Request(await Url.fromString(res.$1.$1.asString()), res.$1.$2); - return (request, ClientResponse._(field0: res.$2.field0)); + final res = await super.extractReq(); + final request = Request( + url: await Url.fromStr(res.$1.url.asString()), + body: res.$1.body, + ); + return (request, res.$2); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); } } - Future processResponse( - {required List body, required ClientResponse clientResponse}) async { + @override + Future processRes( + {required List body, required ClientResponse ctx}) async { try { - final res = await super.processRes(body: body, ctx: clientResponse); + final res = await super.processRes(body: body, ctx: ctx); if (res != null) { return UncheckedProposal._(field0: res.field0); } else { @@ -83,13 +92,15 @@ class ActiveSession extends FfiActiveSession { /// The contents of the `&pj=` query parameter including the base64url-encoded public key receiver subdirectory. /// This identifies a session at the payjoin directory server. - Future pjUrl() { - final res = FfiActiveSession.pjUrl(ptr: this); - return Url.fromString(res.asString()); + @override + Future pjUrl() async { + final res = await super.pjUrl(); + return Url.fromStr(res.asString()); } + @override PjUriBuilder pjUriBuilder() { - final res = FfiActiveSession.pjUriBuilder(ptr: this); + final res = super.pjUriBuilder(); return PjUriBuilder(internal: res.internal); } } @@ -260,11 +271,11 @@ class ProvisionalProposal extends FfiV2ProvisionalProposal { @override Future finalizeProposal( {required FutureOr Function(String p1) processPsbt, - BigInt? minFeerateSatPerVb, + BigInt? minFeeRateSatPerVb, hint}) async { try { final res = await super.finalizeProposal( - processPsbt: processPsbt, minFeerateSatPerVb: minFeerateSatPerVb); + processPsbt: processPsbt, minFeeRateSatPerVb: minFeeRateSatPerVb); return PayjoinProposal._(field0: res.field0); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); @@ -275,7 +286,8 @@ class ProvisionalProposal extends FfiV2ProvisionalProposal { class PayjoinProposal extends FfiV2PayjoinProposal { PayjoinProposal._({required super.field0}); - Future processResponse( + @override + Future processRes( {required List res, required ClientResponse ohttpContext}) { try { return super.processRes(ohttpContext: ohttpContext, res: res); @@ -293,12 +305,15 @@ class PayjoinProposal extends FfiV2PayjoinProposal { } } - Future<(Request, ClientResponse)> extractV2Request({hint}) async { + @override + Future<(Request, ClientResponse)> extractV2Req() async { try { - final res = await FfiV2PayjoinProposal.extractV2Req(ptr: this); - final request = - Request(await Url.fromString(res.$1.$1.asString()), res.$1.$2); - return (request, ClientResponse._(field0: res.$2.field0)); + final res = await super.extractV2Req(); + final request = Request( + url: await Url.fromStr(res.$1.url.asString()), + body: res.$1.body, + ); + return (request, res.$2); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); } @@ -340,7 +355,3 @@ class PayjoinProposal extends FfiV2PayjoinProposal { } } } - -class ClientResponse extends FfiClientResponse { - ClientResponse._({required super.field0}); -} diff --git a/lib/send.dart b/lib/send.dart index d950f5b..73b6560 100644 --- a/lib/send.dart +++ b/lib/send.dart @@ -4,6 +4,7 @@ import 'package:payjoin_flutter/uri.dart'; import 'common.dart' as common; import 'src/generated/api/send.dart'; +import 'src/generated/api/uri.dart'; import 'src/generated/utils/error.dart' as error; class RequestBuilder extends FfiRequestBuilder { @@ -75,25 +76,33 @@ class RequestBuilder extends FfiRequestBuilder { class RequestContext extends FfiRequestContext { RequestContext._({required super.field0}); - Future<(common.Request, ContextV1)> extractContextV1() async { + @override + Future<(common.Request, ContextV1)> extractV1() async { try { - final res = await FfiRequestContext.extractV1(ptr: this); + final res = await super.extractV1(); final request = common.Request( - await Url.fromString((res.request.$1.asString())), res.request.$2); - return (request, ContextV1._(field0: res.contextV1.field0)); + url: await Url.fromStr((res.$1.url.asString())), + body: res.$1.body, + ); + return (request, ContextV1._(field0: res.$2.field0)); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); } } - Future<(common.Request, ContextV2)> extractContextV2( - Url ohttpProxyUrl) async { + @override + Future<(common.Request, ContextV2)> extractV2({ + required FfiUrl ohttpProxyUrl, + }) async { try { - final res = await FfiRequestContext.extractV2( - ohttpProxyUrl: ohttpProxyUrl, ptr: this); + final res = await super.extractV2( + ohttpProxyUrl: ohttpProxyUrl, + ); final request = common.Request( - await Url.fromString((res.request.$1.asString())), res.request.$2); - return (request, ContextV2._(field0: res.contextV2.field0)); + url: await Url.fromStr((res.$1.url.asString())), + body: res.$1.body, + ); + return (request, ContextV2._(field0: res.$2.field0)); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); } diff --git a/lib/src/generated/api/receive.dart b/lib/src/generated/api/receive.dart index 90cc2f3..185e421 100644 --- a/lib/src/generated/api/receive.dart +++ b/lib/src/generated/api/receive.dart @@ -11,7 +11,7 @@ import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; import 'uri.dart'; // These functions are ignored because they are not marked as `pub`: `_finalize_proposal` -// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `clone`, `clone`, `clone`, `fmt`, `fmt`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from` +// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `clone`, `clone`, `clone`, `fmt`, `fmt`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from` class FfiActiveSession { final ActiveSession field0; @@ -20,18 +20,23 @@ class FfiActiveSession { required this.field0, }); - static Future<((FfiUrl, Uint8List), FfiClientResponse)> extractReq( - {required FfiActiveSession ptr}) => - core.instance.api.crateApiReceiveFfiActiveSessionExtractReq(ptr: ptr); + Future<(Request, ClientResponse)> extractReq() => + core.instance.api.crateApiReceiveFfiActiveSessionExtractReq( + that: this, + ); - static FfiPjUriBuilder pjUriBuilder({required FfiActiveSession ptr}) => - core.instance.api.crateApiReceiveFfiActiveSessionPjUriBuilder(ptr: ptr); + FfiPjUriBuilder pjUriBuilder() => + core.instance.api.crateApiReceiveFfiActiveSessionPjUriBuilder( + that: this, + ); - static FfiUrl pjUrl({required FfiActiveSession ptr}) => - core.instance.api.crateApiReceiveFfiActiveSessionPjUrl(ptr: ptr); + Future pjUrl() => + core.instance.api.crateApiReceiveFfiActiveSessionPjUrl( + that: this, + ); Future processRes( - {required List body, required FfiClientResponse ctx}) => + {required List body, required ClientResponse ctx}) => core.instance.api.crateApiReceiveFfiActiveSessionProcessRes( that: this, body: body, ctx: ctx); @@ -52,24 +57,6 @@ class FfiActiveSession { field0 == other.field0; } -class FfiClientResponse { - final MutexOptionClientResponse field0; - - const FfiClientResponse({ - required this.field0, - }); - - @override - int get hashCode => field0.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is FfiClientResponse && - runtimeType == other.runtimeType && - field0 == other.field0; -} - class FfiMaybeInputsOwned { final MaybeInputsOwned field0; @@ -77,11 +64,10 @@ class FfiMaybeInputsOwned { required this.field0, }); - static Future checkInputsNotOwned( - {required FfiMaybeInputsOwned ptr, - required FutureOr Function(Uint8List) isOwned}) => + Future checkInputsNotOwned( + {required FutureOr Function(Uint8List) isOwned}) => core.instance.api.crateApiReceiveFfiMaybeInputsOwnedCheckInputsNotOwned( - ptr: ptr, isOwned: isOwned); + that: this, isOwned: isOwned); @override int get hashCode => field0.hashCode; @@ -101,12 +87,11 @@ class FfiMaybeInputsSeen { required this.field0, }); - static Future checkNoInputsSeenBefore( - {required FfiMaybeInputsSeen ptr, - required FutureOr Function(OutPoint) isKnown}) => + Future checkNoInputsSeenBefore( + {required FutureOr Function(OutPoint) isKnown}) => core.instance.api .crateApiReceiveFfiMaybeInputsSeenCheckNoInputsSeenBefore( - ptr: ptr, isKnown: isKnown); + that: this, isKnown: isKnown); @override int get hashCode => field0.hashCode; @@ -126,11 +111,10 @@ class FfiMaybeMixedInputScripts { required this.field0, }); - static Future checkNoMixedInputScripts( - {required FfiMaybeMixedInputScripts ptr}) => - core.instance.api + Future checkNoMixedInputScripts() => core.instance.api .crateApiReceiveFfiMaybeMixedInputScriptsCheckNoMixedInputScripts( - ptr: ptr); + that: this, + ); @override int get hashCode => field0.hashCode; @@ -150,11 +134,10 @@ class FfiOutputsUnknown { required this.field0, }); - static Future identifyReceiverOutputs( - {required FfiOutputsUnknown ptr, - required FutureOr Function(Uint8List) isReceiverOutput}) => + Future identifyReceiverOutputs( + {required FutureOr Function(Uint8List) isReceiverOutput}) => core.instance.api.crateApiReceiveFfiOutputsUnknownIdentifyReceiverOutputs( - ptr: ptr, isReceiverOutput: isReceiverOutput); + that: this, isReceiverOutput: isReceiverOutput); @override int get hashCode => field0.hashCode; @@ -224,14 +207,13 @@ class FfiProvisionalProposal { .crateApiReceiveFfiProvisionalProposalContributeWitnessInput( that: this, txo: txo, outpoint: outpoint); - static Future finalizeProposal( - {required FfiProvisionalProposal ptr, - required FutureOr Function(String) processPsbt, - BigInt? minFeerateSatPerVb}) => + Future finalizeProposal( + {required FutureOr Function(String) processPsbt, + BigInt? minFeeRateSatPerVb}) => core.instance.api.crateApiReceiveFfiProvisionalProposalFinalizeProposal( - ptr: ptr, + that: this, processPsbt: processPsbt, - minFeerateSatPerVb: minFeerateSatPerVb); + minFeeRateSatPerVb: minFeeRateSatPerVb); Future tryPreservingPrivacy( {required Map candidateInputs}) => @@ -263,10 +245,10 @@ class FfiSessionInitializer { required this.field0, }); - static Future<((FfiUrl, Uint8List), FfiClientResponse)> extractReq( - {required FfiSessionInitializer ptr}) => - core.instance.api - .crateApiReceiveFfiSessionInitializerExtractReq(ptr: ptr); + Future<(Request, ClientResponse)> extractReq() => + core.instance.api.crateApiReceiveFfiSessionInitializerExtractReq( + that: this, + ); // HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class. static Future newInstance( @@ -285,7 +267,7 @@ class FfiSessionInitializer { ohttpRelay: ohttpRelay); Future processRes( - {required List body, required FfiClientResponse ctx}) => + {required List body, required ClientResponse ctx}) => core.instance.api.crateApiReceiveFfiSessionInitializerProcessRes( that: this, body: body, ctx: ctx); @@ -310,11 +292,10 @@ class FfiUncheckedProposal { /// Call this method if the only way to initiate a Payjoin with this receiver requires manual intervention, as in most consumer wallets. /// /// So-called “non-interactive” receivers, like payment processors, that allow arbitrary requests are otherwise vulnerable to probing attacks. Those receivers call get_transaction_to_check_broadcast() and attest_tested_and_scheduled_broadcast() after making those checks downstream. - static Future assumeInteractiveReceiver( - {required FfiUncheckedProposal ptr}) => - core.instance.api + Future assumeInteractiveReceiver() => core.instance.api .crateApiReceiveFfiUncheckedProposalAssumeInteractiveReceiver( - ptr: ptr); + that: this, + ); /// Call after checking that the Original PSBT can be broadcast. /// @@ -323,13 +304,12 @@ class FfiUncheckedProposal { /// Do this check if you generate bitcoin uri to receive Payjoin on sender request without manual human approval, like a payment processor. Such so called “non-interactive” receivers are otherwise vulnerable to probing attacks. If a sender can make requests at will, they can learn which bitcoin the receiver owns at no cost. Broadcasting the Original PSBT after some time in the failure case makes incurs sender cost and prevents probing. /// /// Call this after checking downstream. - static Future checkBroadcastSuitability( - {required FfiUncheckedProposal ptr, - BigInt? minFeeRate, + Future checkBroadcastSuitability( + {BigInt? minFeeRate, required FutureOr Function(Uint8List) canBroadcast}) => core.instance.api .crateApiReceiveFfiUncheckedProposalCheckBroadcastSuitability( - ptr: ptr, minFeeRate: minFeeRate, canBroadcast: canBroadcast); + that: this, minFeeRate: minFeeRate, canBroadcast: canBroadcast); /// The Sender’s Original PSBT Future extractTxToScheduleBroadcast() => core.instance.api @@ -472,10 +452,10 @@ class FfiV2PayjoinProposal { that: this, ); - static Future<((FfiUrl, Uint8List), FfiClientResponse)> extractV2Req( - {required FfiV2PayjoinProposal ptr}) => - core.instance.api - .crateApiReceiveFfiV2PayjoinProposalExtractV2Req(ptr: ptr); + Future<(Request, ClientResponse)> extractV2Req() => + core.instance.api.crateApiReceiveFfiV2PayjoinProposalExtractV2Req( + that: this, + ); Future isOutputSubstitutionDisabled() => core.instance.api .crateApiReceiveFfiV2PayjoinProposalIsOutputSubstitutionDisabled( @@ -488,7 +468,7 @@ class FfiV2PayjoinProposal { ); Future processRes( - {required List res, required FfiClientResponse ohttpContext}) => + {required List res, required ClientResponse ohttpContext}) => core.instance.api.crateApiReceiveFfiV2PayjoinProposalProcessRes( that: this, res: res, ohttpContext: ohttpContext); @@ -534,11 +514,11 @@ class FfiV2ProvisionalProposal { Future finalizeProposal( {required FutureOr Function(String) processPsbt, - BigInt? minFeerateSatPerVb}) => + BigInt? minFeeRateSatPerVb}) => core.instance.api.crateApiReceiveFfiV2ProvisionalProposalFinalizeProposal( that: this, processPsbt: processPsbt, - minFeerateSatPerVb: minFeerateSatPerVb); + minFeeRateSatPerVb: minFeeRateSatPerVb); Future isOutputSubstitutionDisabled() => core.instance.api .crateApiReceiveFfiV2ProvisionalProposalIsOutputSubstitutionDisabled( diff --git a/lib/src/generated/api/send.dart b/lib/src/generated/api/send.dart index 5fcde13..698ed88 100644 --- a/lib/src/generated/api/send.dart +++ b/lib/src/generated/api/send.dart @@ -6,13 +6,15 @@ import '../frb_generated.dart'; import '../lib.dart'; import '../utils/error.dart'; +import '../utils/types.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; import 'uri.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): `clone`, `clone`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from` +// These types are ignored because they are not used by any `pub` functions: `FfiRequestContextV1`, `FfiRequestContextV2` +// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `clone`, `from`, `from`, `from`, `from`, `from`, `from`, `from` class FfiContextV1 { - final ContextV1 field0; + final ArcContextV1 field0; const FfiContextV1({ required this.field0, @@ -112,13 +114,14 @@ class FfiRequestContext { required this.field0, }); - static Future extractV1({required FfiRequestContext ptr}) => - core.instance.api.crateApiSendFfiRequestContextExtractV1(ptr: ptr); + Future<(Request, FfiContextV1)> extractV1() => + core.instance.api.crateApiSendFfiRequestContextExtractV1( + that: this, + ); - static Future extractV2( - {required FfiRequestContext ptr, required FfiUrl ohttpProxyUrl}) => + Future<(Request, FfiContextV2)> extractV2({required FfiUrl ohttpProxyUrl}) => core.instance.api.crateApiSendFfiRequestContextExtractV2( - ptr: ptr, ohttpProxyUrl: ohttpProxyUrl); + that: this, ohttpProxyUrl: ohttpProxyUrl); @override int get hashCode => field0.hashCode; @@ -130,45 +133,3 @@ class FfiRequestContext { runtimeType == other.runtimeType && field0 == other.field0; } - -class RequestContextV1 { - final (FfiUrl, Uint8List) request; - final FfiContextV1 contextV1; - - const RequestContextV1({ - required this.request, - required this.contextV1, - }); - - @override - int get hashCode => request.hashCode ^ contextV1.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is RequestContextV1 && - runtimeType == other.runtimeType && - request == other.request && - contextV1 == other.contextV1; -} - -class RequestContextV2 { - final (FfiUrl, Uint8List) request; - final FfiContextV2 contextV2; - - const RequestContextV2({ - required this.request, - required this.contextV2, - }); - - @override - int get hashCode => request.hashCode ^ contextV2.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is RequestContextV2 && - runtimeType == other.runtimeType && - request == other.request && - contextV2 == other.contextV2; -} diff --git a/lib/src/generated/api/uri.dart b/lib/src/generated/api/uri.dart index 9d8f767..85742bd 100644 --- a/lib/src/generated/api/uri.dart +++ b/lib/src/generated/api/uri.dart @@ -134,7 +134,7 @@ class FfiUri { that: this, ); - static Future fromStr({required String uri}) => + static FfiUri fromStr({required String uri}) => core.instance.api.crateApiUriFfiUriFromStr(uri: uri); @override @@ -159,7 +159,7 @@ class FfiUrl { that: this, ); - static Future fromStr({required String url}) => + static FfiUrl fromStr({required String url}) => core.instance.api.crateApiUriFfiUrlFromStr(url: url); String? query() => core.instance.api.crateApiUriFfiUrlQuery( diff --git a/lib/src/generated/frb_generated.dart b/lib/src/generated/frb_generated.dart index 7a50e1e..0a7a2d0 100644 --- a/lib/src/generated/frb_generated.dart +++ b/lib/src/generated/frb_generated.dart @@ -75,40 +75,40 @@ abstract class coreApi extends BaseApi { Future crateApiIoFetchOhttpKeys( {required FfiUrl ohttpRelay, required FfiUrl payjoinDirectory}); - Future<((FfiUrl, Uint8List), FfiClientResponse)> - crateApiReceiveFfiActiveSessionExtractReq( - {required FfiActiveSession ptr}); + Future<(Request, ClientResponse)> crateApiReceiveFfiActiveSessionExtractReq( + {required FfiActiveSession that}); FfiPjUriBuilder crateApiReceiveFfiActiveSessionPjUriBuilder( - {required FfiActiveSession ptr}); + {required FfiActiveSession that}); - FfiUrl crateApiReceiveFfiActiveSessionPjUrl({required FfiActiveSession ptr}); + Future crateApiReceiveFfiActiveSessionPjUrl( + {required FfiActiveSession that}); Future crateApiReceiveFfiActiveSessionProcessRes( {required FfiActiveSession that, required List body, - required FfiClientResponse ctx}); + required ClientResponse ctx}); String crateApiReceiveFfiActiveSessionPublicKey( {required FfiActiveSession that}); Future crateApiReceiveFfiMaybeInputsOwnedCheckInputsNotOwned( - {required FfiMaybeInputsOwned ptr, + {required FfiMaybeInputsOwned that, required FutureOr Function(Uint8List) isOwned}); Future crateApiReceiveFfiMaybeInputsSeenCheckNoInputsSeenBefore( - {required FfiMaybeInputsSeen ptr, + {required FfiMaybeInputsSeen that, required FutureOr Function(OutPoint) isKnown}); Future crateApiReceiveFfiMaybeMixedInputScriptsCheckNoMixedInputScripts( - {required FfiMaybeMixedInputScripts ptr}); + {required FfiMaybeMixedInputScripts that}); Future crateApiReceiveFfiOutputsUnknownIdentifyReceiverOutputs( - {required FfiOutputsUnknown ptr, + {required FfiOutputsUnknown that, required FutureOr Function(Uint8List) isReceiverOutput}); Future crateApiReceiveFfiPayjoinProposalIsOutputSubstitutionDisabled( @@ -135,9 +135,9 @@ abstract class coreApi extends BaseApi { Future crateApiReceiveFfiProvisionalProposalFinalizeProposal( - {required FfiProvisionalProposal ptr, + {required FfiProvisionalProposal that, required FutureOr Function(String) processPsbt, - BigInt? minFeerateSatPerVb}); + BigInt? minFeeRateSatPerVb}); Future crateApiReceiveFfiProvisionalProposalTryPreservingPrivacy( {required FfiProvisionalProposal that, @@ -147,9 +147,9 @@ abstract class coreApi extends BaseApi { {required FfiProvisionalProposal that, required FutureOr Function() generateScript}); - Future<((FfiUrl, Uint8List), FfiClientResponse)> + Future<(Request, ClientResponse)> crateApiReceiveFfiSessionInitializerExtractReq( - {required FfiSessionInitializer ptr}); + {required FfiSessionInitializer that}); Future crateApiReceiveFfiSessionInitializerNew( {required String address, @@ -162,15 +162,15 @@ abstract class coreApi extends BaseApi { Future crateApiReceiveFfiSessionInitializerProcessRes( {required FfiSessionInitializer that, required List body, - required FfiClientResponse ctx}); + required ClientResponse ctx}); Future crateApiReceiveFfiUncheckedProposalAssumeInteractiveReceiver( - {required FfiUncheckedProposal ptr}); + {required FfiUncheckedProposal that}); Future crateApiReceiveFfiUncheckedProposalCheckBroadcastSuitability( - {required FfiUncheckedProposal ptr, + {required FfiUncheckedProposal that, BigInt? minFeeRate, required FutureOr Function(Uint8List) canBroadcast}); @@ -205,9 +205,9 @@ abstract class coreApi extends BaseApi { Future crateApiReceiveFfiV2PayjoinProposalExtractV1Req( {required FfiV2PayjoinProposal that}); - Future<((FfiUrl, Uint8List), FfiClientResponse)> + Future<(Request, ClientResponse)> crateApiReceiveFfiV2PayjoinProposalExtractV2Req( - {required FfiV2PayjoinProposal ptr}); + {required FfiV2PayjoinProposal that}); Future crateApiReceiveFfiV2PayjoinProposalIsOutputSubstitutionDisabled( {required FfiV2PayjoinProposal that}); @@ -218,7 +218,7 @@ abstract class coreApi extends BaseApi { Future crateApiReceiveFfiV2PayjoinProposalProcessRes( {required FfiV2PayjoinProposal that, required List res, - required FfiClientResponse ohttpContext}); + required ClientResponse ohttpContext}); Future crateApiReceiveFfiV2PayjoinProposalPsbt( {required FfiV2PayjoinProposal that}); @@ -240,7 +240,7 @@ abstract class coreApi extends BaseApi { crateApiReceiveFfiV2ProvisionalProposalFinalizeProposal( {required FfiV2ProvisionalProposal that, required FutureOr Function(String) processPsbt, - BigInt? minFeerateSatPerVb}); + BigInt? minFeeRateSatPerVb}); Future crateApiReceiveFfiV2ProvisionalProposalIsOutputSubstitutionDisabled( @@ -295,11 +295,11 @@ abstract class coreApi extends BaseApi { Future crateApiSendFfiRequestBuilderFromPsbtAndUri( {required String psbtBase64, required FfiPjUri pjUri}); - Future crateApiSendFfiRequestContextExtractV1( - {required FfiRequestContext ptr}); + Future<(Request, FfiContextV1)> crateApiSendFfiRequestContextExtractV1( + {required FfiRequestContext that}); - Future crateApiSendFfiRequestContextExtractV2( - {required FfiRequestContext ptr, required FfiUrl ohttpProxyUrl}); + Future<(Request, FfiContextV2)> crateApiSendFfiRequestContextExtractV2( + {required FfiRequestContext that, required FfiUrl ohttpProxyUrl}); Future crateApiUriFfiOhttpKeysDecode( {required List bytes}); @@ -338,11 +338,11 @@ abstract class coreApi extends BaseApi { FfiPjUri crateApiUriFfiUriCheckPjSupported({required FfiUri that}); - Future crateApiUriFfiUriFromStr({required String uri}); + FfiUri crateApiUriFfiUriFromStr({required String uri}); String crateApiUriFfiUrlAsString({required FfiUrl that}); - Future crateApiUriFfiUrlFromStr({required String url}); + FfiUrl crateApiUriFfiUrlFromStr({required String url}); String? crateApiUriFfiUrlQuery({required FfiUrl that}); @@ -355,6 +355,14 @@ abstract class coreApi extends BaseApi { CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ArcV2PayjoinProposalPtr; + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_ArcContextV1; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_ArcContextV1; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ArcContextV1Ptr; + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_ArcContextV2; @@ -498,14 +506,6 @@ abstract class coreApi extends BaseApi { CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_V2UncheckedProposalPtr; - RustArcIncrementStrongCountFnType - get rust_arc_increment_strong_count_ContextV1; - - RustArcDecrementStrongCountFnType - get rust_arc_decrement_strong_count_ContextV1; - - CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ContextV1Ptr; - RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_RequestBuilder; @@ -601,22 +601,20 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future<((FfiUrl, Uint8List), FfiClientResponse)> - crateApiReceiveFfiActiveSessionExtractReq( - {required FfiActiveSession ptr}) { + Future<(Request, ClientResponse)> crateApiReceiveFfiActiveSessionExtractReq( + {required FfiActiveSession that}) { return handler.executeNormal(NormalTask( callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_ffi_active_session(ptr); + var arg0 = cst_encode_box_autoadd_ffi_active_session(that); return wire.wire__crate__api__receive__ffi_active_session_extract_req( port_, arg0); }, codec: DcoCodec( - decodeSuccessData: - dco_decode_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response, + decodeSuccessData: dco_decode_record_request_client_response, decodeErrorData: dco_decode_payjoin_error, ), constMeta: kCrateApiReceiveFfiActiveSessionExtractReqConstMeta, - argValues: [ptr], + argValues: [that], apiImpl: this, )); } @@ -624,15 +622,15 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { TaskConstMeta get kCrateApiReceiveFfiActiveSessionExtractReqConstMeta => const TaskConstMeta( debugName: "ffi_active_session_extract_req", - argNames: ["ptr"], + argNames: ["that"], ); @override FfiPjUriBuilder crateApiReceiveFfiActiveSessionPjUriBuilder( - {required FfiActiveSession ptr}) { + {required FfiActiveSession that}) { return handler.executeSync(SyncTask( callFfi: () { - var arg0 = cst_encode_box_autoadd_ffi_active_session(ptr); + var arg0 = cst_encode_box_autoadd_ffi_active_session(that); return wire .wire__crate__api__receive__ffi_active_session_pj_uri_builder(arg0); }, @@ -641,7 +639,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { decodeErrorData: null, ), constMeta: kCrateApiReceiveFfiActiveSessionPjUriBuilderConstMeta, - argValues: [ptr], + argValues: [that], apiImpl: this, )); } @@ -649,22 +647,24 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { TaskConstMeta get kCrateApiReceiveFfiActiveSessionPjUriBuilderConstMeta => const TaskConstMeta( debugName: "ffi_active_session_pj_uri_builder", - argNames: ["ptr"], + argNames: ["that"], ); @override - FfiUrl crateApiReceiveFfiActiveSessionPjUrl({required FfiActiveSession ptr}) { - return handler.executeSync(SyncTask( - callFfi: () { - var arg0 = cst_encode_box_autoadd_ffi_active_session(ptr); - return wire.wire__crate__api__receive__ffi_active_session_pj_url(arg0); + Future crateApiReceiveFfiActiveSessionPjUrl( + {required FfiActiveSession that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + var arg0 = cst_encode_box_autoadd_ffi_active_session(that); + return wire.wire__crate__api__receive__ffi_active_session_pj_url( + port_, arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_ffi_url, decodeErrorData: null, ), constMeta: kCrateApiReceiveFfiActiveSessionPjUrlConstMeta, - argValues: [ptr], + argValues: [that], apiImpl: this, )); } @@ -672,19 +672,19 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { TaskConstMeta get kCrateApiReceiveFfiActiveSessionPjUrlConstMeta => const TaskConstMeta( debugName: "ffi_active_session_pj_url", - argNames: ["ptr"], + argNames: ["that"], ); @override Future crateApiReceiveFfiActiveSessionProcessRes( {required FfiActiveSession that, required List body, - required FfiClientResponse ctx}) { + required ClientResponse ctx}) { return handler.executeNormal(NormalTask( callFfi: (port_) { var arg0 = cst_encode_box_autoadd_ffi_active_session(that); var arg1 = cst_encode_list_prim_u_8_loose(body); - var arg2 = cst_encode_box_autoadd_ffi_client_response(ctx); + var arg2 = cst_encode_box_autoadd_client_response(ctx); return wire.wire__crate__api__receive__ffi_active_session_process_res( port_, arg0, arg1, arg2); }, @@ -733,11 +733,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { @override Future crateApiReceiveFfiMaybeInputsOwnedCheckInputsNotOwned( - {required FfiMaybeInputsOwned ptr, + {required FfiMaybeInputsOwned that, required FutureOr Function(Uint8List) isOwned}) { return handler.executeNormal(NormalTask( callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_ffi_maybe_inputs_owned(ptr); + var arg0 = cst_encode_box_autoadd_ffi_maybe_inputs_owned(that); var arg1 = cst_encode_DartFn_Inputs_list_prim_u_8_strict_Output_bool_AnyhowException( isOwned); @@ -751,7 +751,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ), constMeta: kCrateApiReceiveFfiMaybeInputsOwnedCheckInputsNotOwnedConstMeta, - argValues: [ptr, isOwned], + argValues: [that, isOwned], apiImpl: this, )); } @@ -760,17 +760,17 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { get kCrateApiReceiveFfiMaybeInputsOwnedCheckInputsNotOwnedConstMeta => const TaskConstMeta( debugName: "ffi_maybe_inputs_owned_check_inputs_not_owned", - argNames: ["ptr", "isOwned"], + argNames: ["that", "isOwned"], ); @override Future crateApiReceiveFfiMaybeInputsSeenCheckNoInputsSeenBefore( - {required FfiMaybeInputsSeen ptr, + {required FfiMaybeInputsSeen that, required FutureOr Function(OutPoint) isKnown}) { return handler.executeNormal(NormalTask( callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_ffi_maybe_inputs_seen(ptr); + var arg0 = cst_encode_box_autoadd_ffi_maybe_inputs_seen(that); var arg1 = cst_encode_DartFn_Inputs_out_point_Output_bool_AnyhowException( isKnown); @@ -784,7 +784,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ), constMeta: kCrateApiReceiveFfiMaybeInputsSeenCheckNoInputsSeenBeforeConstMeta, - argValues: [ptr, isKnown], + argValues: [that, isKnown], apiImpl: this, )); } @@ -793,16 +793,16 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { get kCrateApiReceiveFfiMaybeInputsSeenCheckNoInputsSeenBeforeConstMeta => const TaskConstMeta( debugName: "ffi_maybe_inputs_seen_check_no_inputs_seen_before", - argNames: ["ptr", "isKnown"], + argNames: ["that", "isKnown"], ); @override Future crateApiReceiveFfiMaybeMixedInputScriptsCheckNoMixedInputScripts( - {required FfiMaybeMixedInputScripts ptr}) { + {required FfiMaybeMixedInputScripts that}) { return handler.executeNormal(NormalTask( callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_ffi_maybe_mixed_input_scripts(ptr); + var arg0 = cst_encode_box_autoadd_ffi_maybe_mixed_input_scripts(that); return wire .wire__crate__api__receive__ffi_maybe_mixed_input_scripts_check_no_mixed_input_scripts( port_, arg0); @@ -813,7 +813,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ), constMeta: kCrateApiReceiveFfiMaybeMixedInputScriptsCheckNoMixedInputScriptsConstMeta, - argValues: [ptr], + argValues: [that], apiImpl: this, )); } @@ -823,17 +823,17 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { const TaskConstMeta( debugName: "ffi_maybe_mixed_input_scripts_check_no_mixed_input_scripts", - argNames: ["ptr"], + argNames: ["that"], ); @override Future crateApiReceiveFfiOutputsUnknownIdentifyReceiverOutputs( - {required FfiOutputsUnknown ptr, + {required FfiOutputsUnknown that, required FutureOr Function(Uint8List) isReceiverOutput}) { return handler.executeNormal(NormalTask( callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_ffi_outputs_unknown(ptr); + var arg0 = cst_encode_box_autoadd_ffi_outputs_unknown(that); var arg1 = cst_encode_DartFn_Inputs_list_prim_u_8_strict_Output_bool_AnyhowException( isReceiverOutput); @@ -847,7 +847,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ), constMeta: kCrateApiReceiveFfiOutputsUnknownIdentifyReceiverOutputsConstMeta, - argValues: [ptr, isReceiverOutput], + argValues: [that, isReceiverOutput], apiImpl: this, )); } @@ -856,7 +856,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { get kCrateApiReceiveFfiOutputsUnknownIdentifyReceiverOutputsConstMeta => const TaskConstMeta( debugName: "ffi_outputs_unknown_identify_receiver_outputs", - argNames: ["ptr", "isReceiverOutput"], + argNames: ["that", "isReceiverOutput"], ); @override @@ -1031,16 +1031,16 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { @override Future crateApiReceiveFfiProvisionalProposalFinalizeProposal( - {required FfiProvisionalProposal ptr, + {required FfiProvisionalProposal that, required FutureOr Function(String) processPsbt, - BigInt? minFeerateSatPerVb}) { + BigInt? minFeeRateSatPerVb}) { return handler.executeNormal(NormalTask( callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_ffi_provisional_proposal(ptr); + var arg0 = cst_encode_box_autoadd_ffi_provisional_proposal(that); var arg1 = cst_encode_DartFn_Inputs_String_Output_String_AnyhowException( processPsbt); - var arg2 = cst_encode_opt_box_autoadd_u_64(minFeerateSatPerVb); + var arg2 = cst_encode_opt_box_autoadd_u_64(minFeeRateSatPerVb); return wire .wire__crate__api__receive__ffi_provisional_proposal_finalize_proposal( port_, arg0, arg1, arg2); @@ -1051,7 +1051,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ), constMeta: kCrateApiReceiveFfiProvisionalProposalFinalizeProposalConstMeta, - argValues: [ptr, processPsbt, minFeerateSatPerVb], + argValues: [that, processPsbt, minFeeRateSatPerVb], apiImpl: this, )); } @@ -1060,7 +1060,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { get kCrateApiReceiveFfiProvisionalProposalFinalizeProposalConstMeta => const TaskConstMeta( debugName: "ffi_provisional_proposal_finalize_proposal", - argNames: ["ptr", "processPsbt", "minFeerateSatPerVb"], + argNames: ["that", "processPsbt", "minFeeRateSatPerVb"], ); @override @@ -1127,23 +1127,22 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future<((FfiUrl, Uint8List), FfiClientResponse)> + Future<(Request, ClientResponse)> crateApiReceiveFfiSessionInitializerExtractReq( - {required FfiSessionInitializer ptr}) { + {required FfiSessionInitializer that}) { return handler.executeNormal(NormalTask( callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_ffi_session_initializer(ptr); + var arg0 = cst_encode_box_autoadd_ffi_session_initializer(that); return wire .wire__crate__api__receive__ffi_session_initializer_extract_req( port_, arg0); }, codec: DcoCodec( - decodeSuccessData: - dco_decode_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response, + decodeSuccessData: dco_decode_record_request_client_response, decodeErrorData: dco_decode_payjoin_error, ), constMeta: kCrateApiReceiveFfiSessionInitializerExtractReqConstMeta, - argValues: [ptr], + argValues: [that], apiImpl: this, )); } @@ -1151,7 +1150,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { TaskConstMeta get kCrateApiReceiveFfiSessionInitializerExtractReqConstMeta => const TaskConstMeta( debugName: "ffi_session_initializer_extract_req", - argNames: ["ptr"], + argNames: ["that"], ); @override @@ -1207,12 +1206,12 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { Future crateApiReceiveFfiSessionInitializerProcessRes( {required FfiSessionInitializer that, required List body, - required FfiClientResponse ctx}) { + required ClientResponse ctx}) { return handler.executeNormal(NormalTask( callFfi: (port_) { var arg0 = cst_encode_box_autoadd_ffi_session_initializer(that); var arg1 = cst_encode_list_prim_u_8_loose(body); - var arg2 = cst_encode_box_autoadd_ffi_client_response(ctx); + var arg2 = cst_encode_box_autoadd_client_response(ctx); return wire .wire__crate__api__receive__ffi_session_initializer_process_res( port_, arg0, arg1, arg2); @@ -1236,10 +1235,10 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { @override Future crateApiReceiveFfiUncheckedProposalAssumeInteractiveReceiver( - {required FfiUncheckedProposal ptr}) { + {required FfiUncheckedProposal that}) { return handler.executeNormal(NormalTask( callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_ffi_unchecked_proposal(ptr); + var arg0 = cst_encode_box_autoadd_ffi_unchecked_proposal(that); return wire .wire__crate__api__receive__ffi_unchecked_proposal_assume_interactive_receiver( port_, arg0); @@ -1250,7 +1249,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ), constMeta: kCrateApiReceiveFfiUncheckedProposalAssumeInteractiveReceiverConstMeta, - argValues: [ptr], + argValues: [that], apiImpl: this, )); } @@ -1259,18 +1258,18 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { get kCrateApiReceiveFfiUncheckedProposalAssumeInteractiveReceiverConstMeta => const TaskConstMeta( debugName: "ffi_unchecked_proposal_assume_interactive_receiver", - argNames: ["ptr"], + argNames: ["that"], ); @override Future crateApiReceiveFfiUncheckedProposalCheckBroadcastSuitability( - {required FfiUncheckedProposal ptr, + {required FfiUncheckedProposal that, BigInt? minFeeRate, required FutureOr Function(Uint8List) canBroadcast}) { return handler.executeNormal(NormalTask( callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_ffi_unchecked_proposal(ptr); + var arg0 = cst_encode_box_autoadd_ffi_unchecked_proposal(that); var arg1 = cst_encode_opt_box_autoadd_u_64(minFeeRate); var arg2 = cst_encode_DartFn_Inputs_list_prim_u_8_strict_Output_bool_AnyhowException( @@ -1285,7 +1284,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ), constMeta: kCrateApiReceiveFfiUncheckedProposalCheckBroadcastSuitabilityConstMeta, - argValues: [ptr, minFeeRate, canBroadcast], + argValues: [that, minFeeRate, canBroadcast], apiImpl: this, )); } @@ -1294,7 +1293,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { get kCrateApiReceiveFfiUncheckedProposalCheckBroadcastSuitabilityConstMeta => const TaskConstMeta( debugName: "ffi_unchecked_proposal_check_broadcast_suitability", - argNames: ["ptr", "minFeeRate", "canBroadcast"], + argNames: ["that", "minFeeRate", "canBroadcast"], ); @override @@ -1514,23 +1513,22 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future<((FfiUrl, Uint8List), FfiClientResponse)> + Future<(Request, ClientResponse)> crateApiReceiveFfiV2PayjoinProposalExtractV2Req( - {required FfiV2PayjoinProposal ptr}) { + {required FfiV2PayjoinProposal that}) { return handler.executeNormal(NormalTask( callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_ffi_v_2_payjoin_proposal(ptr); + var arg0 = cst_encode_box_autoadd_ffi_v_2_payjoin_proposal(that); return wire .wire__crate__api__receive__ffi_v_2_payjoin_proposal_extract_v2_req( port_, arg0); }, codec: DcoCodec( - decodeSuccessData: - dco_decode_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response, + decodeSuccessData: dco_decode_record_request_client_response, decodeErrorData: dco_decode_payjoin_error, ), constMeta: kCrateApiReceiveFfiV2PayjoinProposalExtractV2ReqConstMeta, - argValues: [ptr], + argValues: [that], apiImpl: this, )); } @@ -1538,7 +1536,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { TaskConstMeta get kCrateApiReceiveFfiV2PayjoinProposalExtractV2ReqConstMeta => const TaskConstMeta( debugName: "ffi_v_2_payjoin_proposal_extract_v2_req", - argNames: ["ptr"], + argNames: ["that"], ); @override @@ -1600,12 +1598,12 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { Future crateApiReceiveFfiV2PayjoinProposalProcessRes( {required FfiV2PayjoinProposal that, required List res, - required FfiClientResponse ohttpContext}) { + required ClientResponse ohttpContext}) { return handler.executeNormal(NormalTask( callFfi: (port_) { var arg0 = cst_encode_box_autoadd_ffi_v_2_payjoin_proposal(that); var arg1 = cst_encode_list_prim_u_8_loose(res); - var arg2 = cst_encode_box_autoadd_ffi_client_response(ohttpContext); + var arg2 = cst_encode_box_autoadd_client_response(ohttpContext); return wire .wire__crate__api__receive__ffi_v_2_payjoin_proposal_process_res( port_, arg0, arg1, arg2); @@ -1748,14 +1746,14 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { crateApiReceiveFfiV2ProvisionalProposalFinalizeProposal( {required FfiV2ProvisionalProposal that, required FutureOr Function(String) processPsbt, - BigInt? minFeerateSatPerVb}) { + BigInt? minFeeRateSatPerVb}) { return handler.executeNormal(NormalTask( callFfi: (port_) { var arg0 = cst_encode_box_autoadd_ffi_v_2_provisional_proposal(that); var arg1 = cst_encode_DartFn_Inputs_String_Output_String_AnyhowException( processPsbt); - var arg2 = cst_encode_opt_box_autoadd_u_64(minFeerateSatPerVb); + var arg2 = cst_encode_opt_box_autoadd_u_64(minFeeRateSatPerVb); return wire .wire__crate__api__receive__ffi_v_2_provisional_proposal_finalize_proposal( port_, arg0, arg1, arg2); @@ -1766,7 +1764,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ), constMeta: kCrateApiReceiveFfiV2ProvisionalProposalFinalizeProposalConstMeta, - argValues: [that, processPsbt, minFeerateSatPerVb], + argValues: [that, processPsbt, minFeeRateSatPerVb], apiImpl: this, )); } @@ -1775,7 +1773,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { get kCrateApiReceiveFfiV2ProvisionalProposalFinalizeProposalConstMeta => const TaskConstMeta( debugName: "ffi_v_2_provisional_proposal_finalize_proposal", - argNames: ["that", "processPsbt", "minFeerateSatPerVb"], + argNames: ["that", "processPsbt", "minFeeRateSatPerVb"], ); @override @@ -2178,20 +2176,20 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiSendFfiRequestContextExtractV1( - {required FfiRequestContext ptr}) { + Future<(Request, FfiContextV1)> crateApiSendFfiRequestContextExtractV1( + {required FfiRequestContext that}) { return handler.executeNormal(NormalTask( callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_ffi_request_context(ptr); + var arg0 = cst_encode_box_autoadd_ffi_request_context(that); return wire.wire__crate__api__send__ffi_request_context_extract_v1( port_, arg0); }, codec: DcoCodec( - decodeSuccessData: dco_decode_request_context_v_1, + decodeSuccessData: dco_decode_record_request_ffi_context_v_1, decodeErrorData: dco_decode_payjoin_error, ), constMeta: kCrateApiSendFfiRequestContextExtractV1ConstMeta, - argValues: [ptr], + argValues: [that], apiImpl: this, )); } @@ -2199,25 +2197,25 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { TaskConstMeta get kCrateApiSendFfiRequestContextExtractV1ConstMeta => const TaskConstMeta( debugName: "ffi_request_context_extract_v1", - argNames: ["ptr"], + argNames: ["that"], ); @override - Future crateApiSendFfiRequestContextExtractV2( - {required FfiRequestContext ptr, required FfiUrl ohttpProxyUrl}) { + Future<(Request, FfiContextV2)> crateApiSendFfiRequestContextExtractV2( + {required FfiRequestContext that, required FfiUrl ohttpProxyUrl}) { return handler.executeNormal(NormalTask( callFfi: (port_) { - var arg0 = cst_encode_box_autoadd_ffi_request_context(ptr); + var arg0 = cst_encode_box_autoadd_ffi_request_context(that); var arg1 = cst_encode_box_autoadd_ffi_url(ohttpProxyUrl); return wire.wire__crate__api__send__ffi_request_context_extract_v2( port_, arg0, arg1); }, codec: DcoCodec( - decodeSuccessData: dco_decode_request_context_v_2, + decodeSuccessData: dco_decode_record_request_ffi_context_v_2, decodeErrorData: dco_decode_payjoin_error, ), constMeta: kCrateApiSendFfiRequestContextExtractV2ConstMeta, - argValues: [ptr, ohttpProxyUrl], + argValues: [that, ohttpProxyUrl], apiImpl: this, )); } @@ -2225,7 +2223,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { TaskConstMeta get kCrateApiSendFfiRequestContextExtractV2ConstMeta => const TaskConstMeta( debugName: "ffi_request_context_extract_v2", - argNames: ["ptr", "ohttpProxyUrl"], + argNames: ["that", "ohttpProxyUrl"], ); @override @@ -2565,11 +2563,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiUriFfiUriFromStr({required String uri}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + FfiUri crateApiUriFfiUriFromStr({required String uri}) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_String(uri); - return wire.wire__crate__api__uri__ffi_uri_from_str(port_, arg0); + return wire.wire__crate__api__uri__ffi_uri_from_str(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_ffi_uri, @@ -2609,11 +2607,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); @override - Future crateApiUriFfiUrlFromStr({required String url}) { - return handler.executeNormal(NormalTask( - callFfi: (port_) { + FfiUrl crateApiUriFfiUrlFromStr({required String url}) { + return handler.executeSync(SyncTask( + callFfi: () { var arg0 = cst_encode_String(url); - return wire.wire__crate__api__uri__ffi_url_from_str(port_, arg0); + return wire.wire__crate__api__uri__ffi_url_from_str(arg0); }, codec: DcoCodec( decodeSuccessData: dco_decode_ffi_url, @@ -2793,6 +2791,14 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { get rust_arc_decrement_strong_count_ArcV2PayjoinProposal => wire .rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffireceivev2V2PayjoinProposal; + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_ArcContextV1 => wire + .rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_ArcContextV1 => wire + .rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1; + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_ArcContextV2 => wire .rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv2ContextV2; @@ -2921,14 +2927,6 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { get rust_arc_decrement_strong_count_V2UncheckedProposal => wire .rust_arc_decrement_strong_count_RustOpaque_payjoin_ffireceivev2V2UncheckedProposal; - RustArcIncrementStrongCountFnType - get rust_arc_increment_strong_count_ContextV1 => wire - .rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1ContextV1; - - RustArcDecrementStrongCountFnType - get rust_arc_decrement_strong_count_ContextV1 => wire - .rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1ContextV1; - RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_RequestBuilder => wire .rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1RequestBuilder; @@ -3053,6 +3051,13 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { return ArcV2PayjoinProposalImpl.frbInternalDcoDecode(raw as List); } + @protected + ArcContextV1 dco_decode_RustOpaque_Arcpayjoin_ffisendv1ContextV1( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return ArcContextV1Impl.frbInternalDcoDecode(raw as List); + } + @protected ArcContextV2 dco_decode_RustOpaque_Arcpayjoin_ffisendv2ContextV2( dynamic raw) { @@ -3174,12 +3179,6 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { return V2UncheckedProposalImpl.frbInternalDcoDecode(raw as List); } - @protected - ContextV1 dco_decode_RustOpaque_payjoin_ffisendv1ContextV1(dynamic raw) { - // Codec=Dco (DartCObject based), see doc to use other codecs - return ContextV1Impl.frbInternalDcoDecode(raw as List); - } - @protected RequestBuilder dco_decode_RustOpaque_payjoin_ffisendv1RequestBuilder( dynamic raw) { @@ -3246,21 +3245,21 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } @protected - double dco_decode_box_autoadd_f_64(dynamic raw) { + ClientResponse dco_decode_box_autoadd_client_response(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs - return raw as double; + return dco_decode_client_response(raw); } @protected - FfiActiveSession dco_decode_box_autoadd_ffi_active_session(dynamic raw) { + double dco_decode_box_autoadd_f_64(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs - return dco_decode_ffi_active_session(raw); + return raw as double; } @protected - FfiClientResponse dco_decode_box_autoadd_ffi_client_response(dynamic raw) { + FfiActiveSession dco_decode_box_autoadd_ffi_active_session(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs - return dco_decode_ffi_client_response(raw); + return dco_decode_ffi_active_session(raw); } @protected @@ -3449,6 +3448,19 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { return raw as int; } + @protected + ClientResponse dco_decode_client_response(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 1) + throw Exception('unexpected arr length: expect 1 but see ${arr.length}'); + return ClientResponse( + field0: + dco_decode_RustOpaque_stdsyncMutexcoreoptionOptionohttpClientResponse( + arr[0]), + ); + } + @protected double dco_decode_f_64(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -3466,19 +3478,6 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { ); } - @protected - FfiClientResponse dco_decode_ffi_client_response(dynamic raw) { - // Codec=Dco (DartCObject based), see doc to use other codecs - final arr = raw as List; - if (arr.length != 1) - throw Exception('unexpected arr length: expect 1 but see ${arr.length}'); - return FfiClientResponse( - field0: - dco_decode_RustOpaque_stdsyncMutexcoreoptionOptionohttpClientResponse( - arr[0]), - ); - } - @protected FfiContextV1 dco_decode_ffi_context_v_1(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -3486,7 +3485,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { if (arr.length != 1) throw Exception('unexpected arr length: expect 1 but see ${arr.length}'); return FfiContextV1( - field0: dco_decode_RustOpaque_payjoin_ffisendv1ContextV1(arr[0]), + field0: dco_decode_RustOpaque_Arcpayjoin_ffisendv1ContextV1(arr[0]), ); } @@ -3953,7 +3952,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } @protected - (FfiUrl, Uint8List) dco_decode_record_ffi_url_list_prim_u_8_strict( + (Request, ClientResponse) dco_decode_record_request_client_response( dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs final arr = raw as List; @@ -3961,73 +3960,74 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { throw Exception('Expected 2 elements, got ${arr.length}'); } return ( - dco_decode_ffi_url(arr[0]), - dco_decode_list_prim_u_8_strict(arr[1]), + dco_decode_request(arr[0]), + dco_decode_client_response(arr[1]), ); } @protected - ((FfiUrl, Uint8List), FfiClientResponse) - dco_decode_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response( - dynamic raw) { + (Request, FfiContextV1) dco_decode_record_request_ffi_context_v_1( + dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs final arr = raw as List; if (arr.length != 2) { throw Exception('Expected 2 elements, got ${arr.length}'); } return ( - dco_decode_record_ffi_url_list_prim_u_8_strict(arr[0]), - dco_decode_ffi_client_response(arr[1]), + dco_decode_request(arr[0]), + dco_decode_ffi_context_v_1(arr[1]), ); } @protected - (String, String) dco_decode_record_string_string(dynamic raw) { + (Request, FfiContextV2) dco_decode_record_request_ffi_context_v_2( + dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs final arr = raw as List; if (arr.length != 2) { throw Exception('Expected 2 elements, got ${arr.length}'); } return ( - dco_decode_String(arr[0]), - dco_decode_String(arr[1]), + dco_decode_request(arr[0]), + dco_decode_ffi_context_v_2(arr[1]), ); } @protected - (BigInt, OutPoint) dco_decode_record_u_64_out_point(dynamic raw) { + (String, String) dco_decode_record_string_string(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs final arr = raw as List; if (arr.length != 2) { throw Exception('Expected 2 elements, got ${arr.length}'); } return ( - dco_decode_u_64(arr[0]), - dco_decode_out_point(arr[1]), + dco_decode_String(arr[0]), + dco_decode_String(arr[1]), ); } @protected - RequestContextV1 dco_decode_request_context_v_1(dynamic raw) { + (BigInt, OutPoint) dco_decode_record_u_64_out_point(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 RequestContextV1( - request: dco_decode_record_ffi_url_list_prim_u_8_strict(arr[0]), - contextV1: dco_decode_ffi_context_v_1(arr[1]), + if (arr.length != 2) { + throw Exception('Expected 2 elements, got ${arr.length}'); + } + return ( + dco_decode_u_64(arr[0]), + dco_decode_out_point(arr[1]), ); } @protected - RequestContextV2 dco_decode_request_context_v_2(dynamic raw) { + Request dco_decode_request(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 RequestContextV2( - request: dco_decode_record_ffi_url_list_prim_u_8_strict(arr[0]), - contextV2: dco_decode_ffi_context_v_2(arr[1]), + return Request( + url: dco_decode_ffi_url(arr[0]), + body: dco_decode_list_prim_u_8_strict(arr[1]), ); } @@ -4112,6 +4112,14 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } + @protected + ArcContextV1 sse_decode_RustOpaque_Arcpayjoin_ffisendv1ContextV1( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return ArcContextV1Impl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + @protected ArcContextV2 sse_decode_RustOpaque_Arcpayjoin_ffisendv2ContextV2( SseDeserializer deserializer) { @@ -4247,14 +4255,6 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - @protected - ContextV1 sse_decode_RustOpaque_payjoin_ffisendv1ContextV1( - SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - return ContextV1Impl.frbInternalSseDecode( - sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); - } - @protected RequestBuilder sse_decode_RustOpaque_payjoin_ffisendv1RequestBuilder( SseDeserializer deserializer) { @@ -4332,23 +4332,23 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } @protected - double sse_decode_box_autoadd_f_64(SseDeserializer deserializer) { + ClientResponse sse_decode_box_autoadd_client_response( + SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs - return (sse_decode_f_64(deserializer)); + return (sse_decode_client_response(deserializer)); } @protected - FfiActiveSession sse_decode_box_autoadd_ffi_active_session( - SseDeserializer deserializer) { + double sse_decode_box_autoadd_f_64(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs - return (sse_decode_ffi_active_session(deserializer)); + return (sse_decode_f_64(deserializer)); } @protected - FfiClientResponse sse_decode_box_autoadd_ffi_client_response( + FfiActiveSession sse_decode_box_autoadd_ffi_active_session( SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs - return (sse_decode_ffi_client_response(deserializer)); + return (sse_decode_ffi_active_session(deserializer)); } @protected @@ -4548,6 +4548,15 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { return (sse_decode_u_8(deserializer)); } + @protected + ClientResponse sse_decode_client_response(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_field0 = + sse_decode_RustOpaque_stdsyncMutexcoreoptionOptionohttpClientResponse( + deserializer); + return ClientResponse(field0: var_field0); + } + @protected double sse_decode_f_64(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -4562,21 +4571,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { return FfiActiveSession(field0: var_field0); } - @protected - FfiClientResponse sse_decode_ffi_client_response( - SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - var var_field0 = - sse_decode_RustOpaque_stdsyncMutexcoreoptionOptionohttpClientResponse( - deserializer); - return FfiClientResponse(field0: var_field0); - } - @protected FfiContextV1 sse_decode_ffi_context_v_1(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs var var_field0 = - sse_decode_RustOpaque_payjoin_ffisendv1ContextV1(deserializer); + sse_decode_RustOpaque_Arcpayjoin_ffisendv1ContextV1(deserializer); return FfiContextV1(field0: var_field0); } @@ -5009,22 +5008,29 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } @protected - (FfiUrl, Uint8List) sse_decode_record_ffi_url_list_prim_u_8_strict( + (Request, ClientResponse) sse_decode_record_request_client_response( SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs - var var_field0 = sse_decode_ffi_url(deserializer); - var var_field1 = sse_decode_list_prim_u_8_strict(deserializer); + var var_field0 = sse_decode_request(deserializer); + var var_field1 = sse_decode_client_response(deserializer); return (var_field0, var_field1); } @protected - ((FfiUrl, Uint8List), FfiClientResponse) - sse_decode_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response( - SseDeserializer deserializer) { + (Request, FfiContextV1) sse_decode_record_request_ffi_context_v_1( + SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs - var var_field0 = - sse_decode_record_ffi_url_list_prim_u_8_strict(deserializer); - var var_field1 = sse_decode_ffi_client_response(deserializer); + var var_field0 = sse_decode_request(deserializer); + var var_field1 = sse_decode_ffi_context_v_1(deserializer); + return (var_field0, var_field1); + } + + @protected + (Request, FfiContextV2) sse_decode_record_request_ffi_context_v_2( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_field0 = sse_decode_request(deserializer); + var var_field1 = sse_decode_ffi_context_v_2(deserializer); return (var_field0, var_field1); } @@ -5047,23 +5053,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } @protected - RequestContextV1 sse_decode_request_context_v_1( - SseDeserializer deserializer) { + Request sse_decode_request(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs - var var_request = - sse_decode_record_ffi_url_list_prim_u_8_strict(deserializer); - var var_contextV1 = sse_decode_ffi_context_v_1(deserializer); - return RequestContextV1(request: var_request, contextV1: var_contextV1); - } - - @protected - RequestContextV2 sse_decode_request_context_v_2( - SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - var var_request = - sse_decode_record_ffi_url_list_prim_u_8_strict(deserializer); - var var_contextV2 = sse_decode_ffi_context_v_2(deserializer); - return RequestContextV2(request: var_request, contextV2: var_contextV2); + var var_url = sse_decode_ffi_url(deserializer); + var var_body = sse_decode_list_prim_u_8_strict(deserializer); + return Request(url: var_url, body: var_body); } @protected @@ -5154,6 +5148,13 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { return (raw as ArcV2PayjoinProposalImpl).frbInternalCstEncode(); } + @protected + int cst_encode_RustOpaque_Arcpayjoin_ffisendv1ContextV1(ArcContextV1 raw) { + // Codec=Cst (C-struct based), see doc to use other codecs +// ignore: invalid_use_of_internal_member + return (raw as ArcContextV1Impl).frbInternalCstEncode(); + } + @protected int cst_encode_RustOpaque_Arcpayjoin_ffisendv2ContextV2(ArcContextV2 raw) { // Codec=Cst (C-struct based), see doc to use other codecs @@ -5281,13 +5282,6 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { return (raw as V2UncheckedProposalImpl).frbInternalCstEncode(); } - @protected - int cst_encode_RustOpaque_payjoin_ffisendv1ContextV1(ContextV1 raw) { - // Codec=Cst (C-struct based), see doc to use other codecs -// ignore: invalid_use_of_internal_member - return (raw as ContextV1Impl).frbInternalCstEncode(); - } - @protected int cst_encode_RustOpaque_payjoin_ffisendv1RequestBuilder( RequestBuilder raw) { @@ -5469,6 +5463,15 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { serializer); } + @protected + void sse_encode_RustOpaque_Arcpayjoin_ffisendv1ContextV1( + ArcContextV1 self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as ArcContextV1Impl).frbInternalSseEncode(move: null), + serializer); + } + @protected void sse_encode_RustOpaque_Arcpayjoin_ffisendv2ContextV2( ArcContextV2 self, SseSerializer serializer) { @@ -5613,14 +5616,6 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { serializer); } - @protected - void sse_encode_RustOpaque_payjoin_ffisendv1ContextV1( - ContextV1 self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_usize( - (self as ContextV1Impl).frbInternalSseEncode(move: null), serializer); - } - @protected void sse_encode_RustOpaque_payjoin_ffisendv1RequestBuilder( RequestBuilder self, SseSerializer serializer) { @@ -5702,6 +5697,13 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { serializer.buffer.putUint8(self ? 1 : 0); } + @protected + void sse_encode_box_autoadd_client_response( + ClientResponse self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_client_response(self, serializer); + } + @protected void sse_encode_box_autoadd_f_64(double self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -5715,13 +5717,6 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { sse_encode_ffi_active_session(self, serializer); } - @protected - void sse_encode_box_autoadd_ffi_client_response( - FfiClientResponse self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_ffi_client_response(self, serializer); - } - @protected void sse_encode_box_autoadd_ffi_context_v_1( FfiContextV1 self, SseSerializer serializer) { @@ -5919,6 +5914,14 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { sse_encode_u_8(self, serializer); } + @protected + void sse_encode_client_response( + ClientResponse self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_RustOpaque_stdsyncMutexcoreoptionOptionohttpClientResponse( + self.field0, serializer); + } + @protected void sse_encode_f_64(double self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -5933,18 +5936,11 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { self.field0, serializer); } - @protected - void sse_encode_ffi_client_response( - FfiClientResponse self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_RustOpaque_stdsyncMutexcoreoptionOptionohttpClientResponse( - self.field0, serializer); - } - @protected void sse_encode_ffi_context_v_1(FfiContextV1 self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_RustOpaque_payjoin_ffisendv1ContextV1(self.field0, serializer); + sse_encode_RustOpaque_Arcpayjoin_ffisendv1ContextV1( + self.field0, serializer); } @protected @@ -6327,21 +6323,27 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } @protected - void sse_encode_record_ffi_url_list_prim_u_8_strict( - (FfiUrl, Uint8List) self, SseSerializer serializer) { + void sse_encode_record_request_client_response( + (Request, ClientResponse) self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_ffi_url(self.$1, serializer); - sse_encode_list_prim_u_8_strict(self.$2, serializer); + sse_encode_request(self.$1, serializer); + sse_encode_client_response(self.$2, serializer); } @protected - void - sse_encode_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response( - ((FfiUrl, Uint8List), FfiClientResponse) self, - SseSerializer serializer) { + void sse_encode_record_request_ffi_context_v_1( + (Request, FfiContextV1) self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_request(self.$1, serializer); + sse_encode_ffi_context_v_1(self.$2, serializer); + } + + @protected + void sse_encode_record_request_ffi_context_v_2( + (Request, FfiContextV2) self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_record_ffi_url_list_prim_u_8_strict(self.$1, serializer); - sse_encode_ffi_client_response(self.$2, serializer); + sse_encode_request(self.$1, serializer); + sse_encode_ffi_context_v_2(self.$2, serializer); } @protected @@ -6361,19 +6363,10 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi { } @protected - void sse_encode_request_context_v_1( - RequestContextV1 self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_record_ffi_url_list_prim_u_8_strict(self.request, serializer); - sse_encode_ffi_context_v_1(self.contextV1, serializer); - } - - @protected - void sse_encode_request_context_v_2( - RequestContextV2 self, SseSerializer serializer) { + void sse_encode_request(Request self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_record_ffi_url_list_prim_u_8_strict(self.request, serializer); - sse_encode_ffi_context_v_2(self.contextV2, serializer); + sse_encode_ffi_url(self.url, serializer); + sse_encode_list_prim_u_8_strict(self.body, serializer); } @protected @@ -6433,6 +6426,26 @@ class ActiveSessionImpl extends RustOpaque implements ActiveSession { ); } +@sealed +class ArcContextV1Impl extends RustOpaque implements ArcContextV1 { + // Not to be used by end users + ArcContextV1Impl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + ArcContextV1Impl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + core.instance.api.rust_arc_increment_strong_count_ArcContextV1, + rustArcDecrementStrongCount: + core.instance.api.rust_arc_decrement_strong_count_ArcContextV1, + rustArcDecrementStrongCountPtr: + core.instance.api.rust_arc_decrement_strong_count_ArcContextV1Ptr, + ); +} + @sealed class ArcContextV2Impl extends RustOpaque implements ArcContextV2 { // Not to be used by end users @@ -6475,26 +6488,6 @@ class ArcV2PayjoinProposalImpl extends RustOpaque ); } -@sealed -class ContextV1Impl extends RustOpaque implements ContextV1 { - // Not to be used by end users - ContextV1Impl.frbInternalDcoDecode(List wire) - : super.frbInternalDcoDecode(wire, _kStaticData); - - // Not to be used by end users - ContextV1Impl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) - : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); - - static final _kStaticData = RustArcStaticData( - rustArcIncrementStrongCount: - core.instance.api.rust_arc_increment_strong_count_ContextV1, - rustArcDecrementStrongCount: - core.instance.api.rust_arc_decrement_strong_count_ContextV1, - rustArcDecrementStrongCountPtr: - core.instance.api.rust_arc_decrement_strong_count_ContextV1Ptr, - ); -} - @sealed class MaybeInputsOwnedImpl extends RustOpaque implements MaybeInputsOwned { // Not to be used by end users diff --git a/lib/src/generated/frb_generated.io.dart b/lib/src/generated/frb_generated.io.dart index 08b0ecd..668e41e 100644 --- a/lib/src/generated/frb_generated.io.dart +++ b/lib/src/generated/frb_generated.io.dart @@ -28,6 +28,10 @@ abstract class coreApiImplPlatform extends BaseApiImpl { get rust_arc_decrement_strong_count_ArcV2PayjoinProposalPtr => wire ._rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffireceivev2V2PayjoinProposalPtr; + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_ArcContextV1Ptr => wire + ._rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1Ptr; + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ArcContextV2Ptr => wire ._rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv2ContextV2Ptr; @@ -92,9 +96,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { get rust_arc_decrement_strong_count_V2UncheckedProposalPtr => wire ._rust_arc_decrement_strong_count_RustOpaque_payjoin_ffireceivev2V2UncheckedProposalPtr; - CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ContextV1Ptr => - wire._rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1ContextV1Ptr; - CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_RequestBuilderPtr => wire ._rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1RequestBuilderPtr; @@ -160,6 +161,9 @@ abstract class coreApiImplPlatform extends BaseApiImpl { dco_decode_RustOpaque_Arcpayjoin_ffireceivev2V2PayjoinProposal( dynamic raw); + @protected + ArcContextV1 dco_decode_RustOpaque_Arcpayjoin_ffisendv1ContextV1(dynamic raw); + @protected ArcContextV2 dco_decode_RustOpaque_Arcpayjoin_ffisendv2ContextV2(dynamic raw); @@ -228,9 +232,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { dco_decode_RustOpaque_payjoin_ffireceivev2V2UncheckedProposal( dynamic raw); - @protected - ContextV1 dco_decode_RustOpaque_payjoin_ffisendv1ContextV1(dynamic raw); - @protected RequestBuilder dco_decode_RustOpaque_payjoin_ffisendv1RequestBuilder( dynamic raw); @@ -266,13 +267,13 @@ abstract class coreApiImplPlatform extends BaseApiImpl { bool dco_decode_bool(dynamic raw); @protected - double dco_decode_box_autoadd_f_64(dynamic raw); + ClientResponse dco_decode_box_autoadd_client_response(dynamic raw); @protected - FfiActiveSession dco_decode_box_autoadd_ffi_active_session(dynamic raw); + double dco_decode_box_autoadd_f_64(dynamic raw); @protected - FfiClientResponse dco_decode_box_autoadd_ffi_client_response(dynamic raw); + FfiActiveSession dco_decode_box_autoadd_ffi_active_session(dynamic raw); @protected FfiContextV1 dco_decode_box_autoadd_ffi_context_v_1(dynamic raw); @@ -374,13 +375,13 @@ abstract class coreApiImplPlatform extends BaseApiImpl { int dco_decode_box_autoadd_u_8(dynamic raw); @protected - double dco_decode_f_64(dynamic raw); + ClientResponse dco_decode_client_response(dynamic raw); @protected - FfiActiveSession dco_decode_ffi_active_session(dynamic raw); + double dco_decode_f_64(dynamic raw); @protected - FfiClientResponse dco_decode_ffi_client_response(dynamic raw); + FfiActiveSession dco_decode_ffi_active_session(dynamic raw); @protected FfiContextV1 dco_decode_ffi_context_v_1(dynamic raw); @@ -509,25 +510,25 @@ abstract class coreApiImplPlatform extends BaseApiImpl { PayjoinError dco_decode_payjoin_error(dynamic raw); @protected - (FfiUrl, Uint8List) dco_decode_record_ffi_url_list_prim_u_8_strict( + (Request, ClientResponse) dco_decode_record_request_client_response( dynamic raw); @protected - ((FfiUrl, Uint8List), FfiClientResponse) - dco_decode_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response( - dynamic raw); + (Request, FfiContextV1) dco_decode_record_request_ffi_context_v_1( + dynamic raw); @protected - (String, String) dco_decode_record_string_string(dynamic raw); + (Request, FfiContextV2) dco_decode_record_request_ffi_context_v_2( + dynamic raw); @protected - (BigInt, OutPoint) dco_decode_record_u_64_out_point(dynamic raw); + (String, String) dco_decode_record_string_string(dynamic raw); @protected - RequestContextV1 dco_decode_request_context_v_1(dynamic raw); + (BigInt, OutPoint) dco_decode_record_u_64_out_point(dynamic raw); @protected - RequestContextV2 dco_decode_request_context_v_2(dynamic raw); + Request dco_decode_request(dynamic raw); @protected TxOut dco_decode_tx_out(dynamic raw); @@ -566,6 +567,10 @@ abstract class coreApiImplPlatform extends BaseApiImpl { sse_decode_RustOpaque_Arcpayjoin_ffireceivev2V2PayjoinProposal( SseDeserializer deserializer); + @protected + ArcContextV1 sse_decode_RustOpaque_Arcpayjoin_ffisendv1ContextV1( + SseDeserializer deserializer); + @protected ArcContextV2 sse_decode_RustOpaque_Arcpayjoin_ffisendv2ContextV2( SseDeserializer deserializer); @@ -637,10 +642,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { sse_decode_RustOpaque_payjoin_ffireceivev2V2UncheckedProposal( SseDeserializer deserializer); - @protected - ContextV1 sse_decode_RustOpaque_payjoin_ffisendv1ContextV1( - SseDeserializer deserializer); - @protected RequestBuilder sse_decode_RustOpaque_payjoin_ffisendv1RequestBuilder( SseDeserializer deserializer); @@ -678,14 +679,14 @@ abstract class coreApiImplPlatform extends BaseApiImpl { bool sse_decode_bool(SseDeserializer deserializer); @protected - double sse_decode_box_autoadd_f_64(SseDeserializer deserializer); + ClientResponse sse_decode_box_autoadd_client_response( + SseDeserializer deserializer); @protected - FfiActiveSession sse_decode_box_autoadd_ffi_active_session( - SseDeserializer deserializer); + double sse_decode_box_autoadd_f_64(SseDeserializer deserializer); @protected - FfiClientResponse sse_decode_box_autoadd_ffi_client_response( + FfiActiveSession sse_decode_box_autoadd_ffi_active_session( SseDeserializer deserializer); @protected @@ -799,14 +800,13 @@ abstract class coreApiImplPlatform extends BaseApiImpl { int sse_decode_box_autoadd_u_8(SseDeserializer deserializer); @protected - double sse_decode_f_64(SseDeserializer deserializer); + ClientResponse sse_decode_client_response(SseDeserializer deserializer); @protected - FfiActiveSession sse_decode_ffi_active_session(SseDeserializer deserializer); + double sse_decode_f_64(SseDeserializer deserializer); @protected - FfiClientResponse sse_decode_ffi_client_response( - SseDeserializer deserializer); + FfiActiveSession sse_decode_ffi_active_session(SseDeserializer deserializer); @protected FfiContextV1 sse_decode_ffi_context_v_1(SseDeserializer deserializer); @@ -953,27 +953,27 @@ abstract class coreApiImplPlatform extends BaseApiImpl { PayjoinError sse_decode_payjoin_error(SseDeserializer deserializer); @protected - (FfiUrl, Uint8List) sse_decode_record_ffi_url_list_prim_u_8_strict( + (Request, ClientResponse) sse_decode_record_request_client_response( SseDeserializer deserializer); @protected - ((FfiUrl, Uint8List), FfiClientResponse) - sse_decode_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response( - SseDeserializer deserializer); + (Request, FfiContextV1) sse_decode_record_request_ffi_context_v_1( + SseDeserializer deserializer); @protected - (String, String) sse_decode_record_string_string( + (Request, FfiContextV2) sse_decode_record_request_ffi_context_v_2( SseDeserializer deserializer); @protected - (BigInt, OutPoint) sse_decode_record_u_64_out_point( + (String, String) sse_decode_record_string_string( SseDeserializer deserializer); @protected - RequestContextV1 sse_decode_request_context_v_1(SseDeserializer deserializer); + (BigInt, OutPoint) sse_decode_record_u_64_out_point( + SseDeserializer deserializer); @protected - RequestContextV2 sse_decode_request_context_v_2(SseDeserializer deserializer); + Request sse_decode_request(SseDeserializer deserializer); @protected TxOut sse_decode_tx_out(SseDeserializer deserializer); @@ -1022,6 +1022,15 @@ abstract class coreApiImplPlatform extends BaseApiImpl { return cst_encode_list_prim_u_8_strict(utf8.encoder.convert(raw)); } + @protected + ffi.Pointer cst_encode_box_autoadd_client_response( + ClientResponse raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ptr = wire.cst_new_box_autoadd_client_response(); + cst_api_fill_to_wire_client_response(raw, ptr.ref); + return ptr; + } + @protected ffi.Pointer cst_encode_box_autoadd_f_64(double raw) { // Codec=Cst (C-struct based), see doc to use other codecs @@ -1037,15 +1046,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { return ptr; } - @protected - ffi.Pointer - cst_encode_box_autoadd_ffi_client_response(FfiClientResponse raw) { - // Codec=Cst (C-struct based), see doc to use other codecs - final ptr = wire.cst_new_box_autoadd_ffi_client_response(); - cst_api_fill_to_wire_ffi_client_response(raw, ptr.ref); - return ptr; - } - @protected ffi.Pointer cst_encode_box_autoadd_ffi_context_v_1( FfiContextV1 raw) { @@ -1422,6 +1422,12 @@ abstract class coreApiImplPlatform extends BaseApiImpl { return raw.toSigned(64).toInt(); } + @protected + void cst_api_fill_to_wire_box_autoadd_client_response( + ClientResponse apiObj, ffi.Pointer wireObj) { + cst_api_fill_to_wire_client_response(apiObj, wireObj.ref); + } + @protected void cst_api_fill_to_wire_box_autoadd_ffi_active_session( FfiActiveSession apiObj, @@ -1429,13 +1435,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { cst_api_fill_to_wire_ffi_active_session(apiObj, wireObj.ref); } - @protected - void cst_api_fill_to_wire_box_autoadd_ffi_client_response( - FfiClientResponse apiObj, - ffi.Pointer wireObj) { - cst_api_fill_to_wire_ffi_client_response(apiObj, wireObj.ref); - } - @protected void cst_api_fill_to_wire_box_autoadd_ffi_context_v_1( FfiContextV1 apiObj, ffi.Pointer wireObj) { @@ -1617,25 +1616,25 @@ abstract class coreApiImplPlatform extends BaseApiImpl { } @protected - void cst_api_fill_to_wire_ffi_active_session( - FfiActiveSession apiObj, wire_cst_ffi_active_session wireObj) { + void cst_api_fill_to_wire_client_response( + ClientResponse apiObj, wire_cst_client_response wireObj) { wireObj.field0 = - cst_encode_RustOpaque_payjoin_ffireceivev2ActiveSession(apiObj.field0); + cst_encode_RustOpaque_stdsyncMutexcoreoptionOptionohttpClientResponse( + apiObj.field0); } @protected - void cst_api_fill_to_wire_ffi_client_response( - FfiClientResponse apiObj, wire_cst_ffi_client_response wireObj) { + void cst_api_fill_to_wire_ffi_active_session( + FfiActiveSession apiObj, wire_cst_ffi_active_session wireObj) { wireObj.field0 = - cst_encode_RustOpaque_stdsyncMutexcoreoptionOptionohttpClientResponse( - apiObj.field0); + cst_encode_RustOpaque_payjoin_ffireceivev2ActiveSession(apiObj.field0); } @protected void cst_api_fill_to_wire_ffi_context_v_1( FfiContextV1 apiObj, wire_cst_ffi_context_v_1 wireObj) { wireObj.field0 = - cst_encode_RustOpaque_payjoin_ffisendv1ContextV1(apiObj.field0); + cst_encode_RustOpaque_Arcpayjoin_ffisendv1ContextV1(apiObj.field0); } @protected @@ -1936,21 +1935,27 @@ abstract class coreApiImplPlatform extends BaseApiImpl { } @protected - void cst_api_fill_to_wire_record_ffi_url_list_prim_u_8_strict( - (FfiUrl, Uint8List) apiObj, - wire_cst_record_ffi_url_list_prim_u_8_strict wireObj) { - cst_api_fill_to_wire_ffi_url(apiObj.$1, wireObj.field0); - wireObj.field1 = cst_encode_list_prim_u_8_strict(apiObj.$2); + void cst_api_fill_to_wire_record_request_client_response( + (Request, ClientResponse) apiObj, + wire_cst_record_request_client_response wireObj) { + cst_api_fill_to_wire_request(apiObj.$1, wireObj.field0); + cst_api_fill_to_wire_client_response(apiObj.$2, wireObj.field1); + } + + @protected + void cst_api_fill_to_wire_record_request_ffi_context_v_1( + (Request, FfiContextV1) apiObj, + wire_cst_record_request_ffi_context_v_1 wireObj) { + cst_api_fill_to_wire_request(apiObj.$1, wireObj.field0); + cst_api_fill_to_wire_ffi_context_v_1(apiObj.$2, wireObj.field1); } @protected - void cst_api_fill_to_wire_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response( - ((FfiUrl, Uint8List), FfiClientResponse) apiObj, - wire_cst_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response - wireObj) { - cst_api_fill_to_wire_record_ffi_url_list_prim_u_8_strict( - apiObj.$1, wireObj.field0); - cst_api_fill_to_wire_ffi_client_response(apiObj.$2, wireObj.field1); + void cst_api_fill_to_wire_record_request_ffi_context_v_2( + (Request, FfiContextV2) apiObj, + wire_cst_record_request_ffi_context_v_2 wireObj) { + cst_api_fill_to_wire_request(apiObj.$1, wireObj.field0); + cst_api_fill_to_wire_ffi_context_v_2(apiObj.$2, wireObj.field1); } @protected @@ -1968,19 +1973,9 @@ abstract class coreApiImplPlatform extends BaseApiImpl { } @protected - void cst_api_fill_to_wire_request_context_v_1( - RequestContextV1 apiObj, wire_cst_request_context_v_1 wireObj) { - cst_api_fill_to_wire_record_ffi_url_list_prim_u_8_strict( - apiObj.request, wireObj.request); - cst_api_fill_to_wire_ffi_context_v_1(apiObj.contextV1, wireObj.context_v1); - } - - @protected - void cst_api_fill_to_wire_request_context_v_2( - RequestContextV2 apiObj, wire_cst_request_context_v_2 wireObj) { - cst_api_fill_to_wire_record_ffi_url_list_prim_u_8_strict( - apiObj.request, wireObj.request); - cst_api_fill_to_wire_ffi_context_v_2(apiObj.contextV2, wireObj.context_v2); + void cst_api_fill_to_wire_request(Request apiObj, wire_cst_request wireObj) { + cst_api_fill_to_wire_ffi_url(apiObj.url, wireObj.url); + wireObj.body = cst_encode_list_prim_u_8_strict(apiObj.body); } @protected @@ -2016,6 +2011,9 @@ abstract class coreApiImplPlatform extends BaseApiImpl { int cst_encode_RustOpaque_Arcpayjoin_ffireceivev2V2PayjoinProposal( ArcV2PayjoinProposal raw); + @protected + int cst_encode_RustOpaque_Arcpayjoin_ffisendv1ContextV1(ArcContextV1 raw); + @protected int cst_encode_RustOpaque_Arcpayjoin_ffisendv2ContextV2(ArcContextV2 raw); @@ -2079,9 +2077,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { int cst_encode_RustOpaque_payjoin_ffireceivev2V2UncheckedProposal( V2UncheckedProposal raw); - @protected - int cst_encode_RustOpaque_payjoin_ffisendv1ContextV1(ContextV1 raw); - @protected int cst_encode_RustOpaque_payjoin_ffisendv1RequestBuilder(RequestBuilder raw); @@ -2164,6 +2159,10 @@ abstract class coreApiImplPlatform extends BaseApiImpl { void sse_encode_RustOpaque_Arcpayjoin_ffireceivev2V2PayjoinProposal( ArcV2PayjoinProposal self, SseSerializer serializer); + @protected + void sse_encode_RustOpaque_Arcpayjoin_ffisendv1ContextV1( + ArcContextV1 self, SseSerializer serializer); + @protected void sse_encode_RustOpaque_Arcpayjoin_ffisendv2ContextV2( ArcContextV2 self, SseSerializer serializer); @@ -2228,10 +2227,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { void sse_encode_RustOpaque_payjoin_ffireceivev2V2UncheckedProposal( V2UncheckedProposal self, SseSerializer serializer); - @protected - void sse_encode_RustOpaque_payjoin_ffisendv1ContextV1( - ContextV1 self, SseSerializer serializer); - @protected void sse_encode_RustOpaque_payjoin_ffisendv1RequestBuilder( RequestBuilder self, SseSerializer serializer); @@ -2270,6 +2265,10 @@ abstract class coreApiImplPlatform extends BaseApiImpl { @protected void sse_encode_bool(bool self, SseSerializer serializer); + @protected + void sse_encode_box_autoadd_client_response( + ClientResponse self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_f_64(double self, SseSerializer serializer); @@ -2277,10 +2276,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { void sse_encode_box_autoadd_ffi_active_session( FfiActiveSession self, SseSerializer serializer); - @protected - void sse_encode_box_autoadd_ffi_client_response( - FfiClientResponse self, SseSerializer serializer); - @protected void sse_encode_box_autoadd_ffi_context_v_1( FfiContextV1 self, SseSerializer serializer); @@ -2391,6 +2386,10 @@ abstract class coreApiImplPlatform extends BaseApiImpl { @protected void sse_encode_box_autoadd_u_8(int self, SseSerializer serializer); + @protected + void sse_encode_client_response( + ClientResponse self, SseSerializer serializer); + @protected void sse_encode_f_64(double self, SseSerializer serializer); @@ -2398,10 +2397,6 @@ abstract class coreApiImplPlatform extends BaseApiImpl { void sse_encode_ffi_active_session( FfiActiveSession self, SseSerializer serializer); - @protected - void sse_encode_ffi_client_response( - FfiClientResponse self, SseSerializer serializer); - @protected void sse_encode_ffi_context_v_1(FfiContextV1 self, SseSerializer serializer); @@ -2550,14 +2545,16 @@ abstract class coreApiImplPlatform extends BaseApiImpl { void sse_encode_payjoin_error(PayjoinError self, SseSerializer serializer); @protected - void sse_encode_record_ffi_url_list_prim_u_8_strict( - (FfiUrl, Uint8List) self, SseSerializer serializer); + void sse_encode_record_request_client_response( + (Request, ClientResponse) self, SseSerializer serializer); @protected - void - sse_encode_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response( - ((FfiUrl, Uint8List), FfiClientResponse) self, - SseSerializer serializer); + void sse_encode_record_request_ffi_context_v_1( + (Request, FfiContextV1) self, SseSerializer serializer); + + @protected + void sse_encode_record_request_ffi_context_v_2( + (Request, FfiContextV2) self, SseSerializer serializer); @protected void sse_encode_record_string_string( @@ -2568,12 +2565,7 @@ abstract class coreApiImplPlatform extends BaseApiImpl { (BigInt, OutPoint) self, SseSerializer serializer); @protected - void sse_encode_request_context_v_1( - RequestContextV1 self, SseSerializer serializer); - - @protected - void sse_encode_request_context_v_2( - RequestContextV2 self, SseSerializer serializer); + void sse_encode_request(Request self, SseSerializer serializer); @protected void sse_encode_tx_out(TxOut self, SseSerializer serializer); @@ -2658,11 +2650,11 @@ class coreWire implements BaseWire { void wire__crate__api__receive__ffi_active_session_extract_req( int port_, - ffi.Pointer ptr, + ffi.Pointer that, ) { return _wire__crate__api__receive__ffi_active_session_extract_req( port_, - ptr, + that, ); } @@ -2678,10 +2670,10 @@ class coreWire implements BaseWire { WireSyncRust2DartDco wire__crate__api__receive__ffi_active_session_pj_uri_builder( - ffi.Pointer ptr, + ffi.Pointer that, ) { return _wire__crate__api__receive__ffi_active_session_pj_uri_builder( - ptr, + that, ); } @@ -2697,29 +2689,30 @@ class coreWire implements BaseWire { WireSyncRust2DartDco Function( ffi.Pointer)>(); - WireSyncRust2DartDco wire__crate__api__receive__ffi_active_session_pj_url( - ffi.Pointer ptr, + void wire__crate__api__receive__ffi_active_session_pj_url( + int port_, + ffi.Pointer that, ) { return _wire__crate__api__receive__ffi_active_session_pj_url( - ptr, + port_, + that, ); } late final _wire__crate__api__receive__ffi_active_session_pj_urlPtr = _lookup< ffi.NativeFunction< - WireSyncRust2DartDco Function( - ffi.Pointer)>>( + ffi.Void Function( + ffi.Int64, ffi.Pointer)>>( 'frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_pj_url'); late final _wire__crate__api__receive__ffi_active_session_pj_url = _wire__crate__api__receive__ffi_active_session_pj_urlPtr.asFunction< - WireSyncRust2DartDco Function( - ffi.Pointer)>(); + void Function(int, ffi.Pointer)>(); void wire__crate__api__receive__ffi_active_session_process_res( int port_, ffi.Pointer that, ffi.Pointer body, - ffi.Pointer ctx, + ffi.Pointer ctx, ) { return _wire__crate__api__receive__ffi_active_session_process_res( port_, @@ -2736,7 +2729,7 @@ class coreWire implements BaseWire { ffi.Int64, ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>( + ffi.Pointer)>>( 'frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_process_res'); late final _wire__crate__api__receive__ffi_active_session_process_res = _wire__crate__api__receive__ffi_active_session_process_resPtr.asFunction< @@ -2744,7 +2737,7 @@ class coreWire implements BaseWire { int, ffi.Pointer, ffi.Pointer, - ffi.Pointer)>(); + ffi.Pointer)>(); WireSyncRust2DartDco wire__crate__api__receive__ffi_active_session_public_key( ffi.Pointer that, @@ -2766,12 +2759,12 @@ class coreWire implements BaseWire { void wire__crate__api__receive__ffi_maybe_inputs_owned_check_inputs_not_owned( int port_, - ffi.Pointer ptr, + ffi.Pointer that, ffi.Pointer is_owned, ) { return _wire__crate__api__receive__ffi_maybe_inputs_owned_check_inputs_not_owned( port_, - ptr, + that, is_owned, ); } @@ -2793,12 +2786,12 @@ class coreWire implements BaseWire { void wire__crate__api__receive__ffi_maybe_inputs_seen_check_no_inputs_seen_before( int port_, - ffi.Pointer ptr, + ffi.Pointer that, ffi.Pointer is_known, ) { return _wire__crate__api__receive__ffi_maybe_inputs_seen_check_no_inputs_seen_before( port_, - ptr, + that, is_known, ); } @@ -2820,11 +2813,11 @@ class coreWire implements BaseWire { void wire__crate__api__receive__ffi_maybe_mixed_input_scripts_check_no_mixed_input_scripts( int port_, - ffi.Pointer ptr, + ffi.Pointer that, ) { return _wire__crate__api__receive__ffi_maybe_mixed_input_scripts_check_no_mixed_input_scripts( port_, - ptr, + that, ); } @@ -2842,12 +2835,12 @@ class coreWire implements BaseWire { void wire__crate__api__receive__ffi_outputs_unknown_identify_receiver_outputs( int port_, - ffi.Pointer ptr, + ffi.Pointer that, ffi.Pointer is_receiver_output, ) { return _wire__crate__api__receive__ffi_outputs_unknown_identify_receiver_outputs( port_, - ptr, + that, is_receiver_output, ); } @@ -3017,15 +3010,15 @@ class coreWire implements BaseWire { void wire__crate__api__receive__ffi_provisional_proposal_finalize_proposal( int port_, - ffi.Pointer ptr, + ffi.Pointer that, ffi.Pointer process_psbt, - ffi.Pointer min_feerate_sat_per_vb, + ffi.Pointer min_fee_rate_sat_per_vb, ) { return _wire__crate__api__receive__ffi_provisional_proposal_finalize_proposal( port_, - ptr, + that, process_psbt, - min_feerate_sat_per_vb, + min_fee_rate_sat_per_vb, ); } @@ -3100,11 +3093,11 @@ class coreWire implements BaseWire { void wire__crate__api__receive__ffi_session_initializer_extract_req( int port_, - ffi.Pointer ptr, + ffi.Pointer that, ) { return _wire__crate__api__receive__ffi_session_initializer_extract_req( port_, - ptr, + that, ); } @@ -3166,7 +3159,7 @@ class coreWire implements BaseWire { int port_, ffi.Pointer that, ffi.Pointer body, - ffi.Pointer ctx, + ffi.Pointer ctx, ) { return _wire__crate__api__receive__ffi_session_initializer_process_res( port_, @@ -3183,7 +3176,7 @@ class coreWire implements BaseWire { ffi.Int64, ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>( + ffi.Pointer)>>( 'frbgen_payjoin_flutter_wire__crate__api__receive__ffi_session_initializer_process_res'); late final _wire__crate__api__receive__ffi_session_initializer_process_res = _wire__crate__api__receive__ffi_session_initializer_process_resPtr @@ -3192,16 +3185,16 @@ class coreWire implements BaseWire { int, ffi.Pointer, ffi.Pointer, - ffi.Pointer)>(); + ffi.Pointer)>(); void wire__crate__api__receive__ffi_unchecked_proposal_assume_interactive_receiver( int port_, - ffi.Pointer ptr, + ffi.Pointer that, ) { return _wire__crate__api__receive__ffi_unchecked_proposal_assume_interactive_receiver( port_, - ptr, + that, ); } @@ -3220,13 +3213,13 @@ class coreWire implements BaseWire { void wire__crate__api__receive__ffi_unchecked_proposal_check_broadcast_suitability( int port_, - ffi.Pointer ptr, + ffi.Pointer that, ffi.Pointer min_fee_rate, ffi.Pointer can_broadcast, ) { return _wire__crate__api__receive__ffi_unchecked_proposal_check_broadcast_suitability( port_, - ptr, + that, min_fee_rate, can_broadcast, ); @@ -3436,11 +3429,11 @@ class coreWire implements BaseWire { void wire__crate__api__receive__ffi_v_2_payjoin_proposal_extract_v2_req( int port_, - ffi.Pointer ptr, + ffi.Pointer that, ) { return _wire__crate__api__receive__ffi_v_2_payjoin_proposal_extract_v2_req( port_, - ptr, + that, ); } @@ -3505,7 +3498,7 @@ class coreWire implements BaseWire { int port_, ffi.Pointer that, ffi.Pointer res, - ffi.Pointer ohttp_context, + ffi.Pointer ohttp_context, ) { return _wire__crate__api__receive__ffi_v_2_payjoin_proposal_process_res( port_, @@ -3522,7 +3515,7 @@ class coreWire implements BaseWire { ffi.Int64, ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>( + ffi.Pointer)>>( 'frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_payjoin_proposal_process_res'); late final _wire__crate__api__receive__ffi_v_2_payjoin_proposal_process_res = _wire__crate__api__receive__ffi_v_2_payjoin_proposal_process_resPtr @@ -3531,7 +3524,7 @@ class coreWire implements BaseWire { int, ffi.Pointer, ffi.Pointer, - ffi.Pointer)>(); + ffi.Pointer)>(); void wire__crate__api__receive__ffi_v_2_payjoin_proposal_psbt( int port_, @@ -3645,13 +3638,13 @@ class coreWire implements BaseWire { int port_, ffi.Pointer that, ffi.Pointer process_psbt, - ffi.Pointer min_feerate_sat_per_vb, + ffi.Pointer min_fee_rate_sat_per_vb, ) { return _wire__crate__api__receive__ffi_v_2_provisional_proposal_finalize_proposal( port_, that, process_psbt, - min_feerate_sat_per_vb, + min_fee_rate_sat_per_vb, ); } @@ -4017,11 +4010,11 @@ class coreWire implements BaseWire { void wire__crate__api__send__ffi_request_context_extract_v1( int port_, - ffi.Pointer ptr, + ffi.Pointer that, ) { return _wire__crate__api__send__ffi_request_context_extract_v1( port_, - ptr, + that, ); } @@ -4036,12 +4029,12 @@ class coreWire implements BaseWire { void wire__crate__api__send__ffi_request_context_extract_v2( int port_, - ffi.Pointer ptr, + ffi.Pointer that, ffi.Pointer ohttp_proxy_url, ) { return _wire__crate__api__send__ffi_request_context_extract_v2( port_, - ptr, + that, ohttp_proxy_url, ); } @@ -4325,24 +4318,23 @@ class coreWire implements BaseWire { _wire__crate__api__uri__ffi_uri_check_pj_supportedPtr.asFunction< WireSyncRust2DartDco Function(ffi.Pointer)>(); - void wire__crate__api__uri__ffi_uri_from_str( - int port_, + WireSyncRust2DartDco wire__crate__api__uri__ffi_uri_from_str( ffi.Pointer uri, ) { return _wire__crate__api__uri__ffi_uri_from_str( - port_, uri, ); } late final _wire__crate__api__uri__ffi_uri_from_strPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_payjoin_flutter_wire__crate__api__uri__ffi_uri_from_str'); late final _wire__crate__api__uri__ffi_uri_from_str = _wire__crate__api__uri__ffi_uri_from_strPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); WireSyncRust2DartDco wire__crate__api__uri__ffi_url_as_string( ffi.Pointer that, @@ -4360,24 +4352,23 @@ class coreWire implements BaseWire { _wire__crate__api__uri__ffi_url_as_stringPtr.asFunction< WireSyncRust2DartDco Function(ffi.Pointer)>(); - void wire__crate__api__uri__ffi_url_from_str( - int port_, + WireSyncRust2DartDco wire__crate__api__uri__ffi_url_from_str( ffi.Pointer url, ) { return _wire__crate__api__uri__ffi_url_from_str( - port_, url, ); } late final _wire__crate__api__uri__ffi_url_from_strPtr = _lookup< ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>( + WireSyncRust2DartDco Function( + ffi.Pointer)>>( 'frbgen_payjoin_flutter_wire__crate__api__uri__ffi_url_from_str'); late final _wire__crate__api__uri__ffi_url_from_str = _wire__crate__api__uri__ffi_url_from_strPtr.asFunction< - void Function(int, ffi.Pointer)>(); + WireSyncRust2DartDco Function( + ffi.Pointer)>(); WireSyncRust2DartDco wire__crate__api__uri__ffi_url_query( ffi.Pointer that, @@ -4427,6 +4418,36 @@ class coreWire implements BaseWire { _rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffireceivev2V2PayjoinProposalPtr .asFunction)>(); + void rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1Ptr = + _lookup)>>( + 'frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1'); + late final _rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1 = + _rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1Ptr + .asFunction)>(); + + void rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1Ptr = + _lookup)>>( + 'frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1'); + late final _rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1 = + _rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1Ptr + .asFunction)>(); + void rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv2ContextV2( ffi.Pointer ptr, ) { @@ -4937,36 +4958,6 @@ class coreWire implements BaseWire { _rust_arc_decrement_strong_count_RustOpaque_payjoin_ffireceivev2V2UncheckedProposalPtr .asFunction)>(); - void rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1ContextV1( - ffi.Pointer ptr, - ) { - return _rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1ContextV1( - ptr, - ); - } - - late final _rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1ContextV1Ptr = - _lookup)>>( - 'frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1ContextV1'); - late final _rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1ContextV1 = - _rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1ContextV1Ptr - .asFunction)>(); - - void rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1ContextV1( - ffi.Pointer ptr, - ) { - return _rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1ContextV1( - ptr, - ); - } - - late final _rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1ContextV1Ptr = - _lookup)>>( - 'frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1ContextV1'); - late final _rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1ContextV1 = - _rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1ContextV1Ptr - .asFunction)>(); - void rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1RequestBuilder( ffi.Pointer ptr, @@ -5213,6 +5204,17 @@ class coreWire implements BaseWire { _rust_arc_decrement_strong_count_RustOpaque_stdsyncMutexcoreoptionOptionohttpClientResponsePtr .asFunction)>(); + ffi.Pointer cst_new_box_autoadd_client_response() { + return _cst_new_box_autoadd_client_response(); + } + + late final _cst_new_box_autoadd_client_responsePtr = _lookup< + ffi.NativeFunction Function()>>( + 'frbgen_payjoin_flutter_cst_new_box_autoadd_client_response'); + late final _cst_new_box_autoadd_client_response = + _cst_new_box_autoadd_client_responsePtr + .asFunction Function()>(); + ffi.Pointer cst_new_box_autoadd_f_64( double value, ) { @@ -5240,19 +5242,6 @@ class coreWire implements BaseWire { _cst_new_box_autoadd_ffi_active_sessionPtr .asFunction Function()>(); - ffi.Pointer - cst_new_box_autoadd_ffi_client_response() { - return _cst_new_box_autoadd_ffi_client_response(); - } - - late final _cst_new_box_autoadd_ffi_client_responsePtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function()>>( - 'frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_client_response'); - late final _cst_new_box_autoadd_ffi_client_response = - _cst_new_box_autoadd_ffi_client_responsePtr - .asFunction Function()>(); - ffi.Pointer cst_new_box_autoadd_ffi_context_v_1() { return _cst_new_box_autoadd_ffi_context_v_1(); } @@ -5739,7 +5728,7 @@ final class wire_cst_list_prim_u_8_loose extends ffi.Struct { external int len; } -final class wire_cst_ffi_client_response extends ffi.Struct { +final class wire_cst_client_response extends ffi.Struct { @ffi.UintPtr() external int field0; } @@ -6042,27 +6031,26 @@ final class wire_cst_payjoin_error extends ffi.Struct { external PayjoinErrorKind kind; } -final class wire_cst_record_ffi_url_list_prim_u_8_strict extends ffi.Struct { - external wire_cst_ffi_url field0; +final class wire_cst_request extends ffi.Struct { + external wire_cst_ffi_url url; - external ffi.Pointer field1; + external ffi.Pointer body; } -final class wire_cst_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response - extends ffi.Struct { - external wire_cst_record_ffi_url_list_prim_u_8_strict field0; +final class wire_cst_record_request_client_response extends ffi.Struct { + external wire_cst_request field0; - external wire_cst_ffi_client_response field1; + external wire_cst_client_response field1; } -final class wire_cst_request_context_v_1 extends ffi.Struct { - external wire_cst_record_ffi_url_list_prim_u_8_strict request; +final class wire_cst_record_request_ffi_context_v_1 extends ffi.Struct { + external wire_cst_request field0; - external wire_cst_ffi_context_v_1 context_v1; + external wire_cst_ffi_context_v_1 field1; } -final class wire_cst_request_context_v_2 extends ffi.Struct { - external wire_cst_record_ffi_url_list_prim_u_8_strict request; +final class wire_cst_record_request_ffi_context_v_2 extends ffi.Struct { + external wire_cst_request field0; - external wire_cst_ffi_context_v_2 context_v2; + external wire_cst_ffi_context_v_2 field1; } diff --git a/lib/src/generated/lib.dart b/lib/src/generated/lib.dart index 4a3f470..a1e1698 100644 --- a/lib/src/generated/lib.dart +++ b/lib/src/generated/lib.dart @@ -9,6 +9,9 @@ import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; // Rust type: RustOpaqueNom> abstract class ArcV2PayjoinProposal implements RustOpaqueInterface {} +// Rust type: RustOpaqueNom> +abstract class ArcContextV1 implements RustOpaqueInterface {} + // Rust type: RustOpaqueNom> abstract class ArcContextV2 implements RustOpaqueInterface {} @@ -57,9 +60,6 @@ abstract class V2ProvisionalProposal implements RustOpaqueInterface {} // Rust type: RustOpaqueNom abstract class V2UncheckedProposal implements RustOpaqueInterface {} -// Rust type: RustOpaqueNom -abstract class ContextV1 implements RustOpaqueInterface {} - // Rust type: RustOpaqueNom abstract class RequestBuilder implements RustOpaqueInterface {} diff --git a/lib/src/generated/utils/types.dart b/lib/src/generated/utils/types.dart index 203ff8d..ea4c66b 100644 --- a/lib/src/generated/utils/types.dart +++ b/lib/src/generated/utils/types.dart @@ -3,9 +3,29 @@ // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import +import '../api/uri.dart'; import '../frb_generated.dart'; +import '../lib.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +class ClientResponse { + final MutexOptionClientResponse field0; + + const ClientResponse({ + required this.field0, + }); + + @override + int get hashCode => field0.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ClientResponse && + runtimeType == other.runtimeType && + field0 == other.field0; +} + class Headers { final Map map; @@ -62,6 +82,27 @@ class OutPoint { vout == other.vout; } +class Request { + final FfiUrl url; + final Uint8List body; + + const Request({ + required this.url, + required this.body, + }); + + @override + int get hashCode => url.hashCode ^ body.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Request && + runtimeType == other.runtimeType && + url == other.url && + body == other.body; +} + class TxOut { /// The value of the output, in satoshis. final BigInt value; diff --git a/lib/uri.dart b/lib/uri.dart index 7800619..c16b163 100644 --- a/lib/uri.dart +++ b/lib/uri.dart @@ -27,15 +27,65 @@ class PjUriBuilder extends FfiPjUriBuilder { throw mapPayjoinError(e); } } + + @override + PjUriBuilder amount({required BigInt amount}) { + try { + final res = super.amount(amount: amount); + return PjUriBuilder(internal: res.internal); + } on error.PayjoinError catch (e) { + throw mapPayjoinError(e); + } + } + + @override + PjUriBuilder label({required String label}) { + try { + final res = super.label(label: label); + return PjUriBuilder(internal: res.internal); + } on error.PayjoinError catch (e) { + throw mapPayjoinError(e); + } + } + + @override + PjUriBuilder message({required String message}) { + try { + final res = super.message(message: message); + return PjUriBuilder(internal: res.internal); + } on error.PayjoinError catch (e) { + throw mapPayjoinError(e); + } + } + + @override + PjUriBuilder pjos({required bool pjos}) { + try { + final res = super.pjos(pjos: pjos); + return PjUriBuilder(internal: res.internal); + } on error.PayjoinError catch (e) { + throw mapPayjoinError(e); + } + } + + @override + PjUri build() { + try { + final res = super.build(); + return PjUri._(field0: res.field0); + } on error.PayjoinError catch (e) { + throw mapPayjoinError(e); + } + } } class Uri extends FfiUri { Uri._({required super.field0}); - static Future fromString(String uri) async { + static Future fromStr(String uri) async { try { await PConfig.initializeApp(); - final res = await FfiUri.fromStr(uri: uri); + final res = FfiUri.fromStr(uri: uri); return Uri._(field0: res.field0); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); @@ -69,11 +119,6 @@ class Uri extends FfiUri { throw mapPayjoinError(e); } } - - @override - String toString() { - return super.asString(); - } } class PjUri extends FfiPjUri { @@ -97,19 +142,14 @@ class PjUri extends FfiPjUri { throw mapPayjoinError(e); } } - - @override - String toString() { - return super.asString(); - } } class Url extends FfiUrl { Url._({required super.field0}); - static Future fromString(String uri) async { + static Future fromStr(String uri) async { try { await PConfig.initializeApp(); - final res = await FfiUrl.fromStr(url: uri); + final res = FfiUrl.fromStr(url: uri); return Url._(field0: res.field0); } on error.PayjoinError catch (e) { throw mapPayjoinError(e); @@ -124,11 +164,6 @@ class Url extends FfiUrl { throw mapPayjoinError(e); } } - - @override - String toString() { - return super.asString(); - } } ///The key configuration of a server. This can be used by both client and server. diff --git a/rust/src/api/receive.rs b/rust/src/api/receive.rs index ca927d2..3eb7ce1 100644 --- a/rust/src/api/receive.rs +++ b/rust/src/api/receive.rs @@ -1,7 +1,7 @@ use crate::api::uri::{FfiOhttpKeys, FfiPjUriBuilder, FfiUrl}; use crate::frb_generated::RustOpaque; pub use crate::utils::error::PayjoinError; -use crate::utils::types::{Headers, OutPoint, TxOut}; +use crate::utils::types::{ClientResponse, Headers, OutPoint, Request, TxOut}; use flutter_rust_bridge::{frb, DartFnFuture}; use std::collections::HashMap; pub use std::sync::Arc; @@ -42,12 +42,12 @@ impl FfiUncheckedProposal { /// /// Call this after checking downstream. pub fn check_broadcast_suitability( - ptr: Self, + &self, min_fee_rate: Option, can_broadcast: impl Fn(Vec) -> DartFnFuture, ) -> Result { let runtime = tokio::runtime::Runtime::new().unwrap(); - ptr.0 + self.0 .check_broadcast_suitability(min_fee_rate, |x| { Ok(runtime.block_on(can_broadcast(x.clone()))) }) @@ -57,8 +57,8 @@ impl FfiUncheckedProposal { /// Call this method if the only way to initiate a Payjoin with this receiver requires manual intervention, as in most consumer wallets. /// /// So-called “non-interactive” receivers, like payment processors, that allow arbitrary requests are otherwise vulnerable to probing attacks. Those receivers call get_transaction_to_check_broadcast() and attest_tested_and_scheduled_broadcast() after making those checks downstream. - pub fn assume_interactive_receiver(ptr: Self) -> FfiMaybeInputsOwned { - (*ptr.0.assume_interactive_receiver()).clone().into() + pub fn assume_interactive_receiver(&self) -> FfiMaybeInputsOwned { + (*self.0.assume_interactive_receiver()).clone().into() } } @@ -70,11 +70,11 @@ impl From for FfiMaybeInputsOwned { } impl FfiMaybeInputsOwned { pub fn check_inputs_not_owned( - ptr: Self, + &self, is_owned: impl Fn(Vec) -> DartFnFuture, ) -> Result { let runtime = tokio::runtime::Runtime::new().unwrap(); - ptr.0 + self.0 .check_inputs_not_owned(|o| Ok(runtime.block_on(is_owned(o.clone())))) .map(|e| (*e).clone().into()) .map_err(|e| e.into()) @@ -89,8 +89,8 @@ impl From for FfiMaybeMixedInp } } impl FfiMaybeMixedInputScripts { - pub fn check_no_mixed_input_scripts(ptr: Self) -> Result { - ptr.0 + pub fn check_no_mixed_input_scripts(&self) -> Result { + self.0 .clone() .check_no_mixed_input_scripts() .map(|e| (*e).clone().into()) @@ -106,11 +106,11 @@ impl From for FfiMaybeInputsSeen { impl FfiMaybeInputsSeen { pub fn check_no_inputs_seen_before( - ptr: Self, + &self, is_known: impl Fn(OutPoint) -> DartFnFuture, ) -> Result { let runtime = tokio::runtime::Runtime::new().unwrap(); - ptr.0 + self.0 .check_no_inputs_seen_before(|o| Ok(runtime.block_on(is_known(o.into())))) .map(|e| (*e).clone().into()) .map_err(|e| e.into()) @@ -126,11 +126,11 @@ impl From for FfiOutputsUnknown { impl FfiOutputsUnknown { pub fn identify_receiver_outputs( - ptr: Self, + &self, is_receiver_output: impl Fn(Vec) -> DartFnFuture, ) -> Result { let runtime = tokio::runtime::Runtime::new().unwrap(); - ptr.0 + self.0 .identify_receiver_outputs(|o| Ok(runtime.block_on(is_receiver_output(o.clone())))) .map(|e| e.into()) .map_err(|e| e.into()) @@ -187,15 +187,15 @@ impl FfiProvisionalProposal { } pub fn finalize_proposal( - ptr: Self, + &self, process_psbt: impl Fn(String) -> DartFnFuture, - min_feerate_sat_per_vb: Option, + min_fee_rate_sat_per_vb: Option, ) -> Result { let runtime = tokio::runtime::Runtime::new().unwrap(); - ptr.0 + self.0 .finalize_proposal( |o| Ok(runtime.block_on(process_psbt(o.clone()))), - min_feerate_sat_per_vb, + min_fee_rate_sat_per_vb, ) .map(|e| (*e).clone().into()) .map_err(|e| e.into()) @@ -203,12 +203,12 @@ impl FfiProvisionalProposal { pub(crate) fn _finalize_proposal( ptr: Self, process_psbt: impl Fn(String) -> Result, - min_feerate_sat_per_vb: Option, + min_fee_rate_sat_per_vb: Option, ) -> Result { ptr.0 .finalize_proposal( |o| process_psbt(o.clone()).map_err(|e| e.into()), - min_feerate_sat_per_vb, + min_fee_rate_sat_per_vb, ) .map(|e| (*e).clone().into()) .map_err(|e| e.into()) @@ -233,27 +233,12 @@ impl FfiPayjoinProposal { self.0.is_output_substitution_disabled() } pub fn owned_vouts(&self) -> Vec { - self.0.owned_vouts().iter().map(|x| (*x).into()).collect() + self.0.owned_vouts().to_vec() } pub fn psbt(&self) -> String { self.0.psbt() } } -pub struct FfiClientResponse( - pub RustOpaque>>, -); - -impl From for ohttp::ClientResponse { - fn from(value: FfiClientResponse) -> Self { - let mut data_guard = value.0.lock().unwrap(); - Option::take(&mut *data_guard).expect("ClientResponse moved out of memory") - } -} -impl From for FfiClientResponse { - fn from(value: ohttp::ClientResponse) -> Self { - Self(RustOpaque::new(std::sync::Mutex::new(Some(value)))) - } -} #[derive(Clone, Debug)] pub struct FfiSessionInitializer(pub RustOpaque); @@ -283,16 +268,16 @@ impl FfiSessionInitializer { .into()) } - pub fn extract_req(ptr: Self) -> Result<((FfiUrl, Vec), FfiClientResponse), PayjoinError> { - ptr.0 + pub fn extract_req(&self) -> Result<(Request, ClientResponse), PayjoinError> { + self.0 .extract_req() - .map(|e| (((*e.0.url).clone().into(), e.0.body), e.1.into())) + .map(|e| (e.0.into(), e.1.into())) .map_err(|e| e.into()) } pub fn process_res( &self, body: Vec, - ctx: FfiClientResponse, + ctx: ClientResponse, ) -> Result { self.0 .process_res(body, ctx.into()) @@ -315,24 +300,23 @@ impl FfiActiveSession { self.0.public_key() } - #[frb(sync)] - pub fn pj_url(ptr: Self) -> FfiUrl { - ptr.0.pj_url().into() + pub fn pj_url(&self) -> FfiUrl { + self.0.pj_url().into() } #[frb(sync)] - pub fn pj_uri_builder(ptr: Self) -> FfiPjUriBuilder { - ptr.0.pj_uri_builder().into() + pub fn pj_uri_builder(&self) -> FfiPjUriBuilder { + self.0.pj_uri_builder().into() } - pub fn extract_req(ptr: Self) -> Result<((FfiUrl, Vec), FfiClientResponse), PayjoinError> { - ptr.0 + pub fn extract_req(&self) -> Result<(Request, ClientResponse), PayjoinError> { + self.0 .extract_req() - .map(|e| (((*e.0.url).clone().into(), e.0.body), e.1.into())) + .map(|e| (e.0.into(), e.1.into())) .map_err(|e| e.into()) } pub fn process_res( &self, body: Vec, - ctx: FfiClientResponse, + ctx: ClientResponse, ) -> Result, PayjoinError> { self.0 .process_res(body, ctx.into()) @@ -534,13 +518,13 @@ impl FfiV2ProvisionalProposal { pub fn finalize_proposal( &self, process_psbt: impl Fn(String) -> DartFnFuture, - min_feerate_sat_per_vb: Option, + min_fee_rate_sat_per_vb: Option, ) -> Result { let runtime = tokio::runtime::Runtime::new().unwrap(); self.0 .finalize_proposal( |o| Ok(runtime.block_on(process_psbt(o.clone()))), - min_feerate_sat_per_vb, + min_fee_rate_sat_per_vb, ) .map(|e| e.into()) .map_err(|e| e.into()) @@ -564,7 +548,7 @@ impl FfiV2PayjoinProposal { self.0.is_output_substitution_disabled() } pub fn owned_vouts(&self) -> Vec { - self.0.owned_vouts().iter().map(|x| (*x).into()).collect() + self.0.owned_vouts().to_vec() } pub fn psbt(&self) -> String { self.0.psbt() @@ -572,20 +556,18 @@ impl FfiV2PayjoinProposal { pub fn extract_v1_req(&self) -> String { self.0.extract_v1_req() } - pub fn extract_v2_req( - ptr: Self, - ) -> Result<((FfiUrl, Vec), FfiClientResponse), PayjoinError> { - ptr.0 + pub fn extract_v2_req(&self) -> Result<(Request, ClientResponse), PayjoinError> { + self.0 .clone() .extract_v2_req() - .map(|e| (((*e.0.url).clone().into(), e.0.body), e.1.into())) + .map(|e| (e.0.into(), e.1.into())) .map_err(|e| e.into()) } pub fn process_res( &self, res: Vec, - ohttp_context: FfiClientResponse, + ohttp_context: ClientResponse, ) -> Result<(), PayjoinError> { self.0 .process_res(res, ohttp_context.into()) diff --git a/rust/src/api/send.rs b/rust/src/api/send.rs index cea7ca2..9913064 100644 --- a/rust/src/api/send.rs +++ b/rust/src/api/send.rs @@ -1,5 +1,6 @@ use crate::api::uri::{FfiPjUri, FfiUrl}; use crate::frb_generated::RustOpaque; +use crate::utils::types::Request; use std::sync::Arc; use super::receive::PayjoinError; @@ -78,66 +79,61 @@ impl From for payjoin_ffi::send::v1::RequestContext { } } impl FfiRequestContext { - pub fn extract_v1(ptr: Self) -> Result { - match ptr.0.extract_v1() { - Ok(e) => Ok(e.into()), + pub fn extract_v1(&self) -> Result<(Request, FfiContextV1), PayjoinError> { + match self.0.extract_v1() { + Ok(e) => Ok((e.request.into(), e.context_v1.into())), Err(e) => Err(e.into()), } } pub fn extract_v2( - ptr: Self, + &self, ohttp_proxy_url: FfiUrl, - ) -> Result { - match ptr.0.extract_v2(Arc::new((*ohttp_proxy_url.0).clone())) { - Ok(e) => Ok(e.into()), + ) -> Result<(Request, FfiContextV2), PayjoinError> { + match self.0.extract_v2(Arc::new((*ohttp_proxy_url.0).clone())) { + Ok(e) => Ok((e.request.into(), e.context_v2.into())), Err(e) => Err(e.into()), } } } #[derive(Clone)] -pub struct RequestContextV1 { - pub request: (FfiUrl, Vec), +pub struct FfiRequestContextV1 { + pub request: Request, pub context_v1: FfiContextV1, } -impl From> for RequestContextV1 { - fn from(value: Arc) -> Self { - Self { - request: ( - (*value.request.url).clone().into(), - value.request.body.clone(), - ), - context_v1: (*value.context_v1).clone().into(), - } - } -} - -impl From for RequestContextV1 { +impl From for FfiRequestContextV1 { fn from(value: payjoin_ffi::send::v1::RequestContextV1) -> Self { Self { - request: ((*value.request.url).clone().into(), value.request.body), - context_v1: (*value.context_v1).clone().into(), + request: Request { + url: (*value.request.url).clone().into(), + body: value.request.body.clone(), + }, + context_v1: value.context_v1.into(), } } } -pub struct RequestContextV2 { - pub request: (FfiUrl, Vec), + +pub struct FfiRequestContextV2 { + pub request: Request, pub context_v2: FfiContextV2, } -impl From for RequestContextV2 { +impl From for FfiRequestContextV2 { fn from(value: payjoin_ffi::send::v1::RequestContextV2) -> Self { Self { - request: ((*value.request.url).clone().into(), value.request.body), + request: Request { + url: (*value.request.url).clone().into(), + body: value.request.body, + }, context_v2: value.context_v2.into(), } } } #[derive(Clone)] -pub struct FfiContextV1(pub RustOpaque); -impl From for FfiContextV1 { - fn from(value: payjoin_ffi::send::v1::ContextV1) -> Self { +pub struct FfiContextV1(pub RustOpaque>); +impl From> for FfiContextV1 { + fn from(value: Arc) -> Self { Self(RustOpaque::new(value)) } } diff --git a/rust/src/api/uri.rs b/rust/src/api/uri.rs index c91ce4a..d39e42c 100644 --- a/rust/src/api/uri.rs +++ b/rust/src/api/uri.rs @@ -11,7 +11,8 @@ impl From for FfiUrl { } impl FfiUrl { - pub fn from_str(url: String) -> anyhow::Result { + #[frb(sync)] + pub fn from_str(url: String) -> Result { match payjoin_ffi::uri::Url::from_str(url) { Ok(e) => Ok(e.into()), Err(e) => Err(e.into()), @@ -75,7 +76,7 @@ impl FfiPjUriBuilder { payjoin_ffi::uri::PjUriBuilder::new( address, (*pj.0).clone(), - ohttp_keys.map(|e| (*e.0).clone().into()), + ohttp_keys.map(|e| (*e.0).clone()), expiry, ) .map_err(|e| e.into()) @@ -116,6 +117,7 @@ impl From for FfiUri { } } impl FfiUri { + #[frb(sync)] pub fn from_str(uri: String) -> anyhow::Result { match payjoin_ffi::uri::Uri::from_str(uri) { Ok(e) => Ok(e.into()), diff --git a/rust/src/frb_generated.io.rs b/rust/src/frb_generated.io.rs index 147cc7c..8b6b84d 100644 --- a/rust/src/frb_generated.io.rs +++ b/rust/src/frb_generated.io.rs @@ -53,6 +53,12 @@ impl CstDecode>> unsafe { decode_rust_opaque_nom(self as _) } } } +impl CstDecode>> for usize { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> RustOpaqueNom> { + unsafe { decode_rust_opaque_nom(self as _) } + } +} impl CstDecode>> for usize { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> RustOpaqueNom> { @@ -149,12 +155,6 @@ impl CstDecode> for unsafe { decode_rust_opaque_nom(self as _) } } } -impl CstDecode> for usize { - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> RustOpaqueNom { - unsafe { decode_rust_opaque_nom(self as _) } - } -} impl CstDecode> for usize { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> RustOpaqueNom { @@ -214,6 +214,13 @@ impl CstDecode for *mut wire_cst_list_prim_u_8_strict { String::from_utf8(vec).unwrap() } } +impl CstDecode for *mut wire_cst_client_response { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::utils::types::ClientResponse { + let wrap = unsafe { flutter_rust_bridge::for_generated::box_from_leak_ptr(self) }; + CstDecode::::cst_decode(*wrap).into() + } +} impl CstDecode for *mut f64 { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> f64 { @@ -227,13 +234,6 @@ impl CstDecode for *mut wire_cst_ffi_acti CstDecode::::cst_decode(*wrap).into() } } -impl CstDecode for *mut wire_cst_ffi_client_response { - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> crate::api::receive::FfiClientResponse { - let wrap = unsafe { flutter_rust_bridge::for_generated::box_from_leak_ptr(self) }; - CstDecode::::cst_decode(*wrap).into() - } -} impl CstDecode for *mut wire_cst_ffi_context_v_1 { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::api::send::FfiContextV1 { @@ -453,16 +453,16 @@ impl CstDecode for *mut u8 { unsafe { *flutter_rust_bridge::for_generated::box_from_leak_ptr(self) } } } -impl CstDecode for wire_cst_ffi_active_session { +impl CstDecode for wire_cst_client_response { // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> crate::api::receive::FfiActiveSession { - crate::api::receive::FfiActiveSession(self.field0.cst_decode()) + fn cst_decode(self) -> crate::utils::types::ClientResponse { + crate::utils::types::ClientResponse(self.field0.cst_decode()) } } -impl CstDecode for wire_cst_ffi_client_response { +impl CstDecode for wire_cst_ffi_active_session { // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> crate::api::receive::FfiClientResponse { - crate::api::receive::FfiClientResponse(self.field0.cst_decode()) + fn cst_decode(self) -> crate::api::receive::FfiActiveSession { + crate::api::receive::FfiActiveSession(self.field0.cst_decode()) } } impl CstDecode for wire_cst_ffi_context_v_1 { @@ -811,30 +811,38 @@ impl CstDecode for wire_cst_payjoin_error { } } } -impl CstDecode<(crate::api::uri::FfiUrl, Vec)> - for wire_cst_record_ffi_url_list_prim_u_8_strict -{ - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> (crate::api::uri::FfiUrl, Vec) { - (self.field0.cst_decode(), self.field1.cst_decode()) - } -} impl CstDecode<( - (crate::api::uri::FfiUrl, Vec), - crate::api::receive::FfiClientResponse, - )> for wire_cst_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response + crate::utils::types::Request, + crate::utils::types::ClientResponse, + )> for wire_cst_record_request_client_response { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode( self, ) -> ( - (crate::api::uri::FfiUrl, Vec), - crate::api::receive::FfiClientResponse, + crate::utils::types::Request, + crate::utils::types::ClientResponse, ) { (self.field0.cst_decode(), self.field1.cst_decode()) } } +impl CstDecode<(crate::utils::types::Request, crate::api::send::FfiContextV1)> + for wire_cst_record_request_ffi_context_v_1 +{ + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> (crate::utils::types::Request, crate::api::send::FfiContextV1) { + (self.field0.cst_decode(), self.field1.cst_decode()) + } +} +impl CstDecode<(crate::utils::types::Request, crate::api::send::FfiContextV2)> + for wire_cst_record_request_ffi_context_v_2 +{ + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> (crate::utils::types::Request, crate::api::send::FfiContextV2) { + (self.field0.cst_decode(), self.field1.cst_decode()) + } +} impl CstDecode<(String, String)> for wire_cst_record_string_string { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> (String, String) { @@ -847,21 +855,12 @@ impl CstDecode<(u64, crate::utils::types::OutPoint)> for wire_cst_record_u_64_ou (self.field0.cst_decode(), self.field1.cst_decode()) } } -impl CstDecode for wire_cst_request_context_v_1 { +impl CstDecode for wire_cst_request { // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> crate::api::send::RequestContextV1 { - crate::api::send::RequestContextV1 { - request: self.request.cst_decode(), - context_v1: self.context_v1.cst_decode(), - } - } -} -impl CstDecode for wire_cst_request_context_v_2 { - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> crate::api::send::RequestContextV2 { - crate::api::send::RequestContextV2 { - request: self.request.cst_decode(), - context_v2: self.context_v2.cst_decode(), + fn cst_decode(self) -> crate::utils::types::Request { + crate::utils::types::Request { + url: self.url.cst_decode(), + body: self.body.cst_decode(), } } } @@ -874,26 +873,26 @@ impl CstDecode for wire_cst_tx_out { } } } -impl NewWithNullPtr for wire_cst_ffi_active_session { +impl NewWithNullPtr for wire_cst_client_response { fn new_with_null_ptr() -> Self { Self { field0: Default::default(), } } } -impl Default for wire_cst_ffi_active_session { +impl Default for wire_cst_client_response { fn default() -> Self { Self::new_with_null_ptr() } } -impl NewWithNullPtr for wire_cst_ffi_client_response { +impl NewWithNullPtr for wire_cst_ffi_active_session { fn new_with_null_ptr() -> Self { Self { field0: Default::default(), } } } -impl Default for wire_cst_ffi_client_response { +impl Default for wire_cst_ffi_active_session { fn default() -> Self { Self::new_with_null_ptr() } @@ -1224,20 +1223,20 @@ impl Default for wire_cst_payjoin_error { Self::new_with_null_ptr() } } -impl NewWithNullPtr for wire_cst_record_ffi_url_list_prim_u_8_strict { +impl NewWithNullPtr for wire_cst_record_request_client_response { fn new_with_null_ptr() -> Self { Self { field0: Default::default(), - field1: core::ptr::null_mut(), + field1: Default::default(), } } } -impl Default for wire_cst_record_ffi_url_list_prim_u_8_strict { +impl Default for wire_cst_record_request_client_response { fn default() -> Self { Self::new_with_null_ptr() } } -impl NewWithNullPtr for wire_cst_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response { +impl NewWithNullPtr for wire_cst_record_request_ffi_context_v_1 { fn new_with_null_ptr() -> Self { Self { field0: Default::default(), @@ -1245,59 +1244,59 @@ impl NewWithNullPtr for wire_cst_record_record_ffi_url_list_prim_u_8_strict_ffi_ } } } -impl Default for wire_cst_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response { +impl Default for wire_cst_record_request_ffi_context_v_1 { fn default() -> Self { Self::new_with_null_ptr() } } -impl NewWithNullPtr for wire_cst_record_string_string { +impl NewWithNullPtr for wire_cst_record_request_ffi_context_v_2 { fn new_with_null_ptr() -> Self { Self { - field0: core::ptr::null_mut(), - field1: core::ptr::null_mut(), + field0: Default::default(), + field1: Default::default(), } } } -impl Default for wire_cst_record_string_string { +impl Default for wire_cst_record_request_ffi_context_v_2 { fn default() -> Self { Self::new_with_null_ptr() } } -impl NewWithNullPtr for wire_cst_record_u_64_out_point { +impl NewWithNullPtr for wire_cst_record_string_string { fn new_with_null_ptr() -> Self { Self { - field0: Default::default(), - field1: Default::default(), + field0: core::ptr::null_mut(), + field1: core::ptr::null_mut(), } } } -impl Default for wire_cst_record_u_64_out_point { +impl Default for wire_cst_record_string_string { fn default() -> Self { Self::new_with_null_ptr() } } -impl NewWithNullPtr for wire_cst_request_context_v_1 { +impl NewWithNullPtr for wire_cst_record_u_64_out_point { fn new_with_null_ptr() -> Self { Self { - request: Default::default(), - context_v1: Default::default(), + field0: Default::default(), + field1: Default::default(), } } } -impl Default for wire_cst_request_context_v_1 { +impl Default for wire_cst_record_u_64_out_point { fn default() -> Self { Self::new_with_null_ptr() } } -impl NewWithNullPtr for wire_cst_request_context_v_2 { +impl NewWithNullPtr for wire_cst_request { fn new_with_null_ptr() -> Self { Self { - request: Default::default(), - context_v2: Default::default(), + url: Default::default(), + body: core::ptr::null_mut(), } } } -impl Default for wire_cst_request_context_v_2 { +impl Default for wire_cst_request { fn default() -> Self { Self::new_with_null_ptr() } @@ -1328,23 +1327,24 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__io__fetch_ohttp_keys( #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_extract_req( port_: i64, - ptr: *mut wire_cst_ffi_active_session, + that: *mut wire_cst_ffi_active_session, ) { - wire__crate__api__receive__ffi_active_session_extract_req_impl(port_, ptr) + wire__crate__api__receive__ffi_active_session_extract_req_impl(port_, that) } #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_pj_uri_builder( - ptr: *mut wire_cst_ffi_active_session, + that: *mut wire_cst_ffi_active_session, ) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { - wire__crate__api__receive__ffi_active_session_pj_uri_builder_impl(ptr) + wire__crate__api__receive__ffi_active_session_pj_uri_builder_impl(that) } #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_pj_url( - ptr: *mut wire_cst_ffi_active_session, -) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { - wire__crate__api__receive__ffi_active_session_pj_url_impl(ptr) + port_: i64, + that: *mut wire_cst_ffi_active_session, +) { + wire__crate__api__receive__ffi_active_session_pj_url_impl(port_, that) } #[no_mangle] @@ -1352,7 +1352,7 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_s port_: i64, that: *mut wire_cst_ffi_active_session, body: *mut wire_cst_list_prim_u_8_loose, - ctx: *mut wire_cst_ffi_client_response, + ctx: *mut wire_cst_client_response, ) { wire__crate__api__receive__ffi_active_session_process_res_impl(port_, that, body, ctx) } @@ -1367,44 +1367,44 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_s #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_maybe_inputs_owned_check_inputs_not_owned( port_: i64, - ptr: *mut wire_cst_ffi_maybe_inputs_owned, + that: *mut wire_cst_ffi_maybe_inputs_owned, is_owned: *const std::ffi::c_void, ) { wire__crate__api__receive__ffi_maybe_inputs_owned_check_inputs_not_owned_impl( - port_, ptr, is_owned, + port_, that, is_owned, ) } #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_maybe_inputs_seen_check_no_inputs_seen_before( port_: i64, - ptr: *mut wire_cst_ffi_maybe_inputs_seen, + that: *mut wire_cst_ffi_maybe_inputs_seen, is_known: *const std::ffi::c_void, ) { wire__crate__api__receive__ffi_maybe_inputs_seen_check_no_inputs_seen_before_impl( - port_, ptr, is_known, + port_, that, is_known, ) } #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_maybe_mixed_input_scripts_check_no_mixed_input_scripts( port_: i64, - ptr: *mut wire_cst_ffi_maybe_mixed_input_scripts, + that: *mut wire_cst_ffi_maybe_mixed_input_scripts, ) { wire__crate__api__receive__ffi_maybe_mixed_input_scripts_check_no_mixed_input_scripts_impl( - port_, ptr, + port_, that, ) } #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_outputs_unknown_identify_receiver_outputs( port_: i64, - ptr: *mut wire_cst_ffi_outputs_unknown, + that: *mut wire_cst_ffi_outputs_unknown, is_receiver_output: *const std::ffi::c_void, ) { wire__crate__api__receive__ffi_outputs_unknown_identify_receiver_outputs_impl( port_, - ptr, + that, is_receiver_output, ) } @@ -1470,15 +1470,15 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_provisio #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_provisional_proposal_finalize_proposal( port_: i64, - ptr: *mut wire_cst_ffi_provisional_proposal, + that: *mut wire_cst_ffi_provisional_proposal, process_psbt: *const std::ffi::c_void, - min_feerate_sat_per_vb: *mut u64, + min_fee_rate_sat_per_vb: *mut u64, ) { wire__crate__api__receive__ffi_provisional_proposal_finalize_proposal_impl( port_, - ptr, + that, process_psbt, - min_feerate_sat_per_vb, + min_fee_rate_sat_per_vb, ) } @@ -1511,9 +1511,9 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_provisio #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_session_initializer_extract_req( port_: i64, - ptr: *mut wire_cst_ffi_session_initializer, + that: *mut wire_cst_ffi_session_initializer, ) { - wire__crate__api__receive__ffi_session_initializer_extract_req_impl(port_, ptr) + wire__crate__api__receive__ffi_session_initializer_extract_req_impl(port_, that) } #[no_mangle] @@ -1542,7 +1542,7 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_session_ port_: i64, that: *mut wire_cst_ffi_session_initializer, body: *mut wire_cst_list_prim_u_8_loose, - ctx: *mut wire_cst_ffi_client_response, + ctx: *mut wire_cst_client_response, ) { wire__crate__api__receive__ffi_session_initializer_process_res_impl(port_, that, body, ctx) } @@ -1550,21 +1550,21 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_session_ #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_unchecked_proposal_assume_interactive_receiver( port_: i64, - ptr: *mut wire_cst_ffi_unchecked_proposal, + that: *mut wire_cst_ffi_unchecked_proposal, ) { - wire__crate__api__receive__ffi_unchecked_proposal_assume_interactive_receiver_impl(port_, ptr) + wire__crate__api__receive__ffi_unchecked_proposal_assume_interactive_receiver_impl(port_, that) } #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_unchecked_proposal_check_broadcast_suitability( port_: i64, - ptr: *mut wire_cst_ffi_unchecked_proposal, + that: *mut wire_cst_ffi_unchecked_proposal, min_fee_rate: *mut u64, can_broadcast: *const std::ffi::c_void, ) { wire__crate__api__receive__ffi_unchecked_proposal_check_broadcast_suitability_impl( port_, - ptr, + that, min_fee_rate, can_broadcast, ) @@ -1646,9 +1646,9 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_payj #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_payjoin_proposal_extract_v2_req( port_: i64, - ptr: *mut wire_cst_ffi_v_2_payjoin_proposal, + that: *mut wire_cst_ffi_v_2_payjoin_proposal, ) { - wire__crate__api__receive__ffi_v_2_payjoin_proposal_extract_v2_req_impl(port_, ptr) + wire__crate__api__receive__ffi_v_2_payjoin_proposal_extract_v2_req_impl(port_, that) } #[no_mangle] @@ -1674,7 +1674,7 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_payj port_: i64, that: *mut wire_cst_ffi_v_2_payjoin_proposal, res: *mut wire_cst_list_prim_u_8_loose, - ohttp_context: *mut wire_cst_ffi_client_response, + ohttp_context: *mut wire_cst_client_response, ) { wire__crate__api__receive__ffi_v_2_payjoin_proposal_process_res_impl( port_, @@ -1729,13 +1729,13 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__receive__ffi_v_2_prov port_: i64, that: *mut wire_cst_ffi_v_2_provisional_proposal, process_psbt: *const std::ffi::c_void, - min_feerate_sat_per_vb: *mut u64, + min_fee_rate_sat_per_vb: *mut u64, ) { wire__crate__api__receive__ffi_v_2_provisional_proposal_finalize_proposal_impl( port_, that, process_psbt, - min_feerate_sat_per_vb, + min_fee_rate_sat_per_vb, ) } @@ -1892,18 +1892,18 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__send__ffi_request_bui #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__send__ffi_request_context_extract_v1( port_: i64, - ptr: *mut wire_cst_ffi_request_context, + that: *mut wire_cst_ffi_request_context, ) { - wire__crate__api__send__ffi_request_context_extract_v1_impl(port_, ptr) + wire__crate__api__send__ffi_request_context_extract_v1_impl(port_, that) } #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__send__ffi_request_context_extract_v2( port_: i64, - ptr: *mut wire_cst_ffi_request_context, + that: *mut wire_cst_ffi_request_context, ohttp_proxy_url: *mut wire_cst_ffi_url, ) { - wire__crate__api__send__ffi_request_context_extract_v2_impl(port_, ptr, ohttp_proxy_url) + wire__crate__api__send__ffi_request_context_extract_v2_impl(port_, that, ohttp_proxy_url) } #[no_mangle] @@ -2015,10 +2015,9 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__uri__ffi_uri_check_pj #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__uri__ffi_uri_from_str( - port_: i64, uri: *mut wire_cst_list_prim_u_8_strict, -) { - wire__crate__api__uri__ffi_uri_from_str_impl(port_, uri) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__uri__ffi_uri_from_str_impl(uri) } #[no_mangle] @@ -2030,10 +2029,9 @@ pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__uri__ffi_url_as_strin #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_wire__crate__api__uri__ffi_url_from_str( - port_: i64, url: *mut wire_cst_list_prim_u_8_strict, -) { - wire__crate__api__uri__ffi_url_from_str_impl(port_, url) +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { + wire__crate__api__uri__ffi_url_from_str_impl(url) } #[no_mangle] @@ -2065,6 +2063,24 @@ pub extern "C" fn frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpa } } +#[no_mangle] +pub extern "C" fn frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1( + ptr: *const std::ffi::c_void, +) { + unsafe { + StdArc::>::increment_strong_count(ptr as _); + } +} + +#[no_mangle] +pub extern "C" fn frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_Arcpayjoin_ffisendv1ContextV1( + ptr: *const std::ffi::c_void, +) { + unsafe { + StdArc::>::decrement_strong_count(ptr as _); + } +} + #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_Arcpayjoin_ffisendv2ContextV2( ptr: *const std::ffi::c_void, @@ -2361,24 +2377,6 @@ pub extern "C" fn frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpa } } -#[no_mangle] -pub extern "C" fn frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1ContextV1( - ptr: *const std::ffi::c_void, -) { - unsafe { - StdArc::::increment_strong_count(ptr as _); - } -} - -#[no_mangle] -pub extern "C" fn frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpaque_payjoin_ffisendv1ContextV1( - ptr: *const std::ffi::c_void, -) { - unsafe { - StdArc::::decrement_strong_count(ptr as _); - } -} - #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_rust_arc_increment_strong_count_RustOpaque_payjoin_ffisendv1RequestBuilder( ptr: *const std::ffi::c_void, @@ -2523,6 +2521,14 @@ pub extern "C" fn frbgen_payjoin_flutter_rust_arc_decrement_strong_count_RustOpa } } +#[no_mangle] +pub extern "C" fn frbgen_payjoin_flutter_cst_new_box_autoadd_client_response( +) -> *mut wire_cst_client_response { + flutter_rust_bridge::for_generated::new_leak_box_ptr( + wire_cst_client_response::new_with_null_ptr(), + ) +} + #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_cst_new_box_autoadd_f_64(value: f64) -> *mut f64 { flutter_rust_bridge::for_generated::new_leak_box_ptr(value) @@ -2536,14 +2542,6 @@ pub extern "C" fn frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_active_session( ) } -#[no_mangle] -pub extern "C" fn frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_client_response( -) -> *mut wire_cst_ffi_client_response { - flutter_rust_bridge::for_generated::new_leak_box_ptr( - wire_cst_ffi_client_response::new_with_null_ptr(), - ) -} - #[no_mangle] pub extern "C" fn frbgen_payjoin_flutter_cst_new_box_autoadd_ffi_context_v_1( ) -> *mut wire_cst_ffi_context_v_1 { @@ -2831,12 +2829,12 @@ pub extern "C" fn frbgen_payjoin_flutter_cst_new_list_record_u_64_out_point( #[repr(C)] #[derive(Clone, Copy)] -pub struct wire_cst_ffi_active_session { +pub struct wire_cst_client_response { field0: usize, } #[repr(C)] #[derive(Clone, Copy)] -pub struct wire_cst_ffi_client_response { +pub struct wire_cst_ffi_active_session { field0: usize, } #[repr(C)] @@ -3127,15 +3125,21 @@ pub struct wire_cst_PayjoinError_IoError { } #[repr(C)] #[derive(Clone, Copy)] -pub struct wire_cst_record_ffi_url_list_prim_u_8_strict { - field0: wire_cst_ffi_url, - field1: *mut wire_cst_list_prim_u_8_strict, +pub struct wire_cst_record_request_client_response { + field0: wire_cst_request, + field1: wire_cst_client_response, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_record_request_ffi_context_v_1 { + field0: wire_cst_request, + field1: wire_cst_ffi_context_v_1, } #[repr(C)] #[derive(Clone, Copy)] -pub struct wire_cst_record_record_ffi_url_list_prim_u_8_strict_ffi_client_response { - field0: wire_cst_record_ffi_url_list_prim_u_8_strict, - field1: wire_cst_ffi_client_response, +pub struct wire_cst_record_request_ffi_context_v_2 { + field0: wire_cst_request, + field1: wire_cst_ffi_context_v_2, } #[repr(C)] #[derive(Clone, Copy)] @@ -3151,15 +3155,9 @@ pub struct wire_cst_record_u_64_out_point { } #[repr(C)] #[derive(Clone, Copy)] -pub struct wire_cst_request_context_v_1 { - request: wire_cst_record_ffi_url_list_prim_u_8_strict, - context_v1: wire_cst_ffi_context_v_1, -} -#[repr(C)] -#[derive(Clone, Copy)] -pub struct wire_cst_request_context_v_2 { - request: wire_cst_record_ffi_url_list_prim_u_8_strict, - context_v2: wire_cst_ffi_context_v_2, +pub struct wire_cst_request { + url: wire_cst_ffi_url, + body: *mut wire_cst_list_prim_u_8_strict, } #[repr(C)] #[derive(Clone, Copy)] diff --git a/rust/src/frb_generated.rs b/rust/src/frb_generated.rs index 4763197..ba2b042 100644 --- a/rust/src/frb_generated.rs +++ b/rust/src/frb_generated.rs @@ -78,7 +78,7 @@ fn wire__crate__api__io__fetch_ohttp_keys_impl( } fn wire__crate__api__receive__ffi_active_session_extract_req_impl( port_: flutter_rust_bridge::for_generated::MessagePort, - ptr: impl CstDecode, + that: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( flutter_rust_bridge::for_generated::TaskInfo { @@ -87,10 +87,10 @@ fn wire__crate__api__receive__ffi_active_session_extract_req_impl( mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_ptr = ptr.cst_decode(); + let api_that = that.cst_decode(); move |context| { transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { - let output_ok = crate::api::receive::FfiActiveSession::extract_req(api_ptr)?; + let output_ok = crate::api::receive::FfiActiveSession::extract_req(&api_that)?; Ok(output_ok) })( )) @@ -99,7 +99,7 @@ fn wire__crate__api__receive__ffi_active_session_extract_req_impl( ) } fn wire__crate__api__receive__ffi_active_session_pj_uri_builder_impl( - ptr: impl CstDecode, + that: impl CstDecode, ) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( flutter_rust_bridge::for_generated::TaskInfo { @@ -108,10 +108,10 @@ fn wire__crate__api__receive__ffi_active_session_pj_uri_builder_impl( mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, }, move || { - let api_ptr = ptr.cst_decode(); + let api_that = that.cst_decode(); transform_result_dco::<_, _, ()>((move || { let output_ok = Result::<_, ()>::Ok( - crate::api::receive::FfiActiveSession::pj_uri_builder(api_ptr), + crate::api::receive::FfiActiveSession::pj_uri_builder(&api_that), )?; Ok(output_ok) })()) @@ -119,21 +119,25 @@ fn wire__crate__api__receive__ffi_active_session_pj_uri_builder_impl( ) } fn wire__crate__api__receive__ffi_active_session_pj_url_impl( - ptr: impl CstDecode, -) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( + port_: flutter_rust_bridge::for_generated::MessagePort, + that: impl CstDecode, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( flutter_rust_bridge::for_generated::TaskInfo { debug_name: "ffi_active_session_pj_url", - port: None, - mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_ptr = ptr.cst_decode(); - transform_result_dco::<_, _, ()>((move || { - let output_ok = - Result::<_, ()>::Ok(crate::api::receive::FfiActiveSession::pj_url(api_ptr))?; - Ok(output_ok) - })()) + let api_that = that.cst_decode(); + move |context| { + transform_result_dco::<_, _, ()>((move || { + let output_ok = Result::<_, ()>::Ok( + crate::api::receive::FfiActiveSession::pj_url(&api_that), + )?; + Ok(output_ok) + })()) + } }, ) } @@ -141,7 +145,7 @@ fn wire__crate__api__receive__ffi_active_session_process_res_impl( port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, body: impl CstDecode>, - ctx: impl CstDecode, + ctx: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( flutter_rust_bridge::for_generated::TaskInfo { @@ -187,7 +191,7 @@ fn wire__crate__api__receive__ffi_active_session_public_key_impl( } fn wire__crate__api__receive__ffi_maybe_inputs_owned_check_inputs_not_owned_impl( port_: flutter_rust_bridge::for_generated::MessagePort, - ptr: impl CstDecode, + that: impl CstDecode, is_owned: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( @@ -197,7 +201,7 @@ fn wire__crate__api__receive__ffi_maybe_inputs_owned_check_inputs_not_owned_impl mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_ptr = ptr.cst_decode(); + let api_that = that.cst_decode(); let api_is_owned = decode_DartFn_Inputs_list_prim_u_8_strict_Output_bool_AnyhowException( is_owned.cst_decode(), @@ -206,7 +210,7 @@ fn wire__crate__api__receive__ffi_maybe_inputs_owned_check_inputs_not_owned_impl transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { let output_ok = crate::api::receive::FfiMaybeInputsOwned::check_inputs_not_owned( - api_ptr, + &api_that, api_is_owned, )?; Ok(output_ok) @@ -218,7 +222,7 @@ fn wire__crate__api__receive__ffi_maybe_inputs_owned_check_inputs_not_owned_impl } fn wire__crate__api__receive__ffi_maybe_inputs_seen_check_no_inputs_seen_before_impl( port_: flutter_rust_bridge::for_generated::MessagePort, - ptr: impl CstDecode, + that: impl CstDecode, is_known: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( @@ -228,14 +232,14 @@ fn wire__crate__api__receive__ffi_maybe_inputs_seen_check_no_inputs_seen_before_ mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_ptr = ptr.cst_decode(); + let api_that = that.cst_decode(); let api_is_known = decode_DartFn_Inputs_out_point_Output_bool_AnyhowException(is_known.cst_decode()); move |context| { transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { let output_ok = crate::api::receive::FfiMaybeInputsSeen::check_no_inputs_seen_before( - api_ptr, + &api_that, api_is_known, )?; Ok(output_ok) @@ -247,17 +251,17 @@ fn wire__crate__api__receive__ffi_maybe_inputs_seen_check_no_inputs_seen_before_ } fn wire__crate__api__receive__ffi_maybe_mixed_input_scripts_check_no_mixed_input_scripts_impl( port_: flutter_rust_bridge::for_generated::MessagePort, - ptr: impl CstDecode, + that: impl CstDecode, ) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::(flutter_rust_bridge::for_generated::TaskInfo{ debug_name: "ffi_maybe_mixed_input_scripts_check_no_mixed_input_scripts", port: Some(port_), mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal }, move || { let api_ptr = ptr.cst_decode(); move |context| { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::(flutter_rust_bridge::for_generated::TaskInfo{ debug_name: "ffi_maybe_mixed_input_scripts_check_no_mixed_input_scripts", port: Some(port_), mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal }, move || { let api_that = that.cst_decode(); move |context| { transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { - let output_ok = crate::api::receive::FfiMaybeMixedInputScripts::check_no_mixed_input_scripts(api_ptr)?; Ok(output_ok) + let output_ok = crate::api::receive::FfiMaybeMixedInputScripts::check_no_mixed_input_scripts(&api_that)?; Ok(output_ok) })()) } }) } fn wire__crate__api__receive__ffi_outputs_unknown_identify_receiver_outputs_impl( port_: flutter_rust_bridge::for_generated::MessagePort, - ptr: impl CstDecode, + that: impl CstDecode, is_receiver_output: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( @@ -267,7 +271,7 @@ fn wire__crate__api__receive__ffi_outputs_unknown_identify_receiver_outputs_impl mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_ptr = ptr.cst_decode(); + let api_that = that.cst_decode(); let api_is_receiver_output = decode_DartFn_Inputs_list_prim_u_8_strict_Output_bool_AnyhowException( is_receiver_output.cst_decode(), @@ -276,7 +280,7 @@ fn wire__crate__api__receive__ffi_outputs_unknown_identify_receiver_outputs_impl transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { let output_ok = crate::api::receive::FfiOutputsUnknown::identify_receiver_outputs( - api_ptr, + &api_that, api_is_receiver_output, )?; Ok(output_ok) @@ -444,9 +448,9 @@ fn wire__crate__api__receive__ffi_provisional_proposal_contribute_witness_input_ } fn wire__crate__api__receive__ffi_provisional_proposal_finalize_proposal_impl( port_: flutter_rust_bridge::for_generated::MessagePort, - ptr: impl CstDecode, + that: impl CstDecode, process_psbt: impl CstDecode, - min_feerate_sat_per_vb: impl CstDecode>, + min_fee_rate_sat_per_vb: impl CstDecode>, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( flutter_rust_bridge::for_generated::TaskInfo { @@ -455,17 +459,17 @@ fn wire__crate__api__receive__ffi_provisional_proposal_finalize_proposal_impl( mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_ptr = ptr.cst_decode(); + let api_that = that.cst_decode(); let api_process_psbt = decode_DartFn_Inputs_String_Output_String_AnyhowException( process_psbt.cst_decode(), ); - let api_min_feerate_sat_per_vb = min_feerate_sat_per_vb.cst_decode(); + let api_min_fee_rate_sat_per_vb = min_fee_rate_sat_per_vb.cst_decode(); move |context| { transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { let output_ok = crate::api::receive::FfiProvisionalProposal::finalize_proposal( - api_ptr, + &api_that, api_process_psbt, - api_min_feerate_sat_per_vb, + api_min_fee_rate_sat_per_vb, )?; Ok(output_ok) })( @@ -515,7 +519,7 @@ fn wire__crate__api__receive__ffi_provisional_proposal_try_substitute_receiver_o } fn wire__crate__api__receive__ffi_session_initializer_extract_req_impl( port_: flutter_rust_bridge::for_generated::MessagePort, - ptr: impl CstDecode, + that: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( flutter_rust_bridge::for_generated::TaskInfo { @@ -524,11 +528,11 @@ fn wire__crate__api__receive__ffi_session_initializer_extract_req_impl( mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_ptr = ptr.cst_decode(); + let api_that = that.cst_decode(); move |context| { transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { let output_ok = - crate::api::receive::FfiSessionInitializer::extract_req(api_ptr)?; + crate::api::receive::FfiSessionInitializer::extract_req(&api_that)?; Ok(output_ok) })( )) @@ -579,7 +583,7 @@ fn wire__crate__api__receive__ffi_session_initializer_process_res_impl( port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, body: impl CstDecode>, - ctx: impl CstDecode, + ctx: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( flutter_rust_bridge::for_generated::TaskInfo { @@ -605,7 +609,7 @@ fn wire__crate__api__receive__ffi_session_initializer_process_res_impl( } fn wire__crate__api__receive__ffi_unchecked_proposal_assume_interactive_receiver_impl( port_: flutter_rust_bridge::for_generated::MessagePort, - ptr: impl CstDecode, + that: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( flutter_rust_bridge::for_generated::TaskInfo { @@ -614,12 +618,12 @@ fn wire__crate__api__receive__ffi_unchecked_proposal_assume_interactive_receiver mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_ptr = ptr.cst_decode(); + let api_that = that.cst_decode(); move |context| { transform_result_dco::<_, _, ()>((move || { let output_ok = Result::<_, ()>::Ok( crate::api::receive::FfiUncheckedProposal::assume_interactive_receiver( - api_ptr, + &api_that, ), )?; Ok(output_ok) @@ -630,7 +634,7 @@ fn wire__crate__api__receive__ffi_unchecked_proposal_assume_interactive_receiver } fn wire__crate__api__receive__ffi_unchecked_proposal_check_broadcast_suitability_impl( port_: flutter_rust_bridge::for_generated::MessagePort, - ptr: impl CstDecode, + that: impl CstDecode, min_fee_rate: impl CstDecode>, can_broadcast: impl CstDecode, ) { @@ -641,7 +645,7 @@ fn wire__crate__api__receive__ffi_unchecked_proposal_check_broadcast_suitability mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_ptr = ptr.cst_decode(); + let api_that = that.cst_decode(); let api_min_fee_rate = min_fee_rate.cst_decode(); let api_can_broadcast = decode_DartFn_Inputs_list_prim_u_8_strict_Output_bool_AnyhowException( @@ -651,7 +655,7 @@ fn wire__crate__api__receive__ffi_unchecked_proposal_check_broadcast_suitability transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { let output_ok = crate::api::receive::FfiUncheckedProposal::check_broadcast_suitability( - api_ptr, + &api_that, api_min_fee_rate, api_can_broadcast, )?; @@ -843,7 +847,7 @@ fn wire__crate__api__receive__ffi_v_2_payjoin_proposal_extract_v1_req_impl( } fn wire__crate__api__receive__ffi_v_2_payjoin_proposal_extract_v2_req_impl( port_: flutter_rust_bridge::for_generated::MessagePort, - ptr: impl CstDecode, + that: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( flutter_rust_bridge::for_generated::TaskInfo { @@ -852,11 +856,11 @@ fn wire__crate__api__receive__ffi_v_2_payjoin_proposal_extract_v2_req_impl( mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_ptr = ptr.cst_decode(); + let api_that = that.cst_decode(); move |context| { transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { let output_ok = - crate::api::receive::FfiV2PayjoinProposal::extract_v2_req(api_ptr)?; + crate::api::receive::FfiV2PayjoinProposal::extract_v2_req(&api_that)?; Ok(output_ok) })( )) @@ -916,7 +920,7 @@ fn wire__crate__api__receive__ffi_v_2_payjoin_proposal_process_res_impl( port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, res: impl CstDecode>, - ohttp_context: impl CstDecode, + ohttp_context: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( flutter_rust_bridge::for_generated::TaskInfo { @@ -1035,7 +1039,7 @@ fn wire__crate__api__receive__ffi_v_2_provisional_proposal_finalize_proposal_imp port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode, process_psbt: impl CstDecode, - min_feerate_sat_per_vb: impl CstDecode>, + min_fee_rate_sat_per_vb: impl CstDecode>, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( flutter_rust_bridge::for_generated::TaskInfo { @@ -1048,14 +1052,14 @@ fn wire__crate__api__receive__ffi_v_2_provisional_proposal_finalize_proposal_imp let api_process_psbt = decode_DartFn_Inputs_String_Output_String_AnyhowException( process_psbt.cst_decode(), ); - let api_min_feerate_sat_per_vb = min_feerate_sat_per_vb.cst_decode(); + let api_min_fee_rate_sat_per_vb = min_fee_rate_sat_per_vb.cst_decode(); move |context| { transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { let output_ok = crate::api::receive::FfiV2ProvisionalProposal::finalize_proposal( &api_that, api_process_psbt, - api_min_feerate_sat_per_vb, + api_min_fee_rate_sat_per_vb, )?; Ok(output_ok) })( @@ -1379,7 +1383,7 @@ fn wire__crate__api__send__ffi_request_builder_from_psbt_and_uri_impl( } fn wire__crate__api__send__ffi_request_context_extract_v1_impl( port_: flutter_rust_bridge::for_generated::MessagePort, - ptr: impl CstDecode, + that: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( flutter_rust_bridge::for_generated::TaskInfo { @@ -1388,10 +1392,10 @@ fn wire__crate__api__send__ffi_request_context_extract_v1_impl( mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_ptr = ptr.cst_decode(); + let api_that = that.cst_decode(); move |context| { transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { - let output_ok = crate::api::send::FfiRequestContext::extract_v1(api_ptr)?; + let output_ok = crate::api::send::FfiRequestContext::extract_v1(&api_that)?; Ok(output_ok) })( )) @@ -1401,7 +1405,7 @@ fn wire__crate__api__send__ffi_request_context_extract_v1_impl( } fn wire__crate__api__send__ffi_request_context_extract_v2_impl( port_: flutter_rust_bridge::for_generated::MessagePort, - ptr: impl CstDecode, + that: impl CstDecode, ohttp_proxy_url: impl CstDecode, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( @@ -1411,12 +1415,12 @@ fn wire__crate__api__send__ffi_request_context_extract_v2_impl( mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, move || { - let api_ptr = ptr.cst_decode(); + let api_that = that.cst_decode(); let api_ohttp_proxy_url = ohttp_proxy_url.cst_decode(); move |context| { transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { let output_ok = crate::api::send::FfiRequestContext::extract_v2( - api_ptr, + &api_that, api_ohttp_proxy_url, )?; Ok(output_ok) @@ -1717,24 +1721,20 @@ fn wire__crate__api__uri__ffi_uri_check_pj_supported_impl( ) } fn wire__crate__api__uri__ffi_uri_from_str_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, uri: 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: "ffi_uri_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_uri = uri.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { - let output_ok = crate::api::uri::FfiUri::from_str(api_uri)?; - Ok(output_ok) - })( - )) - } + transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { + let output_ok = crate::api::uri::FfiUri::from_str(api_uri)?; + Ok(output_ok) + })()) }, ) } @@ -1757,24 +1757,20 @@ fn wire__crate__api__uri__ffi_url_as_string_impl( ) } fn wire__crate__api__uri__ffi_url_from_str_impl( - port_: flutter_rust_bridge::for_generated::MessagePort, url: 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: "ffi_url_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_url = url.cst_decode(); - move |context| { - transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { - let output_ok = crate::api::uri::FfiUrl::from_str(api_url)?; - Ok(output_ok) - })( - )) - } + transform_result_dco::<_, _, crate::utils::error::PayjoinError>((move || { + let output_ok = crate::api::uri::FfiUrl::from_str(api_url)?; + Ok(output_ok) + })()) }, ) } @@ -2024,6 +2020,14 @@ impl SseDecode for RustOpaqueNom> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return unsafe { decode_rust_opaque_nom(inner) }; + } +} + impl SseDecode for RustOpaqueNom> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -2152,14 +2156,6 @@ impl SseDecode for RustOpaqueNom } } -impl SseDecode for RustOpaqueNom { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { - let mut inner = ::sse_decode(deserializer); - return unsafe { decode_rust_opaque_nom(inner) }; - } -} - impl SseDecode for RustOpaqueNom { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -2239,6 +2235,16 @@ impl SseDecode for bool { } } +impl SseDecode for crate::utils::types::ClientResponse { + // 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); + return crate::utils::types::ClientResponse(var_field0); + } +} + impl SseDecode for f64 { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -2255,21 +2261,11 @@ impl SseDecode for crate::api::receive::FfiActiveSession { } } -impl SseDecode for crate::api::receive::FfiClientResponse { - // 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); - return crate::api::receive::FfiClientResponse(var_field0); - } -} - impl SseDecode for crate::api::send::FfiContextV1 { // 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); + >>::sse_decode(deserializer); return crate::api::send::FfiContextV1(var_field0); } } @@ -2783,25 +2779,34 @@ impl SseDecode for crate::utils::error::PayjoinError { } } -impl SseDecode for (crate::api::uri::FfiUrl, Vec) { +impl SseDecode + for ( + crate::utils::types::Request, + crate::utils::types::ClientResponse, + ) +{ + // 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); + return (var_field0, var_field1); + } +} + +impl SseDecode for (crate::utils::types::Request, crate::api::send::FfiContextV1) { // 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_field0 = ::sse_decode(deserializer); + let mut var_field1 = ::sse_decode(deserializer); return (var_field0, var_field1); } } -impl SseDecode - for ( - (crate::api::uri::FfiUrl, Vec), - crate::api::receive::FfiClientResponse, - ) -{ +impl SseDecode for (crate::utils::types::Request, crate::api::send::FfiContextV2) { // 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 = <(crate::api::uri::FfiUrl, Vec)>::sse_decode(deserializer); - let mut var_field1 = ::sse_decode(deserializer); + let mut var_field0 = ::sse_decode(deserializer); + let mut var_field1 = ::sse_decode(deserializer); return (var_field0, var_field1); } } @@ -2824,26 +2829,14 @@ impl SseDecode for (u64, crate::utils::types::OutPoint) { } } -impl SseDecode for crate::api::send::RequestContextV1 { - // 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_request = <(crate::api::uri::FfiUrl, Vec)>::sse_decode(deserializer); - let mut var_contextV1 = ::sse_decode(deserializer); - return crate::api::send::RequestContextV1 { - request: var_request, - context_v1: var_contextV1, - }; - } -} - -impl SseDecode for crate::api::send::RequestContextV2 { +impl SseDecode for crate::utils::types::Request { // 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_request = <(crate::api::uri::FfiUrl, Vec)>::sse_decode(deserializer); - let mut var_contextV2 = ::sse_decode(deserializer); - return crate::api::send::RequestContextV2 { - request: var_request, - context_v2: var_contextV2, + let mut var_url = ::sse_decode(deserializer); + let mut var_body = >::sse_decode(deserializer); + return crate::utils::types::Request { + url: var_url, + body: var_body, }; } } @@ -2921,36 +2914,36 @@ fn pde_ffi_dispatcher_sync_impl( // Section: rust2dart // Codec=Dco (DartCObject based), see doc to use other codecs -impl flutter_rust_bridge::IntoDart for crate::api::receive::FfiActiveSession { +impl flutter_rust_bridge::IntoDart for crate::utils::types::ClientResponse { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { [self.0.into_into_dart().into_dart()].into_dart() } } impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive - for crate::api::receive::FfiActiveSession + for crate::utils::types::ClientResponse { } -impl flutter_rust_bridge::IntoIntoDart - for crate::api::receive::FfiActiveSession +impl flutter_rust_bridge::IntoIntoDart + for crate::utils::types::ClientResponse { - fn into_into_dart(self) -> crate::api::receive::FfiActiveSession { + fn into_into_dart(self) -> crate::utils::types::ClientResponse { self } } // Codec=Dco (DartCObject based), see doc to use other codecs -impl flutter_rust_bridge::IntoDart for crate::api::receive::FfiClientResponse { +impl flutter_rust_bridge::IntoDart for crate::api::receive::FfiActiveSession { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { [self.0.into_into_dart().into_dart()].into_dart() } } impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive - for crate::api::receive::FfiClientResponse + for crate::api::receive::FfiActiveSession { } -impl flutter_rust_bridge::IntoIntoDart - for crate::api::receive::FfiClientResponse +impl flutter_rust_bridge::IntoIntoDart + for crate::api::receive::FfiActiveSession { - fn into_into_dart(self) -> crate::api::receive::FfiClientResponse { + fn into_into_dart(self) -> crate::api::receive::FfiActiveSession { self } } @@ -3475,44 +3468,20 @@ impl flutter_rust_bridge::IntoIntoDart } } // Codec=Dco (DartCObject based), see doc to use other codecs -impl flutter_rust_bridge::IntoDart for crate::api::send::RequestContextV1 { - fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { - [ - self.request.into_into_dart().into_dart(), - self.context_v1.into_into_dart().into_dart(), - ] - .into_dart() - } -} -impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive - for crate::api::send::RequestContextV1 -{ -} -impl flutter_rust_bridge::IntoIntoDart - for crate::api::send::RequestContextV1 -{ - fn into_into_dart(self) -> crate::api::send::RequestContextV1 { - self - } -} -// Codec=Dco (DartCObject based), see doc to use other codecs -impl flutter_rust_bridge::IntoDart for crate::api::send::RequestContextV2 { +impl flutter_rust_bridge::IntoDart for crate::utils::types::Request { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { [ - self.request.into_into_dart().into_dart(), - self.context_v2.into_into_dart().into_dart(), + self.url.into_into_dart().into_dart(), + self.body.into_into_dart().into_dart(), ] .into_dart() } } -impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive - for crate::api::send::RequestContextV2 -{ -} -impl flutter_rust_bridge::IntoIntoDart - for crate::api::send::RequestContextV2 +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for crate::utils::types::Request {} +impl flutter_rust_bridge::IntoIntoDart + for crate::utils::types::Request { - fn into_into_dart(self) -> crate::api::send::RequestContextV2 { + fn into_into_dart(self) -> crate::utils::types::Request { self } } @@ -3573,6 +3542,15 @@ impl SseEncode for RustOpaqueNom> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + impl SseEncode for RustOpaqueNom> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -3717,15 +3695,6 @@ impl SseEncode for RustOpaqueNom } } -impl SseEncode for RustOpaqueNom { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - let (ptr, size) = self.sse_encode_raw(); - ::sse_encode(ptr, serializer); - ::sse_encode(size, serializer); - } -} - impl SseEncode for RustOpaqueNom { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -3812,33 +3781,33 @@ impl SseEncode for bool { } } -impl SseEncode for f64 { +impl SseEncode for crate::utils::types::ClientResponse { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - serializer.cursor.write_f64::(self).unwrap(); + >>>::sse_encode( + self.0, serializer, + ); } } -impl SseEncode for crate::api::receive::FfiActiveSession { +impl SseEncode for f64 { // 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); + serializer.cursor.write_f64::(self).unwrap(); } } -impl SseEncode for crate::api::receive::FfiClientResponse { +impl SseEncode for crate::api::receive::FfiActiveSession { // 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.0, serializer); } } impl SseEncode for crate::api::send::FfiContextV1 { // 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.0, serializer); } } @@ -4256,24 +4225,32 @@ impl SseEncode for crate::utils::error::PayjoinError { } } -impl SseEncode for (crate::api::uri::FfiUrl, Vec) { +impl SseEncode + for ( + crate::utils::types::Request, + crate::utils::types::ClientResponse, + ) +{ // 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.0, serializer); + ::sse_encode(self.1, serializer); } } -impl SseEncode - for ( - (crate::api::uri::FfiUrl, Vec), - crate::api::receive::FfiClientResponse, - ) -{ +impl SseEncode for (crate::utils::types::Request, crate::api::send::FfiContextV1) { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - <(crate::api::uri::FfiUrl, Vec)>::sse_encode(self.0, serializer); - ::sse_encode(self.1, serializer); + ::sse_encode(self.0, serializer); + ::sse_encode(self.1, serializer); + } +} + +impl SseEncode for (crate::utils::types::Request, crate::api::send::FfiContextV2) { + // 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); } } @@ -4293,19 +4270,11 @@ impl SseEncode for (u64, crate::utils::types::OutPoint) { } } -impl SseEncode for crate::api::send::RequestContextV1 { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - <(crate::api::uri::FfiUrl, Vec)>::sse_encode(self.request, serializer); - ::sse_encode(self.context_v1, serializer); - } -} - -impl SseEncode for crate::api::send::RequestContextV2 { +impl SseEncode for crate::utils::types::Request { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - <(crate::api::uri::FfiUrl, Vec)>::sse_encode(self.request, serializer); - ::sse_encode(self.context_v2, serializer); + ::sse_encode(self.url, serializer); + >::sse_encode(self.body, serializer); } } diff --git a/rust/src/utils/types.rs b/rust/src/utils/types.rs index 632c8dc..b8fba85 100644 --- a/rust/src/utils/types.rs +++ b/rust/src/utils/types.rs @@ -1,6 +1,8 @@ use flutter_rust_bridge::frb; pub use payjoin_ffi::types::Network; use std::collections::HashMap; + +use crate::{api::uri::FfiUrl, frb_generated::RustOpaque}; // ///Represents data that needs to be transmitted to the receiver. // ///You need to send this request over HTTP(S) to the receiver. // #[derive(Clone, Debug)] @@ -120,3 +122,34 @@ pub enum _Network { ///Bitcoin’s signet Signet, } + +pub struct ClientResponse( + pub RustOpaque>>, +); + +impl From for ohttp::ClientResponse { + fn from(value: ClientResponse) -> Self { + let mut data_guard = value.0.lock().unwrap(); + Option::take(&mut *data_guard).expect("ClientResponse moved out of memory") + } +} +impl From for ClientResponse { + fn from(value: ohttp::ClientResponse) -> Self { + Self(RustOpaque::new(std::sync::Mutex::new(Some(value)))) + } +} + +#[derive(Clone)] +pub struct Request { + pub url: FfiUrl, + pub body: Vec, +} + +impl From for Request { + fn from(value: payjoin_ffi::types::Request) -> Self { + Self { + url: (*value.url).clone().into(), + body: value.body, + } + } +}