@buildonspark/spark-sdk 0.2.11 → 0.2.13

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.
Files changed (102) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/bare/index.cjs +761 -243
  3. package/dist/bare/index.d.cts +70 -11
  4. package/dist/bare/index.d.ts +70 -11
  5. package/dist/bare/index.js +684 -170
  6. package/dist/{chunk-A5M55UR3.js → chunk-5VWGOHED.js} +499 -8
  7. package/dist/{chunk-3WBPICWC.js → chunk-CKHJFQUA.js} +1 -1
  8. package/dist/{chunk-QNYJGFPD.js → chunk-LX45BCZW.js} +207 -160
  9. package/dist/{chunk-76SYPHOC.js → chunk-TB7DG5CU.js} +2 -2
  10. package/dist/{chunk-6CMNEDBK.js → chunk-XXTWWW6L.js} +1 -1
  11. package/dist/{client-Dd3QnxQu.d.ts → client-D7KDa4Ih.d.ts} +1 -1
  12. package/dist/{client-B9CAWKWz.d.cts → client-DVuA5-7M.d.cts} +1 -1
  13. package/dist/debug.cjs +761 -243
  14. package/dist/debug.d.cts +4 -4
  15. package/dist/debug.d.ts +4 -4
  16. package/dist/debug.js +4 -4
  17. package/dist/graphql/objects/index.d.cts +3 -3
  18. package/dist/graphql/objects/index.d.ts +3 -3
  19. package/dist/index.cjs +783 -265
  20. package/dist/index.d.cts +6 -6
  21. package/dist/index.d.ts +6 -6
  22. package/dist/index.js +5 -5
  23. package/dist/index.node.cjs +783 -265
  24. package/dist/index.node.d.cts +6 -6
  25. package/dist/index.node.d.ts +6 -6
  26. package/dist/index.node.js +4 -4
  27. package/dist/{logging-BOAzMqpM.d.cts → logging-BfTyKwqb.d.cts} +3 -3
  28. package/dist/{logging-Bt_WdZbu.d.ts → logging-CaNpBgiE.d.ts} +3 -3
  29. package/dist/native/index.cjs +782 -264
  30. package/dist/native/index.d.cts +70 -11
  31. package/dist/native/index.d.ts +70 -11
  32. package/dist/native/index.js +686 -172
  33. package/dist/proto/spark.cjs +499 -8
  34. package/dist/proto/spark.d.cts +1 -1
  35. package/dist/proto/spark.d.ts +1 -1
  36. package/dist/proto/spark.js +17 -1
  37. package/dist/proto/spark_token.d.cts +1 -1
  38. package/dist/proto/spark_token.d.ts +1 -1
  39. package/dist/proto/spark_token.js +2 -2
  40. package/dist/{spark-CtGJPkx4.d.cts → spark-C7OG9mGJ.d.cts} +79 -2
  41. package/dist/{spark-CtGJPkx4.d.ts → spark-C7OG9mGJ.d.ts} +79 -2
  42. package/dist/{spark-wallet-Cp3yv6cK.d.ts → spark-wallet-D0Df_P_x.d.ts} +26 -13
  43. package/dist/{spark-wallet-yc2KhsVY.d.cts → spark-wallet-Dvh1BLP6.d.cts} +26 -13
  44. package/dist/{spark-wallet.node-D0Qw5Wb4.d.cts → spark-wallet.node-B3V8_fgw.d.cts} +1 -1
  45. package/dist/{spark-wallet.node-D4IovOHu.d.ts → spark-wallet.node-bGmy8-T8.d.ts} +1 -1
  46. package/dist/tests/test-utils.cjs +573 -66
  47. package/dist/tests/test-utils.d.cts +4 -4
  48. package/dist/tests/test-utils.d.ts +4 -4
  49. package/dist/tests/test-utils.js +5 -5
  50. package/dist/{token-transactions-CwhlOgIP.d.cts → token-transactions-D1ta-sHH.d.cts} +2 -2
  51. package/dist/{token-transactions-0nmR9mQO.d.ts → token-transactions-DINiKBzd.d.ts} +2 -2
  52. package/dist/types/index.cjs +492 -9
  53. package/dist/types/index.d.cts +2 -2
  54. package/dist/types/index.d.ts +2 -2
  55. package/dist/types/index.js +2 -2
  56. package/package.json +3 -3
  57. package/src/proto/common.ts +1 -1
  58. package/src/proto/google/protobuf/descriptor.ts +4 -10
  59. package/src/proto/google/protobuf/duration.ts +1 -1
  60. package/src/proto/google/protobuf/empty.ts +1 -1
  61. package/src/proto/google/protobuf/timestamp.ts +1 -1
  62. package/src/proto/mock.ts +1 -1
  63. package/src/proto/spark.ts +593 -3
  64. package/src/proto/spark_authn.ts +1 -1
  65. package/src/proto/spark_token.ts +1 -1
  66. package/src/proto/validate/validate.ts +27 -79
  67. package/src/services/deposit.ts +55 -3
  68. package/src/services/lightning.ts +2 -2
  69. package/src/services/signing.ts +1 -1
  70. package/src/services/token-transactions.ts +2 -5
  71. package/src/services/transfer.ts +2 -28
  72. package/src/signer/signer.ts +2 -2
  73. package/src/spark-wallet/proto-descriptors.ts +22 -0
  74. package/src/spark-wallet/proto-hash.ts +743 -0
  75. package/src/spark-wallet/proto-reflection.ts +193 -0
  76. package/src/spark-wallet/spark-wallet.ts +95 -57
  77. package/src/spark_descriptors.pb +0 -0
  78. package/src/tests/address.test.ts +10 -10
  79. package/src/tests/bitcoin.test.ts +2 -2
  80. package/src/tests/bufbuild-reflection.test.ts +151 -0
  81. package/src/tests/cross-language-hash.test.ts +79 -0
  82. package/src/tests/integration/address.test.ts +3 -12
  83. package/src/tests/integration/coop-exit.test.ts +1 -1
  84. package/src/tests/integration/lightning.test.ts +1 -1
  85. package/src/tests/integration/ssp/static_deposit.test.ts +128 -1
  86. package/src/tests/integration/static_deposit.test.ts +26 -0
  87. package/src/tests/integration/swap.test.ts +1 -1
  88. package/src/tests/integration/transfer.test.ts +1 -129
  89. package/src/tests/integration/wallet.test.ts +7 -7
  90. package/src/tests/integration/watchtower.test.ts +1 -1
  91. package/src/tests/token-hashing.test.ts +3 -6
  92. package/src/tests/token-outputs.test.ts +3 -3
  93. package/src/tests/utils/test-faucet.ts +2 -2
  94. package/src/types/sdk-types.ts +1 -1
  95. package/src/utils/adaptor-signature.ts +1 -1
  96. package/src/utils/address.ts +1 -1
  97. package/src/utils/bitcoin.ts +1 -5
  98. package/src/utils/keys.ts +1 -1
  99. package/src/utils/secret-sharing.ts +1 -1
  100. package/src/utils/token-transactions.ts +1 -2
  101. package/src/utils/transfer_package.ts +1 -1
  102. package/src/utils/unilateral-exit.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.7.5
3
+ // protoc-gen-ts_proto v2.7.7
4
4
  // protoc v5.29.3
5
5
  // source: spark.proto
6
6
 
@@ -345,6 +345,51 @@ export function utxoSwapRequestTypeToJSON(object: UtxoSwapRequestType): string {
345
345
  }
346
346
  }
347
347
 
348
+ export enum InvoiceStatus {
349
+ NOT_FOUND = 0,
350
+ PENDING = 1,
351
+ FINALIZED = 2,
352
+ EXPIRED = 3,
353
+ UNRECOGNIZED = -1,
354
+ }
355
+
356
+ export function invoiceStatusFromJSON(object: any): InvoiceStatus {
357
+ switch (object) {
358
+ case 0:
359
+ case "NOT_FOUND":
360
+ return InvoiceStatus.NOT_FOUND;
361
+ case 1:
362
+ case "PENDING":
363
+ return InvoiceStatus.PENDING;
364
+ case 2:
365
+ case "FINALIZED":
366
+ return InvoiceStatus.FINALIZED;
367
+ case 3:
368
+ case "EXPIRED":
369
+ return InvoiceStatus.EXPIRED;
370
+ case -1:
371
+ case "UNRECOGNIZED":
372
+ default:
373
+ return InvoiceStatus.UNRECOGNIZED;
374
+ }
375
+ }
376
+
377
+ export function invoiceStatusToJSON(object: InvoiceStatus): string {
378
+ switch (object) {
379
+ case InvoiceStatus.NOT_FOUND:
380
+ return "NOT_FOUND";
381
+ case InvoiceStatus.PENDING:
382
+ return "PENDING";
383
+ case InvoiceStatus.FINALIZED:
384
+ return "FINALIZED";
385
+ case InvoiceStatus.EXPIRED:
386
+ return "EXPIRED";
387
+ case InvoiceStatus.UNRECOGNIZED:
388
+ default:
389
+ return "UNRECOGNIZED";
390
+ }
391
+ }
392
+
348
393
  export interface SubscribeToEventsRequest {
349
394
  identityPublicKey: Uint8Array;
350
395
  }
@@ -429,6 +474,21 @@ export interface GenerateDepositAddressResponse {
429
474
  depositAddress: Address | undefined;
430
475
  }
431
476
 
477
+ /** GenerateStaticDepositAddressRequest is the request to generate a static deposit address. */
478
+ export interface GenerateStaticDepositAddressRequest {
479
+ /** The signing public key of the user. */
480
+ signingPublicKey: Uint8Array;
481
+ /** The identity public key of the user. */
482
+ identityPublicKey: Uint8Array;
483
+ /** The network of the bitcoin network. */
484
+ network: Network;
485
+ }
486
+
487
+ /** GenerateStaticDepositAddressResponse is the response to the request to generate a static deposit address. */
488
+ export interface GenerateStaticDepositAddressResponse {
489
+ depositAddress: Address | undefined;
490
+ }
491
+
432
492
  /**
433
493
  * UTXO represents a utxo on the bitcoin network.
434
494
  * The UTXO is used to create a tree on Spark, it can also be an off-chain utxo so that the user
@@ -1109,6 +1169,7 @@ export interface TransferLeaf {
1109
1169
  intermediateRefundTx: Uint8Array;
1110
1170
  intermediateDirectRefundTx: Uint8Array;
1111
1171
  intermediateDirectFromCpfpRefundTx: Uint8Array;
1172
+ pendingKeyTweakPublicKey: Uint8Array;
1112
1173
  }
1113
1174
 
1114
1175
  export interface TransferFilter {
@@ -1433,6 +1494,7 @@ export interface QueryUserSignedRefundsRequest {
1433
1494
 
1434
1495
  export interface QueryUserSignedRefundsResponse {
1435
1496
  userSignedRefunds: UserSignedRefund[];
1497
+ transfer: Transfer | undefined;
1436
1498
  }
1437
1499
 
1438
1500
  export interface ProvidePreimageRequest {
@@ -1514,6 +1576,7 @@ export interface DepositAddressQueryResult {
1514
1576
  userSigningPublicKey: Uint8Array;
1515
1577
  verifyingPublicKey: Uint8Array;
1516
1578
  leafId?: string | undefined;
1579
+ proofOfPossession?: DepositAddressProof | undefined;
1517
1580
  }
1518
1581
 
1519
1582
  export interface QueryUnusedDepositAddressesResponse {
@@ -1697,6 +1760,7 @@ export interface GetUtxosForAddressRequest {
1697
1760
  offset: number;
1698
1761
  limit: number;
1699
1762
  network: Network;
1763
+ excludeClaimed: boolean;
1700
1764
  }
1701
1765
 
1702
1766
  export interface GetUtxosForAddressResponse {
@@ -1704,6 +1768,23 @@ export interface GetUtxosForAddressResponse {
1704
1768
  offset: number;
1705
1769
  }
1706
1770
 
1771
+ export interface QuerySparkInvoicesRequest {
1772
+ limit: number;
1773
+ offset: number;
1774
+ /** returns the status for the provided list of spark invoices. */
1775
+ invoice: string[];
1776
+ }
1777
+
1778
+ export interface QuerySparkInvoicesResponse {
1779
+ offset: number;
1780
+ invoiceStatuses: InvoiceResponse[];
1781
+ }
1782
+
1783
+ export interface InvoiceResponse {
1784
+ invoice: string;
1785
+ status: InvoiceStatus;
1786
+ }
1787
+
1707
1788
  function createBaseSubscribeToEventsRequest(): SubscribeToEventsRequest {
1708
1789
  return { identityPublicKey: new Uint8Array(0) };
1709
1790
  }
@@ -2524,6 +2605,160 @@ export const GenerateDepositAddressResponse: MessageFns<GenerateDepositAddressRe
2524
2605
  },
2525
2606
  };
2526
2607
 
2608
+ function createBaseGenerateStaticDepositAddressRequest(): GenerateStaticDepositAddressRequest {
2609
+ return { signingPublicKey: new Uint8Array(0), identityPublicKey: new Uint8Array(0), network: 0 };
2610
+ }
2611
+
2612
+ export const GenerateStaticDepositAddressRequest: MessageFns<GenerateStaticDepositAddressRequest> = {
2613
+ encode(message: GenerateStaticDepositAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2614
+ if (message.signingPublicKey.length !== 0) {
2615
+ writer.uint32(10).bytes(message.signingPublicKey);
2616
+ }
2617
+ if (message.identityPublicKey.length !== 0) {
2618
+ writer.uint32(18).bytes(message.identityPublicKey);
2619
+ }
2620
+ if (message.network !== 0) {
2621
+ writer.uint32(24).int32(message.network);
2622
+ }
2623
+ return writer;
2624
+ },
2625
+
2626
+ decode(input: BinaryReader | Uint8Array, length?: number): GenerateStaticDepositAddressRequest {
2627
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2628
+ const end = length === undefined ? reader.len : reader.pos + length;
2629
+ const message = createBaseGenerateStaticDepositAddressRequest();
2630
+ while (reader.pos < end) {
2631
+ const tag = reader.uint32();
2632
+ switch (tag >>> 3) {
2633
+ case 1: {
2634
+ if (tag !== 10) {
2635
+ break;
2636
+ }
2637
+
2638
+ message.signingPublicKey = reader.bytes();
2639
+ continue;
2640
+ }
2641
+ case 2: {
2642
+ if (tag !== 18) {
2643
+ break;
2644
+ }
2645
+
2646
+ message.identityPublicKey = reader.bytes();
2647
+ continue;
2648
+ }
2649
+ case 3: {
2650
+ if (tag !== 24) {
2651
+ break;
2652
+ }
2653
+
2654
+ message.network = reader.int32() as any;
2655
+ continue;
2656
+ }
2657
+ }
2658
+ if ((tag & 7) === 4 || tag === 0) {
2659
+ break;
2660
+ }
2661
+ reader.skip(tag & 7);
2662
+ }
2663
+ return message;
2664
+ },
2665
+
2666
+ fromJSON(object: any): GenerateStaticDepositAddressRequest {
2667
+ return {
2668
+ signingPublicKey: isSet(object.signingPublicKey) ? bytesFromBase64(object.signingPublicKey) : new Uint8Array(0),
2669
+ identityPublicKey: isSet(object.identityPublicKey)
2670
+ ? bytesFromBase64(object.identityPublicKey)
2671
+ : new Uint8Array(0),
2672
+ network: isSet(object.network) ? networkFromJSON(object.network) : 0,
2673
+ };
2674
+ },
2675
+
2676
+ toJSON(message: GenerateStaticDepositAddressRequest): unknown {
2677
+ const obj: any = {};
2678
+ if (message.signingPublicKey.length !== 0) {
2679
+ obj.signingPublicKey = base64FromBytes(message.signingPublicKey);
2680
+ }
2681
+ if (message.identityPublicKey.length !== 0) {
2682
+ obj.identityPublicKey = base64FromBytes(message.identityPublicKey);
2683
+ }
2684
+ if (message.network !== 0) {
2685
+ obj.network = networkToJSON(message.network);
2686
+ }
2687
+ return obj;
2688
+ },
2689
+
2690
+ create(base?: DeepPartial<GenerateStaticDepositAddressRequest>): GenerateStaticDepositAddressRequest {
2691
+ return GenerateStaticDepositAddressRequest.fromPartial(base ?? {});
2692
+ },
2693
+ fromPartial(object: DeepPartial<GenerateStaticDepositAddressRequest>): GenerateStaticDepositAddressRequest {
2694
+ const message = createBaseGenerateStaticDepositAddressRequest();
2695
+ message.signingPublicKey = object.signingPublicKey ?? new Uint8Array(0);
2696
+ message.identityPublicKey = object.identityPublicKey ?? new Uint8Array(0);
2697
+ message.network = object.network ?? 0;
2698
+ return message;
2699
+ },
2700
+ };
2701
+
2702
+ function createBaseGenerateStaticDepositAddressResponse(): GenerateStaticDepositAddressResponse {
2703
+ return { depositAddress: undefined };
2704
+ }
2705
+
2706
+ export const GenerateStaticDepositAddressResponse: MessageFns<GenerateStaticDepositAddressResponse> = {
2707
+ encode(message: GenerateStaticDepositAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2708
+ if (message.depositAddress !== undefined) {
2709
+ Address.encode(message.depositAddress, writer.uint32(10).fork()).join();
2710
+ }
2711
+ return writer;
2712
+ },
2713
+
2714
+ decode(input: BinaryReader | Uint8Array, length?: number): GenerateStaticDepositAddressResponse {
2715
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2716
+ const end = length === undefined ? reader.len : reader.pos + length;
2717
+ const message = createBaseGenerateStaticDepositAddressResponse();
2718
+ while (reader.pos < end) {
2719
+ const tag = reader.uint32();
2720
+ switch (tag >>> 3) {
2721
+ case 1: {
2722
+ if (tag !== 10) {
2723
+ break;
2724
+ }
2725
+
2726
+ message.depositAddress = Address.decode(reader, reader.uint32());
2727
+ continue;
2728
+ }
2729
+ }
2730
+ if ((tag & 7) === 4 || tag === 0) {
2731
+ break;
2732
+ }
2733
+ reader.skip(tag & 7);
2734
+ }
2735
+ return message;
2736
+ },
2737
+
2738
+ fromJSON(object: any): GenerateStaticDepositAddressResponse {
2739
+ return { depositAddress: isSet(object.depositAddress) ? Address.fromJSON(object.depositAddress) : undefined };
2740
+ },
2741
+
2742
+ toJSON(message: GenerateStaticDepositAddressResponse): unknown {
2743
+ const obj: any = {};
2744
+ if (message.depositAddress !== undefined) {
2745
+ obj.depositAddress = Address.toJSON(message.depositAddress);
2746
+ }
2747
+ return obj;
2748
+ },
2749
+
2750
+ create(base?: DeepPartial<GenerateStaticDepositAddressResponse>): GenerateStaticDepositAddressResponse {
2751
+ return GenerateStaticDepositAddressResponse.fromPartial(base ?? {});
2752
+ },
2753
+ fromPartial(object: DeepPartial<GenerateStaticDepositAddressResponse>): GenerateStaticDepositAddressResponse {
2754
+ const message = createBaseGenerateStaticDepositAddressResponse();
2755
+ message.depositAddress = (object.depositAddress !== undefined && object.depositAddress !== null)
2756
+ ? Address.fromPartial(object.depositAddress)
2757
+ : undefined;
2758
+ return message;
2759
+ },
2760
+ };
2761
+
2527
2762
  function createBaseUTXO(): UTXO {
2528
2763
  return { rawTx: new Uint8Array(0), vout: 0, network: 0, txid: new Uint8Array(0) };
2529
2764
  }
@@ -9727,6 +9962,7 @@ function createBaseTransferLeaf(): TransferLeaf {
9727
9962
  intermediateRefundTx: new Uint8Array(0),
9728
9963
  intermediateDirectRefundTx: new Uint8Array(0),
9729
9964
  intermediateDirectFromCpfpRefundTx: new Uint8Array(0),
9965
+ pendingKeyTweakPublicKey: new Uint8Array(0),
9730
9966
  };
9731
9967
  }
9732
9968
 
@@ -9750,6 +9986,9 @@ export const TransferLeaf: MessageFns<TransferLeaf> = {
9750
9986
  if (message.intermediateDirectFromCpfpRefundTx.length !== 0) {
9751
9987
  writer.uint32(50).bytes(message.intermediateDirectFromCpfpRefundTx);
9752
9988
  }
9989
+ if (message.pendingKeyTweakPublicKey.length !== 0) {
9990
+ writer.uint32(58).bytes(message.pendingKeyTweakPublicKey);
9991
+ }
9753
9992
  return writer;
9754
9993
  },
9755
9994
 
@@ -9808,6 +10047,14 @@ export const TransferLeaf: MessageFns<TransferLeaf> = {
9808
10047
  message.intermediateDirectFromCpfpRefundTx = reader.bytes();
9809
10048
  continue;
9810
10049
  }
10050
+ case 7: {
10051
+ if (tag !== 58) {
10052
+ break;
10053
+ }
10054
+
10055
+ message.pendingKeyTweakPublicKey = reader.bytes();
10056
+ continue;
10057
+ }
9811
10058
  }
9812
10059
  if ((tag & 7) === 4 || tag === 0) {
9813
10060
  break;
@@ -9831,6 +10078,9 @@ export const TransferLeaf: MessageFns<TransferLeaf> = {
9831
10078
  intermediateDirectFromCpfpRefundTx: isSet(object.intermediateDirectFromCpfpRefundTx)
9832
10079
  ? bytesFromBase64(object.intermediateDirectFromCpfpRefundTx)
9833
10080
  : new Uint8Array(0),
10081
+ pendingKeyTweakPublicKey: isSet(object.pendingKeyTweakPublicKey)
10082
+ ? bytesFromBase64(object.pendingKeyTweakPublicKey)
10083
+ : new Uint8Array(0),
9834
10084
  };
9835
10085
  },
9836
10086
 
@@ -9854,6 +10104,9 @@ export const TransferLeaf: MessageFns<TransferLeaf> = {
9854
10104
  if (message.intermediateDirectFromCpfpRefundTx.length !== 0) {
9855
10105
  obj.intermediateDirectFromCpfpRefundTx = base64FromBytes(message.intermediateDirectFromCpfpRefundTx);
9856
10106
  }
10107
+ if (message.pendingKeyTweakPublicKey.length !== 0) {
10108
+ obj.pendingKeyTweakPublicKey = base64FromBytes(message.pendingKeyTweakPublicKey);
10109
+ }
9857
10110
  return obj;
9858
10111
  },
9859
10112
 
@@ -9868,6 +10121,7 @@ export const TransferLeaf: MessageFns<TransferLeaf> = {
9868
10121
  message.intermediateRefundTx = object.intermediateRefundTx ?? new Uint8Array(0);
9869
10122
  message.intermediateDirectRefundTx = object.intermediateDirectRefundTx ?? new Uint8Array(0);
9870
10123
  message.intermediateDirectFromCpfpRefundTx = object.intermediateDirectFromCpfpRefundTx ?? new Uint8Array(0);
10124
+ message.pendingKeyTweakPublicKey = object.pendingKeyTweakPublicKey ?? new Uint8Array(0);
9871
10125
  return message;
9872
10126
  },
9873
10127
  };
@@ -14216,7 +14470,7 @@ export const QueryUserSignedRefundsRequest: MessageFns<QueryUserSignedRefundsReq
14216
14470
  };
14217
14471
 
14218
14472
  function createBaseQueryUserSignedRefundsResponse(): QueryUserSignedRefundsResponse {
14219
- return { userSignedRefunds: [] };
14473
+ return { userSignedRefunds: [], transfer: undefined };
14220
14474
  }
14221
14475
 
14222
14476
  export const QueryUserSignedRefundsResponse: MessageFns<QueryUserSignedRefundsResponse> = {
@@ -14224,6 +14478,9 @@ export const QueryUserSignedRefundsResponse: MessageFns<QueryUserSignedRefundsRe
14224
14478
  for (const v of message.userSignedRefunds) {
14225
14479
  UserSignedRefund.encode(v!, writer.uint32(10).fork()).join();
14226
14480
  }
14481
+ if (message.transfer !== undefined) {
14482
+ Transfer.encode(message.transfer, writer.uint32(26).fork()).join();
14483
+ }
14227
14484
  return writer;
14228
14485
  },
14229
14486
 
@@ -14242,6 +14499,14 @@ export const QueryUserSignedRefundsResponse: MessageFns<QueryUserSignedRefundsRe
14242
14499
  message.userSignedRefunds.push(UserSignedRefund.decode(reader, reader.uint32()));
14243
14500
  continue;
14244
14501
  }
14502
+ case 3: {
14503
+ if (tag !== 26) {
14504
+ break;
14505
+ }
14506
+
14507
+ message.transfer = Transfer.decode(reader, reader.uint32());
14508
+ continue;
14509
+ }
14245
14510
  }
14246
14511
  if ((tag & 7) === 4 || tag === 0) {
14247
14512
  break;
@@ -14256,6 +14521,7 @@ export const QueryUserSignedRefundsResponse: MessageFns<QueryUserSignedRefundsRe
14256
14521
  userSignedRefunds: globalThis.Array.isArray(object?.userSignedRefunds)
14257
14522
  ? object.userSignedRefunds.map((e: any) => UserSignedRefund.fromJSON(e))
14258
14523
  : [],
14524
+ transfer: isSet(object.transfer) ? Transfer.fromJSON(object.transfer) : undefined,
14259
14525
  };
14260
14526
  },
14261
14527
 
@@ -14264,6 +14530,9 @@ export const QueryUserSignedRefundsResponse: MessageFns<QueryUserSignedRefundsRe
14264
14530
  if (message.userSignedRefunds?.length) {
14265
14531
  obj.userSignedRefunds = message.userSignedRefunds.map((e) => UserSignedRefund.toJSON(e));
14266
14532
  }
14533
+ if (message.transfer !== undefined) {
14534
+ obj.transfer = Transfer.toJSON(message.transfer);
14535
+ }
14267
14536
  return obj;
14268
14537
  },
14269
14538
 
@@ -14273,6 +14542,9 @@ export const QueryUserSignedRefundsResponse: MessageFns<QueryUserSignedRefundsRe
14273
14542
  fromPartial(object: DeepPartial<QueryUserSignedRefundsResponse>): QueryUserSignedRefundsResponse {
14274
14543
  const message = createBaseQueryUserSignedRefundsResponse();
14275
14544
  message.userSignedRefunds = object.userSignedRefunds?.map((e) => UserSignedRefund.fromPartial(e)) || [];
14545
+ message.transfer = (object.transfer !== undefined && object.transfer !== null)
14546
+ ? Transfer.fromPartial(object.transfer)
14547
+ : undefined;
14276
14548
  return message;
14277
14549
  },
14278
14550
  };
@@ -15278,6 +15550,7 @@ function createBaseDepositAddressQueryResult(): DepositAddressQueryResult {
15278
15550
  userSigningPublicKey: new Uint8Array(0),
15279
15551
  verifyingPublicKey: new Uint8Array(0),
15280
15552
  leafId: undefined,
15553
+ proofOfPossession: undefined,
15281
15554
  };
15282
15555
  }
15283
15556
 
@@ -15295,6 +15568,9 @@ export const DepositAddressQueryResult: MessageFns<DepositAddressQueryResult> =
15295
15568
  if (message.leafId !== undefined) {
15296
15569
  writer.uint32(34).string(message.leafId);
15297
15570
  }
15571
+ if (message.proofOfPossession !== undefined) {
15572
+ DepositAddressProof.encode(message.proofOfPossession, writer.uint32(42).fork()).join();
15573
+ }
15298
15574
  return writer;
15299
15575
  },
15300
15576
 
@@ -15337,6 +15613,14 @@ export const DepositAddressQueryResult: MessageFns<DepositAddressQueryResult> =
15337
15613
  message.leafId = reader.string();
15338
15614
  continue;
15339
15615
  }
15616
+ case 5: {
15617
+ if (tag !== 42) {
15618
+ break;
15619
+ }
15620
+
15621
+ message.proofOfPossession = DepositAddressProof.decode(reader, reader.uint32());
15622
+ continue;
15623
+ }
15340
15624
  }
15341
15625
  if ((tag & 7) === 4 || tag === 0) {
15342
15626
  break;
@@ -15356,6 +15640,9 @@ export const DepositAddressQueryResult: MessageFns<DepositAddressQueryResult> =
15356
15640
  ? bytesFromBase64(object.verifyingPublicKey)
15357
15641
  : new Uint8Array(0),
15358
15642
  leafId: isSet(object.leafId) ? globalThis.String(object.leafId) : undefined,
15643
+ proofOfPossession: isSet(object.proofOfPossession)
15644
+ ? DepositAddressProof.fromJSON(object.proofOfPossession)
15645
+ : undefined,
15359
15646
  };
15360
15647
  },
15361
15648
 
@@ -15373,6 +15660,9 @@ export const DepositAddressQueryResult: MessageFns<DepositAddressQueryResult> =
15373
15660
  if (message.leafId !== undefined) {
15374
15661
  obj.leafId = message.leafId;
15375
15662
  }
15663
+ if (message.proofOfPossession !== undefined) {
15664
+ obj.proofOfPossession = DepositAddressProof.toJSON(message.proofOfPossession);
15665
+ }
15376
15666
  return obj;
15377
15667
  },
15378
15668
 
@@ -15385,6 +15675,9 @@ export const DepositAddressQueryResult: MessageFns<DepositAddressQueryResult> =
15385
15675
  message.userSigningPublicKey = object.userSigningPublicKey ?? new Uint8Array(0);
15386
15676
  message.verifyingPublicKey = object.verifyingPublicKey ?? new Uint8Array(0);
15387
15677
  message.leafId = object.leafId ?? undefined;
15678
+ message.proofOfPossession = (object.proofOfPossession !== undefined && object.proofOfPossession !== null)
15679
+ ? DepositAddressProof.fromPartial(object.proofOfPossession)
15680
+ : undefined;
15388
15681
  return message;
15389
15682
  },
15390
15683
  };
@@ -17737,7 +18030,7 @@ export const QueryNodesByValueResponse_NodesEntry: MessageFns<QueryNodesByValueR
17737
18030
  };
17738
18031
 
17739
18032
  function createBaseGetUtxosForAddressRequest(): GetUtxosForAddressRequest {
17740
- return { address: "", offset: 0, limit: 0, network: 0 };
18033
+ return { address: "", offset: 0, limit: 0, network: 0, excludeClaimed: false };
17741
18034
  }
17742
18035
 
17743
18036
  export const GetUtxosForAddressRequest: MessageFns<GetUtxosForAddressRequest> = {
@@ -17754,6 +18047,9 @@ export const GetUtxosForAddressRequest: MessageFns<GetUtxosForAddressRequest> =
17754
18047
  if (message.network !== 0) {
17755
18048
  writer.uint32(32).int32(message.network);
17756
18049
  }
18050
+ if (message.excludeClaimed !== false) {
18051
+ writer.uint32(40).bool(message.excludeClaimed);
18052
+ }
17757
18053
  return writer;
17758
18054
  },
17759
18055
 
@@ -17796,6 +18092,14 @@ export const GetUtxosForAddressRequest: MessageFns<GetUtxosForAddressRequest> =
17796
18092
  message.network = reader.int32() as any;
17797
18093
  continue;
17798
18094
  }
18095
+ case 5: {
18096
+ if (tag !== 40) {
18097
+ break;
18098
+ }
18099
+
18100
+ message.excludeClaimed = reader.bool();
18101
+ continue;
18102
+ }
17799
18103
  }
17800
18104
  if ((tag & 7) === 4 || tag === 0) {
17801
18105
  break;
@@ -17811,6 +18115,7 @@ export const GetUtxosForAddressRequest: MessageFns<GetUtxosForAddressRequest> =
17811
18115
  offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0,
17812
18116
  limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0,
17813
18117
  network: isSet(object.network) ? networkFromJSON(object.network) : 0,
18118
+ excludeClaimed: isSet(object.excludeClaimed) ? globalThis.Boolean(object.excludeClaimed) : false,
17814
18119
  };
17815
18120
  },
17816
18121
 
@@ -17828,6 +18133,9 @@ export const GetUtxosForAddressRequest: MessageFns<GetUtxosForAddressRequest> =
17828
18133
  if (message.network !== 0) {
17829
18134
  obj.network = networkToJSON(message.network);
17830
18135
  }
18136
+ if (message.excludeClaimed !== false) {
18137
+ obj.excludeClaimed = message.excludeClaimed;
18138
+ }
17831
18139
  return obj;
17832
18140
  },
17833
18141
 
@@ -17840,6 +18148,7 @@ export const GetUtxosForAddressRequest: MessageFns<GetUtxosForAddressRequest> =
17840
18148
  message.offset = object.offset ?? 0;
17841
18149
  message.limit = object.limit ?? 0;
17842
18150
  message.network = object.network ?? 0;
18151
+ message.excludeClaimed = object.excludeClaimed ?? false;
17843
18152
  return message;
17844
18153
  },
17845
18154
  };
@@ -17920,6 +18229,252 @@ export const GetUtxosForAddressResponse: MessageFns<GetUtxosForAddressResponse>
17920
18229
  },
17921
18230
  };
17922
18231
 
18232
+ function createBaseQuerySparkInvoicesRequest(): QuerySparkInvoicesRequest {
18233
+ return { limit: 0, offset: 0, invoice: [] };
18234
+ }
18235
+
18236
+ export const QuerySparkInvoicesRequest: MessageFns<QuerySparkInvoicesRequest> = {
18237
+ encode(message: QuerySparkInvoicesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
18238
+ if (message.limit !== 0) {
18239
+ writer.uint32(8).int64(message.limit);
18240
+ }
18241
+ if (message.offset !== 0) {
18242
+ writer.uint32(16).int64(message.offset);
18243
+ }
18244
+ for (const v of message.invoice) {
18245
+ writer.uint32(26).string(v!);
18246
+ }
18247
+ return writer;
18248
+ },
18249
+
18250
+ decode(input: BinaryReader | Uint8Array, length?: number): QuerySparkInvoicesRequest {
18251
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
18252
+ const end = length === undefined ? reader.len : reader.pos + length;
18253
+ const message = createBaseQuerySparkInvoicesRequest();
18254
+ while (reader.pos < end) {
18255
+ const tag = reader.uint32();
18256
+ switch (tag >>> 3) {
18257
+ case 1: {
18258
+ if (tag !== 8) {
18259
+ break;
18260
+ }
18261
+
18262
+ message.limit = longToNumber(reader.int64());
18263
+ continue;
18264
+ }
18265
+ case 2: {
18266
+ if (tag !== 16) {
18267
+ break;
18268
+ }
18269
+
18270
+ message.offset = longToNumber(reader.int64());
18271
+ continue;
18272
+ }
18273
+ case 3: {
18274
+ if (tag !== 26) {
18275
+ break;
18276
+ }
18277
+
18278
+ message.invoice.push(reader.string());
18279
+ continue;
18280
+ }
18281
+ }
18282
+ if ((tag & 7) === 4 || tag === 0) {
18283
+ break;
18284
+ }
18285
+ reader.skip(tag & 7);
18286
+ }
18287
+ return message;
18288
+ },
18289
+
18290
+ fromJSON(object: any): QuerySparkInvoicesRequest {
18291
+ return {
18292
+ limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0,
18293
+ offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0,
18294
+ invoice: globalThis.Array.isArray(object?.invoice) ? object.invoice.map((e: any) => globalThis.String(e)) : [],
18295
+ };
18296
+ },
18297
+
18298
+ toJSON(message: QuerySparkInvoicesRequest): unknown {
18299
+ const obj: any = {};
18300
+ if (message.limit !== 0) {
18301
+ obj.limit = Math.round(message.limit);
18302
+ }
18303
+ if (message.offset !== 0) {
18304
+ obj.offset = Math.round(message.offset);
18305
+ }
18306
+ if (message.invoice?.length) {
18307
+ obj.invoice = message.invoice;
18308
+ }
18309
+ return obj;
18310
+ },
18311
+
18312
+ create(base?: DeepPartial<QuerySparkInvoicesRequest>): QuerySparkInvoicesRequest {
18313
+ return QuerySparkInvoicesRequest.fromPartial(base ?? {});
18314
+ },
18315
+ fromPartial(object: DeepPartial<QuerySparkInvoicesRequest>): QuerySparkInvoicesRequest {
18316
+ const message = createBaseQuerySparkInvoicesRequest();
18317
+ message.limit = object.limit ?? 0;
18318
+ message.offset = object.offset ?? 0;
18319
+ message.invoice = object.invoice?.map((e) => e) || [];
18320
+ return message;
18321
+ },
18322
+ };
18323
+
18324
+ function createBaseQuerySparkInvoicesResponse(): QuerySparkInvoicesResponse {
18325
+ return { offset: 0, invoiceStatuses: [] };
18326
+ }
18327
+
18328
+ export const QuerySparkInvoicesResponse: MessageFns<QuerySparkInvoicesResponse> = {
18329
+ encode(message: QuerySparkInvoicesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
18330
+ if (message.offset !== 0) {
18331
+ writer.uint32(8).int64(message.offset);
18332
+ }
18333
+ for (const v of message.invoiceStatuses) {
18334
+ InvoiceResponse.encode(v!, writer.uint32(18).fork()).join();
18335
+ }
18336
+ return writer;
18337
+ },
18338
+
18339
+ decode(input: BinaryReader | Uint8Array, length?: number): QuerySparkInvoicesResponse {
18340
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
18341
+ const end = length === undefined ? reader.len : reader.pos + length;
18342
+ const message = createBaseQuerySparkInvoicesResponse();
18343
+ while (reader.pos < end) {
18344
+ const tag = reader.uint32();
18345
+ switch (tag >>> 3) {
18346
+ case 1: {
18347
+ if (tag !== 8) {
18348
+ break;
18349
+ }
18350
+
18351
+ message.offset = longToNumber(reader.int64());
18352
+ continue;
18353
+ }
18354
+ case 2: {
18355
+ if (tag !== 18) {
18356
+ break;
18357
+ }
18358
+
18359
+ message.invoiceStatuses.push(InvoiceResponse.decode(reader, reader.uint32()));
18360
+ continue;
18361
+ }
18362
+ }
18363
+ if ((tag & 7) === 4 || tag === 0) {
18364
+ break;
18365
+ }
18366
+ reader.skip(tag & 7);
18367
+ }
18368
+ return message;
18369
+ },
18370
+
18371
+ fromJSON(object: any): QuerySparkInvoicesResponse {
18372
+ return {
18373
+ offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0,
18374
+ invoiceStatuses: globalThis.Array.isArray(object?.invoiceStatuses)
18375
+ ? object.invoiceStatuses.map((e: any) => InvoiceResponse.fromJSON(e))
18376
+ : [],
18377
+ };
18378
+ },
18379
+
18380
+ toJSON(message: QuerySparkInvoicesResponse): unknown {
18381
+ const obj: any = {};
18382
+ if (message.offset !== 0) {
18383
+ obj.offset = Math.round(message.offset);
18384
+ }
18385
+ if (message.invoiceStatuses?.length) {
18386
+ obj.invoiceStatuses = message.invoiceStatuses.map((e) => InvoiceResponse.toJSON(e));
18387
+ }
18388
+ return obj;
18389
+ },
18390
+
18391
+ create(base?: DeepPartial<QuerySparkInvoicesResponse>): QuerySparkInvoicesResponse {
18392
+ return QuerySparkInvoicesResponse.fromPartial(base ?? {});
18393
+ },
18394
+ fromPartial(object: DeepPartial<QuerySparkInvoicesResponse>): QuerySparkInvoicesResponse {
18395
+ const message = createBaseQuerySparkInvoicesResponse();
18396
+ message.offset = object.offset ?? 0;
18397
+ message.invoiceStatuses = object.invoiceStatuses?.map((e) => InvoiceResponse.fromPartial(e)) || [];
18398
+ return message;
18399
+ },
18400
+ };
18401
+
18402
+ function createBaseInvoiceResponse(): InvoiceResponse {
18403
+ return { invoice: "", status: 0 };
18404
+ }
18405
+
18406
+ export const InvoiceResponse: MessageFns<InvoiceResponse> = {
18407
+ encode(message: InvoiceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
18408
+ if (message.invoice !== "") {
18409
+ writer.uint32(10).string(message.invoice);
18410
+ }
18411
+ if (message.status !== 0) {
18412
+ writer.uint32(16).int32(message.status);
18413
+ }
18414
+ return writer;
18415
+ },
18416
+
18417
+ decode(input: BinaryReader | Uint8Array, length?: number): InvoiceResponse {
18418
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
18419
+ const end = length === undefined ? reader.len : reader.pos + length;
18420
+ const message = createBaseInvoiceResponse();
18421
+ while (reader.pos < end) {
18422
+ const tag = reader.uint32();
18423
+ switch (tag >>> 3) {
18424
+ case 1: {
18425
+ if (tag !== 10) {
18426
+ break;
18427
+ }
18428
+
18429
+ message.invoice = reader.string();
18430
+ continue;
18431
+ }
18432
+ case 2: {
18433
+ if (tag !== 16) {
18434
+ break;
18435
+ }
18436
+
18437
+ message.status = reader.int32() as any;
18438
+ continue;
18439
+ }
18440
+ }
18441
+ if ((tag & 7) === 4 || tag === 0) {
18442
+ break;
18443
+ }
18444
+ reader.skip(tag & 7);
18445
+ }
18446
+ return message;
18447
+ },
18448
+
18449
+ fromJSON(object: any): InvoiceResponse {
18450
+ return {
18451
+ invoice: isSet(object.invoice) ? globalThis.String(object.invoice) : "",
18452
+ status: isSet(object.status) ? invoiceStatusFromJSON(object.status) : 0,
18453
+ };
18454
+ },
18455
+
18456
+ toJSON(message: InvoiceResponse): unknown {
18457
+ const obj: any = {};
18458
+ if (message.invoice !== "") {
18459
+ obj.invoice = message.invoice;
18460
+ }
18461
+ if (message.status !== 0) {
18462
+ obj.status = invoiceStatusToJSON(message.status);
18463
+ }
18464
+ return obj;
18465
+ },
18466
+
18467
+ create(base?: DeepPartial<InvoiceResponse>): InvoiceResponse {
18468
+ return InvoiceResponse.fromPartial(base ?? {});
18469
+ },
18470
+ fromPartial(object: DeepPartial<InvoiceResponse>): InvoiceResponse {
18471
+ const message = createBaseInvoiceResponse();
18472
+ message.invoice = object.invoice ?? "";
18473
+ message.status = object.status ?? 0;
18474
+ return message;
18475
+ },
18476
+ };
18477
+
17923
18478
  export type SparkServiceDefinition = typeof SparkServiceDefinition;
17924
18479
  export const SparkServiceDefinition = {
17925
18480
  name: "SparkService",
@@ -17933,6 +18488,15 @@ export const SparkServiceDefinition = {
17933
18488
  responseStream: false,
17934
18489
  options: {},
17935
18490
  },
18491
+ /** Generates a new static deposit address of the user or returns the existing one for the specified network. */
18492
+ generate_static_deposit_address: {
18493
+ name: "generate_static_deposit_address",
18494
+ requestType: GenerateStaticDepositAddressRequest,
18495
+ requestStream: false,
18496
+ responseType: GenerateStaticDepositAddressResponse,
18497
+ responseStream: false,
18498
+ options: {},
18499
+ },
17936
18500
  start_deposit_tree_creation: {
17937
18501
  name: "start_deposit_tree_creation",
17938
18502
  requestType: StartDepositTreeCreationRequest,
@@ -18375,6 +18939,14 @@ export const SparkServiceDefinition = {
18375
18939
  responseStream: false,
18376
18940
  options: {},
18377
18941
  },
18942
+ query_spark_invoices: {
18943
+ name: "query_spark_invoices",
18944
+ requestType: QuerySparkInvoicesRequest,
18945
+ requestStream: false,
18946
+ responseType: QuerySparkInvoicesResponse,
18947
+ responseStream: false,
18948
+ options: {},
18949
+ },
18378
18950
  },
18379
18951
  } as const;
18380
18952
 
@@ -18383,6 +18955,11 @@ export interface SparkServiceImplementation<CallContextExt = {}> {
18383
18955
  request: GenerateDepositAddressRequest,
18384
18956
  context: CallContext & CallContextExt,
18385
18957
  ): Promise<DeepPartial<GenerateDepositAddressResponse>>;
18958
+ /** Generates a new static deposit address of the user or returns the existing one for the specified network. */
18959
+ generate_static_deposit_address(
18960
+ request: GenerateStaticDepositAddressRequest,
18961
+ context: CallContext & CallContextExt,
18962
+ ): Promise<DeepPartial<GenerateStaticDepositAddressResponse>>;
18386
18963
  start_deposit_tree_creation(
18387
18964
  request: StartDepositTreeCreationRequest,
18388
18965
  context: CallContext & CallContextExt,
@@ -18625,6 +19202,10 @@ export interface SparkServiceImplementation<CallContextExt = {}> {
18625
19202
  request: GetUtxosForAddressRequest,
18626
19203
  context: CallContext & CallContextExt,
18627
19204
  ): Promise<DeepPartial<GetUtxosForAddressResponse>>;
19205
+ query_spark_invoices(
19206
+ request: QuerySparkInvoicesRequest,
19207
+ context: CallContext & CallContextExt,
19208
+ ): Promise<DeepPartial<QuerySparkInvoicesResponse>>;
18628
19209
  }
18629
19210
 
18630
19211
  export interface SparkServiceClient<CallOptionsExt = {}> {
@@ -18632,6 +19213,11 @@ export interface SparkServiceClient<CallOptionsExt = {}> {
18632
19213
  request: DeepPartial<GenerateDepositAddressRequest>,
18633
19214
  options?: CallOptions & CallOptionsExt,
18634
19215
  ): Promise<GenerateDepositAddressResponse>;
19216
+ /** Generates a new static deposit address of the user or returns the existing one for the specified network. */
19217
+ generate_static_deposit_address(
19218
+ request: DeepPartial<GenerateStaticDepositAddressRequest>,
19219
+ options?: CallOptions & CallOptionsExt,
19220
+ ): Promise<GenerateStaticDepositAddressResponse>;
18635
19221
  start_deposit_tree_creation(
18636
19222
  request: DeepPartial<StartDepositTreeCreationRequest>,
18637
19223
  options?: CallOptions & CallOptionsExt,
@@ -18874,6 +19460,10 @@ export interface SparkServiceClient<CallOptionsExt = {}> {
18874
19460
  request: DeepPartial<GetUtxosForAddressRequest>,
18875
19461
  options?: CallOptions & CallOptionsExt,
18876
19462
  ): Promise<GetUtxosForAddressResponse>;
19463
+ query_spark_invoices(
19464
+ request: DeepPartial<QuerySparkInvoicesRequest>,
19465
+ options?: CallOptions & CallOptionsExt,
19466
+ ): Promise<QuerySparkInvoicesResponse>;
18877
19467
  }
18878
19468
 
18879
19469
  function bytesFromBase64(b64: string): Uint8Array {