@breeztech/breez-sdk-spark-react-native 0.2.5-dev2 → 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.
@@ -2912,6 +2912,115 @@ const FfiConverterTypeUtxo = (() => {
2912
2912
  return new FFIConverter();
2913
2913
  })();
2914
2914
 
2915
+ export type WaitForPaymentRequest = {
2916
+ identifier: WaitForPaymentIdentifier;
2917
+ };
2918
+
2919
+ /**
2920
+ * Generated factory for {@link WaitForPaymentRequest} record objects.
2921
+ */
2922
+ export const WaitForPaymentRequest = (() => {
2923
+ const defaults = () => ({});
2924
+ const create = (() => {
2925
+ return uniffiCreateRecord<
2926
+ WaitForPaymentRequest,
2927
+ ReturnType<typeof defaults>
2928
+ >(defaults);
2929
+ })();
2930
+ return Object.freeze({
2931
+ /**
2932
+ * Create a frozen instance of {@link WaitForPaymentRequest}, with defaults specified
2933
+ * in Rust, in the {@link breez_sdk_spark} crate.
2934
+ */
2935
+ create,
2936
+
2937
+ /**
2938
+ * Create a frozen instance of {@link WaitForPaymentRequest}, with defaults specified
2939
+ * in Rust, in the {@link breez_sdk_spark} crate.
2940
+ */
2941
+ new: create,
2942
+
2943
+ /**
2944
+ * Defaults specified in the {@link breez_sdk_spark} crate.
2945
+ */
2946
+ defaults: () => Object.freeze(defaults()) as Partial<WaitForPaymentRequest>,
2947
+ });
2948
+ })();
2949
+
2950
+ const FfiConverterTypeWaitForPaymentRequest = (() => {
2951
+ type TypeName = WaitForPaymentRequest;
2952
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
2953
+ read(from: RustBuffer): TypeName {
2954
+ return {
2955
+ identifier: FfiConverterTypeWaitForPaymentIdentifier.read(from),
2956
+ };
2957
+ }
2958
+ write(value: TypeName, into: RustBuffer): void {
2959
+ FfiConverterTypeWaitForPaymentIdentifier.write(value.identifier, into);
2960
+ }
2961
+ allocationSize(value: TypeName): number {
2962
+ return FfiConverterTypeWaitForPaymentIdentifier.allocationSize(
2963
+ value.identifier
2964
+ );
2965
+ }
2966
+ }
2967
+ return new FFIConverter();
2968
+ })();
2969
+
2970
+ export type WaitForPaymentResponse = {
2971
+ payment: Payment;
2972
+ };
2973
+
2974
+ /**
2975
+ * Generated factory for {@link WaitForPaymentResponse} record objects.
2976
+ */
2977
+ export const WaitForPaymentResponse = (() => {
2978
+ const defaults = () => ({});
2979
+ const create = (() => {
2980
+ return uniffiCreateRecord<
2981
+ WaitForPaymentResponse,
2982
+ ReturnType<typeof defaults>
2983
+ >(defaults);
2984
+ })();
2985
+ return Object.freeze({
2986
+ /**
2987
+ * Create a frozen instance of {@link WaitForPaymentResponse}, with defaults specified
2988
+ * in Rust, in the {@link breez_sdk_spark} crate.
2989
+ */
2990
+ create,
2991
+
2992
+ /**
2993
+ * Create a frozen instance of {@link WaitForPaymentResponse}, with defaults specified
2994
+ * in Rust, in the {@link breez_sdk_spark} crate.
2995
+ */
2996
+ new: create,
2997
+
2998
+ /**
2999
+ * Defaults specified in the {@link breez_sdk_spark} crate.
3000
+ */
3001
+ defaults: () =>
3002
+ Object.freeze(defaults()) as Partial<WaitForPaymentResponse>,
3003
+ });
3004
+ })();
3005
+
3006
+ const FfiConverterTypeWaitForPaymentResponse = (() => {
3007
+ type TypeName = WaitForPaymentResponse;
3008
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
3009
+ read(from: RustBuffer): TypeName {
3010
+ return {
3011
+ payment: FfiConverterTypePayment.read(from),
3012
+ };
3013
+ }
3014
+ write(value: TypeName, into: RustBuffer): void {
3015
+ FfiConverterTypePayment.write(value.payment, into);
3016
+ }
3017
+ allocationSize(value: TypeName): number {
3018
+ return FfiConverterTypePayment.allocationSize(value.payment);
3019
+ }
3020
+ }
3021
+ return new FFIConverter();
3022
+ })();
3023
+
2915
3024
  const stringConverter = {
2916
3025
  stringToBytes: (s: string) =>
2917
3026
  uniffiCaller.rustCall((status) =>
@@ -5586,7 +5695,10 @@ export const SendPaymentOptions = (() => {
5586
5695
 
5587
5696
  type Bolt11Invoice__interface = {
5588
5697
  tag: SendPaymentOptions_Tags.Bolt11Invoice;
5589
- inner: Readonly<{ preferSpark: boolean }>;
5698
+ inner: Readonly<{
5699
+ preferSpark: boolean;
5700
+ completionTimeoutSecs: /*u32*/ number | undefined;
5701
+ }>;
5590
5702
  };
5591
5703
 
5592
5704
  class Bolt11Invoice_ extends UniffiEnum implements Bolt11Invoice__interface {
@@ -5596,13 +5708,28 @@ export const SendPaymentOptions = (() => {
5596
5708
  */
5597
5709
  readonly [uniffiTypeNameSymbol] = 'SendPaymentOptions';
5598
5710
  readonly tag = SendPaymentOptions_Tags.Bolt11Invoice;
5599
- readonly inner: Readonly<{ preferSpark: boolean }>;
5600
- constructor(inner: { preferSpark: boolean }) {
5711
+ readonly inner: Readonly<{
5712
+ preferSpark: boolean;
5713
+ completionTimeoutSecs: /*u32*/ number | undefined;
5714
+ }>;
5715
+ constructor(inner: {
5716
+ preferSpark: boolean;
5717
+ /**
5718
+ * If set, the function will return the payment if it is still pending after this
5719
+ * number of seconds. If unset, the function will return immediately after initiating the payment.
5720
+ */ completionTimeoutSecs: /*u32*/ number | undefined;
5721
+ }) {
5601
5722
  super('SendPaymentOptions', 'Bolt11Invoice');
5602
5723
  this.inner = Object.freeze(inner);
5603
5724
  }
5604
5725
 
5605
- static new(inner: { preferSpark: boolean }): Bolt11Invoice_ {
5726
+ static new(inner: {
5727
+ preferSpark: boolean;
5728
+ /**
5729
+ * If set, the function will return the payment if it is still pending after this
5730
+ * number of seconds. If unset, the function will return immediately after initiating the payment.
5731
+ */ completionTimeoutSecs: /*u32*/ number | undefined;
5732
+ }): Bolt11Invoice_ {
5606
5733
  return new Bolt11Invoice_(inner);
5607
5734
  }
5608
5735
 
@@ -5644,6 +5771,7 @@ const FfiConverterTypeSendPaymentOptions = (() => {
5644
5771
  case 2:
5645
5772
  return new SendPaymentOptions.Bolt11Invoice({
5646
5773
  preferSpark: FfiConverterBool.read(from),
5774
+ completionTimeoutSecs: FfiConverterOptionalUInt32.read(from),
5647
5775
  });
5648
5776
  default:
5649
5777
  throw new UniffiInternalError.UnexpectedEnumCase();
@@ -5664,6 +5792,7 @@ const FfiConverterTypeSendPaymentOptions = (() => {
5664
5792
  ordinalConverter.write(2, into);
5665
5793
  const inner = value.inner;
5666
5794
  FfiConverterBool.write(inner.preferSpark, into);
5795
+ FfiConverterOptionalUInt32.write(inner.completionTimeoutSecs, into);
5667
5796
  return;
5668
5797
  }
5669
5798
  default:
@@ -5685,6 +5814,9 @@ const FfiConverterTypeSendPaymentOptions = (() => {
5685
5814
  const inner = value.inner;
5686
5815
  let size = ordinalConverter.allocationSize(2);
5687
5816
  size += FfiConverterBool.allocationSize(inner.preferSpark);
5817
+ size += FfiConverterOptionalUInt32.allocationSize(
5818
+ inner.completionTimeoutSecs
5819
+ );
5688
5820
  return size;
5689
5821
  }
5690
5822
  default:
@@ -6054,6 +6186,147 @@ const FfiConverterTypeUpdateDepositPayload = (() => {
6054
6186
  return new FFIConverter();
6055
6187
  })();
6056
6188
 
6189
+ // Enum: WaitForPaymentIdentifier
6190
+ export enum WaitForPaymentIdentifier_Tags {
6191
+ PaymentId = 'PaymentId',
6192
+ PaymentRequest = 'PaymentRequest',
6193
+ }
6194
+ export const WaitForPaymentIdentifier = (() => {
6195
+ type PaymentId__interface = {
6196
+ tag: WaitForPaymentIdentifier_Tags.PaymentId;
6197
+ inner: Readonly<[string]>;
6198
+ };
6199
+
6200
+ class PaymentId_ extends UniffiEnum implements PaymentId__interface {
6201
+ /**
6202
+ * @private
6203
+ * This field is private and should not be used, use `tag` instead.
6204
+ */
6205
+ readonly [uniffiTypeNameSymbol] = 'WaitForPaymentIdentifier';
6206
+ readonly tag = WaitForPaymentIdentifier_Tags.PaymentId;
6207
+ readonly inner: Readonly<[string]>;
6208
+ constructor(v0: string) {
6209
+ super('WaitForPaymentIdentifier', 'PaymentId');
6210
+ this.inner = Object.freeze([v0]);
6211
+ }
6212
+
6213
+ static new(v0: string): PaymentId_ {
6214
+ return new PaymentId_(v0);
6215
+ }
6216
+
6217
+ static instanceOf(obj: any): obj is PaymentId_ {
6218
+ return obj.tag === WaitForPaymentIdentifier_Tags.PaymentId;
6219
+ }
6220
+ }
6221
+
6222
+ type PaymentRequest__interface = {
6223
+ tag: WaitForPaymentIdentifier_Tags.PaymentRequest;
6224
+ inner: Readonly<[string]>;
6225
+ };
6226
+
6227
+ class PaymentRequest_
6228
+ extends UniffiEnum
6229
+ implements PaymentRequest__interface
6230
+ {
6231
+ /**
6232
+ * @private
6233
+ * This field is private and should not be used, use `tag` instead.
6234
+ */
6235
+ readonly [uniffiTypeNameSymbol] = 'WaitForPaymentIdentifier';
6236
+ readonly tag = WaitForPaymentIdentifier_Tags.PaymentRequest;
6237
+ readonly inner: Readonly<[string]>;
6238
+ constructor(v0: string) {
6239
+ super('WaitForPaymentIdentifier', 'PaymentRequest');
6240
+ this.inner = Object.freeze([v0]);
6241
+ }
6242
+
6243
+ static new(v0: string): PaymentRequest_ {
6244
+ return new PaymentRequest_(v0);
6245
+ }
6246
+
6247
+ static instanceOf(obj: any): obj is PaymentRequest_ {
6248
+ return obj.tag === WaitForPaymentIdentifier_Tags.PaymentRequest;
6249
+ }
6250
+ }
6251
+
6252
+ function instanceOf(obj: any): obj is WaitForPaymentIdentifier {
6253
+ return obj[uniffiTypeNameSymbol] === 'WaitForPaymentIdentifier';
6254
+ }
6255
+
6256
+ return Object.freeze({
6257
+ instanceOf,
6258
+ PaymentId: PaymentId_,
6259
+ PaymentRequest: PaymentRequest_,
6260
+ });
6261
+ })();
6262
+
6263
+ export type WaitForPaymentIdentifier = InstanceType<
6264
+ (typeof WaitForPaymentIdentifier)[keyof Omit<
6265
+ typeof WaitForPaymentIdentifier,
6266
+ 'instanceOf'
6267
+ >]
6268
+ >;
6269
+
6270
+ // FfiConverter for enum WaitForPaymentIdentifier
6271
+ const FfiConverterTypeWaitForPaymentIdentifier = (() => {
6272
+ const ordinalConverter = FfiConverterInt32;
6273
+ type TypeName = WaitForPaymentIdentifier;
6274
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
6275
+ read(from: RustBuffer): TypeName {
6276
+ switch (ordinalConverter.read(from)) {
6277
+ case 1:
6278
+ return new WaitForPaymentIdentifier.PaymentId(
6279
+ FfiConverterString.read(from)
6280
+ );
6281
+ case 2:
6282
+ return new WaitForPaymentIdentifier.PaymentRequest(
6283
+ FfiConverterString.read(from)
6284
+ );
6285
+ default:
6286
+ throw new UniffiInternalError.UnexpectedEnumCase();
6287
+ }
6288
+ }
6289
+ write(value: TypeName, into: RustBuffer): void {
6290
+ switch (value.tag) {
6291
+ case WaitForPaymentIdentifier_Tags.PaymentId: {
6292
+ ordinalConverter.write(1, into);
6293
+ const inner = value.inner;
6294
+ FfiConverterString.write(inner[0], into);
6295
+ return;
6296
+ }
6297
+ case WaitForPaymentIdentifier_Tags.PaymentRequest: {
6298
+ ordinalConverter.write(2, into);
6299
+ const inner = value.inner;
6300
+ FfiConverterString.write(inner[0], into);
6301
+ return;
6302
+ }
6303
+ default:
6304
+ // Throwing from here means that WaitForPaymentIdentifier_Tags hasn't matched an ordinal.
6305
+ throw new UniffiInternalError.UnexpectedEnumCase();
6306
+ }
6307
+ }
6308
+ allocationSize(value: TypeName): number {
6309
+ switch (value.tag) {
6310
+ case WaitForPaymentIdentifier_Tags.PaymentId: {
6311
+ const inner = value.inner;
6312
+ let size = ordinalConverter.allocationSize(1);
6313
+ size += FfiConverterString.allocationSize(inner[0]);
6314
+ return size;
6315
+ }
6316
+ case WaitForPaymentIdentifier_Tags.PaymentRequest: {
6317
+ const inner = value.inner;
6318
+ let size = ordinalConverter.allocationSize(2);
6319
+ size += FfiConverterString.allocationSize(inner[0]);
6320
+ return size;
6321
+ }
6322
+ default:
6323
+ throw new UniffiInternalError.UnexpectedEnumCase();
6324
+ }
6325
+ }
6326
+ }
6327
+ return new FFIConverter();
6328
+ })();
6329
+
6057
6330
  export interface BitcoinChainService {
6058
6331
  getAddressUtxos(
6059
6332
  address: string,
@@ -6569,7 +6842,7 @@ export interface BreezSdkInterface {
6569
6842
  *
6570
6843
  * Result containing either success or an `SdkError` if the background task couldn't be stopped
6571
6844
  */
6572
- disconnect() /*throws*/ : void;
6845
+ disconnect(asyncOpts_?: { signal: AbortSignal }) /*throws*/ : Promise<void>;
6573
6846
  /**
6574
6847
  * Returns the balance of the wallet in satoshis
6575
6848
  */
@@ -6667,6 +6940,19 @@ export interface BreezSdkInterface {
6667
6940
  id: string,
6668
6941
  asyncOpts_?: { signal: AbortSignal }
6669
6942
  ): Promise<boolean>;
6943
+ sendBitcoinAddress(
6944
+ address: BitcoinAddressDetails,
6945
+ feeQuote: SendOnchainFeeQuote,
6946
+ request: SendPaymentRequest,
6947
+ asyncOpts_?: { signal: AbortSignal }
6948
+ ) /*throws*/ : Promise<SendPaymentResponse>;
6949
+ sendBolt11Invoice(
6950
+ invoiceDetails: Bolt11InvoiceDetails,
6951
+ sparkTransferFeeSats: /*u64*/ bigint | undefined,
6952
+ lightningFeeSats: /*u64*/ bigint,
6953
+ request: SendPaymentRequest,
6954
+ asyncOpts_?: { signal: AbortSignal }
6955
+ ) /*throws*/ : Promise<SendPaymentResponse>;
6670
6956
  sendPayment(
6671
6957
  request: SendPaymentRequest,
6672
6958
  asyncOpts_?: { signal: AbortSignal }
@@ -6676,6 +6962,11 @@ export interface BreezSdkInterface {
6676
6962
  suppressPaymentEvent: boolean,
6677
6963
  asyncOpts_?: { signal: AbortSignal }
6678
6964
  ) /*throws*/ : Promise<SendPaymentResponse>;
6965
+ sendSparkAddress(
6966
+ address: string,
6967
+ request: SendPaymentRequest,
6968
+ asyncOpts_?: { signal: AbortSignal }
6969
+ ) /*throws*/ : Promise<SendPaymentResponse>;
6679
6970
  /**
6680
6971
  * Synchronizes the wallet with the Spark network
6681
6972
  */
@@ -6683,6 +6974,10 @@ export interface BreezSdkInterface {
6683
6974
  request: SyncWalletRequest,
6684
6975
  asyncOpts_?: { signal: AbortSignal }
6685
6976
  ) /*throws*/ : Promise<SyncWalletResponse>;
6977
+ waitForPayment(
6978
+ request: WaitForPaymentRequest,
6979
+ asyncOpts_?: { signal: AbortSignal }
6980
+ ) /*throws*/ : Promise<WaitForPaymentResponse>;
6686
6981
  }
6687
6982
 
6688
6983
  /**
@@ -6870,19 +7165,39 @@ export class BreezSdk
6870
7165
  *
6871
7166
  * Result containing either success or an `SdkError` if the background task couldn't be stopped
6872
7167
  */
6873
- public disconnect(): void /*throws*/ {
6874
- uniffiCaller.rustCallWithError(
6875
- /*liftError:*/ FfiConverterTypeSdkError.lift.bind(
6876
- FfiConverterTypeSdkError
6877
- ),
6878
- /*caller:*/ (callStatus) => {
6879
- nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_disconnect(
6880
- uniffiTypeBreezSdkObjectFactory.clonePointer(this),
6881
- callStatus
6882
- );
6883
- },
6884
- /*liftString:*/ FfiConverterString.lift
6885
- );
7168
+ public async disconnect(asyncOpts_?: {
7169
+ signal: AbortSignal;
7170
+ }): Promise<void> /*throws*/ {
7171
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
7172
+ try {
7173
+ return await uniffiRustCallAsync(
7174
+ /*rustCaller:*/ uniffiCaller,
7175
+ /*rustFutureFunc:*/ () => {
7176
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_disconnect(
7177
+ uniffiTypeBreezSdkObjectFactory.clonePointer(this)
7178
+ );
7179
+ },
7180
+ /*pollFunc:*/ nativeModule()
7181
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_void,
7182
+ /*cancelFunc:*/ nativeModule()
7183
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void,
7184
+ /*completeFunc:*/ nativeModule()
7185
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_void,
7186
+ /*freeFunc:*/ nativeModule()
7187
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_void,
7188
+ /*liftFunc:*/ (_v) => {},
7189
+ /*liftString:*/ FfiConverterString.lift,
7190
+ /*asyncOpts:*/ asyncOpts_,
7191
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
7192
+ FfiConverterTypeSdkError
7193
+ )
7194
+ );
7195
+ } catch (__error: any) {
7196
+ if (uniffiIsDebug && __error instanceof Error) {
7197
+ __error.stack = __stack;
7198
+ }
7199
+ throw __error;
7200
+ }
6886
7201
  }
6887
7202
 
6888
7203
  /**
@@ -7511,6 +7826,94 @@ export class BreezSdk
7511
7826
  }
7512
7827
  }
7513
7828
 
7829
+ public async sendBitcoinAddress(
7830
+ address: BitcoinAddressDetails,
7831
+ feeQuote: SendOnchainFeeQuote,
7832
+ request: SendPaymentRequest,
7833
+ asyncOpts_?: { signal: AbortSignal }
7834
+ ): Promise<SendPaymentResponse> /*throws*/ {
7835
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
7836
+ try {
7837
+ return await uniffiRustCallAsync(
7838
+ /*rustCaller:*/ uniffiCaller,
7839
+ /*rustFutureFunc:*/ () => {
7840
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_send_bitcoin_address(
7841
+ uniffiTypeBreezSdkObjectFactory.clonePointer(this),
7842
+ FfiConverterTypeBitcoinAddressDetails.lower(address),
7843
+ FfiConverterTypeSendOnchainFeeQuote.lower(feeQuote),
7844
+ FfiConverterTypeSendPaymentRequest.lower(request)
7845
+ );
7846
+ },
7847
+ /*pollFunc:*/ nativeModule()
7848
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
7849
+ /*cancelFunc:*/ nativeModule()
7850
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
7851
+ /*completeFunc:*/ nativeModule()
7852
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
7853
+ /*freeFunc:*/ nativeModule()
7854
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
7855
+ /*liftFunc:*/ FfiConverterTypeSendPaymentResponse.lift.bind(
7856
+ FfiConverterTypeSendPaymentResponse
7857
+ ),
7858
+ /*liftString:*/ FfiConverterString.lift,
7859
+ /*asyncOpts:*/ asyncOpts_,
7860
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
7861
+ FfiConverterTypeSdkError
7862
+ )
7863
+ );
7864
+ } catch (__error: any) {
7865
+ if (uniffiIsDebug && __error instanceof Error) {
7866
+ __error.stack = __stack;
7867
+ }
7868
+ throw __error;
7869
+ }
7870
+ }
7871
+
7872
+ public async sendBolt11Invoice(
7873
+ invoiceDetails: Bolt11InvoiceDetails,
7874
+ sparkTransferFeeSats: /*u64*/ bigint | undefined,
7875
+ lightningFeeSats: /*u64*/ bigint,
7876
+ request: SendPaymentRequest,
7877
+ asyncOpts_?: { signal: AbortSignal }
7878
+ ): Promise<SendPaymentResponse> /*throws*/ {
7879
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
7880
+ try {
7881
+ return await uniffiRustCallAsync(
7882
+ /*rustCaller:*/ uniffiCaller,
7883
+ /*rustFutureFunc:*/ () => {
7884
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_send_bolt11_invoice(
7885
+ uniffiTypeBreezSdkObjectFactory.clonePointer(this),
7886
+ FfiConverterTypeBolt11InvoiceDetails.lower(invoiceDetails),
7887
+ FfiConverterOptionalUInt64.lower(sparkTransferFeeSats),
7888
+ FfiConverterUInt64.lower(lightningFeeSats),
7889
+ FfiConverterTypeSendPaymentRequest.lower(request)
7890
+ );
7891
+ },
7892
+ /*pollFunc:*/ nativeModule()
7893
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
7894
+ /*cancelFunc:*/ nativeModule()
7895
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
7896
+ /*completeFunc:*/ nativeModule()
7897
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
7898
+ /*freeFunc:*/ nativeModule()
7899
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
7900
+ /*liftFunc:*/ FfiConverterTypeSendPaymentResponse.lift.bind(
7901
+ FfiConverterTypeSendPaymentResponse
7902
+ ),
7903
+ /*liftString:*/ FfiConverterString.lift,
7904
+ /*asyncOpts:*/ asyncOpts_,
7905
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
7906
+ FfiConverterTypeSdkError
7907
+ )
7908
+ );
7909
+ } catch (__error: any) {
7910
+ if (uniffiIsDebug && __error instanceof Error) {
7911
+ __error.stack = __stack;
7912
+ }
7913
+ throw __error;
7914
+ }
7915
+ }
7916
+
7514
7917
  public async sendPayment(
7515
7918
  request: SendPaymentRequest,
7516
7919
  asyncOpts_?: { signal: AbortSignal }
@@ -7591,6 +7994,47 @@ export class BreezSdk
7591
7994
  }
7592
7995
  }
7593
7996
 
7997
+ public async sendSparkAddress(
7998
+ address: string,
7999
+ request: SendPaymentRequest,
8000
+ asyncOpts_?: { signal: AbortSignal }
8001
+ ): Promise<SendPaymentResponse> /*throws*/ {
8002
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
8003
+ try {
8004
+ return await uniffiRustCallAsync(
8005
+ /*rustCaller:*/ uniffiCaller,
8006
+ /*rustFutureFunc:*/ () => {
8007
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_send_spark_address(
8008
+ uniffiTypeBreezSdkObjectFactory.clonePointer(this),
8009
+ FfiConverterString.lower(address),
8010
+ FfiConverterTypeSendPaymentRequest.lower(request)
8011
+ );
8012
+ },
8013
+ /*pollFunc:*/ nativeModule()
8014
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
8015
+ /*cancelFunc:*/ nativeModule()
8016
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
8017
+ /*completeFunc:*/ nativeModule()
8018
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
8019
+ /*freeFunc:*/ nativeModule()
8020
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
8021
+ /*liftFunc:*/ FfiConverterTypeSendPaymentResponse.lift.bind(
8022
+ FfiConverterTypeSendPaymentResponse
8023
+ ),
8024
+ /*liftString:*/ FfiConverterString.lift,
8025
+ /*asyncOpts:*/ asyncOpts_,
8026
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
8027
+ FfiConverterTypeSdkError
8028
+ )
8029
+ );
8030
+ } catch (__error: any) {
8031
+ if (uniffiIsDebug && __error instanceof Error) {
8032
+ __error.stack = __stack;
8033
+ }
8034
+ throw __error;
8035
+ }
8036
+ }
8037
+
7594
8038
  /**
7595
8039
  * Synchronizes the wallet with the Spark network
7596
8040
  */
@@ -7633,6 +8077,45 @@ export class BreezSdk
7633
8077
  }
7634
8078
  }
7635
8079
 
8080
+ public async waitForPayment(
8081
+ request: WaitForPaymentRequest,
8082
+ asyncOpts_?: { signal: AbortSignal }
8083
+ ): Promise<WaitForPaymentResponse> /*throws*/ {
8084
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
8085
+ try {
8086
+ return await uniffiRustCallAsync(
8087
+ /*rustCaller:*/ uniffiCaller,
8088
+ /*rustFutureFunc:*/ () => {
8089
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_wait_for_payment(
8090
+ uniffiTypeBreezSdkObjectFactory.clonePointer(this),
8091
+ FfiConverterTypeWaitForPaymentRequest.lower(request)
8092
+ );
8093
+ },
8094
+ /*pollFunc:*/ nativeModule()
8095
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
8096
+ /*cancelFunc:*/ nativeModule()
8097
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
8098
+ /*completeFunc:*/ nativeModule()
8099
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
8100
+ /*freeFunc:*/ nativeModule()
8101
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
8102
+ /*liftFunc:*/ FfiConverterTypeWaitForPaymentResponse.lift.bind(
8103
+ FfiConverterTypeWaitForPaymentResponse
8104
+ ),
8105
+ /*liftString:*/ FfiConverterString.lift,
8106
+ /*asyncOpts:*/ asyncOpts_,
8107
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
8108
+ FfiConverterTypeSdkError
8109
+ )
8110
+ );
8111
+ } catch (__error: any) {
8112
+ if (uniffiIsDebug && __error instanceof Error) {
8113
+ __error.stack = __stack;
8114
+ }
8115
+ throw __error;
8116
+ }
8117
+ }
8118
+
7636
8119
  /**
7637
8120
  * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
7638
8121
  */
@@ -8211,6 +8694,19 @@ export interface Storage {
8211
8694
  id: string,
8212
8695
  asyncOpts_?: { signal: AbortSignal }
8213
8696
  ) /*throws*/ : Promise<Payment>;
8697
+ /**
8698
+ * Gets a payment by its invoice
8699
+ * # Arguments
8700
+ *
8701
+ * * `invoice` - The invoice of the payment to retrieve
8702
+ * # Returns
8703
+ *
8704
+ * The payment if found or None if not found
8705
+ */
8706
+ getPaymentByInvoice(
8707
+ invoice: string,
8708
+ asyncOpts_?: { signal: AbortSignal }
8709
+ ) /*throws*/ : Promise<Payment | undefined>;
8214
8710
  /**
8215
8711
  * Add a deposit to storage
8216
8712
  * # Arguments
@@ -8605,6 +9101,54 @@ export class StorageImpl extends UniffiAbstractObject implements Storage {
8605
9101
  }
8606
9102
  }
8607
9103
 
9104
+ /**
9105
+ * Gets a payment by its invoice
9106
+ * # Arguments
9107
+ *
9108
+ * * `invoice` - The invoice of the payment to retrieve
9109
+ * # Returns
9110
+ *
9111
+ * The payment if found or None if not found
9112
+ */
9113
+ public async getPaymentByInvoice(
9114
+ invoice: string,
9115
+ asyncOpts_?: { signal: AbortSignal }
9116
+ ): Promise<Payment | undefined> /*throws*/ {
9117
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
9118
+ try {
9119
+ return await uniffiRustCallAsync(
9120
+ /*rustCaller:*/ uniffiCaller,
9121
+ /*rustFutureFunc:*/ () => {
9122
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_payment_by_invoice(
9123
+ uniffiTypeStorageImplObjectFactory.clonePointer(this),
9124
+ FfiConverterString.lower(invoice)
9125
+ );
9126
+ },
9127
+ /*pollFunc:*/ nativeModule()
9128
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
9129
+ /*cancelFunc:*/ nativeModule()
9130
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
9131
+ /*completeFunc:*/ nativeModule()
9132
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
9133
+ /*freeFunc:*/ nativeModule()
9134
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
9135
+ /*liftFunc:*/ FfiConverterOptionalTypePayment.lift.bind(
9136
+ FfiConverterOptionalTypePayment
9137
+ ),
9138
+ /*liftString:*/ FfiConverterString.lift,
9139
+ /*asyncOpts:*/ asyncOpts_,
9140
+ /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind(
9141
+ FfiConverterTypeStorageError
9142
+ )
9143
+ );
9144
+ } catch (__error: any) {
9145
+ if (uniffiIsDebug && __error instanceof Error) {
9146
+ __error.stack = __stack;
9147
+ }
9148
+ throw __error;
9149
+ }
9150
+ }
9151
+
8608
9152
  /**
8609
9153
  * Add a deposit to storage
8610
9154
  * # Arguments
@@ -9204,6 +9748,52 @@ const uniffiCallbackInterfaceStorage: {
9204
9748
  );
9205
9749
  return UniffiResult.success(uniffiForeignFuture);
9206
9750
  },
9751
+ getPaymentByInvoice: (
9752
+ uniffiHandle: bigint,
9753
+ invoice: Uint8Array,
9754
+ uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
9755
+ uniffiCallbackData: bigint
9756
+ ) => {
9757
+ const uniffiMakeCall = async (
9758
+ signal: AbortSignal
9759
+ ): Promise<Payment | undefined> => {
9760
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
9761
+ return await jsCallback.getPaymentByInvoice(
9762
+ FfiConverterString.lift(invoice),
9763
+ { signal }
9764
+ );
9765
+ };
9766
+ const uniffiHandleSuccess = (returnValue: Payment | undefined) => {
9767
+ uniffiFutureCallback(
9768
+ uniffiCallbackData,
9769
+ /* UniffiForeignFutureStructRustBuffer */ {
9770
+ returnValue: FfiConverterOptionalTypePayment.lower(returnValue),
9771
+ callStatus: uniffiCaller.createCallStatus(),
9772
+ }
9773
+ );
9774
+ };
9775
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
9776
+ uniffiFutureCallback(
9777
+ uniffiCallbackData,
9778
+ /* UniffiForeignFutureStructRustBuffer */ {
9779
+ returnValue: /*empty*/ new Uint8Array(0),
9780
+ // TODO create callstatus with error.
9781
+ callStatus: { code, errorBuf },
9782
+ }
9783
+ );
9784
+ };
9785
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
9786
+ /*makeCall:*/ uniffiMakeCall,
9787
+ /*handleSuccess:*/ uniffiHandleSuccess,
9788
+ /*handleError:*/ uniffiHandleError,
9789
+ /*isErrorType:*/ StorageError.instanceOf,
9790
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
9791
+ FfiConverterTypeStorageError
9792
+ ),
9793
+ /*lowerString:*/ FfiConverterString.lower
9794
+ );
9795
+ return UniffiResult.success(uniffiForeignFuture);
9796
+ },
9207
9797
  addDeposit: (
9208
9798
  uniffiHandle: bigint,
9209
9799
  txid: Uint8Array,
@@ -9427,6 +10017,11 @@ const FfiConverterOptionalTypeLnurlPayInfo = new FfiConverterOptional(
9427
10017
  FfiConverterTypeLnurlPayInfo
9428
10018
  );
9429
10019
 
10020
+ // FfiConverter for Payment | undefined
10021
+ const FfiConverterOptionalTypePayment = new FfiConverterOptional(
10022
+ FfiConverterTypePayment
10023
+ );
10024
+
9430
10025
  // FfiConverter for string | undefined
9431
10026
  const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
9432
10027
 
@@ -9603,7 +10198,7 @@ function uniffiEnsureInitialized() {
9603
10198
  }
9604
10199
  if (
9605
10200
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_disconnect() !==
9606
- 30986
10201
+ 330
9607
10202
  ) {
9608
10203
  throw new UniffiInternalError.ApiChecksumMismatch(
9609
10204
  'uniffi_breez_sdk_spark_checksum_method_breezsdk_disconnect'
@@ -9737,6 +10332,22 @@ function uniffiEnsureInitialized() {
9737
10332
  'uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener'
9738
10333
  );
9739
10334
  }
10335
+ if (
10336
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_bitcoin_address() !==
10337
+ 5926
10338
+ ) {
10339
+ throw new UniffiInternalError.ApiChecksumMismatch(
10340
+ 'uniffi_breez_sdk_spark_checksum_method_breezsdk_send_bitcoin_address'
10341
+ );
10342
+ }
10343
+ if (
10344
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_bolt11_invoice() !==
10345
+ 21785
10346
+ ) {
10347
+ throw new UniffiInternalError.ApiChecksumMismatch(
10348
+ 'uniffi_breez_sdk_spark_checksum_method_breezsdk_send_bolt11_invoice'
10349
+ );
10350
+ }
9740
10351
  if (
9741
10352
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment() !==
9742
10353
  54349
@@ -9753,6 +10364,14 @@ function uniffiEnsureInitialized() {
9753
10364
  'uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment_internal'
9754
10365
  );
9755
10366
  }
10367
+ if (
10368
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_spark_address() !==
10369
+ 63147
10370
+ ) {
10371
+ throw new UniffiInternalError.ApiChecksumMismatch(
10372
+ 'uniffi_breez_sdk_spark_checksum_method_breezsdk_send_spark_address'
10373
+ );
10374
+ }
9756
10375
  if (
9757
10376
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet() !==
9758
10377
  30368
@@ -9761,6 +10380,14 @@ function uniffiEnsureInitialized() {
9761
10380
  'uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet'
9762
10381
  );
9763
10382
  }
10383
+ if (
10384
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_wait_for_payment() !==
10385
+ 64922
10386
+ ) {
10387
+ throw new UniffiInternalError.ApiChecksumMismatch(
10388
+ 'uniffi_breez_sdk_spark_checksum_method_breezsdk_wait_for_payment'
10389
+ );
10390
+ }
9764
10391
  if (
9765
10392
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_build() !==
9766
10393
  8126
@@ -9865,9 +10492,17 @@ function uniffiEnsureInitialized() {
9865
10492
  'uniffi_breez_sdk_spark_checksum_method_storage_get_payment_by_id'
9866
10493
  );
9867
10494
  }
10495
+ if (
10496
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_payment_by_invoice() !==
10497
+ 57075
10498
+ ) {
10499
+ throw new UniffiInternalError.ApiChecksumMismatch(
10500
+ 'uniffi_breez_sdk_spark_checksum_method_storage_get_payment_by_invoice'
10501
+ );
10502
+ }
9868
10503
  if (
9869
10504
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_add_deposit() !==
9870
- 55082
10505
+ 60240
9871
10506
  ) {
9872
10507
  throw new UniffiInternalError.ApiChecksumMismatch(
9873
10508
  'uniffi_breez_sdk_spark_checksum_method_storage_add_deposit'
@@ -9875,7 +10510,7 @@ function uniffiEnsureInitialized() {
9875
10510
  }
9876
10511
  if (
9877
10512
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_delete_deposit() !==
9878
- 13111
10513
+ 60586
9879
10514
  ) {
9880
10515
  throw new UniffiInternalError.ApiChecksumMismatch(
9881
10516
  'uniffi_breez_sdk_spark_checksum_method_storage_delete_deposit'
@@ -9883,7 +10518,7 @@ function uniffiEnsureInitialized() {
9883
10518
  }
9884
10519
  if (
9885
10520
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_list_deposits() !==
9886
- 22806
10521
+ 54118
9887
10522
  ) {
9888
10523
  throw new UniffiInternalError.ApiChecksumMismatch(
9889
10524
  'uniffi_breez_sdk_spark_checksum_method_storage_list_deposits'
@@ -9891,7 +10526,7 @@ function uniffiEnsureInitialized() {
9891
10526
  }
9892
10527
  if (
9893
10528
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_update_deposit() !==
9894
- 48478
10529
+ 39803
9895
10530
  ) {
9896
10531
  throw new UniffiInternalError.ApiChecksumMismatch(
9897
10532
  'uniffi_breez_sdk_spark_checksum_method_storage_update_deposit'
@@ -9991,5 +10626,8 @@ export default Object.freeze({
9991
10626
  FfiConverterTypeTxStatus,
9992
10627
  FfiConverterTypeUpdateDepositPayload,
9993
10628
  FfiConverterTypeUtxo,
10629
+ FfiConverterTypeWaitForPaymentIdentifier,
10630
+ FfiConverterTypeWaitForPaymentRequest,
10631
+ FfiConverterTypeWaitForPaymentResponse,
9994
10632
  },
9995
10633
  });