@buildonspark/spark-sdk 0.3.6 → 0.3.8

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 (103) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/bare/index.cjs +11107 -10443
  3. package/dist/bare/index.d.cts +274 -219
  4. package/dist/bare/index.d.ts +274 -219
  5. package/dist/bare/index.js +11459 -10792
  6. package/dist/{chunk-LIZFXQWK.js → chunk-3LPEQGVJ.js} +1 -1
  7. package/dist/{chunk-J2P3KTQP.js → chunk-5ASXVNTM.js} +1 -1
  8. package/dist/{chunk-FJ7LTA2O.js → chunk-5HU5W56H.js} +40 -213
  9. package/dist/{chunk-XPHYQ2L6.js → chunk-FP2CRVQH.js} +6471 -5813
  10. package/dist/{chunk-EHKP3Y65.js → chunk-FXIESWE6.js} +8 -11
  11. package/dist/{chunk-IC4IUEOS.js → chunk-VFN34EOX.js} +56 -43
  12. package/dist/{chunk-XWLR6G5C.js → chunk-XI6FCNYG.js} +1 -1
  13. package/dist/{client-GOlkXliC.d.ts → client-By-N7oJS.d.ts} +13 -11
  14. package/dist/{client-AHn11NHe.d.cts → client-pNpGP15j.d.cts} +13 -11
  15. package/dist/debug.cjs +11179 -10516
  16. package/dist/debug.d.cts +12 -8
  17. package/dist/debug.d.ts +12 -8
  18. package/dist/debug.js +5 -5
  19. package/dist/graphql/objects/index.d.cts +3 -3
  20. package/dist/graphql/objects/index.d.ts +3 -3
  21. package/dist/index.cjs +7063 -6395
  22. package/dist/index.d.cts +8 -7
  23. package/dist/index.d.ts +8 -7
  24. package/dist/index.js +12 -6
  25. package/dist/index.node.cjs +6598 -6100
  26. package/dist/index.node.d.cts +8 -7
  27. package/dist/index.node.d.ts +8 -7
  28. package/dist/index.node.js +11 -5
  29. package/dist/{logging-CW3kwBaM.d.cts → logging-DMFVY384.d.ts} +10 -4
  30. package/dist/{logging-D7ukPwRA.d.ts → logging-DxLp34Xm.d.cts} +10 -4
  31. package/dist/native/{chunk-X2QXUON7.js → chunk-AFP5QR4O.js} +11 -8
  32. package/dist/native/{index.cjs → index.react-native.cjs} +7143 -6464
  33. package/dist/native/{index.d.cts → index.react-native.d.cts} +110 -54
  34. package/dist/native/{index.d.ts → index.react-native.d.ts} +110 -54
  35. package/dist/native/{index.js → index.react-native.js} +7162 -6484
  36. package/dist/native/{wasm-GKEDPGTM.js → wasm-D4TI35NF.js} +1 -1
  37. package/dist/proto/spark.cjs +56 -43
  38. package/dist/proto/spark.d.cts +1 -1
  39. package/dist/proto/spark.d.ts +1 -1
  40. package/dist/proto/spark.js +1 -1
  41. package/dist/proto/spark_token.d.cts +1 -1
  42. package/dist/proto/spark_token.d.ts +1 -1
  43. package/dist/proto/spark_token.js +2 -2
  44. package/dist/{spark-WA_4wcBr.d.ts → spark-By6yHsrk.d.cts} +31 -6
  45. package/dist/{spark-WA_4wcBr.d.cts → spark-By6yHsrk.d.ts} +31 -6
  46. package/dist/{spark-wallet.browser-Cg4fB-Nm.d.ts → spark-wallet.browser-C1dQknVj.d.ts} +8 -8
  47. package/dist/{spark-wallet.browser-Db7Y95Kt.d.cts → spark-wallet.browser-CNMo3IvO.d.cts} +8 -8
  48. package/dist/{spark-wallet.node-HEG2ahNd.d.cts → spark-wallet.node-BZJhJZKq.d.cts} +9 -31
  49. package/dist/{spark-wallet.node-DB3ZqtJG.d.ts → spark-wallet.node-Og6__NMh.d.ts} +9 -31
  50. package/dist/tests/test-utils.cjs +8835 -8332
  51. package/dist/tests/test-utils.d.cts +8 -6
  52. package/dist/tests/test-utils.d.ts +8 -6
  53. package/dist/tests/test-utils.js +7 -7
  54. package/dist/{token-transactions-B2-BO7Oz.d.ts → token-transactions-C7yefB2S.d.ts} +2 -2
  55. package/dist/{token-transactions-BAN68xwg.d.cts → token-transactions-CLR3rnYi.d.cts} +2 -2
  56. package/dist/types/index.cjs +56 -43
  57. package/dist/types/index.d.cts +2 -2
  58. package/dist/types/index.d.ts +2 -2
  59. package/dist/types/index.js +2 -2
  60. package/dist/{spark-wallet-jwNvWvpK.d.ts → wallet-config-BoyMVa6n.d.ts} +293 -267
  61. package/dist/{spark-wallet-NxG55m7K.d.cts → wallet-config-xom-9UFF.d.cts} +293 -267
  62. package/package.json +16 -6
  63. package/src/graphql/client.ts +6 -9
  64. package/src/graphql/mutations/CompleteCoopExit.ts +1 -1
  65. package/src/graphql/mutations/RequestCoopExit.ts +3 -1
  66. package/src/graphql/mutations/RequestLightningSend.ts +3 -1
  67. package/src/graphql/objects/CompleteCoopExitInput.ts +22 -33
  68. package/src/graphql/objects/RequestCoopExitInput.ts +39 -45
  69. package/src/graphql/objects/RequestLightningSendInput.ts +31 -39
  70. package/src/index.react-native.ts +21 -0
  71. package/src/proto/mock.ts +0 -264
  72. package/src/proto/spark.ts +94 -51
  73. package/src/services/config.ts +7 -2
  74. package/src/services/connection/connection.browser.ts +27 -19
  75. package/src/services/connection/connection.node.ts +79 -24
  76. package/src/services/connection/connection.ts +396 -224
  77. package/src/services/coop-exit.ts +5 -1
  78. package/src/services/lightning.ts +30 -4
  79. package/src/services/signing.ts +137 -0
  80. package/src/services/token-transactions.ts +8 -8
  81. package/src/services/transfer.ts +116 -1
  82. package/src/services/wallet-config.ts +6 -0
  83. package/src/spark-wallet/proto-descriptors.ts +1 -1
  84. package/src/spark-wallet/spark-wallet.browser.ts +0 -1
  85. package/src/spark-wallet/spark-wallet.react-native.ts +5 -3
  86. package/src/spark-wallet/spark-wallet.ts +124 -83
  87. package/src/spark_descriptors.pb +0 -0
  88. package/src/tests/connection.test.ts +537 -0
  89. package/src/tests/integration/connection.test.ts +39 -0
  90. package/src/tests/integration/coop-exit.test.ts +2 -0
  91. package/src/tests/integration/lightning.test.ts +30 -12
  92. package/src/tests/integration/ssp/coop-exit-validation.test.ts +5 -6
  93. package/src/tests/integration/ssp/static_deposit.test.ts +45 -35
  94. package/src/tests/integration/static_deposit.test.ts +11 -10
  95. package/src/tests/integration/transfer.test.ts +13 -1
  96. package/src/tests/isHermeticTest.ts +1 -1
  97. package/src/tests/optimize.test.ts +45 -0
  98. package/src/tests/token-outputs.test.ts +60 -1
  99. package/src/tests/utils/test-faucet.ts +65 -28
  100. package/src/utils/htlc-transactions.ts +224 -0
  101. package/src/utils/optimize.ts +226 -0
  102. package/src/utils/transaction.ts +36 -0
  103. package/src/native/index.ts +0 -21
@@ -3,7 +3,7 @@ import {
3
3
  NetworkError,
4
4
  SparkWallet,
5
5
  clientEnv
6
- } from "./chunk-XPHYQ2L6.js";
6
+ } from "./chunk-FP2CRVQH.js";
7
7
 
8
8
  // src/services/connection/connection.browser.ts
9
9
  import {
@@ -19,7 +19,7 @@ var ConnectionManagerBrowser = class extends ConnectionManager {
19
19
  super(config);
20
20
  this.transport = transport;
21
21
  }
22
- async createChannelWithTLS(address, certPath) {
22
+ async createChannelWithTLS(address) {
23
23
  try {
24
24
  return createChannel(address, this.transport);
25
25
  } catch (error) {
@@ -45,16 +45,14 @@ var ConnectionManagerBrowser = class extends ConnectionManager {
45
45
  });
46
46
  }.bind(this);
47
47
  }
48
- createMiddleware(address, initialAuthToken) {
48
+ createMiddleware(address) {
49
49
  return async function* (call, options) {
50
50
  const metadata = Metadata(options.metadata).set("X-Requested-With", "XMLHttpRequest").set("X-Grpc-Web", "1").set("X-Client-Env", clientEnv).set("Content-Type", "application/grpc-web+proto");
51
51
  try {
52
+ const token = await this.authenticate(address);
52
53
  return yield* call.next(call.request, {
53
54
  ...options,
54
- metadata: metadata.set(
55
- "Authorization",
56
- `Bearer ${this.clients.get(address)?.authToken || initialAuthToken}`
57
- )
55
+ metadata: metadata.set("Authorization", `Bearer ${token}`)
58
56
  });
59
57
  } catch (error) {
60
58
  return yield* this.handleMiddlewareError(
@@ -67,7 +65,7 @@ var ConnectionManagerBrowser = class extends ConnectionManager {
67
65
  }
68
66
  }.bind(this);
69
67
  }
70
- async createGrpcClient(defintion, channel, withRetries, middleware) {
68
+ async createGrpcClient(definition, channel, withRetries, middleware, channelKey) {
71
69
  let clientFactory;
72
70
  const retryOptions = {
73
71
  retry: true,
@@ -82,12 +80,12 @@ var ConnectionManagerBrowser = class extends ConnectionManager {
82
80
  if (middleware) {
83
81
  clientFactory = clientFactory.use(middleware);
84
82
  }
85
- const client = clientFactory.create(defintion, channel, {
83
+ const client = clientFactory.create(definition, channel, {
86
84
  "*": options
87
85
  });
88
86
  return {
89
87
  ...client,
90
- close: void 0
88
+ close: channelKey ? () => ConnectionManager.releaseChannel(channelKey) : void 0
91
89
  };
92
90
  }
93
91
  };
@@ -106,7 +104,6 @@ var SparkWalletBrowser = class extends SparkWallet {
106
104
  spanProcessors,
107
105
  traceUrls
108
106
  }) {
109
- console.log("initializeTracerEnvBrowser");
110
107
  initializeTracerEnvBrowser({ spanProcessors, traceUrls });
111
108
  }
112
109
  };
@@ -2954,24 +2954,21 @@ var SigningResult_SignatureSharesEntry = {
2954
2954
  }
2955
2955
  };
2956
2956
  function createBaseRenewLeafRequest() {
2957
- return { leafId: "", ownerIdentityPublicKey: new Uint8Array(0), signingJobs: void 0 };
2957
+ return { leafId: "", signingJobs: void 0 };
2958
2958
  }
2959
2959
  var RenewLeafRequest = {
2960
2960
  encode(message, writer = new BinaryWriter4()) {
2961
2961
  if (message.leafId !== "") {
2962
2962
  writer.uint32(10).string(message.leafId);
2963
2963
  }
2964
- if (message.ownerIdentityPublicKey.length !== 0) {
2965
- writer.uint32(18).bytes(message.ownerIdentityPublicKey);
2966
- }
2967
2964
  switch (message.signingJobs?.$case) {
2968
2965
  case "renewNodeTimelockSigningJob":
2969
- RenewNodeTimelockSigningJob.encode(message.signingJobs.renewNodeTimelockSigningJob, writer.uint32(26).fork()).join();
2966
+ RenewNodeTimelockSigningJob.encode(message.signingJobs.renewNodeTimelockSigningJob, writer.uint32(18).fork()).join();
2970
2967
  break;
2971
2968
  case "renewRefundTimelockSigningJob":
2972
2969
  RenewRefundTimelockSigningJob.encode(
2973
2970
  message.signingJobs.renewRefundTimelockSigningJob,
2974
- writer.uint32(34).fork()
2971
+ writer.uint32(26).fork()
2975
2972
  ).join();
2976
2973
  break;
2977
2974
  }
@@ -2995,21 +2992,14 @@ var RenewLeafRequest = {
2995
2992
  if (tag !== 18) {
2996
2993
  break;
2997
2994
  }
2998
- message.ownerIdentityPublicKey = reader.bytes();
2999
- continue;
3000
- }
3001
- case 3: {
3002
- if (tag !== 26) {
3003
- break;
3004
- }
3005
2995
  message.signingJobs = {
3006
2996
  $case: "renewNodeTimelockSigningJob",
3007
2997
  renewNodeTimelockSigningJob: RenewNodeTimelockSigningJob.decode(reader, reader.uint32())
3008
2998
  };
3009
2999
  continue;
3010
3000
  }
3011
- case 4: {
3012
- if (tag !== 34) {
3001
+ case 3: {
3002
+ if (tag !== 26) {
3013
3003
  break;
3014
3004
  }
3015
3005
  message.signingJobs = {
@@ -3029,7 +3019,6 @@ var RenewLeafRequest = {
3029
3019
  fromJSON(object) {
3030
3020
  return {
3031
3021
  leafId: isSet3(object.leafId) ? globalThis.String(object.leafId) : "",
3032
- ownerIdentityPublicKey: isSet3(object.ownerIdentityPublicKey) ? bytesFromBase642(object.ownerIdentityPublicKey) : new Uint8Array(0),
3033
3022
  signingJobs: isSet3(object.renewNodeTimelockSigningJob) ? {
3034
3023
  $case: "renewNodeTimelockSigningJob",
3035
3024
  renewNodeTimelockSigningJob: RenewNodeTimelockSigningJob.fromJSON(object.renewNodeTimelockSigningJob)
@@ -3044,9 +3033,6 @@ var RenewLeafRequest = {
3044
3033
  if (message.leafId !== "") {
3045
3034
  obj.leafId = message.leafId;
3046
3035
  }
3047
- if (message.ownerIdentityPublicKey.length !== 0) {
3048
- obj.ownerIdentityPublicKey = base64FromBytes2(message.ownerIdentityPublicKey);
3049
- }
3050
3036
  if (message.signingJobs?.$case === "renewNodeTimelockSigningJob") {
3051
3037
  obj.renewNodeTimelockSigningJob = RenewNodeTimelockSigningJob.toJSON(
3052
3038
  message.signingJobs.renewNodeTimelockSigningJob
@@ -3064,7 +3050,6 @@ var RenewLeafRequest = {
3064
3050
  fromPartial(object) {
3065
3051
  const message = createBaseRenewLeafRequest();
3066
3052
  message.leafId = object.leafId ?? "";
3067
- message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
3068
3053
  switch (object.signingJobs?.$case) {
3069
3054
  case "renewNodeTimelockSigningJob": {
3070
3055
  if (object.signingJobs?.renewNodeTimelockSigningJob !== void 0 && object.signingJobs?.renewNodeTimelockSigningJob !== null) {
@@ -3368,11 +3353,11 @@ function createBaseRenewLeafResponse() {
3368
3353
  var RenewLeafResponse = {
3369
3354
  encode(message, writer = new BinaryWriter4()) {
3370
3355
  switch (message.renewResult?.$case) {
3371
- case "extendResult":
3372
- RenewNodeTimelockResult.encode(message.renewResult.extendResult, writer.uint32(10).fork()).join();
3356
+ case "renewNodeTimelockResult":
3357
+ RenewNodeTimelockResult.encode(message.renewResult.renewNodeTimelockResult, writer.uint32(10).fork()).join();
3373
3358
  break;
3374
- case "refreshResult":
3375
- RenewRefundTimelockResult.encode(message.renewResult.refreshResult, writer.uint32(18).fork()).join();
3359
+ case "renewRefundTimelockResult":
3360
+ RenewRefundTimelockResult.encode(message.renewResult.renewRefundTimelockResult, writer.uint32(18).fork()).join();
3376
3361
  break;
3377
3362
  }
3378
3363
  return writer;
@@ -3389,8 +3374,8 @@ var RenewLeafResponse = {
3389
3374
  break;
3390
3375
  }
3391
3376
  message.renewResult = {
3392
- $case: "extendResult",
3393
- extendResult: RenewNodeTimelockResult.decode(reader, reader.uint32())
3377
+ $case: "renewNodeTimelockResult",
3378
+ renewNodeTimelockResult: RenewNodeTimelockResult.decode(reader, reader.uint32())
3394
3379
  };
3395
3380
  continue;
3396
3381
  }
@@ -3399,8 +3384,8 @@ var RenewLeafResponse = {
3399
3384
  break;
3400
3385
  }
3401
3386
  message.renewResult = {
3402
- $case: "refreshResult",
3403
- refreshResult: RenewRefundTimelockResult.decode(reader, reader.uint32())
3387
+ $case: "renewRefundTimelockResult",
3388
+ renewRefundTimelockResult: RenewRefundTimelockResult.decode(reader, reader.uint32())
3404
3389
  };
3405
3390
  continue;
3406
3391
  }
@@ -3414,15 +3399,21 @@ var RenewLeafResponse = {
3414
3399
  },
3415
3400
  fromJSON(object) {
3416
3401
  return {
3417
- renewResult: isSet3(object.extendResult) ? { $case: "extendResult", extendResult: RenewNodeTimelockResult.fromJSON(object.extendResult) } : isSet3(object.refreshResult) ? { $case: "refreshResult", refreshResult: RenewRefundTimelockResult.fromJSON(object.refreshResult) } : void 0
3402
+ renewResult: isSet3(object.renewNodeTimelockResult) ? {
3403
+ $case: "renewNodeTimelockResult",
3404
+ renewNodeTimelockResult: RenewNodeTimelockResult.fromJSON(object.renewNodeTimelockResult)
3405
+ } : isSet3(object.renewRefundTimelockResult) ? {
3406
+ $case: "renewRefundTimelockResult",
3407
+ renewRefundTimelockResult: RenewRefundTimelockResult.fromJSON(object.renewRefundTimelockResult)
3408
+ } : void 0
3418
3409
  };
3419
3410
  },
3420
3411
  toJSON(message) {
3421
3412
  const obj = {};
3422
- if (message.renewResult?.$case === "extendResult") {
3423
- obj.extendResult = RenewNodeTimelockResult.toJSON(message.renewResult.extendResult);
3424
- } else if (message.renewResult?.$case === "refreshResult") {
3425
- obj.refreshResult = RenewRefundTimelockResult.toJSON(message.renewResult.refreshResult);
3413
+ if (message.renewResult?.$case === "renewNodeTimelockResult") {
3414
+ obj.renewNodeTimelockResult = RenewNodeTimelockResult.toJSON(message.renewResult.renewNodeTimelockResult);
3415
+ } else if (message.renewResult?.$case === "renewRefundTimelockResult") {
3416
+ obj.renewRefundTimelockResult = RenewRefundTimelockResult.toJSON(message.renewResult.renewRefundTimelockResult);
3426
3417
  }
3427
3418
  return obj;
3428
3419
  },
@@ -3432,20 +3423,22 @@ var RenewLeafResponse = {
3432
3423
  fromPartial(object) {
3433
3424
  const message = createBaseRenewLeafResponse();
3434
3425
  switch (object.renewResult?.$case) {
3435
- case "extendResult": {
3436
- if (object.renewResult?.extendResult !== void 0 && object.renewResult?.extendResult !== null) {
3426
+ case "renewNodeTimelockResult": {
3427
+ if (object.renewResult?.renewNodeTimelockResult !== void 0 && object.renewResult?.renewNodeTimelockResult !== null) {
3437
3428
  message.renewResult = {
3438
- $case: "extendResult",
3439
- extendResult: RenewNodeTimelockResult.fromPartial(object.renewResult.extendResult)
3429
+ $case: "renewNodeTimelockResult",
3430
+ renewNodeTimelockResult: RenewNodeTimelockResult.fromPartial(object.renewResult.renewNodeTimelockResult)
3440
3431
  };
3441
3432
  }
3442
3433
  break;
3443
3434
  }
3444
- case "refreshResult": {
3445
- if (object.renewResult?.refreshResult !== void 0 && object.renewResult?.refreshResult !== null) {
3435
+ case "renewRefundTimelockResult": {
3436
+ if (object.renewResult?.renewRefundTimelockResult !== void 0 && object.renewResult?.renewRefundTimelockResult !== null) {
3446
3437
  message.renewResult = {
3447
- $case: "refreshResult",
3448
- refreshResult: RenewRefundTimelockResult.fromPartial(object.renewResult.refreshResult)
3438
+ $case: "renewRefundTimelockResult",
3439
+ renewRefundTimelockResult: RenewRefundTimelockResult.fromPartial(
3440
+ object.renewResult.renewRefundTimelockResult
3441
+ )
3449
3442
  };
3450
3443
  }
3451
3444
  break;
@@ -10647,7 +10640,8 @@ function createBaseInitiatePreimageSwapRequest() {
10647
10640
  reason: 0,
10648
10641
  transfer: void 0,
10649
10642
  receiverIdentityPublicKey: new Uint8Array(0),
10650
- feeSats: 0
10643
+ feeSats: 0,
10644
+ transferRequest: void 0
10651
10645
  };
10652
10646
  }
10653
10647
  var InitiatePreimageSwapRequest = {
@@ -10670,6 +10664,9 @@ var InitiatePreimageSwapRequest = {
10670
10664
  if (message.feeSats !== 0) {
10671
10665
  writer.uint32(48).uint64(message.feeSats);
10672
10666
  }
10667
+ if (message.transferRequest !== void 0) {
10668
+ StartTransferRequest.encode(message.transferRequest, writer.uint32(58).fork()).join();
10669
+ }
10673
10670
  return writer;
10674
10671
  },
10675
10672
  decode(input, length) {
@@ -10721,6 +10718,13 @@ var InitiatePreimageSwapRequest = {
10721
10718
  message.feeSats = longToNumber2(reader.uint64());
10722
10719
  continue;
10723
10720
  }
10721
+ case 7: {
10722
+ if (tag !== 58) {
10723
+ break;
10724
+ }
10725
+ message.transferRequest = StartTransferRequest.decode(reader, reader.uint32());
10726
+ continue;
10727
+ }
10724
10728
  }
10725
10729
  if ((tag & 7) === 4 || tag === 0) {
10726
10730
  break;
@@ -10736,7 +10740,8 @@ var InitiatePreimageSwapRequest = {
10736
10740
  reason: isSet3(object.reason) ? initiatePreimageSwapRequest_ReasonFromJSON(object.reason) : 0,
10737
10741
  transfer: isSet3(object.transfer) ? StartUserSignedTransferRequest.fromJSON(object.transfer) : void 0,
10738
10742
  receiverIdentityPublicKey: isSet3(object.receiverIdentityPublicKey) ? bytesFromBase642(object.receiverIdentityPublicKey) : new Uint8Array(0),
10739
- feeSats: isSet3(object.feeSats) ? globalThis.Number(object.feeSats) : 0
10743
+ feeSats: isSet3(object.feeSats) ? globalThis.Number(object.feeSats) : 0,
10744
+ transferRequest: isSet3(object.transferRequest) ? StartTransferRequest.fromJSON(object.transferRequest) : void 0
10740
10745
  };
10741
10746
  },
10742
10747
  toJSON(message) {
@@ -10759,6 +10764,9 @@ var InitiatePreimageSwapRequest = {
10759
10764
  if (message.feeSats !== 0) {
10760
10765
  obj.feeSats = Math.round(message.feeSats);
10761
10766
  }
10767
+ if (message.transferRequest !== void 0) {
10768
+ obj.transferRequest = StartTransferRequest.toJSON(message.transferRequest);
10769
+ }
10762
10770
  return obj;
10763
10771
  },
10764
10772
  create(base) {
@@ -10772,6 +10780,7 @@ var InitiatePreimageSwapRequest = {
10772
10780
  message.transfer = object.transfer !== void 0 && object.transfer !== null ? StartUserSignedTransferRequest.fromPartial(object.transfer) : void 0;
10773
10781
  message.receiverIdentityPublicKey = object.receiverIdentityPublicKey ?? new Uint8Array(0);
10774
10782
  message.feeSats = object.feeSats ?? 0;
10783
+ message.transferRequest = object.transferRequest !== void 0 && object.transferRequest !== null ? StartTransferRequest.fromPartial(object.transferRequest) : void 0;
10775
10784
  return message;
10776
10785
  }
10777
10786
  };
@@ -16656,6 +16665,10 @@ var SparkServiceDefinition = {
16656
16665
  responseStream: false,
16657
16666
  options: {}
16658
16667
  },
16668
+ /**
16669
+ * Gets a specified number of signing commmitments for a set of nodes, which can be used as
16670
+ * part of a transfer package.
16671
+ */
16659
16672
  get_signing_commitments: {
16660
16673
  name: "get_signing_commitments",
16661
16674
  requestType: GetSigningCommitmentsRequest,
@@ -5,7 +5,7 @@ import {
5
5
  Timestamp,
6
6
  networkFromJSON,
7
7
  networkToJSON
8
- } from "./chunk-IC4IUEOS.js";
8
+ } from "./chunk-VFN34EOX.js";
9
9
 
10
10
  // src/proto/spark_token.ts
11
11
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -2,7 +2,7 @@ import { Query } from '@lightsparkdev/core';
2
2
  import { Transaction } from '@scure/btc-signer';
3
3
  import { HDKey } from '@scure/bip32';
4
4
  import { a as ISigningCommitment } from './types-B3hMoTYO.js';
5
- import { S as SigningKeyshare, N as Network, i as TransferStatus, j as TransferType, c as TreeNode, k as TransferLeaf, T as Transfer$1 } from './spark-WA_4wcBr.js';
5
+ import { S as SigningKeyshare, N as Network, k as TransferStatus, l as TransferType, c as TreeNode, m as TransferLeaf, T as Transfer$1 } from './spark-By6yHsrk.js';
6
6
 
7
7
  type Polynomial = {
8
8
  fieldModulus: bigint;
@@ -651,7 +651,7 @@ interface ClaimStaticDepositOutput {
651
651
 
652
652
  interface CompleteCoopExitInput {
653
653
  userOutboundTransferExternalId: string;
654
- coopExitRequestId: string;
654
+ coopExitRequestId?: string | undefined;
655
655
  }
656
656
 
657
657
  interface CompleteLeavesSwapInput {
@@ -740,11 +740,12 @@ interface LightningSendFeeEstimateOutput {
740
740
  interface RequestCoopExitInput {
741
741
  leafExternalIds: string[];
742
742
  withdrawalAddress: string;
743
- idempotencyKey: string;
743
+ idempotencyKey?: string | undefined;
744
744
  exitSpeed: ExitSpeed;
745
745
  withdrawAll: boolean;
746
746
  feeLeafExternalIds?: string[] | undefined;
747
747
  feeQuoteId?: string | undefined;
748
+ userOutboundTransferExternalId?: string | undefined;
748
749
  }
749
750
 
750
751
  interface UserLeafInput {
@@ -804,12 +805,13 @@ interface RequestLightningReceiveInput {
804
805
 
805
806
  interface RequestLightningSendInput {
806
807
  encodedInvoice: string;
807
- idempotencyKey: string;
808
+ idempotencyKey?: string | undefined;
808
809
  /**
809
- * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
810
- * zero.
811
- **/
810
+ * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
811
+ * zero.
812
+ **/
812
813
  amountSats?: number | undefined;
814
+ userOutboundTransferExternalId?: string | undefined;
813
815
  }
814
816
 
815
817
  interface StaticDepositQuoteInput {
@@ -866,10 +868,10 @@ declare class SspClient {
866
868
  getLightningSendFeeEstimate(encodedInvoice: string, amountSats?: number): Promise<LightningSendFeeEstimateOutput | null>;
867
869
  getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
868
870
  getCurrentUser(): Promise<void>;
869
- completeCoopExit({ userOutboundTransferExternalId, coopExitRequestId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
870
- requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
871
+ completeCoopExit({ userOutboundTransferExternalId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
872
+ requestCoopExit({ leafExternalIds, withdrawalAddress, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, userOutboundTransferExternalId, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
871
873
  requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
872
- requestLightningSend({ encodedInvoice, idempotencyKey, amountSats, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
874
+ requestLightningSend({ encodedInvoice, amountSats, userOutboundTransferExternalId, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
873
875
  requestLeaveSwap({ adaptorPubkey, directAdaptorPubkey, directFromCpfpAdaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, targetAmountSatsList, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
874
876
  completeLeaveSwap({ adaptorSecretKey, directAdaptorSecretKey, directFromCpfpAdaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
875
877
  getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
@@ -893,4 +895,4 @@ declare class SspClient {
893
895
  getCoopExitFeeQuote({ leafExternalIds, withdrawalAddress, }: CoopExitFeeQuoteInput): Promise<CoopExitFeeQuote | null>;
894
896
  }
895
897
 
896
- export { getCoopExitFeeQuoteQuery as $, type AggregateFrostParams as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, DefaultSparkSigner as D, ExitSpeed as E, type CoopExitFeeQuote as F, type CoopExitRequest as G, type HasSspClientOptions as H, type TransferWithUserRequest as I, SspClient as J, KeyDerivationType as K, type LeavesSwapFeeEstimateOutput as L, type MayHaveSspClientOptions as M, getClaimStaticDepositQuery as N, type ClaimStaticDeposit as O, type PageInfo as P, ClaimStaticDepositStatus as Q, type CompleteCoopExitInput as R, type SparkSigner as S, TaprootOutputKeysGenerator as T, UnsafeStatelessSparkSigner as U, type VerifiableSecretShare as V, type WalletTransfer as W, type CompleteLeavesSwapInput as X, type CoopExitFeeEstimate as Y, type CoopExitFeeEstimatesInput as Z, type CoopExitFeeEstimatesOutput as _, TaprootSparkSigner as a, type CoopExitFeeQuoteInput as a0, getCoopExitRequestQuery as a1, type CurrencyAmount as a2, CurrencyUnit as a3, type GetChallengeOutput as a4, type Invoice as a5, type Leaf as a6, getLeavesSwapRequestQuery as a7, type LeavesSwapRequest as a8, getLightningReceiveRequestQuery as a9, LightningReceiveRequestStatus as aa, type LightningSendFeeEstimateOutput as ab, getLightningSendRequestQuery as ac, LightningSendRequestStatus as ad, type RequestCoopExitInput as ae, type RequestLeavesSwapInput as af, type RequestLightningReceiveInput as ag, type RequestLightningSendInput as ah, SparkCoopExitRequestStatus as ai, SparkLeavesSwapRequestStatus as aj, type SparkTransferToLeavesConnection as ak, type StaticDepositQuoteInput as al, type SwapLeaf as am, Transfer as an, type UserLeafInput as ao, type VerifyChallengeOutput as ap, mapTreeNodeToWalletLeaf as aq, TransferDirection as ar, type UserRequestType as as, type WalletTransferLeaf as at, mapTransferLeafToWalletTransferLeaf as au, mapTransferToWalletTransfer as av, generatePolynomialForSecretSharing as b, computerLagrangeCoefficients as c, splitSecretWithProofs as d, evaluatePolynomial as e, fieldDiv as f, getRandomBigInt as g, bigIntToPrivateKey as h, type SigningCommitmentWithOptionalNonce as i, type SigningNonce as j, type SigningCommitment as k, type KeyDerivation as l, modInverse as m, type SignFrostParams as n, type SplitSecretWithProofsParams as o, type DerivedHDKey as p, type KeyPair as q, recoverSecret as r, splitSecret as s, type SspClientOptions as t, type StaticDepositQuoteOutput as u, validateShare as v, type WalletLeaf as w, type LightningReceiveRequest as x, type LightningSendRequest as y, type LightningSendFeeEstimateInput as z };
898
+ export { getCoopExitFeeQuoteQuery as $, type AggregateFrostParams as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, DefaultSparkSigner as D, ExitSpeed as E, type CoopExitFeeQuote as F, type CoopExitRequest as G, type HasSspClientOptions as H, type TransferWithUserRequest as I, SspClient as J, KeyDerivationType as K, type LeavesSwapFeeEstimateOutput as L, type MayHaveSspClientOptions as M, getClaimStaticDepositQuery as N, type ClaimStaticDeposit as O, type PageInfo as P, ClaimStaticDepositStatus as Q, type CompleteCoopExitInput as R, type SparkSigner as S, TaprootOutputKeysGenerator as T, UnsafeStatelessSparkSigner as U, type VerifiableSecretShare as V, type WalletLeaf as W, type CompleteLeavesSwapInput as X, type CoopExitFeeEstimate as Y, type CoopExitFeeEstimatesInput as Z, type CoopExitFeeEstimatesOutput as _, TaprootSparkSigner as a, type CoopExitFeeQuoteInput as a0, getCoopExitRequestQuery as a1, type CurrencyAmount as a2, CurrencyUnit as a3, type GetChallengeOutput as a4, type Invoice as a5, type Leaf as a6, getLeavesSwapRequestQuery as a7, type LeavesSwapRequest as a8, getLightningReceiveRequestQuery as a9, LightningReceiveRequestStatus as aa, type LightningSendFeeEstimateOutput as ab, getLightningSendRequestQuery as ac, LightningSendRequestStatus as ad, type RequestCoopExitInput as ae, type RequestLeavesSwapInput as af, type RequestLightningReceiveInput as ag, type RequestLightningSendInput as ah, SparkCoopExitRequestStatus as ai, SparkLeavesSwapRequestStatus as aj, type SparkTransferToLeavesConnection as ak, type StaticDepositQuoteInput as al, type SwapLeaf as am, Transfer as an, type UserLeafInput as ao, type VerifyChallengeOutput as ap, mapTreeNodeToWalletLeaf as aq, TransferDirection as ar, type UserRequestType as as, type WalletTransferLeaf as at, mapTransferLeafToWalletTransferLeaf as au, mapTransferToWalletTransfer as av, generatePolynomialForSecretSharing as b, computerLagrangeCoefficients as c, splitSecretWithProofs as d, evaluatePolynomial as e, fieldDiv as f, getRandomBigInt as g, bigIntToPrivateKey as h, type SigningCommitmentWithOptionalNonce as i, type SigningNonce as j, type SigningCommitment as k, type KeyDerivation as l, modInverse as m, type SignFrostParams as n, type SplitSecretWithProofsParams as o, type DerivedHDKey as p, type KeyPair as q, recoverSecret as r, splitSecret as s, type SspClientOptions as t, type StaticDepositQuoteOutput as u, validateShare as v, type WalletTransfer as w, type LightningReceiveRequest as x, type LightningSendRequest as y, type LightningSendFeeEstimateInput as z };
@@ -2,7 +2,7 @@ import { Query } from '@lightsparkdev/core';
2
2
  import { Transaction } from '@scure/btc-signer';
3
3
  import { HDKey } from '@scure/bip32';
4
4
  import { a as ISigningCommitment } from './types-B3hMoTYO.cjs';
5
- import { S as SigningKeyshare, N as Network, i as TransferStatus, j as TransferType, c as TreeNode, k as TransferLeaf, T as Transfer$1 } from './spark-WA_4wcBr.cjs';
5
+ import { S as SigningKeyshare, N as Network, k as TransferStatus, l as TransferType, c as TreeNode, m as TransferLeaf, T as Transfer$1 } from './spark-By6yHsrk.cjs';
6
6
 
7
7
  type Polynomial = {
8
8
  fieldModulus: bigint;
@@ -651,7 +651,7 @@ interface ClaimStaticDepositOutput {
651
651
 
652
652
  interface CompleteCoopExitInput {
653
653
  userOutboundTransferExternalId: string;
654
- coopExitRequestId: string;
654
+ coopExitRequestId?: string | undefined;
655
655
  }
656
656
 
657
657
  interface CompleteLeavesSwapInput {
@@ -740,11 +740,12 @@ interface LightningSendFeeEstimateOutput {
740
740
  interface RequestCoopExitInput {
741
741
  leafExternalIds: string[];
742
742
  withdrawalAddress: string;
743
- idempotencyKey: string;
743
+ idempotencyKey?: string | undefined;
744
744
  exitSpeed: ExitSpeed;
745
745
  withdrawAll: boolean;
746
746
  feeLeafExternalIds?: string[] | undefined;
747
747
  feeQuoteId?: string | undefined;
748
+ userOutboundTransferExternalId?: string | undefined;
748
749
  }
749
750
 
750
751
  interface UserLeafInput {
@@ -804,12 +805,13 @@ interface RequestLightningReceiveInput {
804
805
 
805
806
  interface RequestLightningSendInput {
806
807
  encodedInvoice: string;
807
- idempotencyKey: string;
808
+ idempotencyKey?: string | undefined;
808
809
  /**
809
- * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
810
- * zero.
811
- **/
810
+ * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
811
+ * zero.
812
+ **/
812
813
  amountSats?: number | undefined;
814
+ userOutboundTransferExternalId?: string | undefined;
813
815
  }
814
816
 
815
817
  interface StaticDepositQuoteInput {
@@ -866,10 +868,10 @@ declare class SspClient {
866
868
  getLightningSendFeeEstimate(encodedInvoice: string, amountSats?: number): Promise<LightningSendFeeEstimateOutput | null>;
867
869
  getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
868
870
  getCurrentUser(): Promise<void>;
869
- completeCoopExit({ userOutboundTransferExternalId, coopExitRequestId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
870
- requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
871
+ completeCoopExit({ userOutboundTransferExternalId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
872
+ requestCoopExit({ leafExternalIds, withdrawalAddress, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, userOutboundTransferExternalId, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
871
873
  requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
872
- requestLightningSend({ encodedInvoice, idempotencyKey, amountSats, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
874
+ requestLightningSend({ encodedInvoice, amountSats, userOutboundTransferExternalId, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
873
875
  requestLeaveSwap({ adaptorPubkey, directAdaptorPubkey, directFromCpfpAdaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, targetAmountSatsList, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
874
876
  completeLeaveSwap({ adaptorSecretKey, directAdaptorSecretKey, directFromCpfpAdaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
875
877
  getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
@@ -893,4 +895,4 @@ declare class SspClient {
893
895
  getCoopExitFeeQuote({ leafExternalIds, withdrawalAddress, }: CoopExitFeeQuoteInput): Promise<CoopExitFeeQuote | null>;
894
896
  }
895
897
 
896
- export { getCoopExitFeeQuoteQuery as $, type AggregateFrostParams as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, DefaultSparkSigner as D, ExitSpeed as E, type CoopExitFeeQuote as F, type CoopExitRequest as G, type HasSspClientOptions as H, type TransferWithUserRequest as I, SspClient as J, KeyDerivationType as K, type LeavesSwapFeeEstimateOutput as L, type MayHaveSspClientOptions as M, getClaimStaticDepositQuery as N, type ClaimStaticDeposit as O, type PageInfo as P, ClaimStaticDepositStatus as Q, type CompleteCoopExitInput as R, type SparkSigner as S, TaprootOutputKeysGenerator as T, UnsafeStatelessSparkSigner as U, type VerifiableSecretShare as V, type WalletTransfer as W, type CompleteLeavesSwapInput as X, type CoopExitFeeEstimate as Y, type CoopExitFeeEstimatesInput as Z, type CoopExitFeeEstimatesOutput as _, TaprootSparkSigner as a, type CoopExitFeeQuoteInput as a0, getCoopExitRequestQuery as a1, type CurrencyAmount as a2, CurrencyUnit as a3, type GetChallengeOutput as a4, type Invoice as a5, type Leaf as a6, getLeavesSwapRequestQuery as a7, type LeavesSwapRequest as a8, getLightningReceiveRequestQuery as a9, LightningReceiveRequestStatus as aa, type LightningSendFeeEstimateOutput as ab, getLightningSendRequestQuery as ac, LightningSendRequestStatus as ad, type RequestCoopExitInput as ae, type RequestLeavesSwapInput as af, type RequestLightningReceiveInput as ag, type RequestLightningSendInput as ah, SparkCoopExitRequestStatus as ai, SparkLeavesSwapRequestStatus as aj, type SparkTransferToLeavesConnection as ak, type StaticDepositQuoteInput as al, type SwapLeaf as am, Transfer as an, type UserLeafInput as ao, type VerifyChallengeOutput as ap, mapTreeNodeToWalletLeaf as aq, TransferDirection as ar, type UserRequestType as as, type WalletTransferLeaf as at, mapTransferLeafToWalletTransferLeaf as au, mapTransferToWalletTransfer as av, generatePolynomialForSecretSharing as b, computerLagrangeCoefficients as c, splitSecretWithProofs as d, evaluatePolynomial as e, fieldDiv as f, getRandomBigInt as g, bigIntToPrivateKey as h, type SigningCommitmentWithOptionalNonce as i, type SigningNonce as j, type SigningCommitment as k, type KeyDerivation as l, modInverse as m, type SignFrostParams as n, type SplitSecretWithProofsParams as o, type DerivedHDKey as p, type KeyPair as q, recoverSecret as r, splitSecret as s, type SspClientOptions as t, type StaticDepositQuoteOutput as u, validateShare as v, type WalletLeaf as w, type LightningReceiveRequest as x, type LightningSendRequest as y, type LightningSendFeeEstimateInput as z };
898
+ export { getCoopExitFeeQuoteQuery as $, type AggregateFrostParams as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, DefaultSparkSigner as D, ExitSpeed as E, type CoopExitFeeQuote as F, type CoopExitRequest as G, type HasSspClientOptions as H, type TransferWithUserRequest as I, SspClient as J, KeyDerivationType as K, type LeavesSwapFeeEstimateOutput as L, type MayHaveSspClientOptions as M, getClaimStaticDepositQuery as N, type ClaimStaticDeposit as O, type PageInfo as P, ClaimStaticDepositStatus as Q, type CompleteCoopExitInput as R, type SparkSigner as S, TaprootOutputKeysGenerator as T, UnsafeStatelessSparkSigner as U, type VerifiableSecretShare as V, type WalletLeaf as W, type CompleteLeavesSwapInput as X, type CoopExitFeeEstimate as Y, type CoopExitFeeEstimatesInput as Z, type CoopExitFeeEstimatesOutput as _, TaprootSparkSigner as a, type CoopExitFeeQuoteInput as a0, getCoopExitRequestQuery as a1, type CurrencyAmount as a2, CurrencyUnit as a3, type GetChallengeOutput as a4, type Invoice as a5, type Leaf as a6, getLeavesSwapRequestQuery as a7, type LeavesSwapRequest as a8, getLightningReceiveRequestQuery as a9, LightningReceiveRequestStatus as aa, type LightningSendFeeEstimateOutput as ab, getLightningSendRequestQuery as ac, LightningSendRequestStatus as ad, type RequestCoopExitInput as ae, type RequestLeavesSwapInput as af, type RequestLightningReceiveInput as ag, type RequestLightningSendInput as ah, SparkCoopExitRequestStatus as ai, SparkLeavesSwapRequestStatus as aj, type SparkTransferToLeavesConnection as ak, type StaticDepositQuoteInput as al, type SwapLeaf as am, Transfer as an, type UserLeafInput as ao, type VerifyChallengeOutput as ap, mapTreeNodeToWalletLeaf as aq, TransferDirection as ar, type UserRequestType as as, type WalletTransferLeaf as at, mapTransferLeafToWalletTransferLeaf as au, mapTransferToWalletTransfer as av, generatePolynomialForSecretSharing as b, computerLagrangeCoefficients as c, splitSecretWithProofs as d, evaluatePolynomial as e, fieldDiv as f, getRandomBigInt as g, bigIntToPrivateKey as h, type SigningCommitmentWithOptionalNonce as i, type SigningNonce as j, type SigningCommitment as k, type KeyDerivation as l, modInverse as m, type SignFrostParams as n, type SplitSecretWithProofsParams as o, type DerivedHDKey as p, type KeyPair as q, recoverSecret as r, splitSecret as s, type SspClientOptions as t, type StaticDepositQuoteOutput as u, validateShare as v, type WalletTransfer as w, type LightningReceiveRequest as x, type LightningSendRequest as y, type LightningSendFeeEstimateInput as z };