@buildonspark/spark-sdk 0.1.46 → 0.2.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.
Files changed (171) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/{chunk-BGGEVUJK.js → chunk-2ENZX6LT.js} +241 -7
  3. package/dist/{chunk-LHRD2WT6.js → chunk-4JD4HIAN.js} +23 -3
  4. package/dist/{chunk-I54FARY2.js → chunk-CDLETEDT.js} +11 -3
  5. package/dist/{chunk-OBFKIEMP.js → chunk-TM6CHQXC.js} +1 -1
  6. package/dist/chunk-UDK3EBE5.js +13514 -0
  7. package/dist/chunk-XYTKKLCV.js +7 -0
  8. package/dist/{RequestLightningSendInput-2cSh_In4.d.cts → client-DKbwpcnl.d.ts} +434 -212
  9. package/dist/{RequestLightningSendInput-CN6BNg_g.d.ts → client-Drs5Lapg.d.cts} +434 -212
  10. package/dist/{services/config.cjs → debug.cjs} +31007 -1003
  11. package/dist/debug.d.cts +126 -0
  12. package/dist/debug.d.ts +126 -0
  13. package/dist/debug.js +21 -0
  14. package/dist/graphql/objects/index.d.cts +4 -11
  15. package/dist/graphql/objects/index.d.ts +4 -11
  16. package/dist/graphql/objects/index.js +2 -4
  17. package/dist/index.cjs +18219 -20818
  18. package/dist/index.d.cts +15 -768
  19. package/dist/index.d.ts +15 -768
  20. package/dist/index.js +82 -76
  21. package/dist/index.node.cjs +23831 -26538
  22. package/dist/index.node.d.cts +191 -33
  23. package/dist/index.node.d.ts +191 -33
  24. package/dist/index.node.js +87 -181
  25. package/dist/native/index.cjs +17835 -20519
  26. package/dist/native/index.d.cts +1466 -1546
  27. package/dist/native/index.d.ts +1466 -1546
  28. package/dist/native/index.js +22605 -25286
  29. package/dist/proto/lrc20.d.cts +2 -2
  30. package/dist/proto/lrc20.d.ts +2 -2
  31. package/dist/proto/lrc20.js +3098 -46
  32. package/dist/proto/spark.cjs +241 -7
  33. package/dist/proto/spark.d.cts +1 -1
  34. package/dist/proto/spark.d.ts +1 -1
  35. package/dist/proto/spark.js +5 -1
  36. package/dist/proto/spark_token.cjs +22 -2
  37. package/dist/proto/spark_token.d.cts +8 -1
  38. package/dist/proto/spark_token.d.ts +8 -1
  39. package/dist/proto/spark_token.js +2 -2
  40. package/dist/{sdk-types-CKBsylfW.d.ts → sdk-types-DCIVdKUT.d.ts} +1 -1
  41. package/dist/{sdk-types-Ct8xmN7l.d.cts → sdk-types-DJ2ve9YY.d.cts} +1 -1
  42. package/dist/{spark-DbzGfse6.d.ts → spark-BUOx3U7Q.d.cts} +103 -5
  43. package/dist/{spark-DbzGfse6.d.cts → spark-BUOx3U7Q.d.ts} +103 -5
  44. package/dist/spark-wallet-CF8Oxjqs.d.ts +935 -0
  45. package/dist/spark-wallet-DOLSa3oF.d.cts +935 -0
  46. package/dist/spark_bindings/native/index.d.cts +1 -1
  47. package/dist/spark_bindings/native/index.d.ts +1 -1
  48. package/dist/spark_bindings/wasm/index.d.cts +1 -1
  49. package/dist/spark_bindings/wasm/index.d.ts +1 -1
  50. package/dist/{services/index.cjs → tests/test-utils.cjs} +9788 -10263
  51. package/dist/tests/test-utils.d.cts +79 -0
  52. package/dist/tests/test-utils.d.ts +79 -0
  53. package/dist/tests/test-utils.js +93 -0
  54. package/dist/types/index.cjs +239 -7
  55. package/dist/types/index.d.cts +5 -9
  56. package/dist/types/index.d.ts +5 -9
  57. package/dist/types/index.js +4 -6
  58. package/dist/{types-C-Rp0Oo7.d.ts → types-BADxR3bm.d.cts} +1 -1
  59. package/dist/{types-C-Rp0Oo7.d.cts → types-BADxR3bm.d.ts} +1 -1
  60. package/dist/{index-COm59SPw.d.ts → xchain-address-C2xMs9nz.d.cts} +6 -94
  61. package/dist/{index-CKL5DodV.d.cts → xchain-address-Ckto9oEz.d.ts} +6 -94
  62. package/package.json +9 -33
  63. package/src/debug.ts +13 -0
  64. package/src/graphql/client.ts +59 -20
  65. package/src/index.node.ts +28 -2
  66. package/src/index.ts +31 -1
  67. package/src/native/index.ts +16 -2
  68. package/src/proto/mock.ts +76 -0
  69. package/src/proto/spark.ts +354 -6
  70. package/src/proto/spark_token.ts +34 -2
  71. package/src/services/config.ts +4 -6
  72. package/src/services/connection.ts +131 -64
  73. package/src/services/coop-exit.ts +6 -3
  74. package/src/services/deposit.ts +9 -8
  75. package/src/services/lightning.ts +4 -3
  76. package/src/services/signing.ts +10 -6
  77. package/src/services/token-transactions.ts +100 -85
  78. package/src/services/transfer.ts +88 -60
  79. package/src/services/tree-creation.ts +17 -9
  80. package/src/services/wallet-config.ts +17 -9
  81. package/src/signer/signer.react-native.ts +5 -10
  82. package/src/signer/signer.ts +269 -339
  83. package/src/signer/types.ts +63 -0
  84. package/src/spark-wallet/spark-wallet.ts +226 -149
  85. package/src/spark-wallet/types.ts +22 -8
  86. package/src/tests/integration/adaptor-signature.test.ts +8 -9
  87. package/src/tests/integration/coop-exit.test.ts +214 -202
  88. package/src/tests/integration/lightning.test.ts +128 -103
  89. package/src/tests/integration/swap.test.ts +116 -84
  90. package/src/tests/integration/transfer.test.ts +291 -214
  91. package/src/tests/integration/tree-creation.test.ts +0 -5
  92. package/src/tests/integration/wallet.test.ts +1 -0
  93. package/src/tests/isHermeticTest.ts +3 -24
  94. package/src/tests/{test-util.ts → test-utils.ts} +13 -11
  95. package/src/tests/token-identifier.test.ts +6 -6
  96. package/src/tests/wrapWithOtelSpan.test.ts +1 -1
  97. package/src/{address → utils}/address.ts +1 -1
  98. package/src/utils/crypto.ts +19 -9
  99. package/src/utils/index.ts +2 -0
  100. package/src/utils/network.ts +17 -0
  101. package/src/utils/secret-sharing.ts +1 -2
  102. package/src/utils/signing.ts +1 -1
  103. package/src/utils/token-identifier.ts +27 -21
  104. package/src/utils/token-transaction-validation.ts +34 -0
  105. package/src/utils/token-transactions.ts +12 -8
  106. package/src/utils/unilateral-exit.ts +32 -0
  107. package/src/utils/xchain-address.ts +1 -1
  108. package/dist/BitcoinNetwork-TnABML0T.d.cts +0 -18
  109. package/dist/BitcoinNetwork-TnABML0T.d.ts +0 -18
  110. package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.cts +0 -10
  111. package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.ts +0 -10
  112. package/dist/address/index.cjs +0 -458
  113. package/dist/address/index.d.cts +0 -32
  114. package/dist/address/index.d.ts +0 -32
  115. package/dist/address/index.js +0 -17
  116. package/dist/chunk-4EMV7HHW.js +0 -277
  117. package/dist/chunk-C2S227QR.js +0 -2336
  118. package/dist/chunk-DXR2PXJU.js +0 -1122
  119. package/dist/chunk-GSI4OLXZ.js +0 -117
  120. package/dist/chunk-HHNQ3ZHC.js +0 -170
  121. package/dist/chunk-HMLOC6TE.js +0 -14
  122. package/dist/chunk-HSCLBJEL.js +0 -113
  123. package/dist/chunk-HWJWKEIU.js +0 -75
  124. package/dist/chunk-JB64OQES.js +0 -7095
  125. package/dist/chunk-KMUMFYFX.js +0 -137
  126. package/dist/chunk-N5VZVCGJ.js +0 -622
  127. package/dist/chunk-NSJF5F5O.js +0 -325
  128. package/dist/chunk-NTFKFRQ2.js +0 -3146
  129. package/dist/chunk-OFCJFZ4I.js +0 -24
  130. package/dist/chunk-QNNSEJ4P.js +0 -232
  131. package/dist/chunk-UXDODSDT.js +0 -838
  132. package/dist/chunk-VTUGIIWI.js +0 -0
  133. package/dist/chunk-Z5HIAYFT.js +0 -84
  134. package/dist/network-Css46DAz.d.cts +0 -46
  135. package/dist/network-hynb7iTZ.d.ts +0 -46
  136. package/dist/services/config.d.cts +0 -42
  137. package/dist/services/config.d.ts +0 -42
  138. package/dist/services/config.js +0 -17
  139. package/dist/services/connection.cjs +0 -17691
  140. package/dist/services/connection.d.cts +0 -95
  141. package/dist/services/connection.d.ts +0 -95
  142. package/dist/services/connection.js +0 -11
  143. package/dist/services/index.d.cts +0 -21
  144. package/dist/services/index.d.ts +0 -21
  145. package/dist/services/index.js +0 -58
  146. package/dist/services/lrc-connection.cjs +0 -4713
  147. package/dist/services/lrc-connection.d.cts +0 -34
  148. package/dist/services/lrc-connection.d.ts +0 -34
  149. package/dist/services/lrc-connection.js +0 -11
  150. package/dist/services/token-transactions.cjs +0 -2877
  151. package/dist/services/token-transactions.d.cts +0 -75
  152. package/dist/services/token-transactions.d.ts +0 -75
  153. package/dist/services/token-transactions.js +0 -15
  154. package/dist/services/wallet-config.cjs +0 -340
  155. package/dist/services/wallet-config.d.cts +0 -56
  156. package/dist/services/wallet-config.d.ts +0 -56
  157. package/dist/services/wallet-config.js +0 -33
  158. package/dist/signer/signer.cjs +0 -2004
  159. package/dist/signer/signer.d.cts +0 -10
  160. package/dist/signer/signer.d.ts +0 -10
  161. package/dist/signer/signer.js +0 -24
  162. package/dist/signer-BP6F__oR.d.cts +0 -187
  163. package/dist/signer-BVZJXcq7.d.ts +0 -187
  164. package/dist/utils/index.cjs +0 -2947
  165. package/dist/utils/index.d.cts +0 -18
  166. package/dist/utils/index.d.ts +0 -18
  167. package/dist/utils/index.js +0 -157
  168. package/ios/spark_frost.kt +0 -1900
  169. package/src/address/index.ts +0 -1
  170. package/src/services/lrc-connection.ts +0 -215
  171. /package/dist/{chunk-L3EHBOUX.js → chunk-BYXBJQAS.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @buildonspark/spark-sdk
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Remove key map state from signer interface.
8
+ - The SDK now passes around the derivation details regarding the signing key instead of forcing the signer to maintain a pubkey to privkey map
9
+ - Parameter changes to transferTokens() and batchTransferTokens()
10
+ - Parameter changes to queryTokenTransactions()
11
+ - Replaced getIssuerTokenInfo() with getIssuerTokenMetadata()
12
+ - Rename HumanReadableTokenIdentifier to Bech32mTokenIdentifier
13
+ - Bech32mTokenIdentifier must now be passed as tokenIdentifier in transferTokens() batchTransferTokens
14
+
15
+ ## 0.1.47
16
+
17
+ ### Patch Changes
18
+
19
+ - - Move some less common imports to root. If you were using these import paths please update them to import the same objects from @buildonspark/spark-sdk instead:
20
+ - @buildonspark/spark-sdk/address
21
+ - @buildonspark/spark-sdk/signer
22
+ - @buildonspark/spark-sdk/services/wallet-config
23
+ - @buildonspark/spark-sdk/utils
24
+ - @buildonspark/spark-sdk/token-transactions
25
+ - @buildonspark/spark-sdk/config
26
+ - @buildonspark/spark-sdk/lrc-connection
27
+ - @buildonspark/spark-sdk/connection
28
+
3
29
  ## 0.1.46
4
30
 
5
31
  ### Patch Changes
@@ -54,6 +54,8 @@ __export(spark_exports, {
54
54
  InitiatePreimageSwapRequest: () => InitiatePreimageSwapRequest,
55
55
  InitiatePreimageSwapRequest_Reason: () => InitiatePreimageSwapRequest_Reason,
56
56
  InitiatePreimageSwapResponse: () => InitiatePreimageSwapResponse,
57
+ InitiateStaticDepositUtxoRefundRequest: () => InitiateStaticDepositUtxoRefundRequest,
58
+ InitiateStaticDepositUtxoRefundResponse: () => InitiateStaticDepositUtxoRefundResponse,
57
59
  InitiateUtxoSwapRequest: () => InitiateUtxoSwapRequest,
58
60
  InitiateUtxoSwapResponse: () => InitiateUtxoSwapResponse,
59
61
  InvestigateLeavesRequest: () => InvestigateLeavesRequest,
@@ -4026,7 +4028,12 @@ var TokenTransactionConfirmationMetadata = {
4026
4028
  }
4027
4029
  };
4028
4030
  function createBaseTokenTransactionWithStatus() {
4029
- return { tokenTransaction: void 0, status: 0, confirmationMetadata: void 0 };
4031
+ return {
4032
+ tokenTransaction: void 0,
4033
+ status: 0,
4034
+ confirmationMetadata: void 0,
4035
+ tokenTransactionHash: new Uint8Array(0)
4036
+ };
4030
4037
  }
4031
4038
  var TokenTransactionWithStatus = {
4032
4039
  encode(message, writer = new BinaryWriter4()) {
@@ -4039,6 +4046,9 @@ var TokenTransactionWithStatus = {
4039
4046
  if (message.confirmationMetadata !== void 0) {
4040
4047
  TokenTransactionConfirmationMetadata.encode(message.confirmationMetadata, writer.uint32(26).fork()).join();
4041
4048
  }
4049
+ if (message.tokenTransactionHash.length !== 0) {
4050
+ writer.uint32(34).bytes(message.tokenTransactionHash);
4051
+ }
4042
4052
  return writer;
4043
4053
  },
4044
4054
  decode(input, length) {
@@ -4069,6 +4079,13 @@ var TokenTransactionWithStatus = {
4069
4079
  message.confirmationMetadata = TokenTransactionConfirmationMetadata.decode(reader, reader.uint32());
4070
4080
  continue;
4071
4081
  }
4082
+ case 4: {
4083
+ if (tag !== 34) {
4084
+ break;
4085
+ }
4086
+ message.tokenTransactionHash = reader.bytes();
4087
+ continue;
4088
+ }
4072
4089
  }
4073
4090
  if ((tag & 7) === 4 || tag === 0) {
4074
4091
  break;
@@ -4081,7 +4098,8 @@ var TokenTransactionWithStatus = {
4081
4098
  return {
4082
4099
  tokenTransaction: isSet3(object.tokenTransaction) ? TokenTransaction.fromJSON(object.tokenTransaction) : void 0,
4083
4100
  status: isSet3(object.status) ? tokenTransactionStatusFromJSON(object.status) : 0,
4084
- confirmationMetadata: isSet3(object.confirmationMetadata) ? TokenTransactionConfirmationMetadata.fromJSON(object.confirmationMetadata) : void 0
4101
+ confirmationMetadata: isSet3(object.confirmationMetadata) ? TokenTransactionConfirmationMetadata.fromJSON(object.confirmationMetadata) : void 0,
4102
+ tokenTransactionHash: isSet3(object.tokenTransactionHash) ? bytesFromBase642(object.tokenTransactionHash) : new Uint8Array(0)
4085
4103
  };
4086
4104
  },
4087
4105
  toJSON(message) {
@@ -4095,6 +4113,9 @@ var TokenTransactionWithStatus = {
4095
4113
  if (message.confirmationMetadata !== void 0) {
4096
4114
  obj.confirmationMetadata = TokenTransactionConfirmationMetadata.toJSON(message.confirmationMetadata);
4097
4115
  }
4116
+ if (message.tokenTransactionHash.length !== 0) {
4117
+ obj.tokenTransactionHash = base64FromBytes2(message.tokenTransactionHash);
4118
+ }
4098
4119
  return obj;
4099
4120
  },
4100
4121
  create(base) {
@@ -4105,6 +4126,7 @@ var TokenTransactionWithStatus = {
4105
4126
  message.tokenTransaction = object.tokenTransaction !== void 0 && object.tokenTransaction !== null ? TokenTransaction.fromPartial(object.tokenTransaction) : void 0;
4106
4127
  message.status = object.status ?? 0;
4107
4128
  message.confirmationMetadata = object.confirmationMetadata !== void 0 && object.confirmationMetadata !== null ? TokenTransactionConfirmationMetadata.fromPartial(object.confirmationMetadata) : void 0;
4129
+ message.tokenTransactionHash = object.tokenTransactionHash ?? new Uint8Array(0);
4108
4130
  return message;
4109
4131
  }
4110
4132
  };
@@ -8979,13 +9001,16 @@ var RequestedSigningCommitments_SigningNonceCommitmentsEntry = {
8979
9001
  }
8980
9002
  };
8981
9003
  function createBaseGetSigningCommitmentsRequest() {
8982
- return { nodeIds: [] };
9004
+ return { nodeIds: [], count: 0 };
8983
9005
  }
8984
9006
  var GetSigningCommitmentsRequest = {
8985
9007
  encode(message, writer = new BinaryWriter4()) {
8986
9008
  for (const v of message.nodeIds) {
8987
9009
  writer.uint32(10).string(v);
8988
9010
  }
9011
+ if (message.count !== 0) {
9012
+ writer.uint32(16).uint32(message.count);
9013
+ }
8989
9014
  return writer;
8990
9015
  },
8991
9016
  decode(input, length) {
@@ -9002,6 +9027,13 @@ var GetSigningCommitmentsRequest = {
9002
9027
  message.nodeIds.push(reader.string());
9003
9028
  continue;
9004
9029
  }
9030
+ case 2: {
9031
+ if (tag !== 16) {
9032
+ break;
9033
+ }
9034
+ message.count = reader.uint32();
9035
+ continue;
9036
+ }
9005
9037
  }
9006
9038
  if ((tag & 7) === 4 || tag === 0) {
9007
9039
  break;
@@ -9012,7 +9044,8 @@ var GetSigningCommitmentsRequest = {
9012
9044
  },
9013
9045
  fromJSON(object) {
9014
9046
  return {
9015
- nodeIds: globalThis.Array.isArray(object?.nodeIds) ? object.nodeIds.map((e) => globalThis.String(e)) : []
9047
+ nodeIds: globalThis.Array.isArray(object?.nodeIds) ? object.nodeIds.map((e) => globalThis.String(e)) : [],
9048
+ count: isSet3(object.count) ? globalThis.Number(object.count) : 0
9016
9049
  };
9017
9050
  },
9018
9051
  toJSON(message) {
@@ -9020,6 +9053,9 @@ var GetSigningCommitmentsRequest = {
9020
9053
  if (message.nodeIds?.length) {
9021
9054
  obj.nodeIds = message.nodeIds;
9022
9055
  }
9056
+ if (message.count !== 0) {
9057
+ obj.count = Math.round(message.count);
9058
+ }
9023
9059
  return obj;
9024
9060
  },
9025
9061
  create(base) {
@@ -9028,6 +9064,7 @@ var GetSigningCommitmentsRequest = {
9028
9064
  fromPartial(object) {
9029
9065
  const message = createBaseGetSigningCommitmentsRequest();
9030
9066
  message.nodeIds = object.nodeIds?.map((e) => e) || [];
9067
+ message.count = object.count ?? 0;
9031
9068
  return message;
9032
9069
  }
9033
9070
  };
@@ -12524,7 +12561,7 @@ var QueryUnusedDepositAddressesRequest = {
12524
12561
  }
12525
12562
  };
12526
12563
  function createBaseQueryStaticDepositAddressesRequest() {
12527
- return { identityPublicKey: new Uint8Array(0), network: 0, limit: 0, offset: 0 };
12564
+ return { identityPublicKey: new Uint8Array(0), network: 0, limit: 0, offset: 0, depositAddress: void 0 };
12528
12565
  }
12529
12566
  var QueryStaticDepositAddressesRequest = {
12530
12567
  encode(message, writer = new BinaryWriter4()) {
@@ -12540,6 +12577,9 @@ var QueryStaticDepositAddressesRequest = {
12540
12577
  if (message.offset !== 0) {
12541
12578
  writer.uint32(40).int64(message.offset);
12542
12579
  }
12580
+ if (message.depositAddress !== void 0) {
12581
+ writer.uint32(50).string(message.depositAddress);
12582
+ }
12543
12583
  return writer;
12544
12584
  },
12545
12585
  decode(input, length) {
@@ -12577,6 +12617,13 @@ var QueryStaticDepositAddressesRequest = {
12577
12617
  message.offset = longToNumber2(reader.int64());
12578
12618
  continue;
12579
12619
  }
12620
+ case 6: {
12621
+ if (tag !== 50) {
12622
+ break;
12623
+ }
12624
+ message.depositAddress = reader.string();
12625
+ continue;
12626
+ }
12580
12627
  }
12581
12628
  if ((tag & 7) === 4 || tag === 0) {
12582
12629
  break;
@@ -12590,7 +12637,8 @@ var QueryStaticDepositAddressesRequest = {
12590
12637
  identityPublicKey: isSet3(object.identityPublicKey) ? bytesFromBase642(object.identityPublicKey) : new Uint8Array(0),
12591
12638
  network: isSet3(object.network) ? networkFromJSON(object.network) : 0,
12592
12639
  limit: isSet3(object.limit) ? globalThis.Number(object.limit) : 0,
12593
- offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0
12640
+ offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0,
12641
+ depositAddress: isSet3(object.depositAddress) ? globalThis.String(object.depositAddress) : void 0
12594
12642
  };
12595
12643
  },
12596
12644
  toJSON(message) {
@@ -12607,6 +12655,9 @@ var QueryStaticDepositAddressesRequest = {
12607
12655
  if (message.offset !== 0) {
12608
12656
  obj.offset = Math.round(message.offset);
12609
12657
  }
12658
+ if (message.depositAddress !== void 0) {
12659
+ obj.depositAddress = message.depositAddress;
12660
+ }
12610
12661
  return obj;
12611
12662
  },
12612
12663
  create(base) {
@@ -12618,6 +12669,7 @@ var QueryStaticDepositAddressesRequest = {
12618
12669
  message.network = object.network ?? 0;
12619
12670
  message.limit = object.limit ?? 0;
12620
12671
  message.offset = object.offset ?? 0;
12672
+ message.depositAddress = object.depositAddress ?? void 0;
12621
12673
  return message;
12622
12674
  }
12623
12675
  };
@@ -13235,6 +13287,157 @@ var PaymentIntentFields = {
13235
13287
  return message;
13236
13288
  }
13237
13289
  };
13290
+ function createBaseInitiateStaticDepositUtxoRefundRequest() {
13291
+ return { onChainUtxo: void 0, refundTxSigningJob: void 0, userSignature: new Uint8Array(0) };
13292
+ }
13293
+ var InitiateStaticDepositUtxoRefundRequest = {
13294
+ encode(message, writer = new BinaryWriter4()) {
13295
+ if (message.onChainUtxo !== void 0) {
13296
+ UTXO.encode(message.onChainUtxo, writer.uint32(10).fork()).join();
13297
+ }
13298
+ if (message.refundTxSigningJob !== void 0) {
13299
+ SigningJob.encode(message.refundTxSigningJob, writer.uint32(26).fork()).join();
13300
+ }
13301
+ if (message.userSignature.length !== 0) {
13302
+ writer.uint32(34).bytes(message.userSignature);
13303
+ }
13304
+ return writer;
13305
+ },
13306
+ decode(input, length) {
13307
+ const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
13308
+ const end = length === void 0 ? reader.len : reader.pos + length;
13309
+ const message = createBaseInitiateStaticDepositUtxoRefundRequest();
13310
+ while (reader.pos < end) {
13311
+ const tag = reader.uint32();
13312
+ switch (tag >>> 3) {
13313
+ case 1: {
13314
+ if (tag !== 10) {
13315
+ break;
13316
+ }
13317
+ message.onChainUtxo = UTXO.decode(reader, reader.uint32());
13318
+ continue;
13319
+ }
13320
+ case 3: {
13321
+ if (tag !== 26) {
13322
+ break;
13323
+ }
13324
+ message.refundTxSigningJob = SigningJob.decode(reader, reader.uint32());
13325
+ continue;
13326
+ }
13327
+ case 4: {
13328
+ if (tag !== 34) {
13329
+ break;
13330
+ }
13331
+ message.userSignature = reader.bytes();
13332
+ continue;
13333
+ }
13334
+ }
13335
+ if ((tag & 7) === 4 || tag === 0) {
13336
+ break;
13337
+ }
13338
+ reader.skip(tag & 7);
13339
+ }
13340
+ return message;
13341
+ },
13342
+ fromJSON(object) {
13343
+ return {
13344
+ onChainUtxo: isSet3(object.onChainUtxo) ? UTXO.fromJSON(object.onChainUtxo) : void 0,
13345
+ refundTxSigningJob: isSet3(object.refundTxSigningJob) ? SigningJob.fromJSON(object.refundTxSigningJob) : void 0,
13346
+ userSignature: isSet3(object.userSignature) ? bytesFromBase642(object.userSignature) : new Uint8Array(0)
13347
+ };
13348
+ },
13349
+ toJSON(message) {
13350
+ const obj = {};
13351
+ if (message.onChainUtxo !== void 0) {
13352
+ obj.onChainUtxo = UTXO.toJSON(message.onChainUtxo);
13353
+ }
13354
+ if (message.refundTxSigningJob !== void 0) {
13355
+ obj.refundTxSigningJob = SigningJob.toJSON(message.refundTxSigningJob);
13356
+ }
13357
+ if (message.userSignature.length !== 0) {
13358
+ obj.userSignature = base64FromBytes2(message.userSignature);
13359
+ }
13360
+ return obj;
13361
+ },
13362
+ create(base) {
13363
+ return InitiateStaticDepositUtxoRefundRequest.fromPartial(base ?? {});
13364
+ },
13365
+ fromPartial(object) {
13366
+ const message = createBaseInitiateStaticDepositUtxoRefundRequest();
13367
+ message.onChainUtxo = object.onChainUtxo !== void 0 && object.onChainUtxo !== null ? UTXO.fromPartial(object.onChainUtxo) : void 0;
13368
+ message.refundTxSigningJob = object.refundTxSigningJob !== void 0 && object.refundTxSigningJob !== null ? SigningJob.fromPartial(object.refundTxSigningJob) : void 0;
13369
+ message.userSignature = object.userSignature ?? new Uint8Array(0);
13370
+ return message;
13371
+ }
13372
+ };
13373
+ function createBaseInitiateStaticDepositUtxoRefundResponse() {
13374
+ return { refundTxSigningResult: void 0, depositAddress: void 0 };
13375
+ }
13376
+ var InitiateStaticDepositUtxoRefundResponse = {
13377
+ encode(message, writer = new BinaryWriter4()) {
13378
+ if (message.refundTxSigningResult !== void 0) {
13379
+ SigningResult2.encode(message.refundTxSigningResult, writer.uint32(10).fork()).join();
13380
+ }
13381
+ if (message.depositAddress !== void 0) {
13382
+ DepositAddressQueryResult.encode(message.depositAddress, writer.uint32(18).fork()).join();
13383
+ }
13384
+ return writer;
13385
+ },
13386
+ decode(input, length) {
13387
+ const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
13388
+ const end = length === void 0 ? reader.len : reader.pos + length;
13389
+ const message = createBaseInitiateStaticDepositUtxoRefundResponse();
13390
+ while (reader.pos < end) {
13391
+ const tag = reader.uint32();
13392
+ switch (tag >>> 3) {
13393
+ case 1: {
13394
+ if (tag !== 10) {
13395
+ break;
13396
+ }
13397
+ message.refundTxSigningResult = SigningResult2.decode(reader, reader.uint32());
13398
+ continue;
13399
+ }
13400
+ case 2: {
13401
+ if (tag !== 18) {
13402
+ break;
13403
+ }
13404
+ message.depositAddress = DepositAddressQueryResult.decode(reader, reader.uint32());
13405
+ continue;
13406
+ }
13407
+ }
13408
+ if ((tag & 7) === 4 || tag === 0) {
13409
+ break;
13410
+ }
13411
+ reader.skip(tag & 7);
13412
+ }
13413
+ return message;
13414
+ },
13415
+ fromJSON(object) {
13416
+ return {
13417
+ refundTxSigningResult: isSet3(object.refundTxSigningResult) ? SigningResult2.fromJSON(object.refundTxSigningResult) : void 0,
13418
+ depositAddress: isSet3(object.depositAddress) ? DepositAddressQueryResult.fromJSON(object.depositAddress) : void 0
13419
+ };
13420
+ },
13421
+ toJSON(message) {
13422
+ const obj = {};
13423
+ if (message.refundTxSigningResult !== void 0) {
13424
+ obj.refundTxSigningResult = SigningResult2.toJSON(message.refundTxSigningResult);
13425
+ }
13426
+ if (message.depositAddress !== void 0) {
13427
+ obj.depositAddress = DepositAddressQueryResult.toJSON(message.depositAddress);
13428
+ }
13429
+ return obj;
13430
+ },
13431
+ create(base) {
13432
+ return InitiateStaticDepositUtxoRefundResponse.fromPartial(base ?? {});
13433
+ },
13434
+ fromPartial(object) {
13435
+ const message = createBaseInitiateStaticDepositUtxoRefundResponse();
13436
+ message.refundTxSigningResult = object.refundTxSigningResult !== void 0 && object.refundTxSigningResult !== null ? SigningResult2.fromPartial(object.refundTxSigningResult) : void 0;
13437
+ message.depositAddress = object.depositAddress !== void 0 && object.depositAddress !== null ? DepositAddressQueryResult.fromPartial(object.depositAddress) : void 0;
13438
+ return message;
13439
+ }
13440
+ };
13238
13441
  function createBaseInitiateUtxoSwapRequest() {
13239
13442
  return {
13240
13443
  onChainUtxo: void 0,
@@ -14628,6 +14831,14 @@ var SparkServiceDefinition = {
14628
14831
  responseStream: false,
14629
14832
  options: {}
14630
14833
  },
14834
+ create_tree_v2: {
14835
+ name: "create_tree_v2",
14836
+ requestType: CreateTreeRequest,
14837
+ requestStream: false,
14838
+ responseType: CreateTreeResponse,
14839
+ responseStream: false,
14840
+ options: {}
14841
+ },
14631
14842
  get_signing_operator_list: {
14632
14843
  name: "get_signing_operator_list",
14633
14844
  requestType: Empty,
@@ -14757,7 +14968,28 @@ var SparkServiceDefinition = {
14757
14968
  responseStream: true,
14758
14969
  options: {}
14759
14970
  },
14760
- /** Claim a deposit to a static address from SSP side */
14971
+ /**
14972
+ * Signs the provided refund transaction which spends the UTXO from a static
14973
+ * deposit address. If successful, the UTXO will no longer be available to claim on
14974
+ * the Spark network, and the refund transaction must be broadcasted on L1 to claim
14975
+ * the funds. Returns an error if the UTXO has already been claimed.
14976
+ */
14977
+ initiate_static_deposit_utxo_refund: {
14978
+ name: "initiate_static_deposit_utxo_refund",
14979
+ requestType: InitiateStaticDepositUtxoRefundRequest,
14980
+ requestStream: false,
14981
+ responseType: InitiateStaticDepositUtxoRefundResponse,
14982
+ responseStream: false,
14983
+ options: {}
14984
+ },
14985
+ /**
14986
+ * DEPRECATED: This unified method is being split for better clarity and type safety
14987
+ *
14988
+ * For swap operations: Use spark_ssp_internal.initiate_static_deposit_utxo_swap()
14989
+ * For refund operations: Use initiate_static_deposit_utxo_refund()
14990
+ *
14991
+ * @deprecated
14992
+ */
14761
14993
  initiate_utxo_swap: {
14762
14994
  name: "initiate_utxo_swap",
14763
14995
  requestType: InitiateUtxoSwapRequest,
@@ -14994,6 +15226,8 @@ export {
14994
15226
  QueryBalanceResponse_NodeBalancesEntry,
14995
15227
  SparkAddress,
14996
15228
  PaymentIntentFields,
15229
+ InitiateStaticDepositUtxoRefundRequest,
15230
+ InitiateStaticDepositUtxoRefundResponse,
14997
15231
  InitiateUtxoSwapRequest,
14998
15232
  InitiateUtxoSwapResponse,
14999
15233
  ExitingTree,
@@ -3,7 +3,7 @@ import {
3
3
  Timestamp,
4
4
  networkFromJSON,
5
5
  networkToJSON
6
- } from "./chunk-BGGEVUJK.js";
6
+ } from "./chunk-2ENZX6LT.js";
7
7
 
8
8
  // src/proto/spark_token.ts
9
9
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -2147,7 +2147,12 @@ var TokenTransactionConfirmationMetadata = {
2147
2147
  }
2148
2148
  };
2149
2149
  function createBaseTokenTransactionWithStatus() {
2150
- return { tokenTransaction: void 0, status: 0, confirmationMetadata: void 0 };
2150
+ return {
2151
+ tokenTransaction: void 0,
2152
+ status: 0,
2153
+ confirmationMetadata: void 0,
2154
+ tokenTransactionHash: new Uint8Array(0)
2155
+ };
2151
2156
  }
2152
2157
  var TokenTransactionWithStatus = {
2153
2158
  encode(message, writer = new BinaryWriter()) {
@@ -2160,6 +2165,9 @@ var TokenTransactionWithStatus = {
2160
2165
  if (message.confirmationMetadata !== void 0) {
2161
2166
  TokenTransactionConfirmationMetadata.encode(message.confirmationMetadata, writer.uint32(26).fork()).join();
2162
2167
  }
2168
+ if (message.tokenTransactionHash.length !== 0) {
2169
+ writer.uint32(34).bytes(message.tokenTransactionHash);
2170
+ }
2163
2171
  return writer;
2164
2172
  },
2165
2173
  decode(input, length) {
@@ -2190,6 +2198,13 @@ var TokenTransactionWithStatus = {
2190
2198
  message.confirmationMetadata = TokenTransactionConfirmationMetadata.decode(reader, reader.uint32());
2191
2199
  continue;
2192
2200
  }
2201
+ case 4: {
2202
+ if (tag !== 34) {
2203
+ break;
2204
+ }
2205
+ message.tokenTransactionHash = reader.bytes();
2206
+ continue;
2207
+ }
2193
2208
  }
2194
2209
  if ((tag & 7) === 4 || tag === 0) {
2195
2210
  break;
@@ -2202,7 +2217,8 @@ var TokenTransactionWithStatus = {
2202
2217
  return {
2203
2218
  tokenTransaction: isSet(object.tokenTransaction) ? TokenTransaction.fromJSON(object.tokenTransaction) : void 0,
2204
2219
  status: isSet(object.status) ? tokenTransactionStatusFromJSON(object.status) : 0,
2205
- confirmationMetadata: isSet(object.confirmationMetadata) ? TokenTransactionConfirmationMetadata.fromJSON(object.confirmationMetadata) : void 0
2220
+ confirmationMetadata: isSet(object.confirmationMetadata) ? TokenTransactionConfirmationMetadata.fromJSON(object.confirmationMetadata) : void 0,
2221
+ tokenTransactionHash: isSet(object.tokenTransactionHash) ? bytesFromBase64(object.tokenTransactionHash) : new Uint8Array(0)
2206
2222
  };
2207
2223
  },
2208
2224
  toJSON(message) {
@@ -2216,6 +2232,9 @@ var TokenTransactionWithStatus = {
2216
2232
  if (message.confirmationMetadata !== void 0) {
2217
2233
  obj.confirmationMetadata = TokenTransactionConfirmationMetadata.toJSON(message.confirmationMetadata);
2218
2234
  }
2235
+ if (message.tokenTransactionHash.length !== 0) {
2236
+ obj.tokenTransactionHash = base64FromBytes(message.tokenTransactionHash);
2237
+ }
2219
2238
  return obj;
2220
2239
  },
2221
2240
  create(base) {
@@ -2226,6 +2245,7 @@ var TokenTransactionWithStatus = {
2226
2245
  message.tokenTransaction = object.tokenTransaction !== void 0 && object.tokenTransaction !== null ? TokenTransaction.fromPartial(object.tokenTransaction) : void 0;
2227
2246
  message.status = object.status ?? 0;
2228
2247
  message.confirmationMetadata = object.confirmationMetadata !== void 0 && object.confirmationMetadata !== null ? TokenTransactionConfirmationMetadata.fromPartial(object.confirmationMetadata) : void 0;
2248
+ message.tokenTransactionHash = object.tokenTransactionHash ?? new Uint8Array(0);
2229
2249
  return message;
2230
2250
  }
2231
2251
  };
@@ -1,6 +1,13 @@
1
- import {
2
- BitcoinNetwork_default
3
- } from "./chunk-HMLOC6TE.js";
1
+ // src/graphql/objects/BitcoinNetwork.ts
2
+ var BitcoinNetwork = /* @__PURE__ */ ((BitcoinNetwork2) => {
3
+ BitcoinNetwork2["FUTURE_VALUE"] = "FUTURE_VALUE";
4
+ BitcoinNetwork2["MAINNET"] = "MAINNET";
5
+ BitcoinNetwork2["REGTEST"] = "REGTEST";
6
+ BitcoinNetwork2["SIGNET"] = "SIGNET";
7
+ BitcoinNetwork2["TESTNET"] = "TESTNET";
8
+ return BitcoinNetwork2;
9
+ })(BitcoinNetwork || {});
10
+ var BitcoinNetwork_default = BitcoinNetwork;
4
11
 
5
12
  // src/graphql/objects/ClaimStaticDeposit.ts
6
13
  import { isObject } from "@lightsparkdev/core";
@@ -1459,6 +1466,7 @@ fragment SparkWalletUserFragment on SparkWalletUser {
1459
1466
  var SparkWalletUser_default = SparkWalletUser;
1460
1467
 
1461
1468
  export {
1469
+ BitcoinNetwork_default,
1462
1470
  CurrencyUnit_default,
1463
1471
  CurrencyAmountFromJson,
1464
1472
  ExitSpeed_default,
@@ -2,7 +2,7 @@ import {
2
2
  Network,
3
3
  TransferStatus,
4
4
  TransferType
5
- } from "./chunk-BGGEVUJK.js";
5
+ } from "./chunk-2ENZX6LT.js";
6
6
 
7
7
  // src/types/sdk-types.ts
8
8
  import { bytesToHex } from "@noble/curves/abstract/utils";