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

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;;AAwgBA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,mBAAmB;AACzC,eAAeF,MAAM;;AAErB;;AAkQA;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();
@@ -2000,6 +2015,88 @@ const FfiConverterTypeUtxo = (() => {
2000
2015
  }
2001
2016
  return new FFIConverter();
2002
2017
  })();
2018
+ /**
2019
+ * Generated factory for {@link WaitForPaymentRequest} record objects.
2020
+ */
2021
+ export const WaitForPaymentRequest = (() => {
2022
+ const defaults = () => ({});
2023
+ const create = (() => {
2024
+ return uniffiCreateRecord(defaults);
2025
+ })();
2026
+ return Object.freeze({
2027
+ /**
2028
+ * Create a frozen instance of {@link WaitForPaymentRequest}, with defaults specified
2029
+ * in Rust, in the {@link breez_sdk_spark} crate.
2030
+ */
2031
+ create,
2032
+ /**
2033
+ * Create a frozen instance of {@link WaitForPaymentRequest}, with defaults specified
2034
+ * in Rust, in the {@link breez_sdk_spark} crate.
2035
+ */
2036
+ new: create,
2037
+ /**
2038
+ * Defaults specified in the {@link breez_sdk_spark} crate.
2039
+ */
2040
+ defaults: () => Object.freeze(defaults())
2041
+ });
2042
+ })();
2043
+ const FfiConverterTypeWaitForPaymentRequest = (() => {
2044
+ class FFIConverter extends AbstractFfiConverterByteArray {
2045
+ read(from) {
2046
+ return {
2047
+ identifier: FfiConverterTypeWaitForPaymentIdentifier.read(from)
2048
+ };
2049
+ }
2050
+ write(value, into) {
2051
+ FfiConverterTypeWaitForPaymentIdentifier.write(value.identifier, into);
2052
+ }
2053
+ allocationSize(value) {
2054
+ return FfiConverterTypeWaitForPaymentIdentifier.allocationSize(value.identifier);
2055
+ }
2056
+ }
2057
+ return new FFIConverter();
2058
+ })();
2059
+ /**
2060
+ * Generated factory for {@link WaitForPaymentResponse} record objects.
2061
+ */
2062
+ export const WaitForPaymentResponse = (() => {
2063
+ const defaults = () => ({});
2064
+ const create = (() => {
2065
+ return uniffiCreateRecord(defaults);
2066
+ })();
2067
+ return Object.freeze({
2068
+ /**
2069
+ * Create a frozen instance of {@link WaitForPaymentResponse}, with defaults specified
2070
+ * in Rust, in the {@link breez_sdk_spark} crate.
2071
+ */
2072
+ create,
2073
+ /**
2074
+ * Create a frozen instance of {@link WaitForPaymentResponse}, with defaults specified
2075
+ * in Rust, in the {@link breez_sdk_spark} crate.
2076
+ */
2077
+ new: create,
2078
+ /**
2079
+ * Defaults specified in the {@link breez_sdk_spark} crate.
2080
+ */
2081
+ defaults: () => Object.freeze(defaults())
2082
+ });
2083
+ })();
2084
+ const FfiConverterTypeWaitForPaymentResponse = (() => {
2085
+ class FFIConverter extends AbstractFfiConverterByteArray {
2086
+ read(from) {
2087
+ return {
2088
+ payment: FfiConverterTypePayment.read(from)
2089
+ };
2090
+ }
2091
+ write(value, into) {
2092
+ FfiConverterTypePayment.write(value.payment, into);
2093
+ }
2094
+ allocationSize(value) {
2095
+ return FfiConverterTypePayment.allocationSize(value.payment);
2096
+ }
2097
+ }
2098
+ return new FFIConverter();
2099
+ })();
2003
2100
  const stringConverter = {
2004
2101
  stringToBytes: s => uniffiCaller.rustCall(status => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(s, status)),
2005
2102
  bytesToString: ab => uniffiCaller.rustCall(status => nativeModule().ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(ab, status)),
@@ -4137,7 +4234,8 @@ const FfiConverterTypeSendPaymentOptions = (() => {
4137
4234
  });
4138
4235
  case 2:
4139
4236
  return new SendPaymentOptions.Bolt11Invoice({
4140
- preferSpark: FfiConverterBool.read(from)
4237
+ preferSpark: FfiConverterBool.read(from),
4238
+ completionTimeoutSecs: FfiConverterOptionalUInt32.read(from)
4141
4239
  });
4142
4240
  default:
4143
4241
  throw new UniffiInternalError.UnexpectedEnumCase();
@@ -4157,6 +4255,7 @@ const FfiConverterTypeSendPaymentOptions = (() => {
4157
4255
  ordinalConverter.write(2, into);
4158
4256
  const inner = value.inner;
4159
4257
  FfiConverterBool.write(inner.preferSpark, into);
4258
+ FfiConverterOptionalUInt32.write(inner.completionTimeoutSecs, into);
4160
4259
  return;
4161
4260
  }
4162
4261
  default:
@@ -4178,6 +4277,7 @@ const FfiConverterTypeSendPaymentOptions = (() => {
4178
4277
  const inner = value.inner;
4179
4278
  let size = ordinalConverter.allocationSize(2);
4180
4279
  size += FfiConverterBool.allocationSize(inner.preferSpark);
4280
+ size += FfiConverterOptionalUInt32.allocationSize(inner.completionTimeoutSecs);
4181
4281
  return size;
4182
4282
  }
4183
4283
  default:
@@ -4483,6 +4583,117 @@ const FfiConverterTypeUpdateDepositPayload = (() => {
4483
4583
  }
4484
4584
  return new FFIConverter();
4485
4585
  })();
4586
+
4587
+ // Enum: WaitForPaymentIdentifier
4588
+ export let WaitForPaymentIdentifier_Tags = /*#__PURE__*/function (WaitForPaymentIdentifier_Tags) {
4589
+ WaitForPaymentIdentifier_Tags["PaymentId"] = "PaymentId";
4590
+ WaitForPaymentIdentifier_Tags["PaymentRequest"] = "PaymentRequest";
4591
+ return WaitForPaymentIdentifier_Tags;
4592
+ }({});
4593
+ export const WaitForPaymentIdentifier = (() => {
4594
+ class PaymentId_ extends UniffiEnum {
4595
+ /**
4596
+ * @private
4597
+ * This field is private and should not be used, use `tag` instead.
4598
+ */
4599
+ [uniffiTypeNameSymbol] = 'WaitForPaymentIdentifier';
4600
+ tag = WaitForPaymentIdentifier_Tags.PaymentId;
4601
+ constructor(v0) {
4602
+ super('WaitForPaymentIdentifier', 'PaymentId');
4603
+ this.inner = Object.freeze([v0]);
4604
+ }
4605
+ static new(v0) {
4606
+ return new PaymentId_(v0);
4607
+ }
4608
+ static instanceOf(obj) {
4609
+ return obj.tag === WaitForPaymentIdentifier_Tags.PaymentId;
4610
+ }
4611
+ }
4612
+ class PaymentRequest_ extends UniffiEnum {
4613
+ /**
4614
+ * @private
4615
+ * This field is private and should not be used, use `tag` instead.
4616
+ */
4617
+ [uniffiTypeNameSymbol] = 'WaitForPaymentIdentifier';
4618
+ tag = WaitForPaymentIdentifier_Tags.PaymentRequest;
4619
+ constructor(v0) {
4620
+ super('WaitForPaymentIdentifier', 'PaymentRequest');
4621
+ this.inner = Object.freeze([v0]);
4622
+ }
4623
+ static new(v0) {
4624
+ return new PaymentRequest_(v0);
4625
+ }
4626
+ static instanceOf(obj) {
4627
+ return obj.tag === WaitForPaymentIdentifier_Tags.PaymentRequest;
4628
+ }
4629
+ }
4630
+ function instanceOf(obj) {
4631
+ return obj[uniffiTypeNameSymbol] === 'WaitForPaymentIdentifier';
4632
+ }
4633
+ return Object.freeze({
4634
+ instanceOf,
4635
+ PaymentId: PaymentId_,
4636
+ PaymentRequest: PaymentRequest_
4637
+ });
4638
+ })();
4639
+ // FfiConverter for enum WaitForPaymentIdentifier
4640
+ const FfiConverterTypeWaitForPaymentIdentifier = (() => {
4641
+ const ordinalConverter = FfiConverterInt32;
4642
+ class FFIConverter extends AbstractFfiConverterByteArray {
4643
+ read(from) {
4644
+ switch (ordinalConverter.read(from)) {
4645
+ case 1:
4646
+ return new WaitForPaymentIdentifier.PaymentId(FfiConverterString.read(from));
4647
+ case 2:
4648
+ return new WaitForPaymentIdentifier.PaymentRequest(FfiConverterString.read(from));
4649
+ default:
4650
+ throw new UniffiInternalError.UnexpectedEnumCase();
4651
+ }
4652
+ }
4653
+ write(value, into) {
4654
+ switch (value.tag) {
4655
+ case WaitForPaymentIdentifier_Tags.PaymentId:
4656
+ {
4657
+ ordinalConverter.write(1, into);
4658
+ const inner = value.inner;
4659
+ FfiConverterString.write(inner[0], into);
4660
+ return;
4661
+ }
4662
+ case WaitForPaymentIdentifier_Tags.PaymentRequest:
4663
+ {
4664
+ ordinalConverter.write(2, into);
4665
+ const inner = value.inner;
4666
+ FfiConverterString.write(inner[0], into);
4667
+ return;
4668
+ }
4669
+ default:
4670
+ // Throwing from here means that WaitForPaymentIdentifier_Tags hasn't matched an ordinal.
4671
+ throw new UniffiInternalError.UnexpectedEnumCase();
4672
+ }
4673
+ }
4674
+ allocationSize(value) {
4675
+ switch (value.tag) {
4676
+ case WaitForPaymentIdentifier_Tags.PaymentId:
4677
+ {
4678
+ const inner = value.inner;
4679
+ let size = ordinalConverter.allocationSize(1);
4680
+ size += FfiConverterString.allocationSize(inner[0]);
4681
+ return size;
4682
+ }
4683
+ case WaitForPaymentIdentifier_Tags.PaymentRequest:
4684
+ {
4685
+ const inner = value.inner;
4686
+ let size = ordinalConverter.allocationSize(2);
4687
+ size += FfiConverterString.allocationSize(inner[0]);
4688
+ return size;
4689
+ }
4690
+ default:
4691
+ throw new UniffiInternalError.UnexpectedEnumCase();
4692
+ }
4693
+ }
4694
+ }
4695
+ return new FFIConverter();
4696
+ })();
4486
4697
  export class BitcoinChainServiceImpl extends UniffiAbstractObject {
4487
4698
  [uniffiTypeNameSymbol] = 'BitcoinChainServiceImpl';
4488
4699
  // No primary constructor declared for this class.
@@ -4742,10 +4953,18 @@ export class BreezSdk extends UniffiAbstractObject {
4742
4953
  *
4743
4954
  * A unique identifier for the listener, which can be used to remove it later
4744
4955
  */
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));
4956
+ async addEventListener(listener, asyncOpts_) {
4957
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
4958
+ try {
4959
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
4960
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_add_event_listener(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeEventListener.lower(listener));
4961
+ }, /*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_);
4962
+ } catch (__error) {
4963
+ if (uniffiIsDebug && __error instanceof Error) {
4964
+ __error.stack = __stack;
4965
+ }
4966
+ throw __error;
4967
+ }
4749
4968
  }
4750
4969
  async checkLightningAddressAvailable(req, asyncOpts_) /*throws*/{
4751
4970
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
@@ -4797,10 +5016,18 @@ export class BreezSdk extends UniffiAbstractObject {
4797
5016
  *
4798
5017
  * Result containing either success or an `SdkError` if the background task couldn't be stopped
4799
5018
  */
4800
- disconnect() /*throws*/{
4801
- uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError), /*caller:*/callStatus => {
4802
- nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_disconnect(uniffiTypeBreezSdkObjectFactory.clonePointer(this), callStatus);
4803
- }, /*liftString:*/FfiConverterString.lift);
5019
+ async disconnect(asyncOpts_) /*throws*/{
5020
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
5021
+ try {
5022
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5023
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_disconnect(uniffiTypeBreezSdkObjectFactory.clonePointer(this));
5024
+ }, /*pollFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/nativeModule().ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/_v => {}, /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError));
5025
+ } catch (__error) {
5026
+ if (uniffiIsDebug && __error instanceof Error) {
5027
+ __error.stack = __stack;
5028
+ }
5029
+ throw __error;
5030
+ }
4804
5031
  }
4805
5032
 
4806
5033
  /**
@@ -5034,10 +5261,44 @@ export class BreezSdk extends UniffiAbstractObject {
5034
5261
  *
5035
5262
  * `true` if the listener was found and removed, `false` otherwise
5036
5263
  */
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));
5264
+ async removeEventListener(id, asyncOpts_) {
5265
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
5266
+ try {
5267
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5268
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_remove_event_listener(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterString.lower(id));
5269
+ }, /*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_);
5270
+ } catch (__error) {
5271
+ if (uniffiIsDebug && __error instanceof Error) {
5272
+ __error.stack = __stack;
5273
+ }
5274
+ throw __error;
5275
+ }
5276
+ }
5277
+ async sendBitcoinAddress(address, feeQuote, request, asyncOpts_) /*throws*/{
5278
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
5279
+ try {
5280
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5281
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_send_bitcoin_address(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeBitcoinAddressDetails.lower(address), FfiConverterTypeSendOnchainFeeQuote.lower(feeQuote), FfiConverterTypeSendPaymentRequest.lower(request));
5282
+ }, /*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:*/FfiConverterTypeSendPaymentResponse.lift.bind(FfiConverterTypeSendPaymentResponse), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError));
5283
+ } catch (__error) {
5284
+ if (uniffiIsDebug && __error instanceof Error) {
5285
+ __error.stack = __stack;
5286
+ }
5287
+ throw __error;
5288
+ }
5289
+ }
5290
+ async sendBolt11Invoice(invoiceDetails, sparkTransferFeeSats, lightningFeeSats, request, asyncOpts_) /*throws*/{
5291
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
5292
+ try {
5293
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5294
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_send_bolt11_invoice(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeBolt11InvoiceDetails.lower(invoiceDetails), FfiConverterOptionalUInt64.lower(sparkTransferFeeSats), FfiConverterUInt64.lower(lightningFeeSats), FfiConverterTypeSendPaymentRequest.lower(request));
5295
+ }, /*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:*/FfiConverterTypeSendPaymentResponse.lift.bind(FfiConverterTypeSendPaymentResponse), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError));
5296
+ } catch (__error) {
5297
+ if (uniffiIsDebug && __error instanceof Error) {
5298
+ __error.stack = __stack;
5299
+ }
5300
+ throw __error;
5301
+ }
5041
5302
  }
5042
5303
  async sendPayment(request, asyncOpts_) /*throws*/{
5043
5304
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
@@ -5065,14 +5326,48 @@ export class BreezSdk extends UniffiAbstractObject {
5065
5326
  throw __error;
5066
5327
  }
5067
5328
  }
5329
+ async sendSparkAddress(address, request, asyncOpts_) /*throws*/{
5330
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
5331
+ try {
5332
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5333
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_send_spark_address(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterString.lower(address), FfiConverterTypeSendPaymentRequest.lower(request));
5334
+ }, /*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:*/FfiConverterTypeSendPaymentResponse.lift.bind(FfiConverterTypeSendPaymentResponse), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError));
5335
+ } catch (__error) {
5336
+ if (uniffiIsDebug && __error instanceof Error) {
5337
+ __error.stack = __stack;
5338
+ }
5339
+ throw __error;
5340
+ }
5341
+ }
5068
5342
 
5069
5343
  /**
5070
5344
  * Synchronizes the wallet with the Spark network
5071
5345
  */
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));
5346
+ async syncWallet(request, asyncOpts_) /*throws*/{
5347
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
5348
+ try {
5349
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5350
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_sync_wallet(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeSyncWalletRequest.lower(request));
5351
+ }, /*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));
5352
+ } catch (__error) {
5353
+ if (uniffiIsDebug && __error instanceof Error) {
5354
+ __error.stack = __stack;
5355
+ }
5356
+ throw __error;
5357
+ }
5358
+ }
5359
+ async waitForPayment(request, asyncOpts_) /*throws*/{
5360
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
5361
+ try {
5362
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5363
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_wait_for_payment(uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeWaitForPaymentRequest.lower(request));
5364
+ }, /*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:*/FfiConverterTypeWaitForPaymentResponse.lift.bind(FfiConverterTypeWaitForPaymentResponse), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError));
5365
+ } catch (__error) {
5366
+ if (uniffiIsDebug && __error instanceof Error) {
5367
+ __error.stack = __stack;
5368
+ }
5369
+ throw __error;
5370
+ }
5076
5371
  }
5077
5372
 
5078
5373
  /**
@@ -5464,6 +5759,29 @@ export class StorageImpl extends UniffiAbstractObject {
5464
5759
  }
5465
5760
  }
5466
5761
 
5762
+ /**
5763
+ * Gets a payment by its invoice
5764
+ * # Arguments
5765
+ *
5766
+ * * `invoice` - The invoice of the payment to retrieve
5767
+ * # Returns
5768
+ *
5769
+ * The payment if found or None if not found
5770
+ */
5771
+ async getPaymentByInvoice(invoice, asyncOpts_) /*throws*/{
5772
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
5773
+ try {
5774
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5775
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_payment_by_invoice(uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(invoice));
5776
+ }, /*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:*/FfiConverterOptionalTypePayment.lift.bind(FfiConverterOptionalTypePayment), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeStorageError.lift.bind(FfiConverterTypeStorageError));
5777
+ } catch (__error) {
5778
+ if (uniffiIsDebug && __error instanceof Error) {
5779
+ __error.stack = __stack;
5780
+ }
5781
+ throw __error;
5782
+ }
5783
+ }
5784
+
5467
5785
  /**
5468
5786
  * Add a deposit to storage
5469
5787
  * # Arguments
@@ -5792,6 +6110,32 @@ const uniffiCallbackInterfaceStorage = {
5792
6110
  const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(/*makeCall:*/uniffiMakeCall, /*handleSuccess:*/uniffiHandleSuccess, /*handleError:*/uniffiHandleError, /*isErrorType:*/StorageError.instanceOf, /*lowerError:*/FfiConverterTypeStorageError.lower.bind(FfiConverterTypeStorageError), /*lowerString:*/FfiConverterString.lower);
5793
6111
  return UniffiResult.success(uniffiForeignFuture);
5794
6112
  },
6113
+ getPaymentByInvoice: (uniffiHandle, invoice, uniffiFutureCallback, uniffiCallbackData) => {
6114
+ const uniffiMakeCall = async signal => {
6115
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
6116
+ return await jsCallback.getPaymentByInvoice(FfiConverterString.lift(invoice), {
6117
+ signal
6118
+ });
6119
+ };
6120
+ const uniffiHandleSuccess = returnValue => {
6121
+ uniffiFutureCallback(uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */{
6122
+ returnValue: FfiConverterOptionalTypePayment.lower(returnValue),
6123
+ callStatus: uniffiCaller.createCallStatus()
6124
+ });
6125
+ };
6126
+ const uniffiHandleError = (code, errorBuf) => {
6127
+ uniffiFutureCallback(uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */{
6128
+ returnValue: /*empty*/new Uint8Array(0),
6129
+ // TODO create callstatus with error.
6130
+ callStatus: {
6131
+ code,
6132
+ errorBuf
6133
+ }
6134
+ });
6135
+ };
6136
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(/*makeCall:*/uniffiMakeCall, /*handleSuccess:*/uniffiHandleSuccess, /*handleError:*/uniffiHandleError, /*isErrorType:*/StorageError.instanceOf, /*lowerError:*/FfiConverterTypeStorageError.lower.bind(FfiConverterTypeStorageError), /*lowerString:*/FfiConverterString.lower);
6137
+ return UniffiResult.success(uniffiForeignFuture);
6138
+ },
5795
6139
  addDeposit: (uniffiHandle, txid, vout, amountSats, uniffiFutureCallback, uniffiCallbackData) => {
5796
6140
  const uniffiMakeCall = async signal => {
5797
6141
  const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
@@ -5921,6 +6265,9 @@ const FfiConverterOptionalTypeLightningAddressInfo = new FfiConverterOptional(Ff
5921
6265
  // FfiConverter for LnurlPayInfo | undefined
5922
6266
  const FfiConverterOptionalTypeLnurlPayInfo = new FfiConverterOptional(FfiConverterTypeLnurlPayInfo);
5923
6267
 
6268
+ // FfiConverter for Payment | undefined
6269
+ const FfiConverterOptionalTypePayment = new FfiConverterOptional(FfiConverterTypePayment);
6270
+
5924
6271
  // FfiConverter for string | undefined
5925
6272
  const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
5926
6273
 
@@ -6002,7 +6349,7 @@ function uniffiEnsureInitialized() {
6002
6349
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_broadcast_transaction() !== 65179) {
6003
6350
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_broadcast_transaction');
6004
6351
  }
6005
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_add_event_listener() !== 61844) {
6352
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_add_event_listener() !== 37737) {
6006
6353
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_add_event_listener');
6007
6354
  }
6008
6355
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_check_lightning_address_available() !== 31624) {
@@ -6014,7 +6361,7 @@ function uniffiEnsureInitialized() {
6014
6361
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_delete_lightning_address() !== 44132) {
6015
6362
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_delete_lightning_address');
6016
6363
  }
6017
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_disconnect() !== 30986) {
6364
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_disconnect() !== 330) {
6018
6365
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_disconnect');
6019
6366
  }
6020
6367
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_get_info() !== 6771) {
@@ -6062,18 +6409,30 @@ function uniffiEnsureInitialized() {
6062
6409
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_register_lightning_address() !== 530) {
6063
6410
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_register_lightning_address');
6064
6411
  }
6065
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener() !== 60980) {
6412
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener() !== 41066) {
6066
6413
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener');
6067
6414
  }
6415
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_bitcoin_address() !== 5926) {
6416
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_send_bitcoin_address');
6417
+ }
6418
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_bolt11_invoice() !== 21785) {
6419
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_send_bolt11_invoice');
6420
+ }
6068
6421
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment() !== 54349) {
6069
6422
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment');
6070
6423
  }
6071
6424
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment_internal() !== 37855) {
6072
6425
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment_internal');
6073
6426
  }
6074
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet() !== 36066) {
6427
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_spark_address() !== 63147) {
6428
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_send_spark_address');
6429
+ }
6430
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet() !== 30368) {
6075
6431
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet');
6076
6432
  }
6433
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_wait_for_payment() !== 64922) {
6434
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_breezsdk_wait_for_payment');
6435
+ }
6077
6436
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_build() !== 8126) {
6078
6437
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_sdkbuilder_build');
6079
6438
  }
@@ -6113,22 +6472,25 @@ function uniffiEnsureInitialized() {
6113
6472
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_payment_by_id() !== 35394) {
6114
6473
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_storage_get_payment_by_id');
6115
6474
  }
6116
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_add_deposit() !== 55082) {
6475
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_payment_by_invoice() !== 57075) {
6476
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_storage_get_payment_by_invoice');
6477
+ }
6478
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_add_deposit() !== 60240) {
6117
6479
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_storage_add_deposit');
6118
6480
  }
6119
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_delete_deposit() !== 13111) {
6481
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_delete_deposit() !== 60586) {
6120
6482
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_storage_delete_deposit');
6121
6483
  }
6122
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_list_deposits() !== 22806) {
6484
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_list_deposits() !== 54118) {
6123
6485
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_storage_list_deposits');
6124
6486
  }
6125
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_update_deposit() !== 48478) {
6487
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_update_deposit() !== 39803) {
6126
6488
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_storage_update_deposit');
6127
6489
  }
6128
6490
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new() !== 53882) {
6129
6491
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new');
6130
6492
  }
6131
- if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_eventlistener_on_event() !== 10824) {
6493
+ if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_eventlistener_on_event() !== 24807) {
6132
6494
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_breez_sdk_spark_checksum_method_eventlistener_on_event');
6133
6495
  }
6134
6496
  if (nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_logger_log() !== 11839) {
@@ -6201,7 +6563,10 @@ export default Object.freeze({
6201
6563
  FfiConverterTypeSyncWalletResponse,
6202
6564
  FfiConverterTypeTxStatus,
6203
6565
  FfiConverterTypeUpdateDepositPayload,
6204
- FfiConverterTypeUtxo
6566
+ FfiConverterTypeUtxo,
6567
+ FfiConverterTypeWaitForPaymentIdentifier,
6568
+ FfiConverterTypeWaitForPaymentRequest,
6569
+ FfiConverterTypeWaitForPaymentResponse
6205
6570
  }
6206
6571
  });
6207
6572
  //# sourceMappingURL=breez_sdk_spark.js.map