@breeztech/breez-sdk-spark-react-native 0.7.21 → 0.9.0

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.
@@ -37,7 +37,6 @@ import nativeModule, {
37
37
  type UniffiVTableCallbackInterfacePaymentObserver,
38
38
  type UniffiVTableCallbackInterfaceRestClient,
39
39
  type UniffiVTableCallbackInterfaceStorage,
40
- type UniffiVTableCallbackInterfaceSyncStorage,
41
40
  } from './breez_sdk_spark-ffi';
42
41
  import {
43
42
  type FfiConverter,
@@ -247,6 +246,46 @@ export function defaultExternalSigner(
247
246
  )
248
247
  );
249
248
  }
249
+ /**
250
+ * Fetches the current status of Spark network services relevant to the SDK.
251
+ *
252
+ * This function queries the Spark status API and returns the worst status
253
+ * across the Spark Operators and SSP services.
254
+ */
255
+ export async function getSparkStatus(asyncOpts_?: {
256
+ signal: AbortSignal;
257
+ }): Promise<SparkStatus> /*throws*/ {
258
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
259
+ try {
260
+ return await uniffiRustCallAsync(
261
+ /*rustCaller:*/ uniffiCaller,
262
+ /*rustFutureFunc:*/ () => {
263
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_get_spark_status();
264
+ },
265
+ /*pollFunc:*/ nativeModule()
266
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
267
+ /*cancelFunc:*/ nativeModule()
268
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
269
+ /*completeFunc:*/ nativeModule()
270
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
271
+ /*freeFunc:*/ nativeModule()
272
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
273
+ /*liftFunc:*/ FfiConverterTypeSparkStatus.lift.bind(
274
+ FfiConverterTypeSparkStatus
275
+ ),
276
+ /*liftString:*/ FfiConverterString.lift,
277
+ /*asyncOpts:*/ asyncOpts_,
278
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
279
+ FfiConverterTypeSdkError
280
+ )
281
+ );
282
+ } catch (__error: any) {
283
+ if (uniffiIsDebug && __error instanceof Error) {
284
+ __error.stack = __stack;
285
+ }
286
+ throw __error;
287
+ }
288
+ }
250
289
  export function initLogging(
251
290
  logDir: string | undefined,
252
291
  appLogger: Logger | undefined,
@@ -1448,6 +1487,135 @@ const FfiConverterTypeBurnIssuerTokenRequest = (() => {
1448
1487
  return new FFIConverter();
1449
1488
  })();
1450
1489
 
1490
+ /**
1491
+ * Request to buy Bitcoin using an external provider (`MoonPay`)
1492
+ */
1493
+ export type BuyBitcoinRequest = {
1494
+ /**
1495
+ * Optional: Lock the purchase to a specific amount in satoshis.
1496
+ * When provided, the user cannot change the amount in the purchase flow.
1497
+ */
1498
+ lockedAmountSat: /*u64*/ bigint | undefined;
1499
+ /**
1500
+ * Optional: Custom redirect URL after purchase completion
1501
+ */
1502
+ redirectUrl: string | undefined;
1503
+ };
1504
+
1505
+ /**
1506
+ * Generated factory for {@link BuyBitcoinRequest} record objects.
1507
+ */
1508
+ export const BuyBitcoinRequest = (() => {
1509
+ const defaults = () => ({
1510
+ lockedAmountSat: undefined,
1511
+ redirectUrl: undefined,
1512
+ });
1513
+ const create = (() => {
1514
+ return uniffiCreateRecord<BuyBitcoinRequest, ReturnType<typeof defaults>>(
1515
+ defaults
1516
+ );
1517
+ })();
1518
+ return Object.freeze({
1519
+ /**
1520
+ * Create a frozen instance of {@link BuyBitcoinRequest}, with defaults specified
1521
+ * in Rust, in the {@link breez_sdk_spark} crate.
1522
+ */
1523
+ create,
1524
+
1525
+ /**
1526
+ * Create a frozen instance of {@link BuyBitcoinRequest}, with defaults specified
1527
+ * in Rust, in the {@link breez_sdk_spark} crate.
1528
+ */
1529
+ new: create,
1530
+
1531
+ /**
1532
+ * Defaults specified in the {@link breez_sdk_spark} crate.
1533
+ */
1534
+ defaults: () => Object.freeze(defaults()) as Partial<BuyBitcoinRequest>,
1535
+ });
1536
+ })();
1537
+
1538
+ const FfiConverterTypeBuyBitcoinRequest = (() => {
1539
+ type TypeName = BuyBitcoinRequest;
1540
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1541
+ read(from: RustBuffer): TypeName {
1542
+ return {
1543
+ lockedAmountSat: FfiConverterOptionalUInt64.read(from),
1544
+ redirectUrl: FfiConverterOptionalString.read(from),
1545
+ };
1546
+ }
1547
+ write(value: TypeName, into: RustBuffer): void {
1548
+ FfiConverterOptionalUInt64.write(value.lockedAmountSat, into);
1549
+ FfiConverterOptionalString.write(value.redirectUrl, into);
1550
+ }
1551
+ allocationSize(value: TypeName): number {
1552
+ return (
1553
+ FfiConverterOptionalUInt64.allocationSize(value.lockedAmountSat) +
1554
+ FfiConverterOptionalString.allocationSize(value.redirectUrl)
1555
+ );
1556
+ }
1557
+ }
1558
+ return new FFIConverter();
1559
+ })();
1560
+
1561
+ /**
1562
+ * Response containing a URL to complete the Bitcoin purchase
1563
+ */
1564
+ export type BuyBitcoinResponse = {
1565
+ /**
1566
+ * The URL to open in a browser to complete the purchase
1567
+ */
1568
+ url: string;
1569
+ };
1570
+
1571
+ /**
1572
+ * Generated factory for {@link BuyBitcoinResponse} record objects.
1573
+ */
1574
+ export const BuyBitcoinResponse = (() => {
1575
+ const defaults = () => ({});
1576
+ const create = (() => {
1577
+ return uniffiCreateRecord<BuyBitcoinResponse, ReturnType<typeof defaults>>(
1578
+ defaults
1579
+ );
1580
+ })();
1581
+ return Object.freeze({
1582
+ /**
1583
+ * Create a frozen instance of {@link BuyBitcoinResponse}, with defaults specified
1584
+ * in Rust, in the {@link breez_sdk_spark} crate.
1585
+ */
1586
+ create,
1587
+
1588
+ /**
1589
+ * Create a frozen instance of {@link BuyBitcoinResponse}, with defaults specified
1590
+ * in Rust, in the {@link breez_sdk_spark} crate.
1591
+ */
1592
+ new: create,
1593
+
1594
+ /**
1595
+ * Defaults specified in the {@link breez_sdk_spark} crate.
1596
+ */
1597
+ defaults: () => Object.freeze(defaults()) as Partial<BuyBitcoinResponse>,
1598
+ });
1599
+ })();
1600
+
1601
+ const FfiConverterTypeBuyBitcoinResponse = (() => {
1602
+ type TypeName = BuyBitcoinResponse;
1603
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1604
+ read(from: RustBuffer): TypeName {
1605
+ return {
1606
+ url: FfiConverterString.read(from),
1607
+ };
1608
+ }
1609
+ write(value: TypeName, into: RustBuffer): void {
1610
+ FfiConverterString.write(value.url, into);
1611
+ }
1612
+ allocationSize(value: TypeName): number {
1613
+ return FfiConverterString.allocationSize(value.url);
1614
+ }
1615
+ }
1616
+ return new FFIConverter();
1617
+ })();
1618
+
1451
1619
  export type CheckLightningAddressRequest = {
1452
1620
  username: string;
1453
1621
  };
@@ -1895,6 +2063,13 @@ export type Config = {
1895
2063
  * More leaves allow payments to be made without needing a swap, reducing payment latency.
1896
2064
  */
1897
2065
  optimizationConfig: OptimizationConfig;
2066
+ /**
2067
+ * Configuration for automatic conversion of Bitcoin to stable tokens.
2068
+ *
2069
+ * When set, received sats will be automatically converted to the specified token
2070
+ * once the balance exceeds the threshold.
2071
+ */
2072
+ stableBalanceConfig: StableBalanceConfig | undefined;
1898
2073
  };
1899
2074
 
1900
2075
  /**
@@ -1942,6 +2117,8 @@ const FfiConverterTypeConfig = (() => {
1942
2117
  realTimeSyncServerUrl: FfiConverterOptionalString.read(from),
1943
2118
  privateEnabledDefault: FfiConverterBool.read(from),
1944
2119
  optimizationConfig: FfiConverterTypeOptimizationConfig.read(from),
2120
+ stableBalanceConfig:
2121
+ FfiConverterOptionalTypeStableBalanceConfig.read(from),
1945
2122
  };
1946
2123
  }
1947
2124
  write(value: TypeName, into: RustBuffer): void {
@@ -1959,6 +2136,10 @@ const FfiConverterTypeConfig = (() => {
1959
2136
  FfiConverterOptionalString.write(value.realTimeSyncServerUrl, into);
1960
2137
  FfiConverterBool.write(value.privateEnabledDefault, into);
1961
2138
  FfiConverterTypeOptimizationConfig.write(value.optimizationConfig, into);
2139
+ FfiConverterOptionalTypeStableBalanceConfig.write(
2140
+ value.stableBalanceConfig,
2141
+ into
2142
+ );
1962
2143
  }
1963
2144
  allocationSize(value: TypeName): number {
1964
2145
  return (
@@ -1978,6 +2159,9 @@ const FfiConverterTypeConfig = (() => {
1978
2159
  FfiConverterBool.allocationSize(value.privateEnabledDefault) +
1979
2160
  FfiConverterTypeOptimizationConfig.allocationSize(
1980
2161
  value.optimizationConfig
2162
+ ) +
2163
+ FfiConverterOptionalTypeStableBalanceConfig.allocationSize(
2164
+ value.stableBalanceConfig
1981
2165
  )
1982
2166
  );
1983
2167
  }
@@ -2116,6 +2300,73 @@ const FfiConverterTypeConnectWithSignerRequest = (() => {
2116
2300
  return new FFIConverter();
2117
2301
  })();
2118
2302
 
2303
+ /**
2304
+ * Outlines the steps involved in a conversion
2305
+ */
2306
+ export type ConversionDetails = {
2307
+ /**
2308
+ * First step is converting from the available asset
2309
+ */
2310
+ from: ConversionStep;
2311
+ /**
2312
+ * Second step is converting to the requested asset
2313
+ */
2314
+ to: ConversionStep;
2315
+ };
2316
+
2317
+ /**
2318
+ * Generated factory for {@link ConversionDetails} record objects.
2319
+ */
2320
+ export const ConversionDetails = (() => {
2321
+ const defaults = () => ({});
2322
+ const create = (() => {
2323
+ return uniffiCreateRecord<ConversionDetails, ReturnType<typeof defaults>>(
2324
+ defaults
2325
+ );
2326
+ })();
2327
+ return Object.freeze({
2328
+ /**
2329
+ * Create a frozen instance of {@link ConversionDetails}, with defaults specified
2330
+ * in Rust, in the {@link breez_sdk_spark} crate.
2331
+ */
2332
+ create,
2333
+
2334
+ /**
2335
+ * Create a frozen instance of {@link ConversionDetails}, with defaults specified
2336
+ * in Rust, in the {@link breez_sdk_spark} crate.
2337
+ */
2338
+ new: create,
2339
+
2340
+ /**
2341
+ * Defaults specified in the {@link breez_sdk_spark} crate.
2342
+ */
2343
+ defaults: () => Object.freeze(defaults()) as Partial<ConversionDetails>,
2344
+ });
2345
+ })();
2346
+
2347
+ const FfiConverterTypeConversionDetails = (() => {
2348
+ type TypeName = ConversionDetails;
2349
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
2350
+ read(from: RustBuffer): TypeName {
2351
+ return {
2352
+ from: FfiConverterTypeConversionStep.read(from),
2353
+ to: FfiConverterTypeConversionStep.read(from),
2354
+ };
2355
+ }
2356
+ write(value: TypeName, into: RustBuffer): void {
2357
+ FfiConverterTypeConversionStep.write(value.from, into);
2358
+ FfiConverterTypeConversionStep.write(value.to, into);
2359
+ }
2360
+ allocationSize(value: TypeName): number {
2361
+ return (
2362
+ FfiConverterTypeConversionStep.allocationSize(value.from) +
2363
+ FfiConverterTypeConversionStep.allocationSize(value.to)
2364
+ );
2365
+ }
2366
+ }
2367
+ return new FFIConverter();
2368
+ })();
2369
+
2119
2370
  /**
2120
2371
  * Response from estimating a conversion, used when preparing a payment that requires conversion
2121
2372
  */
@@ -2290,7 +2541,7 @@ export type ConversionOptions = {
2290
2541
  conversionType: ConversionType;
2291
2542
  /**
2292
2543
  * The optional maximum slippage in basis points (1/100 of a percent) allowed when
2293
- * a conversion is needed to fulfill the payment. Defaults to 50 bps (0.5%) if not set.
2544
+ * a conversion is needed to fulfill the payment. Defaults to 10 bps (0.1%) if not set.
2294
2545
  * The conversion will fail if the actual amount received is less than
2295
2546
  * `estimated_amount * (1 - max_slippage_bps / 10_000)`.
2296
2547
  */
@@ -2363,6 +2614,97 @@ const FfiConverterTypeConversionOptions = (() => {
2363
2614
  return new FFIConverter();
2364
2615
  })();
2365
2616
 
2617
+ /**
2618
+ * A single step in a conversion
2619
+ */
2620
+ export type ConversionStep = {
2621
+ /**
2622
+ * The underlying payment id of the conversion step
2623
+ */
2624
+ paymentId: string;
2625
+ /**
2626
+ * Payment amount in satoshis or token base units
2627
+ */
2628
+ amount: U128;
2629
+ /**
2630
+ * Fee paid in satoshis or token base units
2631
+ * This represents the payment fee + the conversion fee
2632
+ */
2633
+ fee: U128;
2634
+ /**
2635
+ * Method of payment
2636
+ */
2637
+ method: PaymentMethod;
2638
+ /**
2639
+ * Token metadata if a token is used for payment
2640
+ */
2641
+ tokenMetadata: TokenMetadata | undefined;
2642
+ };
2643
+
2644
+ /**
2645
+ * Generated factory for {@link ConversionStep} record objects.
2646
+ */
2647
+ export const ConversionStep = (() => {
2648
+ const defaults = () => ({});
2649
+ const create = (() => {
2650
+ return uniffiCreateRecord<ConversionStep, ReturnType<typeof defaults>>(
2651
+ defaults
2652
+ );
2653
+ })();
2654
+ return Object.freeze({
2655
+ /**
2656
+ * Create a frozen instance of {@link ConversionStep}, with defaults specified
2657
+ * in Rust, in the {@link breez_sdk_spark} crate.
2658
+ */
2659
+ create,
2660
+
2661
+ /**
2662
+ * Create a frozen instance of {@link ConversionStep}, with defaults specified
2663
+ * in Rust, in the {@link breez_sdk_spark} crate.
2664
+ */
2665
+ new: create,
2666
+
2667
+ /**
2668
+ * Defaults specified in the {@link breez_sdk_spark} crate.
2669
+ */
2670
+ defaults: () => Object.freeze(defaults()) as Partial<ConversionStep>,
2671
+ });
2672
+ })();
2673
+
2674
+ const FfiConverterTypeConversionStep = (() => {
2675
+ type TypeName = ConversionStep;
2676
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
2677
+ read(from: RustBuffer): TypeName {
2678
+ return {
2679
+ paymentId: FfiConverterString.read(from),
2680
+ amount: FfiConverterTypeu128.read(from),
2681
+ fee: FfiConverterTypeu128.read(from),
2682
+ method: FfiConverterTypePaymentMethod.read(from),
2683
+ tokenMetadata: FfiConverterOptionalTypeTokenMetadata.read(from),
2684
+ };
2685
+ }
2686
+ write(value: TypeName, into: RustBuffer): void {
2687
+ FfiConverterString.write(value.paymentId, into);
2688
+ FfiConverterTypeu128.write(value.amount, into);
2689
+ FfiConverterTypeu128.write(value.fee, into);
2690
+ FfiConverterTypePaymentMethod.write(value.method, into);
2691
+ FfiConverterOptionalTypeTokenMetadata.write(value.tokenMetadata, into);
2692
+ }
2693
+ allocationSize(value: TypeName): number {
2694
+ return (
2695
+ FfiConverterString.allocationSize(value.paymentId) +
2696
+ FfiConverterTypeu128.allocationSize(value.amount) +
2697
+ FfiConverterTypeu128.allocationSize(value.fee) +
2698
+ FfiConverterTypePaymentMethod.allocationSize(value.method) +
2699
+ FfiConverterOptionalTypeTokenMetadata.allocationSize(
2700
+ value.tokenMetadata
2701
+ )
2702
+ );
2703
+ }
2704
+ }
2705
+ return new FFIConverter();
2706
+ })();
2707
+
2366
2708
  export type CreateIssuerTokenRequest = {
2367
2709
  name: string;
2368
2710
  ticker: string;
@@ -4054,6 +4396,10 @@ const FfiConverterTypeGetInfoRequest = (() => {
4054
4396
  * Response containing the balance of the wallet
4055
4397
  */
4056
4398
  export type GetInfoResponse = {
4399
+ /**
4400
+ * The identity public key of the wallet as a hex string
4401
+ */
4402
+ identityPubkey: string;
4057
4403
  /**
4058
4404
  * The balance in satoshis
4059
4405
  */
@@ -4099,16 +4445,19 @@ const FfiConverterTypeGetInfoResponse = (() => {
4099
4445
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
4100
4446
  read(from: RustBuffer): TypeName {
4101
4447
  return {
4448
+ identityPubkey: FfiConverterString.read(from),
4102
4449
  balanceSats: FfiConverterUInt64.read(from),
4103
4450
  tokenBalances: FfiConverterMapStringTypeTokenBalance.read(from),
4104
4451
  };
4105
4452
  }
4106
4453
  write(value: TypeName, into: RustBuffer): void {
4454
+ FfiConverterString.write(value.identityPubkey, into);
4107
4455
  FfiConverterUInt64.write(value.balanceSats, into);
4108
4456
  FfiConverterMapStringTypeTokenBalance.write(value.tokenBalances, into);
4109
4457
  }
4110
4458
  allocationSize(value: TypeName): number {
4111
4459
  return (
4460
+ FfiConverterString.allocationSize(value.identityPubkey) +
4112
4461
  FfiConverterUInt64.allocationSize(value.balanceSats) +
4113
4462
  FfiConverterMapStringTypeTokenBalance.allocationSize(
4114
4463
  value.tokenBalances
@@ -4775,7 +5124,7 @@ const FfiConverterTypeLightningAddressDetails = (() => {
4775
5124
  export type LightningAddressInfo = {
4776
5125
  description: string;
4777
5126
  lightningAddress: string;
4778
- lnurl: string;
5127
+ lnurl: LnurlInfo;
4779
5128
  username: string;
4780
5129
  };
4781
5130
 
@@ -4817,21 +5166,21 @@ const FfiConverterTypeLightningAddressInfo = (() => {
4817
5166
  return {
4818
5167
  description: FfiConverterString.read(from),
4819
5168
  lightningAddress: FfiConverterString.read(from),
4820
- lnurl: FfiConverterString.read(from),
5169
+ lnurl: FfiConverterTypeLnurlInfo.read(from),
4821
5170
  username: FfiConverterString.read(from),
4822
5171
  };
4823
5172
  }
4824
5173
  write(value: TypeName, into: RustBuffer): void {
4825
5174
  FfiConverterString.write(value.description, into);
4826
5175
  FfiConverterString.write(value.lightningAddress, into);
4827
- FfiConverterString.write(value.lnurl, into);
5176
+ FfiConverterTypeLnurlInfo.write(value.lnurl, into);
4828
5177
  FfiConverterString.write(value.username, into);
4829
5178
  }
4830
5179
  allocationSize(value: TypeName): number {
4831
5180
  return (
4832
5181
  FfiConverterString.allocationSize(value.description) +
4833
5182
  FfiConverterString.allocationSize(value.lightningAddress) +
4834
- FfiConverterString.allocationSize(value.lnurl) +
5183
+ FfiConverterTypeLnurlInfo.allocationSize(value.lnurl) +
4835
5184
  FfiConverterString.allocationSize(value.username)
4836
5185
  );
4837
5186
  }
@@ -5390,15 +5739,71 @@ const FfiConverterTypeLnurlErrorDetails = (() => {
5390
5739
  return new FFIConverter();
5391
5740
  })();
5392
5741
 
5742
+ export type LnurlInfo = {
5743
+ url: string;
5744
+ bech32: string;
5745
+ };
5746
+
5393
5747
  /**
5394
- * Represents the payment LNURL info
5748
+ * Generated factory for {@link LnurlInfo} record objects.
5395
5749
  */
5396
- export type LnurlPayInfo = {
5397
- lnAddress: string | undefined;
5398
- comment: string | undefined;
5399
- domain: string | undefined;
5400
- metadata: string | undefined;
5401
- processedSuccessAction: SuccessActionProcessed | undefined;
5750
+ export const LnurlInfo = (() => {
5751
+ const defaults = () => ({});
5752
+ const create = (() => {
5753
+ return uniffiCreateRecord<LnurlInfo, ReturnType<typeof defaults>>(defaults);
5754
+ })();
5755
+ return Object.freeze({
5756
+ /**
5757
+ * Create a frozen instance of {@link LnurlInfo}, with defaults specified
5758
+ * in Rust, in the {@link breez_sdk_spark} crate.
5759
+ */
5760
+ create,
5761
+
5762
+ /**
5763
+ * Create a frozen instance of {@link LnurlInfo}, with defaults specified
5764
+ * in Rust, in the {@link breez_sdk_spark} crate.
5765
+ */
5766
+ new: create,
5767
+
5768
+ /**
5769
+ * Defaults specified in the {@link breez_sdk_spark} crate.
5770
+ */
5771
+ defaults: () => Object.freeze(defaults()) as Partial<LnurlInfo>,
5772
+ });
5773
+ })();
5774
+
5775
+ const FfiConverterTypeLnurlInfo = (() => {
5776
+ type TypeName = LnurlInfo;
5777
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
5778
+ read(from: RustBuffer): TypeName {
5779
+ return {
5780
+ url: FfiConverterString.read(from),
5781
+ bech32: FfiConverterString.read(from),
5782
+ };
5783
+ }
5784
+ write(value: TypeName, into: RustBuffer): void {
5785
+ FfiConverterString.write(value.url, into);
5786
+ FfiConverterString.write(value.bech32, into);
5787
+ }
5788
+ allocationSize(value: TypeName): number {
5789
+ return (
5790
+ FfiConverterString.allocationSize(value.url) +
5791
+ FfiConverterString.allocationSize(value.bech32)
5792
+ );
5793
+ }
5794
+ }
5795
+ return new FFIConverter();
5796
+ })();
5797
+
5798
+ /**
5799
+ * Represents the payment LNURL info
5800
+ */
5801
+ export type LnurlPayInfo = {
5802
+ lnAddress: string | undefined;
5803
+ comment: string | undefined;
5804
+ domain: string | undefined;
5805
+ metadata: string | undefined;
5806
+ processedSuccessAction: SuccessActionProcessed | undefined;
5402
5807
  rawSuccessAction: SuccessAction | undefined;
5403
5808
  };
5404
5809
 
@@ -6647,6 +7052,10 @@ export type Payment = {
6647
7052
  * Details of the payment
6648
7053
  */
6649
7054
  details: PaymentDetails | undefined;
7055
+ /**
7056
+ * If set, this payment involved a conversion before the payment
7057
+ */
7058
+ conversionDetails: ConversionDetails | undefined;
6650
7059
  };
6651
7060
 
6652
7061
  /**
@@ -6690,6 +7099,7 @@ const FfiConverterTypePayment = (() => {
6690
7099
  timestamp: FfiConverterUInt64.read(from),
6691
7100
  method: FfiConverterTypePaymentMethod.read(from),
6692
7101
  details: FfiConverterOptionalTypePaymentDetails.read(from),
7102
+ conversionDetails: FfiConverterOptionalTypeConversionDetails.read(from),
6693
7103
  };
6694
7104
  }
6695
7105
  write(value: TypeName, into: RustBuffer): void {
@@ -6701,6 +7111,10 @@ const FfiConverterTypePayment = (() => {
6701
7111
  FfiConverterUInt64.write(value.timestamp, into);
6702
7112
  FfiConverterTypePaymentMethod.write(value.method, into);
6703
7113
  FfiConverterOptionalTypePaymentDetails.write(value.details, into);
7114
+ FfiConverterOptionalTypeConversionDetails.write(
7115
+ value.conversionDetails,
7116
+ into
7117
+ );
6704
7118
  }
6705
7119
  allocationSize(value: TypeName): number {
6706
7120
  return (
@@ -6711,7 +7125,10 @@ const FfiConverterTypePayment = (() => {
6711
7125
  FfiConverterTypeu128.allocationSize(value.fees) +
6712
7126
  FfiConverterUInt64.allocationSize(value.timestamp) +
6713
7127
  FfiConverterTypePaymentMethod.allocationSize(value.method) +
6714
- FfiConverterOptionalTypePaymentDetails.allocationSize(value.details)
7128
+ FfiConverterOptionalTypePaymentDetails.allocationSize(value.details) +
7129
+ FfiConverterOptionalTypeConversionDetails.allocationSize(
7130
+ value.conversionDetails
7131
+ )
6715
7132
  );
6716
7133
  }
6717
7134
  }
@@ -6860,10 +7277,21 @@ const FfiConverterTypePaymentRequestSource = (() => {
6860
7277
  })();
6861
7278
 
6862
7279
  export type PrepareLnurlPayRequest = {
7280
+ /**
7281
+ * The amount to send in satoshis.
7282
+ */
6863
7283
  amountSats: /*u64*/ bigint;
6864
7284
  payRequest: LnurlPayRequestDetails;
6865
7285
  comment: string | undefined;
6866
7286
  validateSuccessActionUrl: boolean | undefined;
7287
+ /**
7288
+ * If provided, the payment will include a token conversion step before sending the payment
7289
+ */
7290
+ conversionOptions: ConversionOptions | undefined;
7291
+ /**
7292
+ * How fees should be handled. Defaults to `FeesExcluded` (fees added on top).
7293
+ */
7294
+ feePolicy: FeePolicy | undefined;
6867
7295
  };
6868
7296
 
6869
7297
  /**
@@ -6873,6 +7301,8 @@ export const PrepareLnurlPayRequest = (() => {
6873
7301
  const defaults = () => ({
6874
7302
  comment: undefined,
6875
7303
  validateSuccessActionUrl: undefined,
7304
+ conversionOptions: undefined,
7305
+ feePolicy: undefined,
6876
7306
  });
6877
7307
  const create = (() => {
6878
7308
  return uniffiCreateRecord<
@@ -6910,6 +7340,8 @@ const FfiConverterTypePrepareLnurlPayRequest = (() => {
6910
7340
  payRequest: FfiConverterTypeLnurlPayRequestDetails.read(from),
6911
7341
  comment: FfiConverterOptionalString.read(from),
6912
7342
  validateSuccessActionUrl: FfiConverterOptionalBool.read(from),
7343
+ conversionOptions: FfiConverterOptionalTypeConversionOptions.read(from),
7344
+ feePolicy: FfiConverterOptionalTypeFeePolicy.read(from),
6913
7345
  };
6914
7346
  }
6915
7347
  write(value: TypeName, into: RustBuffer): void {
@@ -6917,6 +7349,11 @@ const FfiConverterTypePrepareLnurlPayRequest = (() => {
6917
7349
  FfiConverterTypeLnurlPayRequestDetails.write(value.payRequest, into);
6918
7350
  FfiConverterOptionalString.write(value.comment, into);
6919
7351
  FfiConverterOptionalBool.write(value.validateSuccessActionUrl, into);
7352
+ FfiConverterOptionalTypeConversionOptions.write(
7353
+ value.conversionOptions,
7354
+ into
7355
+ );
7356
+ FfiConverterOptionalTypeFeePolicy.write(value.feePolicy, into);
6920
7357
  }
6921
7358
  allocationSize(value: TypeName): number {
6922
7359
  return (
@@ -6925,7 +7362,13 @@ const FfiConverterTypePrepareLnurlPayRequest = (() => {
6925
7362
  value.payRequest
6926
7363
  ) +
6927
7364
  FfiConverterOptionalString.allocationSize(value.comment) +
6928
- FfiConverterOptionalBool.allocationSize(value.validateSuccessActionUrl)
7365
+ FfiConverterOptionalBool.allocationSize(
7366
+ value.validateSuccessActionUrl
7367
+ ) +
7368
+ FfiConverterOptionalTypeConversionOptions.allocationSize(
7369
+ value.conversionOptions
7370
+ ) +
7371
+ FfiConverterOptionalTypeFeePolicy.allocationSize(value.feePolicy)
6929
7372
  );
6930
7373
  }
6931
7374
  }
@@ -6933,12 +7376,27 @@ const FfiConverterTypePrepareLnurlPayRequest = (() => {
6933
7376
  })();
6934
7377
 
6935
7378
  export type PrepareLnurlPayResponse = {
7379
+ /**
7380
+ * The amount to send in satoshis.
7381
+ */
6936
7382
  amountSats: /*u64*/ bigint;
6937
7383
  comment: string | undefined;
6938
7384
  payRequest: LnurlPayRequestDetails;
7385
+ /**
7386
+ * The fee in satoshis. For `FeesIncluded` operations, this represents the total fee
7387
+ * (including potential overpayment).
7388
+ */
6939
7389
  feeSats: /*u64*/ bigint;
6940
7390
  invoiceDetails: Bolt11InvoiceDetails;
6941
7391
  successAction: SuccessAction | undefined;
7392
+ /**
7393
+ * When set, the payment will include a token conversion step before sending the payment
7394
+ */
7395
+ conversionEstimate: ConversionEstimate | undefined;
7396
+ /**
7397
+ * How fees are handled for this payment.
7398
+ */
7399
+ feePolicy: FeePolicy;
6942
7400
  };
6943
7401
 
6944
7402
  /**
@@ -6984,6 +7442,9 @@ const FfiConverterTypePrepareLnurlPayResponse = (() => {
6984
7442
  feeSats: FfiConverterUInt64.read(from),
6985
7443
  invoiceDetails: FfiConverterTypeBolt11InvoiceDetails.read(from),
6986
7444
  successAction: FfiConverterOptionalTypeSuccessAction.read(from),
7445
+ conversionEstimate:
7446
+ FfiConverterOptionalTypeConversionEstimate.read(from),
7447
+ feePolicy: FfiConverterTypeFeePolicy.read(from),
6987
7448
  };
6988
7449
  }
6989
7450
  write(value: TypeName, into: RustBuffer): void {
@@ -6993,6 +7454,11 @@ const FfiConverterTypePrepareLnurlPayResponse = (() => {
6993
7454
  FfiConverterUInt64.write(value.feeSats, into);
6994
7455
  FfiConverterTypeBolt11InvoiceDetails.write(value.invoiceDetails, into);
6995
7456
  FfiConverterOptionalTypeSuccessAction.write(value.successAction, into);
7457
+ FfiConverterOptionalTypeConversionEstimate.write(
7458
+ value.conversionEstimate,
7459
+ into
7460
+ );
7461
+ FfiConverterTypeFeePolicy.write(value.feePolicy, into);
6996
7462
  }
6997
7463
  allocationSize(value: TypeName): number {
6998
7464
  return (
@@ -7007,7 +7473,11 @@ const FfiConverterTypePrepareLnurlPayResponse = (() => {
7007
7473
  ) +
7008
7474
  FfiConverterOptionalTypeSuccessAction.allocationSize(
7009
7475
  value.successAction
7010
- )
7476
+ ) +
7477
+ FfiConverterOptionalTypeConversionEstimate.allocationSize(
7478
+ value.conversionEstimate
7479
+ ) +
7480
+ FfiConverterTypeFeePolicy.allocationSize(value.feePolicy)
7011
7481
  );
7012
7482
  }
7013
7483
  }
@@ -7017,19 +7487,25 @@ const FfiConverterTypePrepareLnurlPayResponse = (() => {
7017
7487
  export type PrepareSendPaymentRequest = {
7018
7488
  paymentRequest: string;
7019
7489
  /**
7020
- * Amount to send. By default is denominated in sats.
7021
- * If a token identifier is provided, the amount will be denominated in the token base units.
7490
+ * The amount to send.
7491
+ * Optional for payment requests with embedded amounts (e.g., Spark/Bolt11 invoices with amounts).
7492
+ * Required for Spark addresses, Bitcoin addresses, and amountless invoices.
7493
+ * Denominated in satoshis for Bitcoin payments, or token base units for token payments.
7022
7494
  */
7023
7495
  amount: U128 | undefined;
7024
7496
  /**
7025
- * If provided, the payment will be for a token.
7026
- * May only be provided if the payment request is a spark address.
7497
+ * Optional token identifier for token payments.
7498
+ * Absence indicates that the payment is a Bitcoin payment.
7027
7499
  */
7028
7500
  tokenIdentifier: string | undefined;
7029
7501
  /**
7030
7502
  * If provided, the payment will include a conversion step before sending the payment
7031
7503
  */
7032
7504
  conversionOptions: ConversionOptions | undefined;
7505
+ /**
7506
+ * How fees should be handled. Defaults to `FeesExcluded` (fees added on top).
7507
+ */
7508
+ feePolicy: FeePolicy | undefined;
7033
7509
  };
7034
7510
 
7035
7511
  /**
@@ -7040,6 +7516,7 @@ export const PrepareSendPaymentRequest = (() => {
7040
7516
  amount: undefined,
7041
7517
  tokenIdentifier: undefined,
7042
7518
  conversionOptions: undefined,
7519
+ feePolicy: undefined,
7043
7520
  });
7044
7521
  const create = (() => {
7045
7522
  return uniffiCreateRecord<
@@ -7077,6 +7554,7 @@ const FfiConverterTypePrepareSendPaymentRequest = (() => {
7077
7554
  amount: FfiConverterOptionalTypeu128.read(from),
7078
7555
  tokenIdentifier: FfiConverterOptionalString.read(from),
7079
7556
  conversionOptions: FfiConverterOptionalTypeConversionOptions.read(from),
7557
+ feePolicy: FfiConverterOptionalTypeFeePolicy.read(from),
7080
7558
  };
7081
7559
  }
7082
7560
  write(value: TypeName, into: RustBuffer): void {
@@ -7087,6 +7565,7 @@ const FfiConverterTypePrepareSendPaymentRequest = (() => {
7087
7565
  value.conversionOptions,
7088
7566
  into
7089
7567
  );
7568
+ FfiConverterOptionalTypeFeePolicy.write(value.feePolicy, into);
7090
7569
  }
7091
7570
  allocationSize(value: TypeName): number {
7092
7571
  return (
@@ -7095,7 +7574,8 @@ const FfiConverterTypePrepareSendPaymentRequest = (() => {
7095
7574
  FfiConverterOptionalString.allocationSize(value.tokenIdentifier) +
7096
7575
  FfiConverterOptionalTypeConversionOptions.allocationSize(
7097
7576
  value.conversionOptions
7098
- )
7577
+ ) +
7578
+ FfiConverterOptionalTypeFeePolicy.allocationSize(value.feePolicy)
7099
7579
  );
7100
7580
  }
7101
7581
  }
@@ -7105,19 +7585,23 @@ const FfiConverterTypePrepareSendPaymentRequest = (() => {
7105
7585
  export type PrepareSendPaymentResponse = {
7106
7586
  paymentMethod: SendPaymentMethod;
7107
7587
  /**
7108
- * Amount to send. By default is denominated in sats.
7109
- * If a token identifier is provided, the amount will be denominated in the token base units.
7588
+ * The amount for the payment.
7589
+ * Denominated in satoshis for Bitcoin payments, or token base units for token payments.
7110
7590
  */
7111
7591
  amount: U128;
7112
7592
  /**
7113
- * The presence of this field indicates that the payment is for a token.
7114
- * If empty, it is a Bitcoin payment.
7593
+ * Optional token identifier for token payments.
7594
+ * Absence indicates that the payment is a Bitcoin payment.
7115
7595
  */
7116
7596
  tokenIdentifier: string | undefined;
7117
7597
  /**
7118
7598
  * When set, the payment will include a conversion step before sending the payment
7119
7599
  */
7120
7600
  conversionEstimate: ConversionEstimate | undefined;
7601
+ /**
7602
+ * How fees are handled for this payment.
7603
+ */
7604
+ feePolicy: FeePolicy;
7121
7605
  };
7122
7606
 
7123
7607
  /**
@@ -7162,6 +7646,7 @@ const FfiConverterTypePrepareSendPaymentResponse = (() => {
7162
7646
  tokenIdentifier: FfiConverterOptionalString.read(from),
7163
7647
  conversionEstimate:
7164
7648
  FfiConverterOptionalTypeConversionEstimate.read(from),
7649
+ feePolicy: FfiConverterTypeFeePolicy.read(from),
7165
7650
  };
7166
7651
  }
7167
7652
  write(value: TypeName, into: RustBuffer): void {
@@ -7172,6 +7657,7 @@ const FfiConverterTypePrepareSendPaymentResponse = (() => {
7172
7657
  value.conversionEstimate,
7173
7658
  into
7174
7659
  );
7660
+ FfiConverterTypeFeePolicy.write(value.feePolicy, into);
7175
7661
  }
7176
7662
  allocationSize(value: TypeName): number {
7177
7663
  return (
@@ -7180,7 +7666,8 @@ const FfiConverterTypePrepareSendPaymentResponse = (() => {
7180
7666
  FfiConverterOptionalString.allocationSize(value.tokenIdentifier) +
7181
7667
  FfiConverterOptionalTypeConversionEstimate.allocationSize(
7182
7668
  value.conversionEstimate
7183
- )
7669
+ ) +
7670
+ FfiConverterTypeFeePolicy.allocationSize(value.feePolicy)
7184
7671
  );
7185
7672
  }
7186
7673
  }
@@ -7629,7 +8116,7 @@ export type RecordChange = {
7629
8116
  id: RecordId;
7630
8117
  schemaVersion: string;
7631
8118
  updatedFields: Map<string, string>;
7632
- revision: /*u64*/ bigint;
8119
+ localRevision: /*u64*/ bigint;
7633
8120
  };
7634
8121
 
7635
8122
  /**
@@ -7670,21 +8157,21 @@ const FfiConverterTypeRecordChange = (() => {
7670
8157
  id: FfiConverterTypeRecordId.read(from),
7671
8158
  schemaVersion: FfiConverterString.read(from),
7672
8159
  updatedFields: FfiConverterMapStringString.read(from),
7673
- revision: FfiConverterUInt64.read(from),
8160
+ localRevision: FfiConverterUInt64.read(from),
7674
8161
  };
7675
8162
  }
7676
8163
  write(value: TypeName, into: RustBuffer): void {
7677
8164
  FfiConverterTypeRecordId.write(value.id, into);
7678
8165
  FfiConverterString.write(value.schemaVersion, into);
7679
8166
  FfiConverterMapStringString.write(value.updatedFields, into);
7680
- FfiConverterUInt64.write(value.revision, into);
8167
+ FfiConverterUInt64.write(value.localRevision, into);
7681
8168
  }
7682
8169
  allocationSize(value: TypeName): number {
7683
8170
  return (
7684
8171
  FfiConverterTypeRecordId.allocationSize(value.id) +
7685
8172
  FfiConverterString.allocationSize(value.schemaVersion) +
7686
8173
  FfiConverterMapStringString.allocationSize(value.updatedFields) +
7687
- FfiConverterUInt64.allocationSize(value.revision)
8174
+ FfiConverterUInt64.allocationSize(value.localRevision)
7688
8175
  );
7689
8176
  }
7690
8177
  }
@@ -9057,6 +9544,176 @@ const FfiConverterTypeSparkInvoicePaymentDetails = (() => {
9057
9544
  return new FFIConverter();
9058
9545
  })();
9059
9546
 
9547
+ /**
9548
+ * The status of the Spark network services relevant to the SDK.
9549
+ */
9550
+ export type SparkStatus = {
9551
+ /**
9552
+ * The worst status across all relevant services.
9553
+ */
9554
+ status: ServiceStatus;
9555
+ /**
9556
+ * The last time the status was updated, as a unix timestamp in seconds.
9557
+ */
9558
+ lastUpdated: /*u64*/ bigint;
9559
+ };
9560
+
9561
+ /**
9562
+ * Generated factory for {@link SparkStatus} record objects.
9563
+ */
9564
+ export const SparkStatus = (() => {
9565
+ const defaults = () => ({});
9566
+ const create = (() => {
9567
+ return uniffiCreateRecord<SparkStatus, ReturnType<typeof defaults>>(
9568
+ defaults
9569
+ );
9570
+ })();
9571
+ return Object.freeze({
9572
+ /**
9573
+ * Create a frozen instance of {@link SparkStatus}, with defaults specified
9574
+ * in Rust, in the {@link breez_sdk_spark} crate.
9575
+ */
9576
+ create,
9577
+
9578
+ /**
9579
+ * Create a frozen instance of {@link SparkStatus}, with defaults specified
9580
+ * in Rust, in the {@link breez_sdk_spark} crate.
9581
+ */
9582
+ new: create,
9583
+
9584
+ /**
9585
+ * Defaults specified in the {@link breez_sdk_spark} crate.
9586
+ */
9587
+ defaults: () => Object.freeze(defaults()) as Partial<SparkStatus>,
9588
+ });
9589
+ })();
9590
+
9591
+ const FfiConverterTypeSparkStatus = (() => {
9592
+ type TypeName = SparkStatus;
9593
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
9594
+ read(from: RustBuffer): TypeName {
9595
+ return {
9596
+ status: FfiConverterTypeServiceStatus.read(from),
9597
+ lastUpdated: FfiConverterUInt64.read(from),
9598
+ };
9599
+ }
9600
+ write(value: TypeName, into: RustBuffer): void {
9601
+ FfiConverterTypeServiceStatus.write(value.status, into);
9602
+ FfiConverterUInt64.write(value.lastUpdated, into);
9603
+ }
9604
+ allocationSize(value: TypeName): number {
9605
+ return (
9606
+ FfiConverterTypeServiceStatus.allocationSize(value.status) +
9607
+ FfiConverterUInt64.allocationSize(value.lastUpdated)
9608
+ );
9609
+ }
9610
+ }
9611
+ return new FFIConverter();
9612
+ })();
9613
+
9614
+ /**
9615
+ * Configuration for automatic conversion of Bitcoin to stable tokens.
9616
+ *
9617
+ * When configured, the SDK automatically monitors the Bitcoin balance after each
9618
+ * wallet sync. When the balance exceeds the configured threshold plus the reserved
9619
+ * amount, the SDK automatically converts the excess balance (above the reserve)
9620
+ * to the specified stable token.
9621
+ *
9622
+ * When the balance is held in a stable token, Bitcoin payments can still be sent.
9623
+ * The SDK automatically detects when there's not enough Bitcoin balance to cover a
9624
+ * payment and auto-populates the token-to-Bitcoin conversion options to facilitate
9625
+ * the payment.
9626
+ */
9627
+ export type StableBalanceConfig = {
9628
+ /**
9629
+ * The token identifier to convert Bitcoin to (required).
9630
+ */
9631
+ tokenIdentifier: string;
9632
+ /**
9633
+ * The minimum sats balance that triggers auto-conversion.
9634
+ *
9635
+ * If not provided, uses the minimum from conversion limits.
9636
+ * If provided but less than the conversion limit minimum, the limit minimum is used.
9637
+ */
9638
+ thresholdSats: /*u64*/ bigint | undefined;
9639
+ /**
9640
+ * Maximum slippage in basis points (1/100 of a percent).
9641
+ *
9642
+ * Defaults to 50 bps (0.5%) if not set.
9643
+ */
9644
+ maxSlippageBps: /*u32*/ number | undefined;
9645
+ /**
9646
+ * Amount of sats to keep as Bitcoin and not convert to stable tokens.
9647
+ *
9648
+ * This reserve ensures you can send Bitcoin payments without hitting
9649
+ * the minimum conversion limit. Defaults to the conversion minimum if not set.
9650
+ */
9651
+ reservedSats: /*u64*/ bigint | undefined;
9652
+ };
9653
+
9654
+ /**
9655
+ * Generated factory for {@link StableBalanceConfig} record objects.
9656
+ */
9657
+ export const StableBalanceConfig = (() => {
9658
+ const defaults = () => ({
9659
+ thresholdSats: undefined,
9660
+ maxSlippageBps: undefined,
9661
+ reservedSats: undefined,
9662
+ });
9663
+ const create = (() => {
9664
+ return uniffiCreateRecord<StableBalanceConfig, ReturnType<typeof defaults>>(
9665
+ defaults
9666
+ );
9667
+ })();
9668
+ return Object.freeze({
9669
+ /**
9670
+ * Create a frozen instance of {@link StableBalanceConfig}, with defaults specified
9671
+ * in Rust, in the {@link breez_sdk_spark} crate.
9672
+ */
9673
+ create,
9674
+
9675
+ /**
9676
+ * Create a frozen instance of {@link StableBalanceConfig}, with defaults specified
9677
+ * in Rust, in the {@link breez_sdk_spark} crate.
9678
+ */
9679
+ new: create,
9680
+
9681
+ /**
9682
+ * Defaults specified in the {@link breez_sdk_spark} crate.
9683
+ */
9684
+ defaults: () => Object.freeze(defaults()) as Partial<StableBalanceConfig>,
9685
+ });
9686
+ })();
9687
+
9688
+ const FfiConverterTypeStableBalanceConfig = (() => {
9689
+ type TypeName = StableBalanceConfig;
9690
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
9691
+ read(from: RustBuffer): TypeName {
9692
+ return {
9693
+ tokenIdentifier: FfiConverterString.read(from),
9694
+ thresholdSats: FfiConverterOptionalUInt64.read(from),
9695
+ maxSlippageBps: FfiConverterOptionalUInt32.read(from),
9696
+ reservedSats: FfiConverterOptionalUInt64.read(from),
9697
+ };
9698
+ }
9699
+ write(value: TypeName, into: RustBuffer): void {
9700
+ FfiConverterString.write(value.tokenIdentifier, into);
9701
+ FfiConverterOptionalUInt64.write(value.thresholdSats, into);
9702
+ FfiConverterOptionalUInt32.write(value.maxSlippageBps, into);
9703
+ FfiConverterOptionalUInt64.write(value.reservedSats, into);
9704
+ }
9705
+ allocationSize(value: TypeName): number {
9706
+ return (
9707
+ FfiConverterString.allocationSize(value.tokenIdentifier) +
9708
+ FfiConverterOptionalUInt64.allocationSize(value.thresholdSats) +
9709
+ FfiConverterOptionalUInt32.allocationSize(value.maxSlippageBps) +
9710
+ FfiConverterOptionalUInt64.allocationSize(value.reservedSats)
9711
+ );
9712
+ }
9713
+ }
9714
+ return new FFIConverter();
9715
+ })();
9716
+
9060
9717
  /**
9061
9718
  * Settings for the symbol representation of a currency
9062
9719
  */
@@ -10657,6 +11314,7 @@ const FfiConverterTypeChainServiceError = (() => {
10657
11314
  export enum ConversionPurpose_Tags {
10658
11315
  OngoingPayment = 'OngoingPayment',
10659
11316
  SelfTransfer = 'SelfTransfer',
11317
+ AutoConversion = 'AutoConversion',
10660
11318
  }
10661
11319
  /**
10662
11320
  * The purpose of the conversion, which is used to provide context for the conversion
@@ -10731,6 +11389,36 @@ export const ConversionPurpose = (() => {
10731
11389
  }
10732
11390
  }
10733
11391
 
11392
+ type AutoConversion__interface = {
11393
+ tag: ConversionPurpose_Tags.AutoConversion;
11394
+ };
11395
+
11396
+ /**
11397
+ * Conversion triggered automatically
11398
+ */
11399
+ class AutoConversion_
11400
+ extends UniffiEnum
11401
+ implements AutoConversion__interface
11402
+ {
11403
+ /**
11404
+ * @private
11405
+ * This field is private and should not be used, use `tag` instead.
11406
+ */
11407
+ readonly [uniffiTypeNameSymbol] = 'ConversionPurpose';
11408
+ readonly tag = ConversionPurpose_Tags.AutoConversion;
11409
+ constructor() {
11410
+ super('ConversionPurpose', 'AutoConversion');
11411
+ }
11412
+
11413
+ static new(): AutoConversion_ {
11414
+ return new AutoConversion_();
11415
+ }
11416
+
11417
+ static instanceOf(obj: any): obj is AutoConversion_ {
11418
+ return obj.tag === ConversionPurpose_Tags.AutoConversion;
11419
+ }
11420
+ }
11421
+
10734
11422
  function instanceOf(obj: any): obj is ConversionPurpose {
10735
11423
  return obj[uniffiTypeNameSymbol] === 'ConversionPurpose';
10736
11424
  }
@@ -10739,6 +11427,7 @@ export const ConversionPurpose = (() => {
10739
11427
  instanceOf,
10740
11428
  OngoingPayment: OngoingPayment_,
10741
11429
  SelfTransfer: SelfTransfer_,
11430
+ AutoConversion: AutoConversion_,
10742
11431
  });
10743
11432
  })();
10744
11433
 
@@ -10764,6 +11453,8 @@ const FfiConverterTypeConversionPurpose = (() => {
10764
11453
  });
10765
11454
  case 2:
10766
11455
  return new ConversionPurpose.SelfTransfer();
11456
+ case 3:
11457
+ return new ConversionPurpose.AutoConversion();
10767
11458
  default:
10768
11459
  throw new UniffiInternalError.UnexpectedEnumCase();
10769
11460
  }
@@ -10780,6 +11471,10 @@ const FfiConverterTypeConversionPurpose = (() => {
10780
11471
  ordinalConverter.write(2, into);
10781
11472
  return;
10782
11473
  }
11474
+ case ConversionPurpose_Tags.AutoConversion: {
11475
+ ordinalConverter.write(3, into);
11476
+ return;
11477
+ }
10783
11478
  default:
10784
11479
  // Throwing from here means that ConversionPurpose_Tags hasn't matched an ordinal.
10785
11480
  throw new UniffiInternalError.UnexpectedEnumCase();
@@ -10796,6 +11491,9 @@ const FfiConverterTypeConversionPurpose = (() => {
10796
11491
  case ConversionPurpose_Tags.SelfTransfer: {
10797
11492
  return ordinalConverter.allocationSize(2);
10798
11493
  }
11494
+ case ConversionPurpose_Tags.AutoConversion: {
11495
+ return ordinalConverter.allocationSize(3);
11496
+ }
10799
11497
  default:
10800
11498
  throw new UniffiInternalError.UnexpectedEnumCase();
10801
11499
  }
@@ -11650,22 +12348,67 @@ const FfiConverterTypeFee = (() => {
11650
12348
  return new FFIConverter();
11651
12349
  })();
11652
12350
 
11653
- // Enum: InputType
11654
- export enum InputType_Tags {
11655
- BitcoinAddress = 'BitcoinAddress',
11656
- Bolt11Invoice = 'Bolt11Invoice',
11657
- Bolt12Invoice = 'Bolt12Invoice',
11658
- Bolt12Offer = 'Bolt12Offer',
11659
- LightningAddress = 'LightningAddress',
11660
- LnurlPay = 'LnurlPay',
11661
- SilentPaymentAddress = 'SilentPaymentAddress',
11662
- LnurlAuth = 'LnurlAuth',
11663
- Url = 'Url',
11664
- Bip21 = 'Bip21',
11665
- Bolt12InvoiceRequest = 'Bolt12InvoiceRequest',
11666
- LnurlWithdraw = 'LnurlWithdraw',
11667
- SparkAddress = 'SparkAddress',
11668
- SparkInvoice = 'SparkInvoice',
12351
+ /**
12352
+ * Specifies how fees are handled in a payment.
12353
+ */
12354
+ export enum FeePolicy {
12355
+ /**
12356
+ * Fees are added on top of the specified amount (default behavior).
12357
+ * The receiver gets the exact amount specified.
12358
+ */
12359
+ FeesExcluded,
12360
+ /**
12361
+ * Fees are deducted from the specified amount.
12362
+ * The receiver gets the amount minus fees.
12363
+ */
12364
+ FeesIncluded,
12365
+ }
12366
+
12367
+ const FfiConverterTypeFeePolicy = (() => {
12368
+ const ordinalConverter = FfiConverterInt32;
12369
+ type TypeName = FeePolicy;
12370
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
12371
+ read(from: RustBuffer): TypeName {
12372
+ switch (ordinalConverter.read(from)) {
12373
+ case 1:
12374
+ return FeePolicy.FeesExcluded;
12375
+ case 2:
12376
+ return FeePolicy.FeesIncluded;
12377
+ default:
12378
+ throw new UniffiInternalError.UnexpectedEnumCase();
12379
+ }
12380
+ }
12381
+ write(value: TypeName, into: RustBuffer): void {
12382
+ switch (value) {
12383
+ case FeePolicy.FeesExcluded:
12384
+ return ordinalConverter.write(1, into);
12385
+ case FeePolicy.FeesIncluded:
12386
+ return ordinalConverter.write(2, into);
12387
+ }
12388
+ }
12389
+ allocationSize(value: TypeName): number {
12390
+ return ordinalConverter.allocationSize(0);
12391
+ }
12392
+ }
12393
+ return new FFIConverter();
12394
+ })();
12395
+
12396
+ // Enum: InputType
12397
+ export enum InputType_Tags {
12398
+ BitcoinAddress = 'BitcoinAddress',
12399
+ Bolt11Invoice = 'Bolt11Invoice',
12400
+ Bolt12Invoice = 'Bolt12Invoice',
12401
+ Bolt12Offer = 'Bolt12Offer',
12402
+ LightningAddress = 'LightningAddress',
12403
+ LnurlPay = 'LnurlPay',
12404
+ SilentPaymentAddress = 'SilentPaymentAddress',
12405
+ LnurlAuth = 'LnurlAuth',
12406
+ Url = 'Url',
12407
+ Bip21 = 'Bip21',
12408
+ Bolt12InvoiceRequest = 'Bolt12InvoiceRequest',
12409
+ LnurlWithdraw = 'LnurlWithdraw',
12410
+ SparkAddress = 'SparkAddress',
12411
+ SparkInvoice = 'SparkInvoice',
11669
12412
  }
11670
12413
  export const InputType = (() => {
11671
12414
  type BitcoinAddress__interface = {
@@ -13185,6 +13928,7 @@ export const PaymentDetails = (() => {
13185
13928
  inner: Readonly<{
13186
13929
  metadata: TokenMetadata;
13187
13930
  txHash: string;
13931
+ txType: TokenTransactionType;
13188
13932
  invoiceDetails: SparkInvoicePaymentDetails | undefined;
13189
13933
  conversionInfo: ConversionInfo | undefined;
13190
13934
  }>;
@@ -13200,12 +13944,14 @@ export const PaymentDetails = (() => {
13200
13944
  readonly inner: Readonly<{
13201
13945
  metadata: TokenMetadata;
13202
13946
  txHash: string;
13947
+ txType: TokenTransactionType;
13203
13948
  invoiceDetails: SparkInvoicePaymentDetails | undefined;
13204
13949
  conversionInfo: ConversionInfo | undefined;
13205
13950
  }>;
13206
13951
  constructor(inner: {
13207
13952
  metadata: TokenMetadata;
13208
13953
  txHash: string;
13954
+ txType: TokenTransactionType;
13209
13955
  /**
13210
13956
  * The invoice details if the payment fulfilled a spark invoice
13211
13957
  */ invoiceDetails: SparkInvoicePaymentDetails | undefined;
@@ -13220,6 +13966,7 @@ export const PaymentDetails = (() => {
13220
13966
  static new(inner: {
13221
13967
  metadata: TokenMetadata;
13222
13968
  txHash: string;
13969
+ txType: TokenTransactionType;
13223
13970
  /**
13224
13971
  * The invoice details if the payment fulfilled a spark invoice
13225
13972
  */ invoiceDetails: SparkInvoicePaymentDetails | undefined;
@@ -13239,10 +13986,9 @@ export const PaymentDetails = (() => {
13239
13986
  tag: PaymentDetails_Tags.Lightning;
13240
13987
  inner: Readonly<{
13241
13988
  description: string | undefined;
13242
- preimage: string | undefined;
13243
13989
  invoice: string;
13244
- paymentHash: string;
13245
13990
  destinationPubkey: string;
13991
+ htlcDetails: SparkHtlcDetails;
13246
13992
  lnurlPayInfo: LnurlPayInfo | undefined;
13247
13993
  lnurlWithdrawInfo: LnurlWithdrawInfo | undefined;
13248
13994
  lnurlReceiveMetadata: LnurlReceiveMetadata | undefined;
@@ -13258,10 +14004,9 @@ export const PaymentDetails = (() => {
13258
14004
  readonly tag = PaymentDetails_Tags.Lightning;
13259
14005
  readonly inner: Readonly<{
13260
14006
  description: string | undefined;
13261
- preimage: string | undefined;
13262
14007
  invoice: string;
13263
- paymentHash: string;
13264
14008
  destinationPubkey: string;
14009
+ htlcDetails: SparkHtlcDetails;
13265
14010
  lnurlPayInfo: LnurlPayInfo | undefined;
13266
14011
  lnurlWithdrawInfo: LnurlWithdrawInfo | undefined;
13267
14012
  lnurlReceiveMetadata: LnurlReceiveMetadata | undefined;
@@ -13270,20 +14015,17 @@ export const PaymentDetails = (() => {
13270
14015
  /**
13271
14016
  * Represents the invoice description
13272
14017
  */ description: string | undefined;
13273
- /**
13274
- * The preimage of the paid invoice (proof of payment).
13275
- */ preimage: string | undefined;
13276
14018
  /**
13277
14019
  * Represents the Bolt11/Bolt12 invoice associated with a payment
13278
14020
  * In the case of a Send payment, this is the invoice paid by the user
13279
14021
  * In the case of a Receive payment, this is the invoice paid to the user
13280
14022
  */ invoice: string;
13281
- /**
13282
- * The payment hash of the invoice
13283
- */ paymentHash: string;
13284
14023
  /**
13285
14024
  * The invoice destination/payee pubkey
13286
14025
  */ destinationPubkey: string;
14026
+ /**
14027
+ * The HTLC transfer details
14028
+ */ htlcDetails: SparkHtlcDetails;
13287
14029
  /**
13288
14030
  * Lnurl payment information if this was an lnurl payment.
13289
14031
  */ lnurlPayInfo: LnurlPayInfo | undefined;
@@ -13302,20 +14044,17 @@ export const PaymentDetails = (() => {
13302
14044
  /**
13303
14045
  * Represents the invoice description
13304
14046
  */ description: string | undefined;
13305
- /**
13306
- * The preimage of the paid invoice (proof of payment).
13307
- */ preimage: string | undefined;
13308
14047
  /**
13309
14048
  * Represents the Bolt11/Bolt12 invoice associated with a payment
13310
14049
  * In the case of a Send payment, this is the invoice paid by the user
13311
14050
  * In the case of a Receive payment, this is the invoice paid to the user
13312
14051
  */ invoice: string;
13313
- /**
13314
- * The payment hash of the invoice
13315
- */ paymentHash: string;
13316
14052
  /**
13317
14053
  * The invoice destination/payee pubkey
13318
14054
  */ destinationPubkey: string;
14055
+ /**
14056
+ * The HTLC transfer details
14057
+ */ htlcDetails: SparkHtlcDetails;
13319
14058
  /**
13320
14059
  * Lnurl payment information if this was an lnurl payment.
13321
14060
  */ lnurlPayInfo: LnurlPayInfo | undefined;
@@ -13424,6 +14163,7 @@ const FfiConverterTypePaymentDetails = (() => {
13424
14163
  return new PaymentDetails.Token({
13425
14164
  metadata: FfiConverterTypeTokenMetadata.read(from),
13426
14165
  txHash: FfiConverterString.read(from),
14166
+ txType: FfiConverterTypeTokenTransactionType.read(from),
13427
14167
  invoiceDetails:
13428
14168
  FfiConverterOptionalTypeSparkInvoicePaymentDetails.read(from),
13429
14169
  conversionInfo: FfiConverterOptionalTypeConversionInfo.read(from),
@@ -13431,10 +14171,9 @@ const FfiConverterTypePaymentDetails = (() => {
13431
14171
  case 3:
13432
14172
  return new PaymentDetails.Lightning({
13433
14173
  description: FfiConverterOptionalString.read(from),
13434
- preimage: FfiConverterOptionalString.read(from),
13435
14174
  invoice: FfiConverterString.read(from),
13436
- paymentHash: FfiConverterString.read(from),
13437
14175
  destinationPubkey: FfiConverterString.read(from),
14176
+ htlcDetails: FfiConverterTypeSparkHtlcDetails.read(from),
13438
14177
  lnurlPayInfo: FfiConverterOptionalTypeLnurlPayInfo.read(from),
13439
14178
  lnurlWithdrawInfo:
13440
14179
  FfiConverterOptionalTypeLnurlWithdrawInfo.read(from),
@@ -13477,6 +14216,7 @@ const FfiConverterTypePaymentDetails = (() => {
13477
14216
  const inner = value.inner;
13478
14217
  FfiConverterTypeTokenMetadata.write(inner.metadata, into);
13479
14218
  FfiConverterString.write(inner.txHash, into);
14219
+ FfiConverterTypeTokenTransactionType.write(inner.txType, into);
13480
14220
  FfiConverterOptionalTypeSparkInvoicePaymentDetails.write(
13481
14221
  inner.invoiceDetails,
13482
14222
  into
@@ -13491,10 +14231,9 @@ const FfiConverterTypePaymentDetails = (() => {
13491
14231
  ordinalConverter.write(3, into);
13492
14232
  const inner = value.inner;
13493
14233
  FfiConverterOptionalString.write(inner.description, into);
13494
- FfiConverterOptionalString.write(inner.preimage, into);
13495
14234
  FfiConverterString.write(inner.invoice, into);
13496
- FfiConverterString.write(inner.paymentHash, into);
13497
14235
  FfiConverterString.write(inner.destinationPubkey, into);
14236
+ FfiConverterTypeSparkHtlcDetails.write(inner.htlcDetails, into);
13498
14237
  FfiConverterOptionalTypeLnurlPayInfo.write(inner.lnurlPayInfo, into);
13499
14238
  FfiConverterOptionalTypeLnurlWithdrawInfo.write(
13500
14239
  inner.lnurlWithdrawInfo,
@@ -13545,6 +14284,9 @@ const FfiConverterTypePaymentDetails = (() => {
13545
14284
  let size = ordinalConverter.allocationSize(2);
13546
14285
  size += FfiConverterTypeTokenMetadata.allocationSize(inner.metadata);
13547
14286
  size += FfiConverterString.allocationSize(inner.txHash);
14287
+ size += FfiConverterTypeTokenTransactionType.allocationSize(
14288
+ inner.txType
14289
+ );
13548
14290
  size +=
13549
14291
  FfiConverterOptionalTypeSparkInvoicePaymentDetails.allocationSize(
13550
14292
  inner.invoiceDetails
@@ -13558,10 +14300,11 @@ const FfiConverterTypePaymentDetails = (() => {
13558
14300
  const inner = value.inner;
13559
14301
  let size = ordinalConverter.allocationSize(3);
13560
14302
  size += FfiConverterOptionalString.allocationSize(inner.description);
13561
- size += FfiConverterOptionalString.allocationSize(inner.preimage);
13562
14303
  size += FfiConverterString.allocationSize(inner.invoice);
13563
- size += FfiConverterString.allocationSize(inner.paymentHash);
13564
14304
  size += FfiConverterString.allocationSize(inner.destinationPubkey);
14305
+ size += FfiConverterTypeSparkHtlcDetails.allocationSize(
14306
+ inner.htlcDetails
14307
+ );
13565
14308
  size += FfiConverterOptionalTypeLnurlPayInfo.allocationSize(
13566
14309
  inner.lnurlPayInfo
13567
14310
  );
@@ -13597,6 +14340,7 @@ const FfiConverterTypePaymentDetails = (() => {
13597
14340
  export enum PaymentDetailsFilter_Tags {
13598
14341
  Spark = 'Spark',
13599
14342
  Token = 'Token',
14343
+ Lightning = 'Lightning',
13600
14344
  }
13601
14345
  export const PaymentDetailsFilter = (() => {
13602
14346
  type Spark__interface = {
@@ -13651,6 +14395,7 @@ export const PaymentDetailsFilter = (() => {
13651
14395
  inner: Readonly<{
13652
14396
  conversionRefundNeeded: boolean | undefined;
13653
14397
  txHash: string | undefined;
14398
+ txType: TokenTransactionType | undefined;
13654
14399
  }>;
13655
14400
  };
13656
14401
 
@@ -13664,6 +14409,7 @@ export const PaymentDetailsFilter = (() => {
13664
14409
  readonly inner: Readonly<{
13665
14410
  conversionRefundNeeded: boolean | undefined;
13666
14411
  txHash: string | undefined;
14412
+ txType: TokenTransactionType | undefined;
13667
14413
  }>;
13668
14414
  constructor(inner: {
13669
14415
  /**
@@ -13672,6 +14418,9 @@ export const PaymentDetailsFilter = (() => {
13672
14418
  /**
13673
14419
  * Filter by transaction hash
13674
14420
  */ txHash: string | undefined;
14421
+ /**
14422
+ * Filter by transaction type
14423
+ */ txType: TokenTransactionType | undefined;
13675
14424
  }) {
13676
14425
  super('PaymentDetailsFilter', 'Token');
13677
14426
  this.inner = Object.freeze(inner);
@@ -13684,6 +14433,9 @@ export const PaymentDetailsFilter = (() => {
13684
14433
  /**
13685
14434
  * Filter by transaction hash
13686
14435
  */ txHash: string | undefined;
14436
+ /**
14437
+ * Filter by transaction type
14438
+ */ txType: TokenTransactionType | undefined;
13687
14439
  }): Token_ {
13688
14440
  return new Token_(inner);
13689
14441
  }
@@ -13693,6 +14445,43 @@ export const PaymentDetailsFilter = (() => {
13693
14445
  }
13694
14446
  }
13695
14447
 
14448
+ type Lightning__interface = {
14449
+ tag: PaymentDetailsFilter_Tags.Lightning;
14450
+ inner: Readonly<{ htlcStatus: Array<SparkHtlcStatus> | undefined }>;
14451
+ };
14452
+
14453
+ class Lightning_ extends UniffiEnum implements Lightning__interface {
14454
+ /**
14455
+ * @private
14456
+ * This field is private and should not be used, use `tag` instead.
14457
+ */
14458
+ readonly [uniffiTypeNameSymbol] = 'PaymentDetailsFilter';
14459
+ readonly tag = PaymentDetailsFilter_Tags.Lightning;
14460
+ readonly inner: Readonly<{
14461
+ htlcStatus: Array<SparkHtlcStatus> | undefined;
14462
+ }>;
14463
+ constructor(inner: {
14464
+ /**
14465
+ * Filter specific Spark HTLC statuses
14466
+ */ htlcStatus: Array<SparkHtlcStatus> | undefined;
14467
+ }) {
14468
+ super('PaymentDetailsFilter', 'Lightning');
14469
+ this.inner = Object.freeze(inner);
14470
+ }
14471
+
14472
+ static new(inner: {
14473
+ /**
14474
+ * Filter specific Spark HTLC statuses
14475
+ */ htlcStatus: Array<SparkHtlcStatus> | undefined;
14476
+ }): Lightning_ {
14477
+ return new Lightning_(inner);
14478
+ }
14479
+
14480
+ static instanceOf(obj: any): obj is Lightning_ {
14481
+ return obj.tag === PaymentDetailsFilter_Tags.Lightning;
14482
+ }
14483
+ }
14484
+
13696
14485
  function instanceOf(obj: any): obj is PaymentDetailsFilter {
13697
14486
  return obj[uniffiTypeNameSymbol] === 'PaymentDetailsFilter';
13698
14487
  }
@@ -13701,6 +14490,7 @@ export const PaymentDetailsFilter = (() => {
13701
14490
  instanceOf,
13702
14491
  Spark: Spark_,
13703
14492
  Token: Token_,
14493
+ Lightning: Lightning_,
13704
14494
  });
13705
14495
  })();
13706
14496
 
@@ -13727,6 +14517,11 @@ const FfiConverterTypePaymentDetailsFilter = (() => {
13727
14517
  return new PaymentDetailsFilter.Token({
13728
14518
  conversionRefundNeeded: FfiConverterOptionalBool.read(from),
13729
14519
  txHash: FfiConverterOptionalString.read(from),
14520
+ txType: FfiConverterOptionalTypeTokenTransactionType.read(from),
14521
+ });
14522
+ case 3:
14523
+ return new PaymentDetailsFilter.Lightning({
14524
+ htlcStatus: FfiConverterOptionalArrayTypeSparkHtlcStatus.read(from),
13730
14525
  });
13731
14526
  default:
13732
14527
  throw new UniffiInternalError.UnexpectedEnumCase();
@@ -13749,6 +14544,19 @@ const FfiConverterTypePaymentDetailsFilter = (() => {
13749
14544
  const inner = value.inner;
13750
14545
  FfiConverterOptionalBool.write(inner.conversionRefundNeeded, into);
13751
14546
  FfiConverterOptionalString.write(inner.txHash, into);
14547
+ FfiConverterOptionalTypeTokenTransactionType.write(
14548
+ inner.txType,
14549
+ into
14550
+ );
14551
+ return;
14552
+ }
14553
+ case PaymentDetailsFilter_Tags.Lightning: {
14554
+ ordinalConverter.write(3, into);
14555
+ const inner = value.inner;
14556
+ FfiConverterOptionalArrayTypeSparkHtlcStatus.write(
14557
+ inner.htlcStatus,
14558
+ into
14559
+ );
13752
14560
  return;
13753
14561
  }
13754
14562
  default:
@@ -13776,6 +14584,17 @@ const FfiConverterTypePaymentDetailsFilter = (() => {
13776
14584
  inner.conversionRefundNeeded
13777
14585
  );
13778
14586
  size += FfiConverterOptionalString.allocationSize(inner.txHash);
14587
+ size += FfiConverterOptionalTypeTokenTransactionType.allocationSize(
14588
+ inner.txType
14589
+ );
14590
+ return size;
14591
+ }
14592
+ case PaymentDetailsFilter_Tags.Lightning: {
14593
+ const inner = value.inner;
14594
+ let size = ordinalConverter.allocationSize(3);
14595
+ size += FfiConverterOptionalArrayTypeSparkHtlcStatus.allocationSize(
14596
+ inner.htlcStatus
14597
+ );
13779
14598
  return size;
13780
14599
  }
13781
14600
  default:
@@ -14500,6 +15319,7 @@ export const ReceivePaymentMethod = (() => {
14500
15319
  description: string;
14501
15320
  amountSats: /*u64*/ bigint | undefined;
14502
15321
  expirySecs: /*u32*/ number | undefined;
15322
+ paymentHash: string | undefined;
14503
15323
  }>;
14504
15324
  };
14505
15325
 
@@ -14514,6 +15334,7 @@ export const ReceivePaymentMethod = (() => {
14514
15334
  description: string;
14515
15335
  amountSats: /*u64*/ bigint | undefined;
14516
15336
  expirySecs: /*u32*/ number | undefined;
15337
+ paymentHash: string | undefined;
14517
15338
  }>;
14518
15339
  constructor(inner: {
14519
15340
  description: string;
@@ -14521,6 +15342,11 @@ export const ReceivePaymentMethod = (() => {
14521
15342
  /**
14522
15343
  * The expiry of the invoice as a duration in seconds
14523
15344
  */ expirySecs: /*u32*/ number | undefined;
15345
+ /**
15346
+ * If set, creates a HODL invoice with this payment hash (hex-encoded).
15347
+ * The payer's HTLC will be held until the preimage is provided via
15348
+ * `claim_htlc_payment` or the HTLC expires.
15349
+ */ paymentHash: string | undefined;
14524
15350
  }) {
14525
15351
  super('ReceivePaymentMethod', 'Bolt11Invoice');
14526
15352
  this.inner = Object.freeze(inner);
@@ -14532,6 +15358,11 @@ export const ReceivePaymentMethod = (() => {
14532
15358
  /**
14533
15359
  * The expiry of the invoice as a duration in seconds
14534
15360
  */ expirySecs: /*u32*/ number | undefined;
15361
+ /**
15362
+ * If set, creates a HODL invoice with this payment hash (hex-encoded).
15363
+ * The payer's HTLC will be held until the preimage is provided via
15364
+ * `claim_htlc_payment` or the HTLC expires.
15365
+ */ paymentHash: string | undefined;
14535
15366
  }): Bolt11Invoice_ {
14536
15367
  return new Bolt11Invoice_(inner);
14537
15368
  }
@@ -14585,6 +15416,7 @@ const FfiConverterTypeReceivePaymentMethod = (() => {
14585
15416
  description: FfiConverterString.read(from),
14586
15417
  amountSats: FfiConverterOptionalUInt64.read(from),
14587
15418
  expirySecs: FfiConverterOptionalUInt32.read(from),
15419
+ paymentHash: FfiConverterOptionalString.read(from),
14588
15420
  });
14589
15421
  default:
14590
15422
  throw new UniffiInternalError.UnexpectedEnumCase();
@@ -14616,6 +15448,7 @@ const FfiConverterTypeReceivePaymentMethod = (() => {
14616
15448
  FfiConverterString.write(inner.description, into);
14617
15449
  FfiConverterOptionalUInt64.write(inner.amountSats, into);
14618
15450
  FfiConverterOptionalUInt32.write(inner.expirySecs, into);
15451
+ FfiConverterOptionalString.write(inner.paymentHash, into);
14619
15452
  return;
14620
15453
  }
14621
15454
  default:
@@ -14651,6 +15484,7 @@ const FfiConverterTypeReceivePaymentMethod = (() => {
14651
15484
  size += FfiConverterString.allocationSize(inner.description);
14652
15485
  size += FfiConverterOptionalUInt64.allocationSize(inner.amountSats);
14653
15486
  size += FfiConverterOptionalUInt32.allocationSize(inner.expirySecs);
15487
+ size += FfiConverterOptionalString.allocationSize(inner.paymentHash);
14654
15488
  return size;
14655
15489
  }
14656
15490
  default:
@@ -16320,13 +17154,19 @@ export const SendPaymentOptions = (() => {
16320
17154
  readonly [uniffiTypeNameSymbol] = 'SendPaymentOptions';
16321
17155
  readonly tag = SendPaymentOptions_Tags.BitcoinAddress;
16322
17156
  readonly inner: Readonly<{ confirmationSpeed: OnchainConfirmationSpeed }>;
16323
- constructor(inner: { confirmationSpeed: OnchainConfirmationSpeed }) {
17157
+ constructor(inner: {
17158
+ /**
17159
+ * Confirmation speed for the on-chain transaction.
17160
+ */ confirmationSpeed: OnchainConfirmationSpeed;
17161
+ }) {
16324
17162
  super('SendPaymentOptions', 'BitcoinAddress');
16325
17163
  this.inner = Object.freeze(inner);
16326
17164
  }
16327
17165
 
16328
17166
  static new(inner: {
16329
- confirmationSpeed: OnchainConfirmationSpeed;
17167
+ /**
17168
+ * Confirmation speed for the on-chain transaction.
17169
+ */ confirmationSpeed: OnchainConfirmationSpeed;
16330
17170
  }): BitcoinAddress_ {
16331
17171
  return new BitcoinAddress_(inner);
16332
17172
  }
@@ -17114,6 +17954,73 @@ const FfiConverterTypeServiceConnectivityError = (() => {
17114
17954
  return new FFIConverter();
17115
17955
  })();
17116
17956
 
17957
+ /**
17958
+ * The operational status of a Spark service.
17959
+ */
17960
+ export enum ServiceStatus {
17961
+ /**
17962
+ * Service is fully operational.
17963
+ */
17964
+ Operational,
17965
+ /**
17966
+ * Service is experiencing degraded performance.
17967
+ */
17968
+ Degraded,
17969
+ /**
17970
+ * Service is partially unavailable.
17971
+ */
17972
+ Partial,
17973
+ /**
17974
+ * Service status is unknown.
17975
+ */
17976
+ Unknown,
17977
+ /**
17978
+ * Service is experiencing a major outage.
17979
+ */
17980
+ Major,
17981
+ }
17982
+
17983
+ const FfiConverterTypeServiceStatus = (() => {
17984
+ const ordinalConverter = FfiConverterInt32;
17985
+ type TypeName = ServiceStatus;
17986
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
17987
+ read(from: RustBuffer): TypeName {
17988
+ switch (ordinalConverter.read(from)) {
17989
+ case 1:
17990
+ return ServiceStatus.Operational;
17991
+ case 2:
17992
+ return ServiceStatus.Degraded;
17993
+ case 3:
17994
+ return ServiceStatus.Partial;
17995
+ case 4:
17996
+ return ServiceStatus.Unknown;
17997
+ case 5:
17998
+ return ServiceStatus.Major;
17999
+ default:
18000
+ throw new UniffiInternalError.UnexpectedEnumCase();
18001
+ }
18002
+ }
18003
+ write(value: TypeName, into: RustBuffer): void {
18004
+ switch (value) {
18005
+ case ServiceStatus.Operational:
18006
+ return ordinalConverter.write(1, into);
18007
+ case ServiceStatus.Degraded:
18008
+ return ordinalConverter.write(2, into);
18009
+ case ServiceStatus.Partial:
18010
+ return ordinalConverter.write(3, into);
18011
+ case ServiceStatus.Unknown:
18012
+ return ordinalConverter.write(4, into);
18013
+ case ServiceStatus.Major:
18014
+ return ordinalConverter.write(5, into);
18015
+ }
18016
+ }
18017
+ allocationSize(value: TypeName): number {
18018
+ return ordinalConverter.allocationSize(0);
18019
+ }
18020
+ }
18021
+ return new FFIConverter();
18022
+ })();
18023
+
17117
18024
  // Error type: SignerError
17118
18025
 
17119
18026
  // Enum: SignerError
@@ -17577,6 +18484,7 @@ const FfiConverterTypeSparkHtlcStatus = (() => {
17577
18484
 
17578
18485
  // Enum: StorageError
17579
18486
  export enum StorageError_Tags {
18487
+ Connection = 'Connection',
17580
18488
  Implementation = 'Implementation',
17581
18489
  InitializationError = 'InitializationError',
17582
18490
  Serialization = 'Serialization',
@@ -17585,6 +18493,45 @@ export enum StorageError_Tags {
17585
18493
  * Errors that can occur during storage operations
17586
18494
  */
17587
18495
  export const StorageError = (() => {
18496
+ type Connection__interface = {
18497
+ tag: StorageError_Tags.Connection;
18498
+ inner: Readonly<[string]>;
18499
+ };
18500
+
18501
+ /**
18502
+ * Connection-related errors (pool exhaustion, timeouts, connection refused).
18503
+ * These are often transient and may be retried.
18504
+ */
18505
+ class Connection_ extends UniffiError implements Connection__interface {
18506
+ /**
18507
+ * @private
18508
+ * This field is private and should not be used, use `tag` instead.
18509
+ */
18510
+ readonly [uniffiTypeNameSymbol] = 'StorageError';
18511
+ readonly tag = StorageError_Tags.Connection;
18512
+ readonly inner: Readonly<[string]>;
18513
+ constructor(v0: string) {
18514
+ super('StorageError', 'Connection');
18515
+ this.inner = Object.freeze([v0]);
18516
+ }
18517
+
18518
+ static new(v0: string): Connection_ {
18519
+ return new Connection_(v0);
18520
+ }
18521
+
18522
+ static instanceOf(obj: any): obj is Connection_ {
18523
+ return obj.tag === StorageError_Tags.Connection;
18524
+ }
18525
+
18526
+ static hasInner(obj: any): obj is Connection_ {
18527
+ return Connection_.instanceOf(obj);
18528
+ }
18529
+
18530
+ static getInner(obj: Connection_): Readonly<[string]> {
18531
+ return obj.inner;
18532
+ }
18533
+ }
18534
+
17588
18535
  type Implementation__interface = {
17589
18536
  tag: StorageError_Tags.Implementation;
17590
18537
  inner: Readonly<[string]>;
@@ -17705,6 +18652,7 @@ export const StorageError = (() => {
17705
18652
 
17706
18653
  return Object.freeze({
17707
18654
  instanceOf,
18655
+ Connection: Connection_,
17708
18656
  Implementation: Implementation_,
17709
18657
  InitializationError: InitializationError_,
17710
18658
  Serialization: Serialization_,
@@ -17727,12 +18675,14 @@ const FfiConverterTypeStorageError = (() => {
17727
18675
  read(from: RustBuffer): TypeName {
17728
18676
  switch (ordinalConverter.read(from)) {
17729
18677
  case 1:
17730
- return new StorageError.Implementation(FfiConverterString.read(from));
18678
+ return new StorageError.Connection(FfiConverterString.read(from));
17731
18679
  case 2:
18680
+ return new StorageError.Implementation(FfiConverterString.read(from));
18681
+ case 3:
17732
18682
  return new StorageError.InitializationError(
17733
18683
  FfiConverterString.read(from)
17734
18684
  );
17735
- case 3:
18685
+ case 4:
17736
18686
  return new StorageError.Serialization(FfiConverterString.read(from));
17737
18687
  default:
17738
18688
  throw new UniffiInternalError.UnexpectedEnumCase();
@@ -17740,24 +18690,30 @@ const FfiConverterTypeStorageError = (() => {
17740
18690
  }
17741
18691
  write(value: TypeName, into: RustBuffer): void {
17742
18692
  switch (value.tag) {
17743
- case StorageError_Tags.Implementation: {
18693
+ case StorageError_Tags.Connection: {
17744
18694
  ordinalConverter.write(1, into);
17745
18695
  const inner = value.inner;
17746
18696
  FfiConverterString.write(inner[0], into);
17747
18697
  return;
17748
18698
  }
17749
- case StorageError_Tags.InitializationError: {
18699
+ case StorageError_Tags.Implementation: {
17750
18700
  ordinalConverter.write(2, into);
17751
18701
  const inner = value.inner;
17752
18702
  FfiConverterString.write(inner[0], into);
17753
18703
  return;
17754
18704
  }
17755
- case StorageError_Tags.Serialization: {
18705
+ case StorageError_Tags.InitializationError: {
17756
18706
  ordinalConverter.write(3, into);
17757
18707
  const inner = value.inner;
17758
18708
  FfiConverterString.write(inner[0], into);
17759
18709
  return;
17760
18710
  }
18711
+ case StorageError_Tags.Serialization: {
18712
+ ordinalConverter.write(4, into);
18713
+ const inner = value.inner;
18714
+ FfiConverterString.write(inner[0], into);
18715
+ return;
18716
+ }
17761
18717
  default:
17762
18718
  // Throwing from here means that StorageError_Tags hasn't matched an ordinal.
17763
18719
  throw new UniffiInternalError.UnexpectedEnumCase();
@@ -17765,24 +18721,30 @@ const FfiConverterTypeStorageError = (() => {
17765
18721
  }
17766
18722
  allocationSize(value: TypeName): number {
17767
18723
  switch (value.tag) {
17768
- case StorageError_Tags.Implementation: {
18724
+ case StorageError_Tags.Connection: {
17769
18725
  const inner = value.inner;
17770
18726
  let size = ordinalConverter.allocationSize(1);
17771
18727
  size += FfiConverterString.allocationSize(inner[0]);
17772
18728
  return size;
17773
18729
  }
17774
- case StorageError_Tags.InitializationError: {
18730
+ case StorageError_Tags.Implementation: {
17775
18731
  const inner = value.inner;
17776
18732
  let size = ordinalConverter.allocationSize(2);
17777
18733
  size += FfiConverterString.allocationSize(inner[0]);
17778
18734
  return size;
17779
18735
  }
17780
- case StorageError_Tags.Serialization: {
18736
+ case StorageError_Tags.InitializationError: {
17781
18737
  const inner = value.inner;
17782
18738
  let size = ordinalConverter.allocationSize(3);
17783
18739
  size += FfiConverterString.allocationSize(inner[0]);
17784
18740
  return size;
17785
18741
  }
18742
+ case StorageError_Tags.Serialization: {
18743
+ const inner = value.inner;
18744
+ let size = ordinalConverter.allocationSize(4);
18745
+ size += FfiConverterString.allocationSize(inner[0]);
18746
+ return size;
18747
+ }
17786
18748
  default:
17787
18749
  throw new UniffiInternalError.UnexpectedEnumCase();
17788
18750
  }
@@ -18210,240 +19172,57 @@ const FfiConverterTypeSuccessActionProcessed = (() => {
18210
19172
  return new FFIConverter();
18211
19173
  })();
18212
19174
 
18213
- // Error type: SyncStorageError
19175
+ export enum TokenTransactionType {
19176
+ Transfer,
19177
+ Mint,
19178
+ Burn,
19179
+ }
18214
19180
 
18215
- // Enum: SyncStorageError
18216
- export enum SyncStorageError_Tags {
18217
- Implementation = 'Implementation',
18218
- InitializationError = 'InitializationError',
18219
- Serialization = 'Serialization',
19181
+ const FfiConverterTypeTokenTransactionType = (() => {
19182
+ const ordinalConverter = FfiConverterInt32;
19183
+ type TypeName = TokenTransactionType;
19184
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
19185
+ read(from: RustBuffer): TypeName {
19186
+ switch (ordinalConverter.read(from)) {
19187
+ case 1:
19188
+ return TokenTransactionType.Transfer;
19189
+ case 2:
19190
+ return TokenTransactionType.Mint;
19191
+ case 3:
19192
+ return TokenTransactionType.Burn;
19193
+ default:
19194
+ throw new UniffiInternalError.UnexpectedEnumCase();
19195
+ }
19196
+ }
19197
+ write(value: TypeName, into: RustBuffer): void {
19198
+ switch (value) {
19199
+ case TokenTransactionType.Transfer:
19200
+ return ordinalConverter.write(1, into);
19201
+ case TokenTransactionType.Mint:
19202
+ return ordinalConverter.write(2, into);
19203
+ case TokenTransactionType.Burn:
19204
+ return ordinalConverter.write(3, into);
19205
+ }
19206
+ }
19207
+ allocationSize(value: TypeName): number {
19208
+ return ordinalConverter.allocationSize(0);
19209
+ }
19210
+ }
19211
+ return new FFIConverter();
19212
+ })();
19213
+
19214
+ // Enum: UpdateDepositPayload
19215
+ export enum UpdateDepositPayload_Tags {
19216
+ ClaimError = 'ClaimError',
19217
+ Refund = 'Refund',
18220
19218
  }
18221
- /**
18222
- * Errors that can occur during storage operations
18223
- */
18224
- export const SyncStorageError = (() => {
18225
- type Implementation__interface = {
18226
- tag: SyncStorageError_Tags.Implementation;
18227
- inner: Readonly<[string]>;
19219
+ export const UpdateDepositPayload = (() => {
19220
+ type ClaimError__interface = {
19221
+ tag: UpdateDepositPayload_Tags.ClaimError;
19222
+ inner: Readonly<{ error: DepositClaimError }>;
18228
19223
  };
18229
19224
 
18230
- class Implementation_
18231
- extends UniffiError
18232
- implements Implementation__interface
18233
- {
18234
- /**
18235
- * @private
18236
- * This field is private and should not be used, use `tag` instead.
18237
- */
18238
- readonly [uniffiTypeNameSymbol] = 'SyncStorageError';
18239
- readonly tag = SyncStorageError_Tags.Implementation;
18240
- readonly inner: Readonly<[string]>;
18241
- constructor(v0: string) {
18242
- super('SyncStorageError', 'Implementation');
18243
- this.inner = Object.freeze([v0]);
18244
- }
18245
-
18246
- static new(v0: string): Implementation_ {
18247
- return new Implementation_(v0);
18248
- }
18249
-
18250
- static instanceOf(obj: any): obj is Implementation_ {
18251
- return obj.tag === SyncStorageError_Tags.Implementation;
18252
- }
18253
-
18254
- static hasInner(obj: any): obj is Implementation_ {
18255
- return Implementation_.instanceOf(obj);
18256
- }
18257
-
18258
- static getInner(obj: Implementation_): Readonly<[string]> {
18259
- return obj.inner;
18260
- }
18261
- }
18262
-
18263
- type InitializationError__interface = {
18264
- tag: SyncStorageError_Tags.InitializationError;
18265
- inner: Readonly<[string]>;
18266
- };
18267
-
18268
- /**
18269
- * Database initialization error
18270
- */
18271
- class InitializationError_
18272
- extends UniffiError
18273
- implements InitializationError__interface
18274
- {
18275
- /**
18276
- * @private
18277
- * This field is private and should not be used, use `tag` instead.
18278
- */
18279
- readonly [uniffiTypeNameSymbol] = 'SyncStorageError';
18280
- readonly tag = SyncStorageError_Tags.InitializationError;
18281
- readonly inner: Readonly<[string]>;
18282
- constructor(v0: string) {
18283
- super('SyncStorageError', 'InitializationError');
18284
- this.inner = Object.freeze([v0]);
18285
- }
18286
-
18287
- static new(v0: string): InitializationError_ {
18288
- return new InitializationError_(v0);
18289
- }
18290
-
18291
- static instanceOf(obj: any): obj is InitializationError_ {
18292
- return obj.tag === SyncStorageError_Tags.InitializationError;
18293
- }
18294
-
18295
- static hasInner(obj: any): obj is InitializationError_ {
18296
- return InitializationError_.instanceOf(obj);
18297
- }
18298
-
18299
- static getInner(obj: InitializationError_): Readonly<[string]> {
18300
- return obj.inner;
18301
- }
18302
- }
18303
-
18304
- type Serialization__interface = {
18305
- tag: SyncStorageError_Tags.Serialization;
18306
- inner: Readonly<[string]>;
18307
- };
18308
-
18309
- class Serialization_ extends UniffiError implements Serialization__interface {
18310
- /**
18311
- * @private
18312
- * This field is private and should not be used, use `tag` instead.
18313
- */
18314
- readonly [uniffiTypeNameSymbol] = 'SyncStorageError';
18315
- readonly tag = SyncStorageError_Tags.Serialization;
18316
- readonly inner: Readonly<[string]>;
18317
- constructor(v0: string) {
18318
- super('SyncStorageError', 'Serialization');
18319
- this.inner = Object.freeze([v0]);
18320
- }
18321
-
18322
- static new(v0: string): Serialization_ {
18323
- return new Serialization_(v0);
18324
- }
18325
-
18326
- static instanceOf(obj: any): obj is Serialization_ {
18327
- return obj.tag === SyncStorageError_Tags.Serialization;
18328
- }
18329
-
18330
- static hasInner(obj: any): obj is Serialization_ {
18331
- return Serialization_.instanceOf(obj);
18332
- }
18333
-
18334
- static getInner(obj: Serialization_): Readonly<[string]> {
18335
- return obj.inner;
18336
- }
18337
- }
18338
-
18339
- function instanceOf(obj: any): obj is SyncStorageError {
18340
- return obj[uniffiTypeNameSymbol] === 'SyncStorageError';
18341
- }
18342
-
18343
- return Object.freeze({
18344
- instanceOf,
18345
- Implementation: Implementation_,
18346
- InitializationError: InitializationError_,
18347
- Serialization: Serialization_,
18348
- });
18349
- })();
18350
-
18351
- /**
18352
- * Errors that can occur during storage operations
18353
- */
18354
-
18355
- export type SyncStorageError = InstanceType<
18356
- (typeof SyncStorageError)[keyof Omit<typeof SyncStorageError, 'instanceOf'>]
18357
- >;
18358
-
18359
- // FfiConverter for enum SyncStorageError
18360
- const FfiConverterTypeSyncStorageError = (() => {
18361
- const ordinalConverter = FfiConverterInt32;
18362
- type TypeName = SyncStorageError;
18363
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
18364
- read(from: RustBuffer): TypeName {
18365
- switch (ordinalConverter.read(from)) {
18366
- case 1:
18367
- return new SyncStorageError.Implementation(
18368
- FfiConverterString.read(from)
18369
- );
18370
- case 2:
18371
- return new SyncStorageError.InitializationError(
18372
- FfiConverterString.read(from)
18373
- );
18374
- case 3:
18375
- return new SyncStorageError.Serialization(
18376
- FfiConverterString.read(from)
18377
- );
18378
- default:
18379
- throw new UniffiInternalError.UnexpectedEnumCase();
18380
- }
18381
- }
18382
- write(value: TypeName, into: RustBuffer): void {
18383
- switch (value.tag) {
18384
- case SyncStorageError_Tags.Implementation: {
18385
- ordinalConverter.write(1, into);
18386
- const inner = value.inner;
18387
- FfiConverterString.write(inner[0], into);
18388
- return;
18389
- }
18390
- case SyncStorageError_Tags.InitializationError: {
18391
- ordinalConverter.write(2, into);
18392
- const inner = value.inner;
18393
- FfiConverterString.write(inner[0], into);
18394
- return;
18395
- }
18396
- case SyncStorageError_Tags.Serialization: {
18397
- ordinalConverter.write(3, into);
18398
- const inner = value.inner;
18399
- FfiConverterString.write(inner[0], into);
18400
- return;
18401
- }
18402
- default:
18403
- // Throwing from here means that SyncStorageError_Tags hasn't matched an ordinal.
18404
- throw new UniffiInternalError.UnexpectedEnumCase();
18405
- }
18406
- }
18407
- allocationSize(value: TypeName): number {
18408
- switch (value.tag) {
18409
- case SyncStorageError_Tags.Implementation: {
18410
- const inner = value.inner;
18411
- let size = ordinalConverter.allocationSize(1);
18412
- size += FfiConverterString.allocationSize(inner[0]);
18413
- return size;
18414
- }
18415
- case SyncStorageError_Tags.InitializationError: {
18416
- const inner = value.inner;
18417
- let size = ordinalConverter.allocationSize(2);
18418
- size += FfiConverterString.allocationSize(inner[0]);
18419
- return size;
18420
- }
18421
- case SyncStorageError_Tags.Serialization: {
18422
- const inner = value.inner;
18423
- let size = ordinalConverter.allocationSize(3);
18424
- size += FfiConverterString.allocationSize(inner[0]);
18425
- return size;
18426
- }
18427
- default:
18428
- throw new UniffiInternalError.UnexpectedEnumCase();
18429
- }
18430
- }
18431
- }
18432
- return new FFIConverter();
18433
- })();
18434
-
18435
- // Enum: UpdateDepositPayload
18436
- export enum UpdateDepositPayload_Tags {
18437
- ClaimError = 'ClaimError',
18438
- Refund = 'Refund',
18439
- }
18440
- export const UpdateDepositPayload = (() => {
18441
- type ClaimError__interface = {
18442
- tag: UpdateDepositPayload_Tags.ClaimError;
18443
- inner: Readonly<{ error: DepositClaimError }>;
18444
- };
18445
-
18446
- class ClaimError_ extends UniffiEnum implements ClaimError__interface {
19225
+ class ClaimError_ extends UniffiEnum implements ClaimError__interface {
18447
19226
  /**
18448
19227
  * @private
18449
19228
  * This field is private and should not be used, use `tag` instead.
@@ -19162,6 +19941,25 @@ export interface BreezSdkInterface {
19162
19941
  listener: EventListener,
19163
19942
  asyncOpts_?: { signal: AbortSignal }
19164
19943
  ): Promise<string>;
19944
+ /**
19945
+ * Initiates a Bitcoin purchase flow via an external provider (`MoonPay`).
19946
+ *
19947
+ * This method generates a URL that the user can open in a browser to complete
19948
+ * the Bitcoin purchase. The purchased Bitcoin will be sent to an automatically
19949
+ * generated deposit address.
19950
+ *
19951
+ * # Arguments
19952
+ *
19953
+ * * `request` - The purchase request containing optional amount and redirect URL
19954
+ *
19955
+ * # Returns
19956
+ *
19957
+ * A response containing the URL to open in a browser to complete the purchase
19958
+ */
19959
+ buyBitcoin(
19960
+ request: BuyBitcoinRequest,
19961
+ asyncOpts_?: { signal: AbortSignal }
19962
+ ): /*throws*/ Promise<BuyBitcoinResponse>;
19165
19963
  /**
19166
19964
  * Cancels the ongoing leaf optimization.
19167
19965
  *
@@ -19270,21 +20068,20 @@ export interface BreezSdkInterface {
19270
20068
  signal: AbortSignal;
19271
20069
  }): /*throws*/ Promise<ListFiatRatesResponse>;
19272
20070
  /**
19273
- * Lists payments from the storage with pagination
19274
- *
19275
- * This method provides direct access to the payment history stored in the database.
19276
- * It returns payments in reverse chronological order (newest first).
19277
- *
19278
- * # Arguments
19279
- *
19280
- * * `request` - Contains pagination parameters (offset and limit)
19281
- *
19282
- * # Returns
19283
- *
19284
- * * `Ok(ListPaymentsResponse)` - Contains the list of payments if successful
19285
- * * `Err(SdkError)` - If there was an error accessing the storage
19286
-
19287
- */
20071
+ * Lists payments from the storage with pagination
20072
+ *
20073
+ * This method provides direct access to the payment history stored in the database.
20074
+ * It returns payments in reverse chronological order (newest first).
20075
+ *
20076
+ * # Arguments
20077
+ *
20078
+ * * `request` - Contains pagination parameters (offset and limit)
20079
+ *
20080
+ * # Returns
20081
+ *
20082
+ * * `Ok(ListPaymentsResponse)` - Contains the list of payments if successful
20083
+ * * `Err(SdkError)` - If there was an error accessing the storage
20084
+ */
19288
20085
  listPayments(
19289
20086
  request: ListPaymentsRequest,
19290
20087
  asyncOpts_?: { signal: AbortSignal }
@@ -19299,48 +20096,6 @@ export interface BreezSdkInterface {
19299
20096
  * This method implements the LNURL-auth protocol as specified in LUD-04 and LUD-05.
19300
20097
  * It derives a domain-specific linking key, signs the challenge, and sends the
19301
20098
  * authentication request to the service.
19302
- *
19303
- * # Arguments
19304
- *
19305
- * * `request_data` - The parsed LNURL-auth request details obtained from [`parse`]
19306
- *
19307
- * # Returns
19308
- *
19309
- * * `Ok(LnurlCallbackStatus::Ok)` - Authentication was successful
19310
- * * `Ok(LnurlCallbackStatus::ErrorStatus{reason})` - Service returned an error
19311
- * * `Err(SdkError)` - An error occurred during the authentication process
19312
- *
19313
- * # Example
19314
- *
19315
- * ```rust,no_run
19316
- * # use breez_sdk_spark::{BreezSdk, InputType};
19317
- * # async fn example(sdk: BreezSdk) -> Result<(), Box<dyn std::error::Error>> {
19318
- * // 1. Parse the LNURL-auth string
19319
- * let input = sdk.parse("lnurl1...").await?;
19320
- * let auth_request = match input {
19321
- * InputType::LnurlAuth(data) => data,
19322
- * _ => return Err("Not an auth request".into()),
19323
- * };
19324
- *
19325
- * // 2. Show user the domain and get confirmation
19326
- * println!("Authenticate with {}?", auth_request.domain);
19327
- *
19328
- * // 3. Perform authentication
19329
- * let status = sdk.lnurl_auth(auth_request).await?;
19330
- * match status {
19331
- * breez_sdk_spark::LnurlCallbackStatus::Ok => println!("Success!"),
19332
- * breez_sdk_spark::LnurlCallbackStatus::ErrorStatus { error_details } => {
19333
- * println!("Error: {}", error_details.reason)
19334
- * }
19335
- * }
19336
- * # Ok(())
19337
- * # }
19338
- * ```
19339
- *
19340
- * # See Also
19341
- *
19342
- * * LUD-04: <https://github.com/lnurl/luds/blob/luds/04.md>
19343
- * * LUD-05: <https://github.com/lnurl/luds/blob/luds/05.md>
19344
20099
  */
19345
20100
  lnurlAuth(
19346
20101
  requestData: LnurlAuthRequestDetails,
@@ -19529,6 +20284,60 @@ export class BreezSdk
19529
20284
  }
19530
20285
  }
19531
20286
 
20287
+ /**
20288
+ * Initiates a Bitcoin purchase flow via an external provider (`MoonPay`).
20289
+ *
20290
+ * This method generates a URL that the user can open in a browser to complete
20291
+ * the Bitcoin purchase. The purchased Bitcoin will be sent to an automatically
20292
+ * generated deposit address.
20293
+ *
20294
+ * # Arguments
20295
+ *
20296
+ * * `request` - The purchase request containing optional amount and redirect URL
20297
+ *
20298
+ * # Returns
20299
+ *
20300
+ * A response containing the URL to open in a browser to complete the purchase
20301
+ */
20302
+ public async buyBitcoin(
20303
+ request: BuyBitcoinRequest,
20304
+ asyncOpts_?: { signal: AbortSignal }
20305
+ ): Promise<BuyBitcoinResponse> /*throws*/ {
20306
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
20307
+ try {
20308
+ return await uniffiRustCallAsync(
20309
+ /*rustCaller:*/ uniffiCaller,
20310
+ /*rustFutureFunc:*/ () => {
20311
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_buy_bitcoin(
20312
+ uniffiTypeBreezSdkObjectFactory.clonePointer(this),
20313
+ FfiConverterTypeBuyBitcoinRequest.lower(request)
20314
+ );
20315
+ },
20316
+ /*pollFunc:*/ nativeModule()
20317
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
20318
+ /*cancelFunc:*/ nativeModule()
20319
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
20320
+ /*completeFunc:*/ nativeModule()
20321
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
20322
+ /*freeFunc:*/ nativeModule()
20323
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
20324
+ /*liftFunc:*/ FfiConverterTypeBuyBitcoinResponse.lift.bind(
20325
+ FfiConverterTypeBuyBitcoinResponse
20326
+ ),
20327
+ /*liftString:*/ FfiConverterString.lift,
20328
+ /*asyncOpts:*/ asyncOpts_,
20329
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
20330
+ FfiConverterTypeSdkError
20331
+ )
20332
+ );
20333
+ } catch (__error: any) {
20334
+ if (uniffiIsDebug && __error instanceof Error) {
20335
+ __error.stack = __stack;
20336
+ }
20337
+ throw __error;
20338
+ }
20339
+ }
20340
+
19532
20341
  /**
19533
20342
  * Cancels the ongoing leaf optimization.
19534
20343
  *
@@ -20175,26 +20984,25 @@ export class BreezSdk
20175
20984
  }
20176
20985
 
20177
20986
  /**
20178
- * Lists payments from the storage with pagination
20179
- *
20180
- * This method provides direct access to the payment history stored in the database.
20181
- * It returns payments in reverse chronological order (newest first).
20182
- *
20183
- * # Arguments
20184
- *
20185
- * * `request` - Contains pagination parameters (offset and limit)
20186
- *
20187
- * # Returns
20188
- *
20189
- * * `Ok(ListPaymentsResponse)` - Contains the list of payments if successful
20190
- * * `Err(SdkError)` - If there was an error accessing the storage
20191
-
20192
- */
20193
- public async listPayments(
20194
- request: ListPaymentsRequest,
20195
- asyncOpts_?: { signal: AbortSignal }
20196
- ): Promise<ListPaymentsResponse> /*throws*/ {
20197
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
20987
+ * Lists payments from the storage with pagination
20988
+ *
20989
+ * This method provides direct access to the payment history stored in the database.
20990
+ * It returns payments in reverse chronological order (newest first).
20991
+ *
20992
+ * # Arguments
20993
+ *
20994
+ * * `request` - Contains pagination parameters (offset and limit)
20995
+ *
20996
+ * # Returns
20997
+ *
20998
+ * * `Ok(ListPaymentsResponse)` - Contains the list of payments if successful
20999
+ * * `Err(SdkError)` - If there was an error accessing the storage
21000
+ */
21001
+ public async listPayments(
21002
+ request: ListPaymentsRequest,
21003
+ asyncOpts_?: { signal: AbortSignal }
21004
+ ): Promise<ListPaymentsResponse> /*throws*/ {
21005
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
20198
21006
  try {
20199
21007
  return await uniffiRustCallAsync(
20200
21008
  /*rustCaller:*/ uniffiCaller,
@@ -20274,48 +21082,6 @@ export class BreezSdk
20274
21082
  * This method implements the LNURL-auth protocol as specified in LUD-04 and LUD-05.
20275
21083
  * It derives a domain-specific linking key, signs the challenge, and sends the
20276
21084
  * authentication request to the service.
20277
- *
20278
- * # Arguments
20279
- *
20280
- * * `request_data` - The parsed LNURL-auth request details obtained from [`parse`]
20281
- *
20282
- * # Returns
20283
- *
20284
- * * `Ok(LnurlCallbackStatus::Ok)` - Authentication was successful
20285
- * * `Ok(LnurlCallbackStatus::ErrorStatus{reason})` - Service returned an error
20286
- * * `Err(SdkError)` - An error occurred during the authentication process
20287
- *
20288
- * # Example
20289
- *
20290
- * ```rust,no_run
20291
- * # use breez_sdk_spark::{BreezSdk, InputType};
20292
- * # async fn example(sdk: BreezSdk) -> Result<(), Box<dyn std::error::Error>> {
20293
- * // 1. Parse the LNURL-auth string
20294
- * let input = sdk.parse("lnurl1...").await?;
20295
- * let auth_request = match input {
20296
- * InputType::LnurlAuth(data) => data,
20297
- * _ => return Err("Not an auth request".into()),
20298
- * };
20299
- *
20300
- * // 2. Show user the domain and get confirmation
20301
- * println!("Authenticate with {}?", auth_request.domain);
20302
- *
20303
- * // 3. Perform authentication
20304
- * let status = sdk.lnurl_auth(auth_request).await?;
20305
- * match status {
20306
- * breez_sdk_spark::LnurlCallbackStatus::Ok => println!("Success!"),
20307
- * breez_sdk_spark::LnurlCallbackStatus::ErrorStatus { error_details } => {
20308
- * println!("Error: {}", error_details.reason)
20309
- * }
20310
- * }
20311
- * # Ok(())
20312
- * # }
20313
- * ```
20314
- *
20315
- * # See Also
20316
- *
20317
- * * LUD-04: <https://github.com/lnurl/luds/blob/luds/04.md>
20318
- * * LUD-05: <https://github.com/lnurl/luds/blob/luds/05.md>
20319
21085
  */
20320
21086
  public async lnurlAuth(
20321
21087
  requestData: LnurlAuthRequestDetails,
@@ -21277,6 +22043,8 @@ export interface ExternalSigner {
21277
22043
  /**
21278
22044
  * Subtracts one secret from another.
21279
22045
  *
22046
+ * This is a lower-level primitive used as part of key tweaking operations.
22047
+ *
21280
22048
  * # Arguments
21281
22049
  * * `signing_key` - The first secret
21282
22050
  * * `new_signing_key` - The second secret to subtract
@@ -22089,6 +22857,8 @@ export class ExternalSignerImpl
22089
22857
  /**
22090
22858
  * Subtracts one secret from another.
22091
22859
  *
22860
+ * This is a lower-level primitive used as part of key tweaking operations.
22861
+ *
22092
22862
  * # Arguments
22093
22863
  * * `signing_key` - The first secret
22094
22864
  * * `new_signing_key` - The second secret to subtract
@@ -23962,6 +24732,13 @@ const uniffiCallbackInterfacePaymentObserver: {
23962
24732
  },
23963
24733
  };
23964
24734
 
24735
+ /**
24736
+ * REST client trait for making HTTP requests.
24737
+ *
24738
+ * This trait provides a way for users to supply their own HTTP client implementation
24739
+ * for use with the SDK. The SDK will use this client for all HTTP operations including
24740
+ * LNURL flows and chain service requests.
24741
+ */
23965
24742
  export interface RestClient {
23966
24743
  /**
23967
24744
  * Makes a GET request and logs on DEBUG.
@@ -24002,6 +24779,13 @@ export interface RestClient {
24002
24779
  ): /*throws*/ Promise<RestResponse>;
24003
24780
  }
24004
24781
 
24782
+ /**
24783
+ * REST client trait for making HTTP requests.
24784
+ *
24785
+ * This trait provides a way for users to supply their own HTTP client implementation
24786
+ * for use with the SDK. The SDK will use this client for all HTTP operations including
24787
+ * LNURL flows and chain service requests.
24788
+ */
24005
24789
  export class RestClientImpl extends UniffiAbstractObject implements RestClient {
24006
24790
  readonly [uniffiTypeNameSymbol] = 'RestClientImpl';
24007
24791
  readonly [destructorGuardSymbol]: UniffiRustArcPtr;
@@ -24476,15 +25260,6 @@ export interface SdkBuilderInterface {
24476
25260
  paymentObserver: PaymentObserver,
24477
25261
  asyncOpts_?: { signal: AbortSignal }
24478
25262
  ): Promise<void>;
24479
- /**
24480
- * Sets the real-time sync storage implementation to be used by the SDK.
24481
- * Arguments:
24482
- * - `storage`: The sync storage implementation to be used.
24483
- */
24484
- withRealTimeSyncStorage(
24485
- storage: SyncStorage,
24486
- asyncOpts_?: { signal: AbortSignal }
24487
- ): Promise<void>;
24488
25263
  /**
24489
25264
  * Sets the REST chain service to be used by the SDK.
24490
25265
  * Arguments:
@@ -24813,45 +25588,6 @@ export class SdkBuilder
24813
25588
  }
24814
25589
  }
24815
25590
 
24816
- /**
24817
- * Sets the real-time sync storage implementation to be used by the SDK.
24818
- * Arguments:
24819
- * - `storage`: The sync storage implementation to be used.
24820
- */
24821
- public async withRealTimeSyncStorage(
24822
- storage: SyncStorage,
24823
- asyncOpts_?: { signal: AbortSignal }
24824
- ): Promise<void> {
24825
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
24826
- try {
24827
- return await uniffiRustCallAsync(
24828
- /*rustCaller:*/ uniffiCaller,
24829
- /*rustFutureFunc:*/ () => {
24830
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_real_time_sync_storage(
24831
- uniffiTypeSdkBuilderObjectFactory.clonePointer(this),
24832
- FfiConverterTypeSyncStorage.lower(storage)
24833
- );
24834
- },
24835
- /*pollFunc:*/ nativeModule()
24836
- .ubrn_ffi_breez_sdk_spark_rust_future_poll_void,
24837
- /*cancelFunc:*/ nativeModule()
24838
- .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void,
24839
- /*completeFunc:*/ nativeModule()
24840
- .ubrn_ffi_breez_sdk_spark_rust_future_complete_void,
24841
- /*freeFunc:*/ nativeModule()
24842
- .ubrn_ffi_breez_sdk_spark_rust_future_free_void,
24843
- /*liftFunc:*/ (_v) => {},
24844
- /*liftString:*/ FfiConverterString.lift,
24845
- /*asyncOpts:*/ asyncOpts_
24846
- );
24847
- } catch (__error: any) {
24848
- if (uniffiIsDebug && __error instanceof Error) {
24849
- __error.stack = __stack;
24850
- }
24851
- throw __error;
24852
- }
24853
- }
24854
-
24855
25591
  /**
24856
25592
  * Sets the REST chain service to be used by the SDK.
24857
25593
  * Arguments:
@@ -25079,7 +25815,7 @@ export interface Storage {
25079
25815
  *
25080
25816
  * Success or a `StorageError`
25081
25817
  */
25082
- setPaymentMetadata(
25818
+ insertPaymentMetadata(
25083
25819
  paymentId: string,
25084
25820
  metadata: PaymentMetadata,
25085
25821
  asyncOpts_?: { signal: AbortSignal }
@@ -25111,6 +25847,22 @@ export interface Storage {
25111
25847
  invoice: string,
25112
25848
  asyncOpts_?: { signal: AbortSignal }
25113
25849
  ): /*throws*/ Promise<Payment | undefined>;
25850
+ /**
25851
+ * Gets payments that have any of the specified parent payment IDs.
25852
+ * Used to load related payments for a set of parent payments.
25853
+ *
25854
+ * # Arguments
25855
+ *
25856
+ * * `parent_payment_ids` - The IDs of the parent payments
25857
+ *
25858
+ * # Returns
25859
+ *
25860
+ * A map of `parent_payment_id` -> Vec<Payment> or a `StorageError`
25861
+ */
25862
+ getPaymentsByParentIds(
25863
+ parentPaymentIds: Array<string>,
25864
+ asyncOpts_?: { signal: AbortSignal }
25865
+ ): /*throws*/ Promise<Map<string, Array<Payment>>>;
25114
25866
  /**
25115
25867
  * Add a deposit to storage
25116
25868
  * # Arguments
@@ -25176,6 +25928,64 @@ export interface Storage {
25176
25928
  metadata: Array<SetLnurlMetadataItem>,
25177
25929
  asyncOpts_?: { signal: AbortSignal }
25178
25930
  ): /*throws*/ Promise<void>;
25931
+ addOutgoingChange(
25932
+ record: UnversionedRecordChange,
25933
+ asyncOpts_?: { signal: AbortSignal }
25934
+ ): /*throws*/ Promise</*u64*/ bigint>;
25935
+ completeOutgoingSync(
25936
+ record: Record,
25937
+ localRevision: /*u64*/ bigint,
25938
+ asyncOpts_?: { signal: AbortSignal }
25939
+ ): /*throws*/ Promise<void>;
25940
+ getPendingOutgoingChanges(
25941
+ limit: /*u32*/ number,
25942
+ asyncOpts_?: { signal: AbortSignal }
25943
+ ): /*throws*/ Promise<Array<OutgoingChange>>;
25944
+ /**
25945
+ * Get the last committed sync revision.
25946
+ *
25947
+ * The `sync_revision` table tracks the highest revision that has been committed
25948
+ * (i.e. acknowledged by the server or received from it). It does NOT include
25949
+ * pending outgoing queue ids. This value is used by the sync protocol to
25950
+ * request changes from the server.
25951
+ */
25952
+ getLastRevision(asyncOpts_?: {
25953
+ signal: AbortSignal;
25954
+ }): /*throws*/ Promise</*u64*/ bigint>;
25955
+ /**
25956
+ * Insert incoming records from remote sync
25957
+ */
25958
+ insertIncomingRecords(
25959
+ records: Array<Record>,
25960
+ asyncOpts_?: { signal: AbortSignal }
25961
+ ): /*throws*/ Promise<void>;
25962
+ /**
25963
+ * Delete an incoming record after it has been processed
25964
+ */
25965
+ deleteIncomingRecord(
25966
+ record: Record,
25967
+ asyncOpts_?: { signal: AbortSignal }
25968
+ ): /*throws*/ Promise<void>;
25969
+ /**
25970
+ * Get incoming records that need to be processed, up to the specified limit
25971
+ */
25972
+ getIncomingRecords(
25973
+ limit: /*u32*/ number,
25974
+ asyncOpts_?: { signal: AbortSignal }
25975
+ ): /*throws*/ Promise<Array<IncomingChange>>;
25976
+ /**
25977
+ * Get the latest outgoing record if any exists
25978
+ */
25979
+ getLatestOutgoingChange(asyncOpts_?: {
25980
+ signal: AbortSignal;
25981
+ }): /*throws*/ Promise<OutgoingChange | undefined>;
25982
+ /**
25983
+ * Update the sync state record from an incoming record
25984
+ */
25985
+ updateRecordFromIncoming(
25986
+ record: Record,
25987
+ asyncOpts_?: { signal: AbortSignal }
25988
+ ): /*throws*/ Promise<void>;
25179
25989
  }
25180
25990
 
25181
25991
  /**
@@ -25418,7 +26228,7 @@ export class StorageImpl extends UniffiAbstractObject implements Storage {
25418
26228
  *
25419
26229
  * Success or a `StorageError`
25420
26230
  */
25421
- public async setPaymentMetadata(
26231
+ public async insertPaymentMetadata(
25422
26232
  paymentId: string,
25423
26233
  metadata: PaymentMetadata,
25424
26234
  asyncOpts_?: { signal: AbortSignal }
@@ -25428,7 +26238,7 @@ export class StorageImpl extends UniffiAbstractObject implements Storage {
25428
26238
  return await uniffiRustCallAsync(
25429
26239
  /*rustCaller:*/ uniffiCaller,
25430
26240
  /*rustFutureFunc:*/ () => {
25431
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_set_payment_metadata(
26241
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_insert_payment_metadata(
25432
26242
  uniffiTypeStorageImplObjectFactory.clonePointer(this),
25433
26243
  FfiConverterString.lower(paymentId),
25434
26244
  FfiConverterTypePaymentMetadata.lower(metadata)
@@ -25554,6 +26364,57 @@ export class StorageImpl extends UniffiAbstractObject implements Storage {
25554
26364
  }
25555
26365
  }
25556
26366
 
26367
+ /**
26368
+ * Gets payments that have any of the specified parent payment IDs.
26369
+ * Used to load related payments for a set of parent payments.
26370
+ *
26371
+ * # Arguments
26372
+ *
26373
+ * * `parent_payment_ids` - The IDs of the parent payments
26374
+ *
26375
+ * # Returns
26376
+ *
26377
+ * A map of `parent_payment_id` -> Vec<Payment> or a `StorageError`
26378
+ */
26379
+ public async getPaymentsByParentIds(
26380
+ parentPaymentIds: Array<string>,
26381
+ asyncOpts_?: { signal: AbortSignal }
26382
+ ): Promise<Map<string, Array<Payment>>> /*throws*/ {
26383
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
26384
+ try {
26385
+ return await uniffiRustCallAsync(
26386
+ /*rustCaller:*/ uniffiCaller,
26387
+ /*rustFutureFunc:*/ () => {
26388
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_payments_by_parent_ids(
26389
+ uniffiTypeStorageImplObjectFactory.clonePointer(this),
26390
+ FfiConverterArrayString.lower(parentPaymentIds)
26391
+ );
26392
+ },
26393
+ /*pollFunc:*/ nativeModule()
26394
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
26395
+ /*cancelFunc:*/ nativeModule()
26396
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
26397
+ /*completeFunc:*/ nativeModule()
26398
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
26399
+ /*freeFunc:*/ nativeModule()
26400
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
26401
+ /*liftFunc:*/ FfiConverterMapStringArrayTypePayment.lift.bind(
26402
+ FfiConverterMapStringArrayTypePayment
26403
+ ),
26404
+ /*liftString:*/ FfiConverterString.lift,
26405
+ /*asyncOpts:*/ asyncOpts_,
26406
+ /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind(
26407
+ FfiConverterTypeStorageError
26408
+ )
26409
+ );
26410
+ } catch (__error: any) {
26411
+ if (uniffiIsDebug && __error instanceof Error) {
26412
+ __error.stack = __stack;
26413
+ }
26414
+ throw __error;
26415
+ }
26416
+ }
26417
+
25557
26418
  /**
25558
26419
  * Add a deposit to storage
25559
26420
  * # Arguments
@@ -25790,113 +26651,473 @@ export class StorageImpl extends UniffiAbstractObject implements Storage {
25790
26651
  }
25791
26652
  }
25792
26653
 
25793
- /**
25794
- * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
25795
- */
25796
- uniffiDestroy(): void {
25797
- const ptr = (this as any)[destructorGuardSymbol];
25798
- if (ptr !== undefined) {
25799
- const pointer = uniffiTypeStorageImplObjectFactory.pointer(this);
25800
- uniffiTypeStorageImplObjectFactory.freePointer(pointer);
25801
- uniffiTypeStorageImplObjectFactory.unbless(ptr);
25802
- delete (this as any)[destructorGuardSymbol];
26654
+ public async addOutgoingChange(
26655
+ record: UnversionedRecordChange,
26656
+ asyncOpts_?: { signal: AbortSignal }
26657
+ ): Promise</*u64*/ bigint> /*throws*/ {
26658
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
26659
+ try {
26660
+ return await uniffiRustCallAsync(
26661
+ /*rustCaller:*/ uniffiCaller,
26662
+ /*rustFutureFunc:*/ () => {
26663
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_add_outgoing_change(
26664
+ uniffiTypeStorageImplObjectFactory.clonePointer(this),
26665
+ FfiConverterTypeUnversionedRecordChange.lower(record)
26666
+ );
26667
+ },
26668
+ /*pollFunc:*/ nativeModule()
26669
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_u64,
26670
+ /*cancelFunc:*/ nativeModule()
26671
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_u64,
26672
+ /*completeFunc:*/ nativeModule()
26673
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_u64,
26674
+ /*freeFunc:*/ nativeModule()
26675
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_u64,
26676
+ /*liftFunc:*/ FfiConverterUInt64.lift.bind(FfiConverterUInt64),
26677
+ /*liftString:*/ FfiConverterString.lift,
26678
+ /*asyncOpts:*/ asyncOpts_,
26679
+ /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind(
26680
+ FfiConverterTypeStorageError
26681
+ )
26682
+ );
26683
+ } catch (__error: any) {
26684
+ if (uniffiIsDebug && __error instanceof Error) {
26685
+ __error.stack = __stack;
26686
+ }
26687
+ throw __error;
25803
26688
  }
25804
26689
  }
25805
26690
 
25806
- static instanceOf(obj: any): obj is StorageImpl {
25807
- return uniffiTypeStorageImplObjectFactory.isConcreteType(obj);
26691
+ public async completeOutgoingSync(
26692
+ record: Record,
26693
+ localRevision: /*u64*/ bigint,
26694
+ asyncOpts_?: { signal: AbortSignal }
26695
+ ): Promise<void> /*throws*/ {
26696
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
26697
+ try {
26698
+ return await uniffiRustCallAsync(
26699
+ /*rustCaller:*/ uniffiCaller,
26700
+ /*rustFutureFunc:*/ () => {
26701
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_complete_outgoing_sync(
26702
+ uniffiTypeStorageImplObjectFactory.clonePointer(this),
26703
+ FfiConverterTypeRecord.lower(record),
26704
+ FfiConverterUInt64.lower(localRevision)
26705
+ );
26706
+ },
26707
+ /*pollFunc:*/ nativeModule()
26708
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_void,
26709
+ /*cancelFunc:*/ nativeModule()
26710
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void,
26711
+ /*completeFunc:*/ nativeModule()
26712
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_void,
26713
+ /*freeFunc:*/ nativeModule()
26714
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_void,
26715
+ /*liftFunc:*/ (_v) => {},
26716
+ /*liftString:*/ FfiConverterString.lift,
26717
+ /*asyncOpts:*/ asyncOpts_,
26718
+ /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind(
26719
+ FfiConverterTypeStorageError
26720
+ )
26721
+ );
26722
+ } catch (__error: any) {
26723
+ if (uniffiIsDebug && __error instanceof Error) {
26724
+ __error.stack = __stack;
26725
+ }
26726
+ throw __error;
26727
+ }
25808
26728
  }
25809
- }
25810
-
25811
- const uniffiTypeStorageImplObjectFactory: UniffiObjectFactory<Storage> = {
25812
- create(pointer: UnsafeMutableRawPointer): Storage {
25813
- const instance = Object.create(StorageImpl.prototype);
25814
- instance[pointerLiteralSymbol] = pointer;
25815
- instance[destructorGuardSymbol] = this.bless(pointer);
25816
- instance[uniffiTypeNameSymbol] = 'StorageImpl';
25817
- return instance;
25818
- },
25819
26729
 
25820
- bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr {
25821
- return uniffiCaller.rustCall(
25822
- /*caller:*/ (status) =>
25823
- nativeModule().ubrn_uniffi_internal_fn_method_storage_ffi__bless_pointer(
25824
- p,
25825
- status
26730
+ public async getPendingOutgoingChanges(
26731
+ limit: /*u32*/ number,
26732
+ asyncOpts_?: { signal: AbortSignal }
26733
+ ): Promise<Array<OutgoingChange>> /*throws*/ {
26734
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
26735
+ try {
26736
+ return await uniffiRustCallAsync(
26737
+ /*rustCaller:*/ uniffiCaller,
26738
+ /*rustFutureFunc:*/ () => {
26739
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_pending_outgoing_changes(
26740
+ uniffiTypeStorageImplObjectFactory.clonePointer(this),
26741
+ FfiConverterUInt32.lower(limit)
26742
+ );
26743
+ },
26744
+ /*pollFunc:*/ nativeModule()
26745
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
26746
+ /*cancelFunc:*/ nativeModule()
26747
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
26748
+ /*completeFunc:*/ nativeModule()
26749
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
26750
+ /*freeFunc:*/ nativeModule()
26751
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
26752
+ /*liftFunc:*/ FfiConverterArrayTypeOutgoingChange.lift.bind(
26753
+ FfiConverterArrayTypeOutgoingChange
25826
26754
  ),
25827
- /*liftString:*/ FfiConverterString.lift
25828
- );
25829
- },
26755
+ /*liftString:*/ FfiConverterString.lift,
26756
+ /*asyncOpts:*/ asyncOpts_,
26757
+ /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind(
26758
+ FfiConverterTypeStorageError
26759
+ )
26760
+ );
26761
+ } catch (__error: any) {
26762
+ if (uniffiIsDebug && __error instanceof Error) {
26763
+ __error.stack = __stack;
26764
+ }
26765
+ throw __error;
26766
+ }
26767
+ }
25830
26768
 
25831
- unbless(ptr: UniffiRustArcPtr) {
25832
- ptr.markDestroyed();
25833
- },
26769
+ /**
26770
+ * Get the last committed sync revision.
26771
+ *
26772
+ * The `sync_revision` table tracks the highest revision that has been committed
26773
+ * (i.e. acknowledged by the server or received from it). It does NOT include
26774
+ * pending outgoing queue ids. This value is used by the sync protocol to
26775
+ * request changes from the server.
26776
+ */
26777
+ public async getLastRevision(asyncOpts_?: {
26778
+ signal: AbortSignal;
26779
+ }): Promise</*u64*/ bigint> /*throws*/ {
26780
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
26781
+ try {
26782
+ return await uniffiRustCallAsync(
26783
+ /*rustCaller:*/ uniffiCaller,
26784
+ /*rustFutureFunc:*/ () => {
26785
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_last_revision(
26786
+ uniffiTypeStorageImplObjectFactory.clonePointer(this)
26787
+ );
26788
+ },
26789
+ /*pollFunc:*/ nativeModule()
26790
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_u64,
26791
+ /*cancelFunc:*/ nativeModule()
26792
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_u64,
26793
+ /*completeFunc:*/ nativeModule()
26794
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_u64,
26795
+ /*freeFunc:*/ nativeModule()
26796
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_u64,
26797
+ /*liftFunc:*/ FfiConverterUInt64.lift.bind(FfiConverterUInt64),
26798
+ /*liftString:*/ FfiConverterString.lift,
26799
+ /*asyncOpts:*/ asyncOpts_,
26800
+ /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind(
26801
+ FfiConverterTypeStorageError
26802
+ )
26803
+ );
26804
+ } catch (__error: any) {
26805
+ if (uniffiIsDebug && __error instanceof Error) {
26806
+ __error.stack = __stack;
26807
+ }
26808
+ throw __error;
26809
+ }
26810
+ }
25834
26811
 
25835
- pointer(obj: Storage): UnsafeMutableRawPointer {
25836
- if ((obj as any)[destructorGuardSymbol] === undefined) {
25837
- throw new UniffiInternalError.UnexpectedNullPointer();
26812
+ /**
26813
+ * Insert incoming records from remote sync
26814
+ */
26815
+ public async insertIncomingRecords(
26816
+ records: Array<Record>,
26817
+ asyncOpts_?: { signal: AbortSignal }
26818
+ ): Promise<void> /*throws*/ {
26819
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
26820
+ try {
26821
+ return await uniffiRustCallAsync(
26822
+ /*rustCaller:*/ uniffiCaller,
26823
+ /*rustFutureFunc:*/ () => {
26824
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_insert_incoming_records(
26825
+ uniffiTypeStorageImplObjectFactory.clonePointer(this),
26826
+ FfiConverterArrayTypeRecord.lower(records)
26827
+ );
26828
+ },
26829
+ /*pollFunc:*/ nativeModule()
26830
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_void,
26831
+ /*cancelFunc:*/ nativeModule()
26832
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void,
26833
+ /*completeFunc:*/ nativeModule()
26834
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_void,
26835
+ /*freeFunc:*/ nativeModule()
26836
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_void,
26837
+ /*liftFunc:*/ (_v) => {},
26838
+ /*liftString:*/ FfiConverterString.lift,
26839
+ /*asyncOpts:*/ asyncOpts_,
26840
+ /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind(
26841
+ FfiConverterTypeStorageError
26842
+ )
26843
+ );
26844
+ } catch (__error: any) {
26845
+ if (uniffiIsDebug && __error instanceof Error) {
26846
+ __error.stack = __stack;
26847
+ }
26848
+ throw __error;
25838
26849
  }
25839
- return (obj as any)[pointerLiteralSymbol];
25840
- },
26850
+ }
25841
26851
 
25842
- clonePointer(obj: Storage): UnsafeMutableRawPointer {
25843
- const pointer = this.pointer(obj);
25844
- return uniffiCaller.rustCall(
25845
- /*caller:*/ (callStatus) =>
25846
- nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_storage(
25847
- pointer,
25848
- callStatus
25849
- ),
25850
- /*liftString:*/ FfiConverterString.lift
25851
- );
25852
- },
26852
+ /**
26853
+ * Delete an incoming record after it has been processed
26854
+ */
26855
+ public async deleteIncomingRecord(
26856
+ record: Record,
26857
+ asyncOpts_?: { signal: AbortSignal }
26858
+ ): Promise<void> /*throws*/ {
26859
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
26860
+ try {
26861
+ return await uniffiRustCallAsync(
26862
+ /*rustCaller:*/ uniffiCaller,
26863
+ /*rustFutureFunc:*/ () => {
26864
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_delete_incoming_record(
26865
+ uniffiTypeStorageImplObjectFactory.clonePointer(this),
26866
+ FfiConverterTypeRecord.lower(record)
26867
+ );
26868
+ },
26869
+ /*pollFunc:*/ nativeModule()
26870
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_void,
26871
+ /*cancelFunc:*/ nativeModule()
26872
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void,
26873
+ /*completeFunc:*/ nativeModule()
26874
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_void,
26875
+ /*freeFunc:*/ nativeModule()
26876
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_void,
26877
+ /*liftFunc:*/ (_v) => {},
26878
+ /*liftString:*/ FfiConverterString.lift,
26879
+ /*asyncOpts:*/ asyncOpts_,
26880
+ /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind(
26881
+ FfiConverterTypeStorageError
26882
+ )
26883
+ );
26884
+ } catch (__error: any) {
26885
+ if (uniffiIsDebug && __error instanceof Error) {
26886
+ __error.stack = __stack;
26887
+ }
26888
+ throw __error;
26889
+ }
26890
+ }
25853
26891
 
25854
- freePointer(pointer: UnsafeMutableRawPointer): void {
25855
- uniffiCaller.rustCall(
25856
- /*caller:*/ (callStatus) =>
25857
- nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_storage(
25858
- pointer,
25859
- callStatus
26892
+ /**
26893
+ * Get incoming records that need to be processed, up to the specified limit
26894
+ */
26895
+ public async getIncomingRecords(
26896
+ limit: /*u32*/ number,
26897
+ asyncOpts_?: { signal: AbortSignal }
26898
+ ): Promise<Array<IncomingChange>> /*throws*/ {
26899
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
26900
+ try {
26901
+ return await uniffiRustCallAsync(
26902
+ /*rustCaller:*/ uniffiCaller,
26903
+ /*rustFutureFunc:*/ () => {
26904
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_incoming_records(
26905
+ uniffiTypeStorageImplObjectFactory.clonePointer(this),
26906
+ FfiConverterUInt32.lower(limit)
26907
+ );
26908
+ },
26909
+ /*pollFunc:*/ nativeModule()
26910
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
26911
+ /*cancelFunc:*/ nativeModule()
26912
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
26913
+ /*completeFunc:*/ nativeModule()
26914
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
26915
+ /*freeFunc:*/ nativeModule()
26916
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
26917
+ /*liftFunc:*/ FfiConverterArrayTypeIncomingChange.lift.bind(
26918
+ FfiConverterArrayTypeIncomingChange
25860
26919
  ),
25861
- /*liftString:*/ FfiConverterString.lift
25862
- );
25863
- },
25864
-
25865
- isConcreteType(obj: any): obj is Storage {
25866
- return (
25867
- obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'StorageImpl'
25868
- );
25869
- },
25870
- };
25871
- // FfiConverter for Storage
25872
- const FfiConverterTypeStorage = new FfiConverterObjectWithCallbacks(
25873
- uniffiTypeStorageImplObjectFactory
25874
- );
25875
-
25876
- // Add a vtavble for the callbacks that go in Storage.
26920
+ /*liftString:*/ FfiConverterString.lift,
26921
+ /*asyncOpts:*/ asyncOpts_,
26922
+ /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind(
26923
+ FfiConverterTypeStorageError
26924
+ )
26925
+ );
26926
+ } catch (__error: any) {
26927
+ if (uniffiIsDebug && __error instanceof Error) {
26928
+ __error.stack = __stack;
26929
+ }
26930
+ throw __error;
26931
+ }
26932
+ }
25877
26933
 
25878
- // Put the implementation in a struct so we don't pollute the top-level namespace
25879
- const uniffiCallbackInterfaceStorage: {
25880
- vtable: UniffiVTableCallbackInterfaceStorage;
25881
- register: () => void;
25882
- } = {
25883
- // Create the VTable using a series of closures.
25884
- // ts automatically converts these into C callback functions.
25885
- vtable: {
25886
- deleteCachedItem: (
25887
- uniffiHandle: bigint,
25888
- key: Uint8Array,
25889
- uniffiFutureCallback: UniffiForeignFutureCompleteVoid,
25890
- uniffiCallbackData: bigint
25891
- ) => {
25892
- const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
25893
- const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
25894
- return await jsCallback.deleteCachedItem(FfiConverterString.lift(key), {
25895
- signal,
25896
- });
25897
- };
25898
- const uniffiHandleSuccess = (returnValue: void) => {
25899
- uniffiFutureCallback(
26934
+ /**
26935
+ * Get the latest outgoing record if any exists
26936
+ */
26937
+ public async getLatestOutgoingChange(asyncOpts_?: {
26938
+ signal: AbortSignal;
26939
+ }): Promise<OutgoingChange | undefined> /*throws*/ {
26940
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
26941
+ try {
26942
+ return await uniffiRustCallAsync(
26943
+ /*rustCaller:*/ uniffiCaller,
26944
+ /*rustFutureFunc:*/ () => {
26945
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_latest_outgoing_change(
26946
+ uniffiTypeStorageImplObjectFactory.clonePointer(this)
26947
+ );
26948
+ },
26949
+ /*pollFunc:*/ nativeModule()
26950
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
26951
+ /*cancelFunc:*/ nativeModule()
26952
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
26953
+ /*completeFunc:*/ nativeModule()
26954
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
26955
+ /*freeFunc:*/ nativeModule()
26956
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
26957
+ /*liftFunc:*/ FfiConverterOptionalTypeOutgoingChange.lift.bind(
26958
+ FfiConverterOptionalTypeOutgoingChange
26959
+ ),
26960
+ /*liftString:*/ FfiConverterString.lift,
26961
+ /*asyncOpts:*/ asyncOpts_,
26962
+ /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind(
26963
+ FfiConverterTypeStorageError
26964
+ )
26965
+ );
26966
+ } catch (__error: any) {
26967
+ if (uniffiIsDebug && __error instanceof Error) {
26968
+ __error.stack = __stack;
26969
+ }
26970
+ throw __error;
26971
+ }
26972
+ }
26973
+
26974
+ /**
26975
+ * Update the sync state record from an incoming record
26976
+ */
26977
+ public async updateRecordFromIncoming(
26978
+ record: Record,
26979
+ asyncOpts_?: { signal: AbortSignal }
26980
+ ): Promise<void> /*throws*/ {
26981
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
26982
+ try {
26983
+ return await uniffiRustCallAsync(
26984
+ /*rustCaller:*/ uniffiCaller,
26985
+ /*rustFutureFunc:*/ () => {
26986
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_update_record_from_incoming(
26987
+ uniffiTypeStorageImplObjectFactory.clonePointer(this),
26988
+ FfiConverterTypeRecord.lower(record)
26989
+ );
26990
+ },
26991
+ /*pollFunc:*/ nativeModule()
26992
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_void,
26993
+ /*cancelFunc:*/ nativeModule()
26994
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void,
26995
+ /*completeFunc:*/ nativeModule()
26996
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_void,
26997
+ /*freeFunc:*/ nativeModule()
26998
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_void,
26999
+ /*liftFunc:*/ (_v) => {},
27000
+ /*liftString:*/ FfiConverterString.lift,
27001
+ /*asyncOpts:*/ asyncOpts_,
27002
+ /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind(
27003
+ FfiConverterTypeStorageError
27004
+ )
27005
+ );
27006
+ } catch (__error: any) {
27007
+ if (uniffiIsDebug && __error instanceof Error) {
27008
+ __error.stack = __stack;
27009
+ }
27010
+ throw __error;
27011
+ }
27012
+ }
27013
+
27014
+ /**
27015
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
27016
+ */
27017
+ uniffiDestroy(): void {
27018
+ const ptr = (this as any)[destructorGuardSymbol];
27019
+ if (ptr !== undefined) {
27020
+ const pointer = uniffiTypeStorageImplObjectFactory.pointer(this);
27021
+ uniffiTypeStorageImplObjectFactory.freePointer(pointer);
27022
+ uniffiTypeStorageImplObjectFactory.unbless(ptr);
27023
+ delete (this as any)[destructorGuardSymbol];
27024
+ }
27025
+ }
27026
+
27027
+ static instanceOf(obj: any): obj is StorageImpl {
27028
+ return uniffiTypeStorageImplObjectFactory.isConcreteType(obj);
27029
+ }
27030
+ }
27031
+
27032
+ const uniffiTypeStorageImplObjectFactory: UniffiObjectFactory<Storage> = {
27033
+ create(pointer: UnsafeMutableRawPointer): Storage {
27034
+ const instance = Object.create(StorageImpl.prototype);
27035
+ instance[pointerLiteralSymbol] = pointer;
27036
+ instance[destructorGuardSymbol] = this.bless(pointer);
27037
+ instance[uniffiTypeNameSymbol] = 'StorageImpl';
27038
+ return instance;
27039
+ },
27040
+
27041
+ bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr {
27042
+ return uniffiCaller.rustCall(
27043
+ /*caller:*/ (status) =>
27044
+ nativeModule().ubrn_uniffi_internal_fn_method_storage_ffi__bless_pointer(
27045
+ p,
27046
+ status
27047
+ ),
27048
+ /*liftString:*/ FfiConverterString.lift
27049
+ );
27050
+ },
27051
+
27052
+ unbless(ptr: UniffiRustArcPtr) {
27053
+ ptr.markDestroyed();
27054
+ },
27055
+
27056
+ pointer(obj: Storage): UnsafeMutableRawPointer {
27057
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
27058
+ throw new UniffiInternalError.UnexpectedNullPointer();
27059
+ }
27060
+ return (obj as any)[pointerLiteralSymbol];
27061
+ },
27062
+
27063
+ clonePointer(obj: Storage): UnsafeMutableRawPointer {
27064
+ const pointer = this.pointer(obj);
27065
+ return uniffiCaller.rustCall(
27066
+ /*caller:*/ (callStatus) =>
27067
+ nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_storage(
27068
+ pointer,
27069
+ callStatus
27070
+ ),
27071
+ /*liftString:*/ FfiConverterString.lift
27072
+ );
27073
+ },
27074
+
27075
+ freePointer(pointer: UnsafeMutableRawPointer): void {
27076
+ uniffiCaller.rustCall(
27077
+ /*caller:*/ (callStatus) =>
27078
+ nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_storage(
27079
+ pointer,
27080
+ callStatus
27081
+ ),
27082
+ /*liftString:*/ FfiConverterString.lift
27083
+ );
27084
+ },
27085
+
27086
+ isConcreteType(obj: any): obj is Storage {
27087
+ return (
27088
+ obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'StorageImpl'
27089
+ );
27090
+ },
27091
+ };
27092
+ // FfiConverter for Storage
27093
+ const FfiConverterTypeStorage = new FfiConverterObjectWithCallbacks(
27094
+ uniffiTypeStorageImplObjectFactory
27095
+ );
27096
+
27097
+ // Add a vtavble for the callbacks that go in Storage.
27098
+
27099
+ // Put the implementation in a struct so we don't pollute the top-level namespace
27100
+ const uniffiCallbackInterfaceStorage: {
27101
+ vtable: UniffiVTableCallbackInterfaceStorage;
27102
+ register: () => void;
27103
+ } = {
27104
+ // Create the VTable using a series of closures.
27105
+ // ts automatically converts these into C callback functions.
27106
+ vtable: {
27107
+ deleteCachedItem: (
27108
+ uniffiHandle: bigint,
27109
+ key: Uint8Array,
27110
+ uniffiFutureCallback: UniffiForeignFutureCompleteVoid,
27111
+ uniffiCallbackData: bigint
27112
+ ) => {
27113
+ const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
27114
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27115
+ return await jsCallback.deleteCachedItem(FfiConverterString.lift(key), {
27116
+ signal,
27117
+ });
27118
+ };
27119
+ const uniffiHandleSuccess = (returnValue: void) => {
27120
+ uniffiFutureCallback(
25900
27121
  uniffiCallbackData,
25901
27122
  /* UniffiForeignFutureStructVoid */ {
25902
27123
  callStatus: uniffiCaller.createCallStatus(),
@@ -26101,7 +27322,7 @@ const uniffiCallbackInterfaceStorage: {
26101
27322
  );
26102
27323
  return UniffiResult.success(uniffiForeignFuture);
26103
27324
  },
26104
- setPaymentMetadata: (
27325
+ insertPaymentMetadata: (
26105
27326
  uniffiHandle: bigint,
26106
27327
  paymentId: Uint8Array,
26107
27328
  metadata: Uint8Array,
@@ -26110,7 +27331,7 @@ const uniffiCallbackInterfaceStorage: {
26110
27331
  ) => {
26111
27332
  const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
26112
27333
  const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
26113
- return await jsCallback.setPaymentMetadata(
27334
+ return await jsCallback.insertPaymentMetadata(
26114
27335
  FfiConverterString.lift(paymentId),
26115
27336
  FfiConverterTypePaymentMetadata.lift(metadata),
26116
27337
  { signal }
@@ -26227,810 +27448,282 @@ const uniffiCallbackInterfaceStorage: {
26227
27448
  /*handleSuccess:*/ uniffiHandleSuccess,
26228
27449
  /*handleError:*/ uniffiHandleError,
26229
27450
  /*isErrorType:*/ StorageError.instanceOf,
26230
- /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
26231
- FfiConverterTypeStorageError
26232
- ),
26233
- /*lowerString:*/ FfiConverterString.lower
26234
- );
26235
- return UniffiResult.success(uniffiForeignFuture);
26236
- },
26237
- addDeposit: (
26238
- uniffiHandle: bigint,
26239
- txid: Uint8Array,
26240
- vout: number,
26241
- amountSats: bigint,
26242
- uniffiFutureCallback: UniffiForeignFutureCompleteVoid,
26243
- uniffiCallbackData: bigint
26244
- ) => {
26245
- const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
26246
- const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
26247
- return await jsCallback.addDeposit(
26248
- FfiConverterString.lift(txid),
26249
- FfiConverterUInt32.lift(vout),
26250
- FfiConverterUInt64.lift(amountSats),
26251
- { signal }
26252
- );
26253
- };
26254
- const uniffiHandleSuccess = (returnValue: void) => {
26255
- uniffiFutureCallback(
26256
- uniffiCallbackData,
26257
- /* UniffiForeignFutureStructVoid */ {
26258
- callStatus: uniffiCaller.createCallStatus(),
26259
- }
26260
- );
26261
- };
26262
- const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
26263
- uniffiFutureCallback(
26264
- uniffiCallbackData,
26265
- /* UniffiForeignFutureStructVoid */ {
26266
- // TODO create callstatus with error.
26267
- callStatus: { code, errorBuf },
26268
- }
26269
- );
26270
- };
26271
- const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
26272
- /*makeCall:*/ uniffiMakeCall,
26273
- /*handleSuccess:*/ uniffiHandleSuccess,
26274
- /*handleError:*/ uniffiHandleError,
26275
- /*isErrorType:*/ StorageError.instanceOf,
26276
- /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
26277
- FfiConverterTypeStorageError
26278
- ),
26279
- /*lowerString:*/ FfiConverterString.lower
26280
- );
26281
- return UniffiResult.success(uniffiForeignFuture);
26282
- },
26283
- deleteDeposit: (
26284
- uniffiHandle: bigint,
26285
- txid: Uint8Array,
26286
- vout: number,
26287
- uniffiFutureCallback: UniffiForeignFutureCompleteVoid,
26288
- uniffiCallbackData: bigint
26289
- ) => {
26290
- const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
26291
- const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
26292
- return await jsCallback.deleteDeposit(
26293
- FfiConverterString.lift(txid),
26294
- FfiConverterUInt32.lift(vout),
26295
- { signal }
26296
- );
26297
- };
26298
- const uniffiHandleSuccess = (returnValue: void) => {
26299
- uniffiFutureCallback(
26300
- uniffiCallbackData,
26301
- /* UniffiForeignFutureStructVoid */ {
26302
- callStatus: uniffiCaller.createCallStatus(),
26303
- }
26304
- );
26305
- };
26306
- const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
26307
- uniffiFutureCallback(
26308
- uniffiCallbackData,
26309
- /* UniffiForeignFutureStructVoid */ {
26310
- // TODO create callstatus with error.
26311
- callStatus: { code, errorBuf },
26312
- }
26313
- );
26314
- };
26315
- const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
26316
- /*makeCall:*/ uniffiMakeCall,
26317
- /*handleSuccess:*/ uniffiHandleSuccess,
26318
- /*handleError:*/ uniffiHandleError,
26319
- /*isErrorType:*/ StorageError.instanceOf,
26320
- /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
26321
- FfiConverterTypeStorageError
26322
- ),
26323
- /*lowerString:*/ FfiConverterString.lower
26324
- );
26325
- return UniffiResult.success(uniffiForeignFuture);
26326
- },
26327
- listDeposits: (
26328
- uniffiHandle: bigint,
26329
- uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
26330
- uniffiCallbackData: bigint
26331
- ) => {
26332
- const uniffiMakeCall = async (
26333
- signal: AbortSignal
26334
- ): Promise<Array<DepositInfo>> => {
26335
- const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
26336
- return await jsCallback.listDeposits({ signal });
26337
- };
26338
- const uniffiHandleSuccess = (returnValue: Array<DepositInfo>) => {
26339
- uniffiFutureCallback(
26340
- uniffiCallbackData,
26341
- /* UniffiForeignFutureStructRustBuffer */ {
26342
- returnValue: FfiConverterArrayTypeDepositInfo.lower(returnValue),
26343
- callStatus: uniffiCaller.createCallStatus(),
26344
- }
26345
- );
26346
- };
26347
- const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
26348
- uniffiFutureCallback(
26349
- uniffiCallbackData,
26350
- /* UniffiForeignFutureStructRustBuffer */ {
26351
- returnValue: /*empty*/ new Uint8Array(0),
26352
- // TODO create callstatus with error.
26353
- callStatus: { code, errorBuf },
26354
- }
26355
- );
26356
- };
26357
- const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
26358
- /*makeCall:*/ uniffiMakeCall,
26359
- /*handleSuccess:*/ uniffiHandleSuccess,
26360
- /*handleError:*/ uniffiHandleError,
26361
- /*isErrorType:*/ StorageError.instanceOf,
26362
- /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
26363
- FfiConverterTypeStorageError
26364
- ),
26365
- /*lowerString:*/ FfiConverterString.lower
26366
- );
26367
- return UniffiResult.success(uniffiForeignFuture);
26368
- },
26369
- updateDeposit: (
26370
- uniffiHandle: bigint,
26371
- txid: Uint8Array,
26372
- vout: number,
26373
- payload: Uint8Array,
26374
- uniffiFutureCallback: UniffiForeignFutureCompleteVoid,
26375
- uniffiCallbackData: bigint
26376
- ) => {
26377
- const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
26378
- const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
26379
- return await jsCallback.updateDeposit(
26380
- FfiConverterString.lift(txid),
26381
- FfiConverterUInt32.lift(vout),
26382
- FfiConverterTypeUpdateDepositPayload.lift(payload),
26383
- { signal }
26384
- );
26385
- };
26386
- const uniffiHandleSuccess = (returnValue: void) => {
26387
- uniffiFutureCallback(
26388
- uniffiCallbackData,
26389
- /* UniffiForeignFutureStructVoid */ {
26390
- callStatus: uniffiCaller.createCallStatus(),
26391
- }
26392
- );
26393
- };
26394
- const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
26395
- uniffiFutureCallback(
26396
- uniffiCallbackData,
26397
- /* UniffiForeignFutureStructVoid */ {
26398
- // TODO create callstatus with error.
26399
- callStatus: { code, errorBuf },
26400
- }
26401
- );
26402
- };
26403
- const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
26404
- /*makeCall:*/ uniffiMakeCall,
26405
- /*handleSuccess:*/ uniffiHandleSuccess,
26406
- /*handleError:*/ uniffiHandleError,
26407
- /*isErrorType:*/ StorageError.instanceOf,
26408
- /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
26409
- FfiConverterTypeStorageError
26410
- ),
26411
- /*lowerString:*/ FfiConverterString.lower
26412
- );
26413
- return UniffiResult.success(uniffiForeignFuture);
26414
- },
26415
- setLnurlMetadata: (
26416
- uniffiHandle: bigint,
26417
- metadata: Uint8Array,
26418
- uniffiFutureCallback: UniffiForeignFutureCompleteVoid,
26419
- uniffiCallbackData: bigint
26420
- ) => {
26421
- const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
26422
- const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
26423
- return await jsCallback.setLnurlMetadata(
26424
- FfiConverterArrayTypeSetLnurlMetadataItem.lift(metadata),
26425
- { signal }
26426
- );
26427
- };
26428
- const uniffiHandleSuccess = (returnValue: void) => {
26429
- uniffiFutureCallback(
26430
- uniffiCallbackData,
26431
- /* UniffiForeignFutureStructVoid */ {
26432
- callStatus: uniffiCaller.createCallStatus(),
26433
- }
26434
- );
26435
- };
26436
- const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
26437
- uniffiFutureCallback(
26438
- uniffiCallbackData,
26439
- /* UniffiForeignFutureStructVoid */ {
26440
- // TODO create callstatus with error.
26441
- callStatus: { code, errorBuf },
26442
- }
26443
- );
26444
- };
26445
- const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
26446
- /*makeCall:*/ uniffiMakeCall,
26447
- /*handleSuccess:*/ uniffiHandleSuccess,
26448
- /*handleError:*/ uniffiHandleError,
26449
- /*isErrorType:*/ StorageError.instanceOf,
26450
- /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
26451
- FfiConverterTypeStorageError
26452
- ),
26453
- /*lowerString:*/ FfiConverterString.lower
26454
- );
26455
- return UniffiResult.success(uniffiForeignFuture);
26456
- },
26457
- uniffiFree: (uniffiHandle: UniffiHandle): void => {
26458
- // Storage: this will throw a stale handle error if the handle isn't found.
26459
- FfiConverterTypeStorage.drop(uniffiHandle);
26460
- },
26461
- },
26462
- register: () => {
26463
- nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_storage(
26464
- uniffiCallbackInterfaceStorage.vtable
26465
- );
26466
- },
26467
- };
26468
-
26469
- export interface SyncStorage {
26470
- addOutgoingChange(
26471
- record: UnversionedRecordChange,
26472
- asyncOpts_?: { signal: AbortSignal }
26473
- ): /*throws*/ Promise</*u64*/ bigint>;
26474
- completeOutgoingSync(
26475
- record: Record,
26476
- asyncOpts_?: { signal: AbortSignal }
26477
- ): /*throws*/ Promise<void>;
26478
- getPendingOutgoingChanges(
26479
- limit: /*u32*/ number,
26480
- asyncOpts_?: { signal: AbortSignal }
26481
- ): /*throws*/ Promise<Array<OutgoingChange>>;
26482
- /**
26483
- * Get the revision number of the last synchronized record
26484
- */
26485
- getLastRevision(asyncOpts_?: {
26486
- signal: AbortSignal;
26487
- }): /*throws*/ Promise</*u64*/ bigint>;
26488
- /**
26489
- * Insert incoming records from remote sync
26490
- */
26491
- insertIncomingRecords(
26492
- records: Array<Record>,
26493
- asyncOpts_?: { signal: AbortSignal }
26494
- ): /*throws*/ Promise<void>;
26495
- /**
26496
- * Delete an incoming record after it has been processed
26497
- */
26498
- deleteIncomingRecord(
26499
- record: Record,
26500
- asyncOpts_?: { signal: AbortSignal }
26501
- ): /*throws*/ Promise<void>;
26502
- /**
26503
- * Update revision numbers of pending outgoing records to be higher than the given revision
26504
- */
26505
- rebasePendingOutgoingRecords(
26506
- revision: /*u64*/ bigint,
26507
- asyncOpts_?: { signal: AbortSignal }
26508
- ): /*throws*/ Promise<void>;
26509
- /**
26510
- * Get incoming records that need to be processed, up to the specified limit
26511
- */
26512
- getIncomingRecords(
26513
- limit: /*u32*/ number,
26514
- asyncOpts_?: { signal: AbortSignal }
26515
- ): /*throws*/ Promise<Array<IncomingChange>>;
26516
- /**
26517
- * Get the latest outgoing record if any exists
26518
- */
26519
- getLatestOutgoingChange(asyncOpts_?: {
26520
- signal: AbortSignal;
26521
- }): /*throws*/ Promise<OutgoingChange | undefined>;
26522
- /**
26523
- * Update the sync state record from an incoming record
26524
- */
26525
- updateRecordFromIncoming(
26526
- record: Record,
26527
- asyncOpts_?: { signal: AbortSignal }
26528
- ): /*throws*/ Promise<void>;
26529
- }
26530
-
26531
- export class SyncStorageImpl
26532
- extends UniffiAbstractObject
26533
- implements SyncStorage
26534
- {
26535
- readonly [uniffiTypeNameSymbol] = 'SyncStorageImpl';
26536
- readonly [destructorGuardSymbol]: UniffiRustArcPtr;
26537
- readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer;
26538
- // No primary constructor declared for this class.
26539
- private constructor(pointer: UnsafeMutableRawPointer) {
26540
- super();
26541
- this[pointerLiteralSymbol] = pointer;
26542
- this[destructorGuardSymbol] =
26543
- uniffiTypeSyncStorageImplObjectFactory.bless(pointer);
26544
- }
26545
-
26546
- public async addOutgoingChange(
26547
- record: UnversionedRecordChange,
26548
- asyncOpts_?: { signal: AbortSignal }
26549
- ): Promise</*u64*/ bigint> /*throws*/ {
26550
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
26551
- try {
26552
- return await uniffiRustCallAsync(
26553
- /*rustCaller:*/ uniffiCaller,
26554
- /*rustFutureFunc:*/ () => {
26555
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_syncstorage_add_outgoing_change(
26556
- uniffiTypeSyncStorageImplObjectFactory.clonePointer(this),
26557
- FfiConverterTypeUnversionedRecordChange.lower(record)
26558
- );
26559
- },
26560
- /*pollFunc:*/ nativeModule()
26561
- .ubrn_ffi_breez_sdk_spark_rust_future_poll_u64,
26562
- /*cancelFunc:*/ nativeModule()
26563
- .ubrn_ffi_breez_sdk_spark_rust_future_cancel_u64,
26564
- /*completeFunc:*/ nativeModule()
26565
- .ubrn_ffi_breez_sdk_spark_rust_future_complete_u64,
26566
- /*freeFunc:*/ nativeModule()
26567
- .ubrn_ffi_breez_sdk_spark_rust_future_free_u64,
26568
- /*liftFunc:*/ FfiConverterUInt64.lift.bind(FfiConverterUInt64),
26569
- /*liftString:*/ FfiConverterString.lift,
26570
- /*asyncOpts:*/ asyncOpts_,
26571
- /*errorHandler:*/ FfiConverterTypeSyncStorageError.lift.bind(
26572
- FfiConverterTypeSyncStorageError
26573
- )
26574
- );
26575
- } catch (__error: any) {
26576
- if (uniffiIsDebug && __error instanceof Error) {
26577
- __error.stack = __stack;
26578
- }
26579
- throw __error;
26580
- }
26581
- }
26582
-
26583
- public async completeOutgoingSync(
26584
- record: Record,
26585
- asyncOpts_?: { signal: AbortSignal }
26586
- ): Promise<void> /*throws*/ {
26587
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
26588
- try {
26589
- return await uniffiRustCallAsync(
26590
- /*rustCaller:*/ uniffiCaller,
26591
- /*rustFutureFunc:*/ () => {
26592
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_syncstorage_complete_outgoing_sync(
26593
- uniffiTypeSyncStorageImplObjectFactory.clonePointer(this),
26594
- FfiConverterTypeRecord.lower(record)
26595
- );
26596
- },
26597
- /*pollFunc:*/ nativeModule()
26598
- .ubrn_ffi_breez_sdk_spark_rust_future_poll_void,
26599
- /*cancelFunc:*/ nativeModule()
26600
- .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void,
26601
- /*completeFunc:*/ nativeModule()
26602
- .ubrn_ffi_breez_sdk_spark_rust_future_complete_void,
26603
- /*freeFunc:*/ nativeModule()
26604
- .ubrn_ffi_breez_sdk_spark_rust_future_free_void,
26605
- /*liftFunc:*/ (_v) => {},
26606
- /*liftString:*/ FfiConverterString.lift,
26607
- /*asyncOpts:*/ asyncOpts_,
26608
- /*errorHandler:*/ FfiConverterTypeSyncStorageError.lift.bind(
26609
- FfiConverterTypeSyncStorageError
26610
- )
26611
- );
26612
- } catch (__error: any) {
26613
- if (uniffiIsDebug && __error instanceof Error) {
26614
- __error.stack = __stack;
26615
- }
26616
- throw __error;
26617
- }
26618
- }
26619
-
26620
- public async getPendingOutgoingChanges(
26621
- limit: /*u32*/ number,
26622
- asyncOpts_?: { signal: AbortSignal }
26623
- ): Promise<Array<OutgoingChange>> /*throws*/ {
26624
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
26625
- try {
26626
- return await uniffiRustCallAsync(
26627
- /*rustCaller:*/ uniffiCaller,
26628
- /*rustFutureFunc:*/ () => {
26629
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_syncstorage_get_pending_outgoing_changes(
26630
- uniffiTypeSyncStorageImplObjectFactory.clonePointer(this),
26631
- FfiConverterUInt32.lower(limit)
26632
- );
26633
- },
26634
- /*pollFunc:*/ nativeModule()
26635
- .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
26636
- /*cancelFunc:*/ nativeModule()
26637
- .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
26638
- /*completeFunc:*/ nativeModule()
26639
- .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
26640
- /*freeFunc:*/ nativeModule()
26641
- .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
26642
- /*liftFunc:*/ FfiConverterArrayTypeOutgoingChange.lift.bind(
26643
- FfiConverterArrayTypeOutgoingChange
26644
- ),
26645
- /*liftString:*/ FfiConverterString.lift,
26646
- /*asyncOpts:*/ asyncOpts_,
26647
- /*errorHandler:*/ FfiConverterTypeSyncStorageError.lift.bind(
26648
- FfiConverterTypeSyncStorageError
26649
- )
26650
- );
26651
- } catch (__error: any) {
26652
- if (uniffiIsDebug && __error instanceof Error) {
26653
- __error.stack = __stack;
26654
- }
26655
- throw __error;
26656
- }
26657
- }
26658
-
26659
- /**
26660
- * Get the revision number of the last synchronized record
26661
- */
26662
- public async getLastRevision(asyncOpts_?: {
26663
- signal: AbortSignal;
26664
- }): Promise</*u64*/ bigint> /*throws*/ {
26665
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
26666
- try {
26667
- return await uniffiRustCallAsync(
26668
- /*rustCaller:*/ uniffiCaller,
26669
- /*rustFutureFunc:*/ () => {
26670
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_syncstorage_get_last_revision(
26671
- uniffiTypeSyncStorageImplObjectFactory.clonePointer(this)
26672
- );
26673
- },
26674
- /*pollFunc:*/ nativeModule()
26675
- .ubrn_ffi_breez_sdk_spark_rust_future_poll_u64,
26676
- /*cancelFunc:*/ nativeModule()
26677
- .ubrn_ffi_breez_sdk_spark_rust_future_cancel_u64,
26678
- /*completeFunc:*/ nativeModule()
26679
- .ubrn_ffi_breez_sdk_spark_rust_future_complete_u64,
26680
- /*freeFunc:*/ nativeModule()
26681
- .ubrn_ffi_breez_sdk_spark_rust_future_free_u64,
26682
- /*liftFunc:*/ FfiConverterUInt64.lift.bind(FfiConverterUInt64),
26683
- /*liftString:*/ FfiConverterString.lift,
26684
- /*asyncOpts:*/ asyncOpts_,
26685
- /*errorHandler:*/ FfiConverterTypeSyncStorageError.lift.bind(
26686
- FfiConverterTypeSyncStorageError
26687
- )
26688
- );
26689
- } catch (__error: any) {
26690
- if (uniffiIsDebug && __error instanceof Error) {
26691
- __error.stack = __stack;
26692
- }
26693
- throw __error;
26694
- }
26695
- }
26696
-
26697
- /**
26698
- * Insert incoming records from remote sync
26699
- */
26700
- public async insertIncomingRecords(
26701
- records: Array<Record>,
26702
- asyncOpts_?: { signal: AbortSignal }
26703
- ): Promise<void> /*throws*/ {
26704
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
26705
- try {
26706
- return await uniffiRustCallAsync(
26707
- /*rustCaller:*/ uniffiCaller,
26708
- /*rustFutureFunc:*/ () => {
26709
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_syncstorage_insert_incoming_records(
26710
- uniffiTypeSyncStorageImplObjectFactory.clonePointer(this),
26711
- FfiConverterArrayTypeRecord.lower(records)
26712
- );
26713
- },
26714
- /*pollFunc:*/ nativeModule()
26715
- .ubrn_ffi_breez_sdk_spark_rust_future_poll_void,
26716
- /*cancelFunc:*/ nativeModule()
26717
- .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void,
26718
- /*completeFunc:*/ nativeModule()
26719
- .ubrn_ffi_breez_sdk_spark_rust_future_complete_void,
26720
- /*freeFunc:*/ nativeModule()
26721
- .ubrn_ffi_breez_sdk_spark_rust_future_free_void,
26722
- /*liftFunc:*/ (_v) => {},
26723
- /*liftString:*/ FfiConverterString.lift,
26724
- /*asyncOpts:*/ asyncOpts_,
26725
- /*errorHandler:*/ FfiConverterTypeSyncStorageError.lift.bind(
26726
- FfiConverterTypeSyncStorageError
26727
- )
26728
- );
26729
- } catch (__error: any) {
26730
- if (uniffiIsDebug && __error instanceof Error) {
26731
- __error.stack = __stack;
26732
- }
26733
- throw __error;
26734
- }
26735
- }
26736
-
26737
- /**
26738
- * Delete an incoming record after it has been processed
26739
- */
26740
- public async deleteIncomingRecord(
26741
- record: Record,
26742
- asyncOpts_?: { signal: AbortSignal }
26743
- ): Promise<void> /*throws*/ {
26744
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
26745
- try {
26746
- return await uniffiRustCallAsync(
26747
- /*rustCaller:*/ uniffiCaller,
26748
- /*rustFutureFunc:*/ () => {
26749
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_syncstorage_delete_incoming_record(
26750
- uniffiTypeSyncStorageImplObjectFactory.clonePointer(this),
26751
- FfiConverterTypeRecord.lower(record)
26752
- );
26753
- },
26754
- /*pollFunc:*/ nativeModule()
26755
- .ubrn_ffi_breez_sdk_spark_rust_future_poll_void,
26756
- /*cancelFunc:*/ nativeModule()
26757
- .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void,
26758
- /*completeFunc:*/ nativeModule()
26759
- .ubrn_ffi_breez_sdk_spark_rust_future_complete_void,
26760
- /*freeFunc:*/ nativeModule()
26761
- .ubrn_ffi_breez_sdk_spark_rust_future_free_void,
26762
- /*liftFunc:*/ (_v) => {},
26763
- /*liftString:*/ FfiConverterString.lift,
26764
- /*asyncOpts:*/ asyncOpts_,
26765
- /*errorHandler:*/ FfiConverterTypeSyncStorageError.lift.bind(
26766
- FfiConverterTypeSyncStorageError
26767
- )
26768
- );
26769
- } catch (__error: any) {
26770
- if (uniffiIsDebug && __error instanceof Error) {
26771
- __error.stack = __stack;
26772
- }
26773
- throw __error;
26774
- }
26775
- }
26776
-
26777
- /**
26778
- * Update revision numbers of pending outgoing records to be higher than the given revision
26779
- */
26780
- public async rebasePendingOutgoingRecords(
26781
- revision: /*u64*/ bigint,
26782
- asyncOpts_?: { signal: AbortSignal }
26783
- ): Promise<void> /*throws*/ {
26784
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
26785
- try {
26786
- return await uniffiRustCallAsync(
26787
- /*rustCaller:*/ uniffiCaller,
26788
- /*rustFutureFunc:*/ () => {
26789
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_syncstorage_rebase_pending_outgoing_records(
26790
- uniffiTypeSyncStorageImplObjectFactory.clonePointer(this),
26791
- FfiConverterUInt64.lower(revision)
26792
- );
26793
- },
26794
- /*pollFunc:*/ nativeModule()
26795
- .ubrn_ffi_breez_sdk_spark_rust_future_poll_void,
26796
- /*cancelFunc:*/ nativeModule()
26797
- .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void,
26798
- /*completeFunc:*/ nativeModule()
26799
- .ubrn_ffi_breez_sdk_spark_rust_future_complete_void,
26800
- /*freeFunc:*/ nativeModule()
26801
- .ubrn_ffi_breez_sdk_spark_rust_future_free_void,
26802
- /*liftFunc:*/ (_v) => {},
26803
- /*liftString:*/ FfiConverterString.lift,
26804
- /*asyncOpts:*/ asyncOpts_,
26805
- /*errorHandler:*/ FfiConverterTypeSyncStorageError.lift.bind(
26806
- FfiConverterTypeSyncStorageError
26807
- )
26808
- );
26809
- } catch (__error: any) {
26810
- if (uniffiIsDebug && __error instanceof Error) {
26811
- __error.stack = __stack;
26812
- }
26813
- throw __error;
26814
- }
26815
- }
26816
-
26817
- /**
26818
- * Get incoming records that need to be processed, up to the specified limit
26819
- */
26820
- public async getIncomingRecords(
26821
- limit: /*u32*/ number,
26822
- asyncOpts_?: { signal: AbortSignal }
26823
- ): Promise<Array<IncomingChange>> /*throws*/ {
26824
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
26825
- try {
26826
- return await uniffiRustCallAsync(
26827
- /*rustCaller:*/ uniffiCaller,
26828
- /*rustFutureFunc:*/ () => {
26829
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_syncstorage_get_incoming_records(
26830
- uniffiTypeSyncStorageImplObjectFactory.clonePointer(this),
26831
- FfiConverterUInt32.lower(limit)
26832
- );
26833
- },
26834
- /*pollFunc:*/ nativeModule()
26835
- .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
26836
- /*cancelFunc:*/ nativeModule()
26837
- .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
26838
- /*completeFunc:*/ nativeModule()
26839
- .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
26840
- /*freeFunc:*/ nativeModule()
26841
- .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
26842
- /*liftFunc:*/ FfiConverterArrayTypeIncomingChange.lift.bind(
26843
- FfiConverterArrayTypeIncomingChange
27451
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27452
+ FfiConverterTypeStorageError
26844
27453
  ),
26845
- /*liftString:*/ FfiConverterString.lift,
26846
- /*asyncOpts:*/ asyncOpts_,
26847
- /*errorHandler:*/ FfiConverterTypeSyncStorageError.lift.bind(
26848
- FfiConverterTypeSyncStorageError
26849
- )
27454
+ /*lowerString:*/ FfiConverterString.lower
26850
27455
  );
26851
- } catch (__error: any) {
26852
- if (uniffiIsDebug && __error instanceof Error) {
26853
- __error.stack = __stack;
26854
- }
26855
- throw __error;
26856
- }
26857
- }
26858
-
26859
- /**
26860
- * Get the latest outgoing record if any exists
26861
- */
26862
- public async getLatestOutgoingChange(asyncOpts_?: {
26863
- signal: AbortSignal;
26864
- }): Promise<OutgoingChange | undefined> /*throws*/ {
26865
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
26866
- try {
26867
- return await uniffiRustCallAsync(
26868
- /*rustCaller:*/ uniffiCaller,
26869
- /*rustFutureFunc:*/ () => {
26870
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_syncstorage_get_latest_outgoing_change(
26871
- uniffiTypeSyncStorageImplObjectFactory.clonePointer(this)
26872
- );
26873
- },
26874
- /*pollFunc:*/ nativeModule()
26875
- .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
26876
- /*cancelFunc:*/ nativeModule()
26877
- .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
26878
- /*completeFunc:*/ nativeModule()
26879
- .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
26880
- /*freeFunc:*/ nativeModule()
26881
- .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
26882
- /*liftFunc:*/ FfiConverterOptionalTypeOutgoingChange.lift.bind(
26883
- FfiConverterOptionalTypeOutgoingChange
27456
+ return UniffiResult.success(uniffiForeignFuture);
27457
+ },
27458
+ getPaymentsByParentIds: (
27459
+ uniffiHandle: bigint,
27460
+ parentPaymentIds: Uint8Array,
27461
+ uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
27462
+ uniffiCallbackData: bigint
27463
+ ) => {
27464
+ const uniffiMakeCall = async (
27465
+ signal: AbortSignal
27466
+ ): Promise<Map<string, Array<Payment>>> => {
27467
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27468
+ return await jsCallback.getPaymentsByParentIds(
27469
+ FfiConverterArrayString.lift(parentPaymentIds),
27470
+ { signal }
27471
+ );
27472
+ };
27473
+ const uniffiHandleSuccess = (
27474
+ returnValue: Map<string, Array<Payment>>
27475
+ ) => {
27476
+ uniffiFutureCallback(
27477
+ uniffiCallbackData,
27478
+ /* UniffiForeignFutureStructRustBuffer */ {
27479
+ returnValue:
27480
+ FfiConverterMapStringArrayTypePayment.lower(returnValue),
27481
+ callStatus: uniffiCaller.createCallStatus(),
27482
+ }
27483
+ );
27484
+ };
27485
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
27486
+ uniffiFutureCallback(
27487
+ uniffiCallbackData,
27488
+ /* UniffiForeignFutureStructRustBuffer */ {
27489
+ returnValue: /*empty*/ new Uint8Array(0),
27490
+ // TODO create callstatus with error.
27491
+ callStatus: { code, errorBuf },
27492
+ }
27493
+ );
27494
+ };
27495
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
27496
+ /*makeCall:*/ uniffiMakeCall,
27497
+ /*handleSuccess:*/ uniffiHandleSuccess,
27498
+ /*handleError:*/ uniffiHandleError,
27499
+ /*isErrorType:*/ StorageError.instanceOf,
27500
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27501
+ FfiConverterTypeStorageError
26884
27502
  ),
26885
- /*liftString:*/ FfiConverterString.lift,
26886
- /*asyncOpts:*/ asyncOpts_,
26887
- /*errorHandler:*/ FfiConverterTypeSyncStorageError.lift.bind(
26888
- FfiConverterTypeSyncStorageError
26889
- )
26890
- );
26891
- } catch (__error: any) {
26892
- if (uniffiIsDebug && __error instanceof Error) {
26893
- __error.stack = __stack;
26894
- }
26895
- throw __error;
26896
- }
26897
- }
26898
-
26899
- /**
26900
- * Update the sync state record from an incoming record
26901
- */
26902
- public async updateRecordFromIncoming(
26903
- record: Record,
26904
- asyncOpts_?: { signal: AbortSignal }
26905
- ): Promise<void> /*throws*/ {
26906
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
26907
- try {
26908
- return await uniffiRustCallAsync(
26909
- /*rustCaller:*/ uniffiCaller,
26910
- /*rustFutureFunc:*/ () => {
26911
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_syncstorage_update_record_from_incoming(
26912
- uniffiTypeSyncStorageImplObjectFactory.clonePointer(this),
26913
- FfiConverterTypeRecord.lower(record)
26914
- );
26915
- },
26916
- /*pollFunc:*/ nativeModule()
26917
- .ubrn_ffi_breez_sdk_spark_rust_future_poll_void,
26918
- /*cancelFunc:*/ nativeModule()
26919
- .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void,
26920
- /*completeFunc:*/ nativeModule()
26921
- .ubrn_ffi_breez_sdk_spark_rust_future_complete_void,
26922
- /*freeFunc:*/ nativeModule()
26923
- .ubrn_ffi_breez_sdk_spark_rust_future_free_void,
26924
- /*liftFunc:*/ (_v) => {},
26925
- /*liftString:*/ FfiConverterString.lift,
26926
- /*asyncOpts:*/ asyncOpts_,
26927
- /*errorHandler:*/ FfiConverterTypeSyncStorageError.lift.bind(
26928
- FfiConverterTypeSyncStorageError
26929
- )
27503
+ /*lowerString:*/ FfiConverterString.lower
26930
27504
  );
26931
- } catch (__error: any) {
26932
- if (uniffiIsDebug && __error instanceof Error) {
26933
- __error.stack = __stack;
26934
- }
26935
- throw __error;
26936
- }
26937
- }
26938
-
26939
- /**
26940
- * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
26941
- */
26942
- uniffiDestroy(): void {
26943
- const ptr = (this as any)[destructorGuardSymbol];
26944
- if (ptr !== undefined) {
26945
- const pointer = uniffiTypeSyncStorageImplObjectFactory.pointer(this);
26946
- uniffiTypeSyncStorageImplObjectFactory.freePointer(pointer);
26947
- uniffiTypeSyncStorageImplObjectFactory.unbless(ptr);
26948
- delete (this as any)[destructorGuardSymbol];
26949
- }
26950
- }
26951
-
26952
- static instanceOf(obj: any): obj is SyncStorageImpl {
26953
- return uniffiTypeSyncStorageImplObjectFactory.isConcreteType(obj);
26954
- }
26955
- }
26956
-
26957
- const uniffiTypeSyncStorageImplObjectFactory: UniffiObjectFactory<SyncStorage> =
26958
- {
26959
- create(pointer: UnsafeMutableRawPointer): SyncStorage {
26960
- const instance = Object.create(SyncStorageImpl.prototype);
26961
- instance[pointerLiteralSymbol] = pointer;
26962
- instance[destructorGuardSymbol] = this.bless(pointer);
26963
- instance[uniffiTypeNameSymbol] = 'SyncStorageImpl';
26964
- return instance;
27505
+ return UniffiResult.success(uniffiForeignFuture);
26965
27506
  },
26966
-
26967
- bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr {
26968
- return uniffiCaller.rustCall(
26969
- /*caller:*/ (status) =>
26970
- nativeModule().ubrn_uniffi_internal_fn_method_syncstorage_ffi__bless_pointer(
26971
- p,
26972
- status
26973
- ),
26974
- /*liftString:*/ FfiConverterString.lift
27507
+ addDeposit: (
27508
+ uniffiHandle: bigint,
27509
+ txid: Uint8Array,
27510
+ vout: number,
27511
+ amountSats: bigint,
27512
+ uniffiFutureCallback: UniffiForeignFutureCompleteVoid,
27513
+ uniffiCallbackData: bigint
27514
+ ) => {
27515
+ const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
27516
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27517
+ return await jsCallback.addDeposit(
27518
+ FfiConverterString.lift(txid),
27519
+ FfiConverterUInt32.lift(vout),
27520
+ FfiConverterUInt64.lift(amountSats),
27521
+ { signal }
27522
+ );
27523
+ };
27524
+ const uniffiHandleSuccess = (returnValue: void) => {
27525
+ uniffiFutureCallback(
27526
+ uniffiCallbackData,
27527
+ /* UniffiForeignFutureStructVoid */ {
27528
+ callStatus: uniffiCaller.createCallStatus(),
27529
+ }
27530
+ );
27531
+ };
27532
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
27533
+ uniffiFutureCallback(
27534
+ uniffiCallbackData,
27535
+ /* UniffiForeignFutureStructVoid */ {
27536
+ // TODO create callstatus with error.
27537
+ callStatus: { code, errorBuf },
27538
+ }
27539
+ );
27540
+ };
27541
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
27542
+ /*makeCall:*/ uniffiMakeCall,
27543
+ /*handleSuccess:*/ uniffiHandleSuccess,
27544
+ /*handleError:*/ uniffiHandleError,
27545
+ /*isErrorType:*/ StorageError.instanceOf,
27546
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27547
+ FfiConverterTypeStorageError
27548
+ ),
27549
+ /*lowerString:*/ FfiConverterString.lower
26975
27550
  );
27551
+ return UniffiResult.success(uniffiForeignFuture);
26976
27552
  },
26977
-
26978
- unbless(ptr: UniffiRustArcPtr) {
26979
- ptr.markDestroyed();
26980
- },
26981
-
26982
- pointer(obj: SyncStorage): UnsafeMutableRawPointer {
26983
- if ((obj as any)[destructorGuardSymbol] === undefined) {
26984
- throw new UniffiInternalError.UnexpectedNullPointer();
26985
- }
26986
- return (obj as any)[pointerLiteralSymbol];
27553
+ deleteDeposit: (
27554
+ uniffiHandle: bigint,
27555
+ txid: Uint8Array,
27556
+ vout: number,
27557
+ uniffiFutureCallback: UniffiForeignFutureCompleteVoid,
27558
+ uniffiCallbackData: bigint
27559
+ ) => {
27560
+ const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
27561
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27562
+ return await jsCallback.deleteDeposit(
27563
+ FfiConverterString.lift(txid),
27564
+ FfiConverterUInt32.lift(vout),
27565
+ { signal }
27566
+ );
27567
+ };
27568
+ const uniffiHandleSuccess = (returnValue: void) => {
27569
+ uniffiFutureCallback(
27570
+ uniffiCallbackData,
27571
+ /* UniffiForeignFutureStructVoid */ {
27572
+ callStatus: uniffiCaller.createCallStatus(),
27573
+ }
27574
+ );
27575
+ };
27576
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
27577
+ uniffiFutureCallback(
27578
+ uniffiCallbackData,
27579
+ /* UniffiForeignFutureStructVoid */ {
27580
+ // TODO create callstatus with error.
27581
+ callStatus: { code, errorBuf },
27582
+ }
27583
+ );
27584
+ };
27585
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
27586
+ /*makeCall:*/ uniffiMakeCall,
27587
+ /*handleSuccess:*/ uniffiHandleSuccess,
27588
+ /*handleError:*/ uniffiHandleError,
27589
+ /*isErrorType:*/ StorageError.instanceOf,
27590
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27591
+ FfiConverterTypeStorageError
27592
+ ),
27593
+ /*lowerString:*/ FfiConverterString.lower
27594
+ );
27595
+ return UniffiResult.success(uniffiForeignFuture);
26987
27596
  },
26988
-
26989
- clonePointer(obj: SyncStorage): UnsafeMutableRawPointer {
26990
- const pointer = this.pointer(obj);
26991
- return uniffiCaller.rustCall(
26992
- /*caller:*/ (callStatus) =>
26993
- nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_syncstorage(
26994
- pointer,
26995
- callStatus
26996
- ),
26997
- /*liftString:*/ FfiConverterString.lift
27597
+ listDeposits: (
27598
+ uniffiHandle: bigint,
27599
+ uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
27600
+ uniffiCallbackData: bigint
27601
+ ) => {
27602
+ const uniffiMakeCall = async (
27603
+ signal: AbortSignal
27604
+ ): Promise<Array<DepositInfo>> => {
27605
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27606
+ return await jsCallback.listDeposits({ signal });
27607
+ };
27608
+ const uniffiHandleSuccess = (returnValue: Array<DepositInfo>) => {
27609
+ uniffiFutureCallback(
27610
+ uniffiCallbackData,
27611
+ /* UniffiForeignFutureStructRustBuffer */ {
27612
+ returnValue: FfiConverterArrayTypeDepositInfo.lower(returnValue),
27613
+ callStatus: uniffiCaller.createCallStatus(),
27614
+ }
27615
+ );
27616
+ };
27617
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
27618
+ uniffiFutureCallback(
27619
+ uniffiCallbackData,
27620
+ /* UniffiForeignFutureStructRustBuffer */ {
27621
+ returnValue: /*empty*/ new Uint8Array(0),
27622
+ // TODO create callstatus with error.
27623
+ callStatus: { code, errorBuf },
27624
+ }
27625
+ );
27626
+ };
27627
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
27628
+ /*makeCall:*/ uniffiMakeCall,
27629
+ /*handleSuccess:*/ uniffiHandleSuccess,
27630
+ /*handleError:*/ uniffiHandleError,
27631
+ /*isErrorType:*/ StorageError.instanceOf,
27632
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27633
+ FfiConverterTypeStorageError
27634
+ ),
27635
+ /*lowerString:*/ FfiConverterString.lower
26998
27636
  );
27637
+ return UniffiResult.success(uniffiForeignFuture);
26999
27638
  },
27000
-
27001
- freePointer(pointer: UnsafeMutableRawPointer): void {
27002
- uniffiCaller.rustCall(
27003
- /*caller:*/ (callStatus) =>
27004
- nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_syncstorage(
27005
- pointer,
27006
- callStatus
27007
- ),
27008
- /*liftString:*/ FfiConverterString.lift
27639
+ updateDeposit: (
27640
+ uniffiHandle: bigint,
27641
+ txid: Uint8Array,
27642
+ vout: number,
27643
+ payload: Uint8Array,
27644
+ uniffiFutureCallback: UniffiForeignFutureCompleteVoid,
27645
+ uniffiCallbackData: bigint
27646
+ ) => {
27647
+ const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
27648
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27649
+ return await jsCallback.updateDeposit(
27650
+ FfiConverterString.lift(txid),
27651
+ FfiConverterUInt32.lift(vout),
27652
+ FfiConverterTypeUpdateDepositPayload.lift(payload),
27653
+ { signal }
27654
+ );
27655
+ };
27656
+ const uniffiHandleSuccess = (returnValue: void) => {
27657
+ uniffiFutureCallback(
27658
+ uniffiCallbackData,
27659
+ /* UniffiForeignFutureStructVoid */ {
27660
+ callStatus: uniffiCaller.createCallStatus(),
27661
+ }
27662
+ );
27663
+ };
27664
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
27665
+ uniffiFutureCallback(
27666
+ uniffiCallbackData,
27667
+ /* UniffiForeignFutureStructVoid */ {
27668
+ // TODO create callstatus with error.
27669
+ callStatus: { code, errorBuf },
27670
+ }
27671
+ );
27672
+ };
27673
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
27674
+ /*makeCall:*/ uniffiMakeCall,
27675
+ /*handleSuccess:*/ uniffiHandleSuccess,
27676
+ /*handleError:*/ uniffiHandleError,
27677
+ /*isErrorType:*/ StorageError.instanceOf,
27678
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27679
+ FfiConverterTypeStorageError
27680
+ ),
27681
+ /*lowerString:*/ FfiConverterString.lower
27009
27682
  );
27683
+ return UniffiResult.success(uniffiForeignFuture);
27010
27684
  },
27011
-
27012
- isConcreteType(obj: any): obj is SyncStorage {
27013
- return (
27014
- obj[destructorGuardSymbol] &&
27015
- obj[uniffiTypeNameSymbol] === 'SyncStorageImpl'
27685
+ setLnurlMetadata: (
27686
+ uniffiHandle: bigint,
27687
+ metadata: Uint8Array,
27688
+ uniffiFutureCallback: UniffiForeignFutureCompleteVoid,
27689
+ uniffiCallbackData: bigint
27690
+ ) => {
27691
+ const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
27692
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27693
+ return await jsCallback.setLnurlMetadata(
27694
+ FfiConverterArrayTypeSetLnurlMetadataItem.lift(metadata),
27695
+ { signal }
27696
+ );
27697
+ };
27698
+ const uniffiHandleSuccess = (returnValue: void) => {
27699
+ uniffiFutureCallback(
27700
+ uniffiCallbackData,
27701
+ /* UniffiForeignFutureStructVoid */ {
27702
+ callStatus: uniffiCaller.createCallStatus(),
27703
+ }
27704
+ );
27705
+ };
27706
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
27707
+ uniffiFutureCallback(
27708
+ uniffiCallbackData,
27709
+ /* UniffiForeignFutureStructVoid */ {
27710
+ // TODO create callstatus with error.
27711
+ callStatus: { code, errorBuf },
27712
+ }
27713
+ );
27714
+ };
27715
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
27716
+ /*makeCall:*/ uniffiMakeCall,
27717
+ /*handleSuccess:*/ uniffiHandleSuccess,
27718
+ /*handleError:*/ uniffiHandleError,
27719
+ /*isErrorType:*/ StorageError.instanceOf,
27720
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27721
+ FfiConverterTypeStorageError
27722
+ ),
27723
+ /*lowerString:*/ FfiConverterString.lower
27016
27724
  );
27725
+ return UniffiResult.success(uniffiForeignFuture);
27017
27726
  },
27018
- };
27019
- // FfiConverter for SyncStorage
27020
- const FfiConverterTypeSyncStorage = new FfiConverterObjectWithCallbacks(
27021
- uniffiTypeSyncStorageImplObjectFactory
27022
- );
27023
-
27024
- // Add a vtavble for the callbacks that go in SyncStorage.
27025
-
27026
- // Put the implementation in a struct so we don't pollute the top-level namespace
27027
- const uniffiCallbackInterfaceSyncStorage: {
27028
- vtable: UniffiVTableCallbackInterfaceSyncStorage;
27029
- register: () => void;
27030
- } = {
27031
- // Create the VTable using a series of closures.
27032
- // ts automatically converts these into C callback functions.
27033
- vtable: {
27034
27727
  addOutgoingChange: (
27035
27728
  uniffiHandle: bigint,
27036
27729
  record: Uint8Array,
@@ -27040,7 +27733,7 @@ const uniffiCallbackInterfaceSyncStorage: {
27040
27733
  const uniffiMakeCall = async (
27041
27734
  signal: AbortSignal
27042
27735
  ): Promise</*u64*/ bigint> => {
27043
- const jsCallback = FfiConverterTypeSyncStorage.lift(uniffiHandle);
27736
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27044
27737
  return await jsCallback.addOutgoingChange(
27045
27738
  FfiConverterTypeUnversionedRecordChange.lift(record),
27046
27739
  { signal }
@@ -27069,9 +27762,9 @@ const uniffiCallbackInterfaceSyncStorage: {
27069
27762
  /*makeCall:*/ uniffiMakeCall,
27070
27763
  /*handleSuccess:*/ uniffiHandleSuccess,
27071
27764
  /*handleError:*/ uniffiHandleError,
27072
- /*isErrorType:*/ SyncStorageError.instanceOf,
27073
- /*lowerError:*/ FfiConverterTypeSyncStorageError.lower.bind(
27074
- FfiConverterTypeSyncStorageError
27765
+ /*isErrorType:*/ StorageError.instanceOf,
27766
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27767
+ FfiConverterTypeStorageError
27075
27768
  ),
27076
27769
  /*lowerString:*/ FfiConverterString.lower
27077
27770
  );
@@ -27080,13 +27773,15 @@ const uniffiCallbackInterfaceSyncStorage: {
27080
27773
  completeOutgoingSync: (
27081
27774
  uniffiHandle: bigint,
27082
27775
  record: Uint8Array,
27776
+ localRevision: bigint,
27083
27777
  uniffiFutureCallback: UniffiForeignFutureCompleteVoid,
27084
27778
  uniffiCallbackData: bigint
27085
27779
  ) => {
27086
27780
  const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
27087
- const jsCallback = FfiConverterTypeSyncStorage.lift(uniffiHandle);
27781
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27088
27782
  return await jsCallback.completeOutgoingSync(
27089
27783
  FfiConverterTypeRecord.lift(record),
27784
+ FfiConverterUInt64.lift(localRevision),
27090
27785
  { signal }
27091
27786
  );
27092
27787
  };
@@ -27111,9 +27806,9 @@ const uniffiCallbackInterfaceSyncStorage: {
27111
27806
  /*makeCall:*/ uniffiMakeCall,
27112
27807
  /*handleSuccess:*/ uniffiHandleSuccess,
27113
27808
  /*handleError:*/ uniffiHandleError,
27114
- /*isErrorType:*/ SyncStorageError.instanceOf,
27115
- /*lowerError:*/ FfiConverterTypeSyncStorageError.lower.bind(
27116
- FfiConverterTypeSyncStorageError
27809
+ /*isErrorType:*/ StorageError.instanceOf,
27810
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27811
+ FfiConverterTypeStorageError
27117
27812
  ),
27118
27813
  /*lowerString:*/ FfiConverterString.lower
27119
27814
  );
@@ -27128,7 +27823,7 @@ const uniffiCallbackInterfaceSyncStorage: {
27128
27823
  const uniffiMakeCall = async (
27129
27824
  signal: AbortSignal
27130
27825
  ): Promise<Array<OutgoingChange>> => {
27131
- const jsCallback = FfiConverterTypeSyncStorage.lift(uniffiHandle);
27826
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27132
27827
  return await jsCallback.getPendingOutgoingChanges(
27133
27828
  FfiConverterUInt32.lift(limit),
27134
27829
  { signal }
@@ -27157,9 +27852,9 @@ const uniffiCallbackInterfaceSyncStorage: {
27157
27852
  /*makeCall:*/ uniffiMakeCall,
27158
27853
  /*handleSuccess:*/ uniffiHandleSuccess,
27159
27854
  /*handleError:*/ uniffiHandleError,
27160
- /*isErrorType:*/ SyncStorageError.instanceOf,
27161
- /*lowerError:*/ FfiConverterTypeSyncStorageError.lower.bind(
27162
- FfiConverterTypeSyncStorageError
27855
+ /*isErrorType:*/ StorageError.instanceOf,
27856
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27857
+ FfiConverterTypeStorageError
27163
27858
  ),
27164
27859
  /*lowerString:*/ FfiConverterString.lower
27165
27860
  );
@@ -27173,7 +27868,7 @@ const uniffiCallbackInterfaceSyncStorage: {
27173
27868
  const uniffiMakeCall = async (
27174
27869
  signal: AbortSignal
27175
27870
  ): Promise</*u64*/ bigint> => {
27176
- const jsCallback = FfiConverterTypeSyncStorage.lift(uniffiHandle);
27871
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27177
27872
  return await jsCallback.getLastRevision({ signal });
27178
27873
  };
27179
27874
  const uniffiHandleSuccess = (returnValue: /*u64*/ bigint) => {
@@ -27199,9 +27894,9 @@ const uniffiCallbackInterfaceSyncStorage: {
27199
27894
  /*makeCall:*/ uniffiMakeCall,
27200
27895
  /*handleSuccess:*/ uniffiHandleSuccess,
27201
27896
  /*handleError:*/ uniffiHandleError,
27202
- /*isErrorType:*/ SyncStorageError.instanceOf,
27203
- /*lowerError:*/ FfiConverterTypeSyncStorageError.lower.bind(
27204
- FfiConverterTypeSyncStorageError
27897
+ /*isErrorType:*/ StorageError.instanceOf,
27898
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27899
+ FfiConverterTypeStorageError
27205
27900
  ),
27206
27901
  /*lowerString:*/ FfiConverterString.lower
27207
27902
  );
@@ -27214,7 +27909,7 @@ const uniffiCallbackInterfaceSyncStorage: {
27214
27909
  uniffiCallbackData: bigint
27215
27910
  ) => {
27216
27911
  const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
27217
- const jsCallback = FfiConverterTypeSyncStorage.lift(uniffiHandle);
27912
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27218
27913
  return await jsCallback.insertIncomingRecords(
27219
27914
  FfiConverterArrayTypeRecord.lift(records),
27220
27915
  { signal }
@@ -27241,9 +27936,9 @@ const uniffiCallbackInterfaceSyncStorage: {
27241
27936
  /*makeCall:*/ uniffiMakeCall,
27242
27937
  /*handleSuccess:*/ uniffiHandleSuccess,
27243
27938
  /*handleError:*/ uniffiHandleError,
27244
- /*isErrorType:*/ SyncStorageError.instanceOf,
27245
- /*lowerError:*/ FfiConverterTypeSyncStorageError.lower.bind(
27246
- FfiConverterTypeSyncStorageError
27939
+ /*isErrorType:*/ StorageError.instanceOf,
27940
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27941
+ FfiConverterTypeStorageError
27247
27942
  ),
27248
27943
  /*lowerString:*/ FfiConverterString.lower
27249
27944
  );
@@ -27256,7 +27951,7 @@ const uniffiCallbackInterfaceSyncStorage: {
27256
27951
  uniffiCallbackData: bigint
27257
27952
  ) => {
27258
27953
  const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
27259
- const jsCallback = FfiConverterTypeSyncStorage.lift(uniffiHandle);
27954
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27260
27955
  return await jsCallback.deleteIncomingRecord(
27261
27956
  FfiConverterTypeRecord.lift(record),
27262
27957
  { signal }
@@ -27283,51 +27978,9 @@ const uniffiCallbackInterfaceSyncStorage: {
27283
27978
  /*makeCall:*/ uniffiMakeCall,
27284
27979
  /*handleSuccess:*/ uniffiHandleSuccess,
27285
27980
  /*handleError:*/ uniffiHandleError,
27286
- /*isErrorType:*/ SyncStorageError.instanceOf,
27287
- /*lowerError:*/ FfiConverterTypeSyncStorageError.lower.bind(
27288
- FfiConverterTypeSyncStorageError
27289
- ),
27290
- /*lowerString:*/ FfiConverterString.lower
27291
- );
27292
- return UniffiResult.success(uniffiForeignFuture);
27293
- },
27294
- rebasePendingOutgoingRecords: (
27295
- uniffiHandle: bigint,
27296
- revision: bigint,
27297
- uniffiFutureCallback: UniffiForeignFutureCompleteVoid,
27298
- uniffiCallbackData: bigint
27299
- ) => {
27300
- const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
27301
- const jsCallback = FfiConverterTypeSyncStorage.lift(uniffiHandle);
27302
- return await jsCallback.rebasePendingOutgoingRecords(
27303
- FfiConverterUInt64.lift(revision),
27304
- { signal }
27305
- );
27306
- };
27307
- const uniffiHandleSuccess = (returnValue: void) => {
27308
- uniffiFutureCallback(
27309
- uniffiCallbackData,
27310
- /* UniffiForeignFutureStructVoid */ {
27311
- callStatus: uniffiCaller.createCallStatus(),
27312
- }
27313
- );
27314
- };
27315
- const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
27316
- uniffiFutureCallback(
27317
- uniffiCallbackData,
27318
- /* UniffiForeignFutureStructVoid */ {
27319
- // TODO create callstatus with error.
27320
- callStatus: { code, errorBuf },
27321
- }
27322
- );
27323
- };
27324
- const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
27325
- /*makeCall:*/ uniffiMakeCall,
27326
- /*handleSuccess:*/ uniffiHandleSuccess,
27327
- /*handleError:*/ uniffiHandleError,
27328
- /*isErrorType:*/ SyncStorageError.instanceOf,
27329
- /*lowerError:*/ FfiConverterTypeSyncStorageError.lower.bind(
27330
- FfiConverterTypeSyncStorageError
27981
+ /*isErrorType:*/ StorageError.instanceOf,
27982
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
27983
+ FfiConverterTypeStorageError
27331
27984
  ),
27332
27985
  /*lowerString:*/ FfiConverterString.lower
27333
27986
  );
@@ -27342,7 +27995,7 @@ const uniffiCallbackInterfaceSyncStorage: {
27342
27995
  const uniffiMakeCall = async (
27343
27996
  signal: AbortSignal
27344
27997
  ): Promise<Array<IncomingChange>> => {
27345
- const jsCallback = FfiConverterTypeSyncStorage.lift(uniffiHandle);
27998
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27346
27999
  return await jsCallback.getIncomingRecords(
27347
28000
  FfiConverterUInt32.lift(limit),
27348
28001
  { signal }
@@ -27371,9 +28024,9 @@ const uniffiCallbackInterfaceSyncStorage: {
27371
28024
  /*makeCall:*/ uniffiMakeCall,
27372
28025
  /*handleSuccess:*/ uniffiHandleSuccess,
27373
28026
  /*handleError:*/ uniffiHandleError,
27374
- /*isErrorType:*/ SyncStorageError.instanceOf,
27375
- /*lowerError:*/ FfiConverterTypeSyncStorageError.lower.bind(
27376
- FfiConverterTypeSyncStorageError
28027
+ /*isErrorType:*/ StorageError.instanceOf,
28028
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
28029
+ FfiConverterTypeStorageError
27377
28030
  ),
27378
28031
  /*lowerString:*/ FfiConverterString.lower
27379
28032
  );
@@ -27387,7 +28040,7 @@ const uniffiCallbackInterfaceSyncStorage: {
27387
28040
  const uniffiMakeCall = async (
27388
28041
  signal: AbortSignal
27389
28042
  ): Promise<OutgoingChange | undefined> => {
27390
- const jsCallback = FfiConverterTypeSyncStorage.lift(uniffiHandle);
28043
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27391
28044
  return await jsCallback.getLatestOutgoingChange({ signal });
27392
28045
  };
27393
28046
  const uniffiHandleSuccess = (returnValue: OutgoingChange | undefined) => {
@@ -27414,9 +28067,9 @@ const uniffiCallbackInterfaceSyncStorage: {
27414
28067
  /*makeCall:*/ uniffiMakeCall,
27415
28068
  /*handleSuccess:*/ uniffiHandleSuccess,
27416
28069
  /*handleError:*/ uniffiHandleError,
27417
- /*isErrorType:*/ SyncStorageError.instanceOf,
27418
- /*lowerError:*/ FfiConverterTypeSyncStorageError.lower.bind(
27419
- FfiConverterTypeSyncStorageError
28070
+ /*isErrorType:*/ StorageError.instanceOf,
28071
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
28072
+ FfiConverterTypeStorageError
27420
28073
  ),
27421
28074
  /*lowerString:*/ FfiConverterString.lower
27422
28075
  );
@@ -27429,7 +28082,7 @@ const uniffiCallbackInterfaceSyncStorage: {
27429
28082
  uniffiCallbackData: bigint
27430
28083
  ) => {
27431
28084
  const uniffiMakeCall = async (signal: AbortSignal): Promise<void> => {
27432
- const jsCallback = FfiConverterTypeSyncStorage.lift(uniffiHandle);
28085
+ const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle);
27433
28086
  return await jsCallback.updateRecordFromIncoming(
27434
28087
  FfiConverterTypeRecord.lift(record),
27435
28088
  { signal }
@@ -27456,22 +28109,22 @@ const uniffiCallbackInterfaceSyncStorage: {
27456
28109
  /*makeCall:*/ uniffiMakeCall,
27457
28110
  /*handleSuccess:*/ uniffiHandleSuccess,
27458
28111
  /*handleError:*/ uniffiHandleError,
27459
- /*isErrorType:*/ SyncStorageError.instanceOf,
27460
- /*lowerError:*/ FfiConverterTypeSyncStorageError.lower.bind(
27461
- FfiConverterTypeSyncStorageError
28112
+ /*isErrorType:*/ StorageError.instanceOf,
28113
+ /*lowerError:*/ FfiConverterTypeStorageError.lower.bind(
28114
+ FfiConverterTypeStorageError
27462
28115
  ),
27463
28116
  /*lowerString:*/ FfiConverterString.lower
27464
28117
  );
27465
28118
  return UniffiResult.success(uniffiForeignFuture);
27466
28119
  },
27467
28120
  uniffiFree: (uniffiHandle: UniffiHandle): void => {
27468
- // SyncStorage: this will throw a stale handle error if the handle isn't found.
27469
- FfiConverterTypeSyncStorage.drop(uniffiHandle);
28121
+ // Storage: this will throw a stale handle error if the handle isn't found.
28122
+ FfiConverterTypeStorage.drop(uniffiHandle);
27470
28123
  },
27471
28124
  },
27472
28125
  register: () => {
27473
- nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_syncstorage(
27474
- uniffiCallbackInterfaceSyncStorage.vtable
28126
+ nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_storage(
28127
+ uniffiCallbackInterfaceStorage.vtable
27475
28128
  );
27476
28129
  },
27477
28130
  };
@@ -28053,6 +28706,11 @@ const FfiConverterOptionalTypeLogger = new FfiConverterOptional(
28053
28706
  FfiConverterTypeLogger
28054
28707
  );
28055
28708
 
28709
+ // FfiConverter for ConversionDetails | undefined
28710
+ const FfiConverterOptionalTypeConversionDetails = new FfiConverterOptional(
28711
+ FfiConverterTypeConversionDetails
28712
+ );
28713
+
28056
28714
  // FfiConverter for ConversionEstimate | undefined
28057
28715
  const FfiConverterOptionalTypeConversionEstimate = new FfiConverterOptional(
28058
28716
  FfiConverterTypeConversionEstimate
@@ -28127,11 +28785,21 @@ const FfiConverterOptionalTypeSparkHtlcOptions = new FfiConverterOptional(
28127
28785
  const FfiConverterOptionalTypeSparkInvoicePaymentDetails =
28128
28786
  new FfiConverterOptional(FfiConverterTypeSparkInvoicePaymentDetails);
28129
28787
 
28788
+ // FfiConverter for StableBalanceConfig | undefined
28789
+ const FfiConverterOptionalTypeStableBalanceConfig = new FfiConverterOptional(
28790
+ FfiConverterTypeStableBalanceConfig
28791
+ );
28792
+
28130
28793
  // FfiConverter for Symbol | undefined
28131
28794
  const FfiConverterOptionalTypeSymbol = new FfiConverterOptional(
28132
28795
  FfiConverterTypeSymbol
28133
28796
  );
28134
28797
 
28798
+ // FfiConverter for TokenMetadata | undefined
28799
+ const FfiConverterOptionalTypeTokenMetadata = new FfiConverterOptional(
28800
+ FfiConverterTypeTokenMetadata
28801
+ );
28802
+
28135
28803
  // FfiConverter for string | undefined
28136
28804
  const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
28137
28805
 
@@ -28254,6 +28922,12 @@ const FfiConverterArrayTypeUtxo = new FfiConverterArray(FfiConverterTypeUtxo);
28254
28922
  // FfiConverter for Array<string>
28255
28923
  const FfiConverterArrayString = new FfiConverterArray(FfiConverterString);
28256
28924
 
28925
+ // FfiConverter for Map<string, Array<Payment>>
28926
+ const FfiConverterMapStringArrayTypePayment = new FfiConverterMap(
28927
+ FfiConverterString,
28928
+ FfiConverterArrayTypePayment
28929
+ );
28930
+
28257
28931
  // FfiConverter for U128 | undefined
28258
28932
  const FfiConverterOptionalTypeu128 = new FfiConverterOptional(
28259
28933
  FfiConverterTypeu128
@@ -28284,6 +28958,11 @@ const FfiConverterOptionalTypeFee = new FfiConverterOptional(
28284
28958
  FfiConverterTypeFee
28285
28959
  );
28286
28960
 
28961
+ // FfiConverter for FeePolicy | undefined
28962
+ const FfiConverterOptionalTypeFeePolicy = new FfiConverterOptional(
28963
+ FfiConverterTypeFeePolicy
28964
+ );
28965
+
28287
28966
  // FfiConverter for MaxFee | undefined
28288
28967
  const FfiConverterOptionalTypeMaxFee = new FfiConverterOptional(
28289
28968
  FfiConverterTypeMaxFee
@@ -28309,6 +28988,11 @@ const FfiConverterOptionalTypeSuccessActionProcessed = new FfiConverterOptional(
28309
28988
  FfiConverterTypeSuccessActionProcessed
28310
28989
  );
28311
28990
 
28991
+ // FfiConverter for TokenTransactionType | undefined
28992
+ const FfiConverterOptionalTypeTokenTransactionType = new FfiConverterOptional(
28993
+ FfiConverterTypeTokenTransactionType
28994
+ );
28995
+
28312
28996
  // FfiConverter for Map<string, string> | undefined
28313
28997
  const FfiConverterOptionalMapStringString = new FfiConverterOptional(
28314
28998
  FfiConverterMapStringString
@@ -28415,6 +29099,14 @@ function uniffiEnsureInitialized() {
28415
29099
  'uniffi_breez_sdk_spark_checksum_func_default_external_signer'
28416
29100
  );
28417
29101
  }
29102
+ if (
29103
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_get_spark_status() !==
29104
+ 62888
29105
+ ) {
29106
+ throw new UniffiInternalError.ApiChecksumMismatch(
29107
+ 'uniffi_breez_sdk_spark_checksum_func_get_spark_status'
29108
+ );
29109
+ }
28418
29110
  if (
28419
29111
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_init_logging() !==
28420
29112
  8518
@@ -28471,6 +29163,14 @@ function uniffiEnsureInitialized() {
28471
29163
  'uniffi_breez_sdk_spark_checksum_method_breezsdk_add_event_listener'
28472
29164
  );
28473
29165
  }
29166
+ if (
29167
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_buy_bitcoin() !==
29168
+ 32150
29169
+ ) {
29170
+ throw new UniffiInternalError.ApiChecksumMismatch(
29171
+ 'uniffi_breez_sdk_spark_checksum_method_breezsdk_buy_bitcoin'
29172
+ );
29173
+ }
28474
29174
  if (
28475
29175
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_cancel_leaf_optimization() !==
28476
29176
  56996
@@ -28609,7 +29309,7 @@ function uniffiEnsureInitialized() {
28609
29309
  }
28610
29310
  if (
28611
29311
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_list_payments() !==
28612
- 16156
29312
+ 39170
28613
29313
  ) {
28614
29314
  throw new UniffiInternalError.ApiChecksumMismatch(
28615
29315
  'uniffi_breez_sdk_spark_checksum_method_breezsdk_list_payments'
@@ -28625,7 +29325,7 @@ function uniffiEnsureInitialized() {
28625
29325
  }
28626
29326
  if (
28627
29327
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_auth() !==
28628
- 37942
29328
+ 125
28629
29329
  ) {
28630
29330
  throw new UniffiInternalError.ApiChecksumMismatch(
28631
29331
  'uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_auth'
@@ -28865,7 +29565,7 @@ function uniffiEnsureInitialized() {
28865
29565
  }
28866
29566
  if (
28867
29567
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_subtract_secrets() !==
28868
- 51106
29568
+ 45969
28869
29569
  ) {
28870
29570
  throw new UniffiInternalError.ApiChecksumMismatch(
28871
29571
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_subtract_secrets'
@@ -29015,14 +29715,6 @@ function uniffiEnsureInitialized() {
29015
29715
  'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_payment_observer'
29016
29716
  );
29017
29717
  }
29018
- if (
29019
- nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_real_time_sync_storage() !==
29020
- 20579
29021
- ) {
29022
- throw new UniffiInternalError.ApiChecksumMismatch(
29023
- 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_real_time_sync_storage'
29024
- );
29025
- }
29026
29718
  if (
29027
29719
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_rest_chain_service() !==
29028
29720
  63155
@@ -29080,11 +29772,11 @@ function uniffiEnsureInitialized() {
29080
29772
  );
29081
29773
  }
29082
29774
  if (
29083
- nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_set_payment_metadata() !==
29084
- 45500
29775
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_insert_payment_metadata() !==
29776
+ 32757
29085
29777
  ) {
29086
29778
  throw new UniffiInternalError.ApiChecksumMismatch(
29087
- 'uniffi_breez_sdk_spark_checksum_method_storage_set_payment_metadata'
29779
+ 'uniffi_breez_sdk_spark_checksum_method_storage_insert_payment_metadata'
29088
29780
  );
29089
29781
  }
29090
29782
  if (
@@ -29103,9 +29795,17 @@ function uniffiEnsureInitialized() {
29103
29795
  'uniffi_breez_sdk_spark_checksum_method_storage_get_payment_by_invoice'
29104
29796
  );
29105
29797
  }
29798
+ if (
29799
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_payments_by_parent_ids() !==
29800
+ 10948
29801
+ ) {
29802
+ throw new UniffiInternalError.ApiChecksumMismatch(
29803
+ 'uniffi_breez_sdk_spark_checksum_method_storage_get_payments_by_parent_ids'
29804
+ );
29805
+ }
29106
29806
  if (
29107
29807
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_add_deposit() !==
29108
- 60240
29808
+ 13181
29109
29809
  ) {
29110
29810
  throw new UniffiInternalError.ApiChecksumMismatch(
29111
29811
  'uniffi_breez_sdk_spark_checksum_method_storage_add_deposit'
@@ -29113,7 +29813,7 @@ function uniffiEnsureInitialized() {
29113
29813
  }
29114
29814
  if (
29115
29815
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_delete_deposit() !==
29116
- 60586
29816
+ 28477
29117
29817
  ) {
29118
29818
  throw new UniffiInternalError.ApiChecksumMismatch(
29119
29819
  'uniffi_breez_sdk_spark_checksum_method_storage_delete_deposit'
@@ -29121,7 +29821,7 @@ function uniffiEnsureInitialized() {
29121
29821
  }
29122
29822
  if (
29123
29823
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_list_deposits() !==
29124
- 54118
29824
+ 62636
29125
29825
  ) {
29126
29826
  throw new UniffiInternalError.ApiChecksumMismatch(
29127
29827
  'uniffi_breez_sdk_spark_checksum_method_storage_list_deposits'
@@ -29129,7 +29829,7 @@ function uniffiEnsureInitialized() {
29129
29829
  }
29130
29830
  if (
29131
29831
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_update_deposit() !==
29132
- 39803
29832
+ 18714
29133
29833
  ) {
29134
29834
  throw new UniffiInternalError.ApiChecksumMismatch(
29135
29835
  'uniffi_breez_sdk_spark_checksum_method_storage_update_deposit'
@@ -29137,90 +29837,82 @@ function uniffiEnsureInitialized() {
29137
29837
  }
29138
29838
  if (
29139
29839
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_set_lnurl_metadata() !==
29140
- 7460
29840
+ 64210
29141
29841
  ) {
29142
29842
  throw new UniffiInternalError.ApiChecksumMismatch(
29143
29843
  'uniffi_breez_sdk_spark_checksum_method_storage_set_lnurl_metadata'
29144
29844
  );
29145
29845
  }
29146
29846
  if (
29147
- nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_syncstorage_add_outgoing_change() !==
29148
- 19087
29149
- ) {
29150
- throw new UniffiInternalError.ApiChecksumMismatch(
29151
- 'uniffi_breez_sdk_spark_checksum_method_syncstorage_add_outgoing_change'
29152
- );
29153
- }
29154
- if (
29155
- nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_syncstorage_complete_outgoing_sync() !==
29156
- 20071
29847
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_add_outgoing_change() !==
29848
+ 50774
29157
29849
  ) {
29158
29850
  throw new UniffiInternalError.ApiChecksumMismatch(
29159
- 'uniffi_breez_sdk_spark_checksum_method_syncstorage_complete_outgoing_sync'
29851
+ 'uniffi_breez_sdk_spark_checksum_method_storage_add_outgoing_change'
29160
29852
  );
29161
29853
  }
29162
29854
  if (
29163
- nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_syncstorage_get_pending_outgoing_changes() !==
29164
- 23473
29855
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_complete_outgoing_sync() !==
29856
+ 8796
29165
29857
  ) {
29166
29858
  throw new UniffiInternalError.ApiChecksumMismatch(
29167
- 'uniffi_breez_sdk_spark_checksum_method_syncstorage_get_pending_outgoing_changes'
29859
+ 'uniffi_breez_sdk_spark_checksum_method_storage_complete_outgoing_sync'
29168
29860
  );
29169
29861
  }
29170
29862
  if (
29171
- nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_syncstorage_get_last_revision() !==
29172
- 36887
29863
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_pending_outgoing_changes() !==
29864
+ 20314
29173
29865
  ) {
29174
29866
  throw new UniffiInternalError.ApiChecksumMismatch(
29175
- 'uniffi_breez_sdk_spark_checksum_method_syncstorage_get_last_revision'
29867
+ 'uniffi_breez_sdk_spark_checksum_method_storage_get_pending_outgoing_changes'
29176
29868
  );
29177
29869
  }
29178
29870
  if (
29179
- nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_syncstorage_insert_incoming_records() !==
29180
- 41782
29871
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_last_revision() !==
29872
+ 48442
29181
29873
  ) {
29182
29874
  throw new UniffiInternalError.ApiChecksumMismatch(
29183
- 'uniffi_breez_sdk_spark_checksum_method_syncstorage_insert_incoming_records'
29875
+ 'uniffi_breez_sdk_spark_checksum_method_storage_get_last_revision'
29184
29876
  );
29185
29877
  }
29186
29878
  if (
29187
- nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_syncstorage_delete_incoming_record() !==
29188
- 23002
29879
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_insert_incoming_records() !==
29880
+ 38174
29189
29881
  ) {
29190
29882
  throw new UniffiInternalError.ApiChecksumMismatch(
29191
- 'uniffi_breez_sdk_spark_checksum_method_syncstorage_delete_incoming_record'
29883
+ 'uniffi_breez_sdk_spark_checksum_method_storage_insert_incoming_records'
29192
29884
  );
29193
29885
  }
29194
29886
  if (
29195
- nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_syncstorage_rebase_pending_outgoing_records() !==
29196
- 61508
29887
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_delete_incoming_record() !==
29888
+ 26412
29197
29889
  ) {
29198
29890
  throw new UniffiInternalError.ApiChecksumMismatch(
29199
- 'uniffi_breez_sdk_spark_checksum_method_syncstorage_rebase_pending_outgoing_records'
29891
+ 'uniffi_breez_sdk_spark_checksum_method_storage_delete_incoming_record'
29200
29892
  );
29201
29893
  }
29202
29894
  if (
29203
- nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_syncstorage_get_incoming_records() !==
29204
- 53552
29895
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_incoming_records() !==
29896
+ 13705
29205
29897
  ) {
29206
29898
  throw new UniffiInternalError.ApiChecksumMismatch(
29207
- 'uniffi_breez_sdk_spark_checksum_method_syncstorage_get_incoming_records'
29899
+ 'uniffi_breez_sdk_spark_checksum_method_storage_get_incoming_records'
29208
29900
  );
29209
29901
  }
29210
29902
  if (
29211
- nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_syncstorage_get_latest_outgoing_change() !==
29212
- 16326
29903
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_latest_outgoing_change() !==
29904
+ 41859
29213
29905
  ) {
29214
29906
  throw new UniffiInternalError.ApiChecksumMismatch(
29215
- 'uniffi_breez_sdk_spark_checksum_method_syncstorage_get_latest_outgoing_change'
29907
+ 'uniffi_breez_sdk_spark_checksum_method_storage_get_latest_outgoing_change'
29216
29908
  );
29217
29909
  }
29218
29910
  if (
29219
- nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_syncstorage_update_record_from_incoming() !==
29220
- 9986
29911
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_update_record_from_incoming() !==
29912
+ 54499
29221
29913
  ) {
29222
29914
  throw new UniffiInternalError.ApiChecksumMismatch(
29223
- 'uniffi_breez_sdk_spark_checksum_method_syncstorage_update_record_from_incoming'
29915
+ 'uniffi_breez_sdk_spark_checksum_method_storage_update_record_from_incoming'
29224
29916
  );
29225
29917
  }
29226
29918
  if (
@@ -29312,7 +30004,6 @@ function uniffiEnsureInitialized() {
29312
30004
  uniffiCallbackInterfacePaymentObserver.register();
29313
30005
  uniffiCallbackInterfaceRestClient.register();
29314
30006
  uniffiCallbackInterfaceStorage.register();
29315
- uniffiCallbackInterfaceSyncStorage.register();
29316
30007
  }
29317
30008
 
29318
30009
  export default Object.freeze({
@@ -29340,6 +30031,8 @@ export default Object.freeze({
29340
30031
  FfiConverterTypeBolt12OfferDetails,
29341
30032
  FfiConverterTypeBreezSdk,
29342
30033
  FfiConverterTypeBurnIssuerTokenRequest,
30034
+ FfiConverterTypeBuyBitcoinRequest,
30035
+ FfiConverterTypeBuyBitcoinResponse,
29343
30036
  FfiConverterTypeChainApiType,
29344
30037
  FfiConverterTypeCheckLightningAddressRequest,
29345
30038
  FfiConverterTypeCheckMessageRequest,
@@ -29351,11 +30044,13 @@ export default Object.freeze({
29351
30044
  FfiConverterTypeConfig,
29352
30045
  FfiConverterTypeConnectRequest,
29353
30046
  FfiConverterTypeConnectWithSignerRequest,
30047
+ FfiConverterTypeConversionDetails,
29354
30048
  FfiConverterTypeConversionEstimate,
29355
30049
  FfiConverterTypeConversionInfo,
29356
30050
  FfiConverterTypeConversionOptions,
29357
30051
  FfiConverterTypeConversionPurpose,
29358
30052
  FfiConverterTypeConversionStatus,
30053
+ FfiConverterTypeConversionStep,
29359
30054
  FfiConverterTypeConversionType,
29360
30055
  FfiConverterTypeCreateIssuerTokenRequest,
29361
30056
  FfiConverterTypeCredentials,
@@ -29380,6 +30075,7 @@ export default Object.freeze({
29380
30075
  FfiConverterTypeExternalTreeNodeId,
29381
30076
  FfiConverterTypeExternalVerifiableSecretShare,
29382
30077
  FfiConverterTypeFee,
30078
+ FfiConverterTypeFeePolicy,
29383
30079
  FfiConverterTypeFetchConversionLimitsRequest,
29384
30080
  FfiConverterTypeFetchConversionLimitsResponse,
29385
30081
  FfiConverterTypeFiatCurrency,
@@ -29411,6 +30107,7 @@ export default Object.freeze({
29411
30107
  FfiConverterTypeLnurlAuthRequestDetails,
29412
30108
  FfiConverterTypeLnurlCallbackStatus,
29413
30109
  FfiConverterTypeLnurlErrorDetails,
30110
+ FfiConverterTypeLnurlInfo,
29414
30111
  FfiConverterTypeLnurlPayInfo,
29415
30112
  FfiConverterTypeLnurlPayRequest,
29416
30113
  FfiConverterTypeLnurlPayRequestDetails,
@@ -29474,6 +30171,7 @@ export default Object.freeze({
29474
30171
  FfiConverterTypeSendPaymentOptions,
29475
30172
  FfiConverterTypeSendPaymentRequest,
29476
30173
  FfiConverterTypeSendPaymentResponse,
30174
+ FfiConverterTypeServiceStatus,
29477
30175
  FfiConverterTypeSetLnurlMetadataItem,
29478
30176
  FfiConverterTypeSignMessageRequest,
29479
30177
  FfiConverterTypeSignMessageResponse,
@@ -29484,16 +30182,18 @@ export default Object.freeze({
29484
30182
  FfiConverterTypeSparkHtlcStatus,
29485
30183
  FfiConverterTypeSparkInvoiceDetails,
29486
30184
  FfiConverterTypeSparkInvoicePaymentDetails,
30185
+ FfiConverterTypeSparkStatus,
30186
+ FfiConverterTypeStableBalanceConfig,
29487
30187
  FfiConverterTypeStorage,
29488
30188
  FfiConverterTypeSuccessAction,
29489
30189
  FfiConverterTypeSuccessActionProcessed,
29490
30190
  FfiConverterTypeSymbol,
29491
- FfiConverterTypeSyncStorage,
29492
30191
  FfiConverterTypeSyncWalletRequest,
29493
30192
  FfiConverterTypeSyncWalletResponse,
29494
30193
  FfiConverterTypeTokenBalance,
29495
30194
  FfiConverterTypeTokenIssuer,
29496
30195
  FfiConverterTypeTokenMetadata,
30196
+ FfiConverterTypeTokenTransactionType,
29497
30197
  FfiConverterTypeTxStatus,
29498
30198
  FfiConverterTypeUnfreezeIssuerTokenRequest,
29499
30199
  FfiConverterTypeUnfreezeIssuerTokenResponse,