@breeztech/breez-sdk-spark-react-native 0.2.5-dev1 → 0.2.5-dev2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"names":["getter","globalThis","NativeBreezSdkSpark","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/breez_sdk_spark-ffi.ts"],"mappings":";;AAAA;AACA;;AA6eA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,mBAAmB;AACzC,eAAeF,MAAM;;AAErB;;AAyPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["getter","globalThis","NativeBreezSdkSpark","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/breez_sdk_spark-ffi.ts"],"mappings":";;AAAA;AACA;;AA0eA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,mBAAmB;AACzC,eAAeF,MAAM;;AAErB;;AA2PA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
4
4
  // Trust me, you don't want to mess with it!
5
5
  import nativeModule from "./breez_sdk_spark-ffi.js";
6
- import { AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterCallback, FfiConverterInt32, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt32, FfiConverterUInt64, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCall, uniffiTraitInterfaceCallAsyncWithError, uniffiTypeNameSymbol } from 'uniffi-bindgen-react-native';
6
+ import { AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterCallback, FfiConverterInt32, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt32, FfiConverterUInt64, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCall, uniffiTraitInterfaceCallAsync, uniffiTraitInterfaceCallAsyncWithError, uniffiTypeNameSymbol } from 'uniffi-bindgen-react-native';
7
7
 
8
8
  // Get converters from the other files, if any.
9
9
  import uniffiBreezSdkCommonModule from "./breez_sdk_common.js";
@@ -89,18 +89,29 @@ const uniffiCallbackInterfaceEventListener = {
89
89
  // Create the VTable using a series of closures.
90
90
  // ts automatically converts these into C callback functions.
91
91
  vtable: {
92
- onEvent: (uniffiHandle, event) => {
93
- const uniffiMakeCall = () => {
92
+ onEvent: (uniffiHandle, event, uniffiFutureCallback, uniffiCallbackData) => {
93
+ const uniffiMakeCall = async signal => {
94
94
  const jsCallback = FfiConverterTypeEventListener.lift(uniffiHandle);
95
- return jsCallback.onEvent(FfiConverterTypeSdkEvent.lift(event));
95
+ return await jsCallback.onEvent(FfiConverterTypeSdkEvent.lift(event), {
96
+ signal
97
+ });
96
98
  };
97
- const uniffiResult = UniffiResult.ready();
98
- const uniffiHandleSuccess = obj => {};
99
- const uniffiHandleError = (code, errBuf) => {
100
- UniffiResult.writeError(uniffiResult, code, errBuf);
99
+ const uniffiHandleSuccess = returnValue => {
100
+ uniffiFutureCallback(uniffiCallbackData, /* UniffiForeignFutureStructVoid */{
101
+ callStatus: uniffiCaller.createCallStatus()
102
+ });
101
103
  };
102
- uniffiTraitInterfaceCall(/*makeCall:*/uniffiMakeCall, /*handleSuccess:*/uniffiHandleSuccess, /*handleError:*/uniffiHandleError, /*lowerString:*/FfiConverterString.lower);
103
- return uniffiResult;
104
+ const uniffiHandleError = (code, errorBuf) => {
105
+ uniffiFutureCallback(uniffiCallbackData, /* UniffiForeignFutureStructVoid */{
106
+ // TODO create callstatus with error.
107
+ callStatus: {
108
+ code,
109
+ errorBuf
110
+ }
111
+ });
112
+ };
113
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsync(/*makeCall:*/uniffiMakeCall, /*handleSuccess:*/uniffiHandleSuccess, /*handleError:*/uniffiHandleError, /*lowerString:*/FfiConverterString.lower);
114
+ return UniffiResult.success(uniffiForeignFuture);
104
115
  },
105
116
  uniffiFree: uniffiHandle => {
106
117
  // EventListener: this will throw a stale handle error if the handle isn't found.
@@ -496,11 +507,15 @@ export const GetInfoRequest = (() => {
496
507
  const FfiConverterTypeGetInfoRequest = (() => {
497
508
  class FFIConverter extends AbstractFfiConverterByteArray {
498
509
  read(from) {
499
- return {};
510
+ return {
511
+ ensureSynced: FfiConverterOptionalBool.read(from)
512
+ };
513
+ }
514
+ write(value, into) {
515
+ FfiConverterOptionalBool.write(value.ensureSynced, into);
500
516
  }
501
- write(value, into) {}
502
517
  allocationSize(value) {
503
- return 0;
518
+ return FfiConverterOptionalBool.allocationSize(value.ensureSynced);
504
519
  }
505
520
  }
506
521
  return new FFIConverter();
@@ -4742,10 +4757,18 @@ export class BreezSdk extends UniffiAbstractObject {
4742
4757
  *
4743
4758
  * A unique identifier for the listener, which can be used to remove it later
4744
4759
  */
4745
- addEventListener(listener) {
4746
- return FfiConverterString.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
4747
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_add_event_listener(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeEventListener.lower(listener), callStatus);
4748
- }, /*liftString:*/FfiConverterString.lift));
4760
+ async addEventListener(listener, asyncOpts_) {
4761
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
4762
+ try {
4763
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
4764
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_add_event_listener(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeEventListener.lower(listener));
4765
+ }, /*pollFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/FfiConverterString.lift.bind(FfiConverterString), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_);
4766
+ } catch (__error) {
4767
+ if (uniffiIsDebug && __error instanceof Error) {
4768
+ __error.stack = __stack;
4769
+ }
4770
+ throw __error;
4771
+ }
4749
4772
  }
4750
4773
  async checkLightningAddressAvailable(req, asyncOpts_) /*throws*/{
4751
4774
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
@@ -5034,10 +5057,18 @@ export class BreezSdk extends UniffiAbstractObject {
5034
5057
  *
5035
5058
  * `true` if the listener was found and removed, `false` otherwise
5036
5059
  */
5037
- removeEventListener(id) {
5038
- return FfiConverterBool.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
5039
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_remove_event_listener(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterString.lower(id), callStatus);
5040
- }, /*liftString:*/FfiConverterString.lift));
5060
+ async removeEventListener(id, asyncOpts_) {
5061
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
5062
+ try {
5063
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5064
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_remove_event_listener(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterString.lower(id));
5065
+ }, /*pollFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_poll_i8, /*cancelFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_cancel_i8, /*completeFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_complete_i8, /*freeFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_free_i8, /*liftFunc:*/FfiConverterBool.lift.bind(FfiConverterBool), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_);
5066
+ } catch (__error) {
5067
+ if (uniffiIsDebug && __error instanceof Error) {
5068
+ __error.stack = __stack;
5069
+ }
5070
+ throw __error;
5071
+ }
5041
5072
  }
5042
5073
  async sendPayment(request, asyncOpts_) /*throws*/{
5043
5074
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
@@ -5069,10 +5100,18 @@ export class BreezSdk extends UniffiAbstractObject {
5069
5100
  /**
5070
5101
  * Synchronizes the wallet with the Spark network
5071
5102
  */
5072
- syncWallet(request) /*throws*/{
5073
- return FfiConverterTypeSyncWalletResponse.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError), /*caller:*/callStatus => {
5074
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_sync_wallet(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeSyncWalletRequest.lower(request), callStatus);
5075
- }, /*liftString:*/FfiConverterString.lift));
5103
+ async syncWallet(request, asyncOpts_) /*throws*/{
5104
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
5105
+ try {
5106
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5107
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_sync_wallet(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeSyncWalletRequest.lower(request));
5108
+ }, /*pollFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/FfiConverterTypeSyncWalletResponse.lift.bind(FfiConverterTypeSyncWalletResponse), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError));
5109
+ } catch (__error) {
5110
+ if (uniffiIsDebug && __error instanceof Error) {
5111
+ __error.stack = __stack;
5112
+ }
5113
+ throw __error;
5114
+ }
5076
5115
  }
5077
5116
 
5078
5117
  /**
@@ -6002,7 +6041,7 @@ function uniffiEnsureInitialized() {
6002
6041
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_broadcast_transaction() !== 65179) {
6003
6042
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_broadcast_transaction');
6004
6043
  }
6005
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_add_event_listener() !== 61844) {
6044
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_add_event_listener() !== 37737) {
6006
6045
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_add_event_listener');
6007
6046
  }
6008
6047
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_check_lightning_address_available() !== 31624) {
@@ -6062,7 +6101,7 @@ function uniffiEnsureInitialized() {
6062
6101
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_register_lightning_address() !== 530) {
6063
6102
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_register_lightning_address');
6064
6103
  }
6065
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener() !== 60980) {
6104
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener() !== 41066) {
6066
6105
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener');
6067
6106
  }
6068
6107
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment() !== 54349) {
@@ -6071,7 +6110,7 @@ function uniffiEnsureInitialized() {
6071
6110
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment_internal() !== 37855) {
6072
6111
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment_internal');
6073
6112
  }
6074
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet() !== 36066) {
6113
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet() !== 30368) {
6075
6114
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet');
6076
6115
  }
6077
6116
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_build() !== 8126) {
@@ -6128,7 +6167,7 @@ function uniffiEnsureInitialized() {
6128
6167
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new() !== 53882) {
6129
6168
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new');
6130
6169
  }
6131
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_eventlistener_on_event() !== 10824) {
6170
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_eventlistener_on_event() !== 24807) {
6132
6171
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_eventlistener_on_event');
6133
6172
  }
6134
6173
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_logger_log() !== 11839) {