@buildonspark/spark-sdk 0.1.43 → 0.1.45

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 (153) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{RequestLightningSendInput-D7fZdT4A.d.ts → RequestLightningSendInput-DEPd_fPO.d.ts} +43 -4
  3. package/dist/{RequestLightningSendInput-Na1mHdWg.d.cts → RequestLightningSendInput-Du0z7Om7.d.cts} +43 -4
  4. package/dist/address/index.cjs +2 -2
  5. package/dist/address/index.d.cts +2 -2
  6. package/dist/address/index.d.ts +2 -2
  7. package/dist/address/index.js +2 -2
  8. package/dist/{chunk-IRW5TWMH.js → chunk-5FUB65LX.js} +7 -9
  9. package/dist/{chunk-BUTZWYBW.js → chunk-6264CGDM.js} +4 -4
  10. package/dist/{chunk-VFJQNBFX.js → chunk-7V6N75CC.js} +5 -2
  11. package/dist/{chunk-M6A4KFIG.js → chunk-BGGEVUJK.js} +1505 -445
  12. package/dist/{chunk-DQYKQJRZ.js → chunk-C2S227QR.js} +675 -52
  13. package/dist/{chunk-GYQR4B4P.js → chunk-GZ5IPPJ2.js} +2 -2
  14. package/dist/{chunk-6AFUC5M2.js → chunk-HWJWKEIU.js} +8 -2
  15. package/dist/{chunk-TOSP3INR.js → chunk-I54FARY2.js} +4 -2
  16. package/dist/{chunk-WWOTVNPP.js → chunk-J2IE4Z7Y.js} +544 -431
  17. package/dist/{chunk-O4RYNJNB.js → chunk-KMUMFYFX.js} +3 -3
  18. package/dist/chunk-LHRD2WT6.js +2374 -0
  19. package/dist/{chunk-ABZA6R5S.js → chunk-NTFKFRQ2.js} +1 -1
  20. package/dist/{chunk-MIVX3GHD.js → chunk-OBFKIEMP.js} +1 -1
  21. package/dist/{chunk-HRQRRDSS.js → chunk-PQN3C2MF.js} +15 -15
  22. package/dist/{chunk-DOA6QXYQ.js → chunk-R5PXJZQS.js} +3 -1
  23. package/dist/{chunk-TIUBYNN5.js → chunk-YUPMXTCJ.js} +4 -4
  24. package/dist/graphql/objects/index.d.cts +6 -43
  25. package/dist/graphql/objects/index.d.ts +6 -43
  26. package/dist/graphql/objects/index.js +1 -1
  27. package/dist/index-B2AwKW5J.d.cts +214 -0
  28. package/dist/index-CJDi1HWc.d.ts +214 -0
  29. package/dist/index.cjs +4150 -1026
  30. package/dist/index.d.cts +764 -19
  31. package/dist/index.d.ts +764 -19
  32. package/dist/index.js +17 -21
  33. package/dist/index.node.cjs +4153 -1033
  34. package/dist/index.node.d.cts +10 -8
  35. package/dist/index.node.d.ts +10 -8
  36. package/dist/index.node.js +20 -28
  37. package/dist/native/index.cjs +4166 -1042
  38. package/dist/native/index.d.cts +369 -108
  39. package/dist/native/index.d.ts +369 -108
  40. package/dist/native/index.js +4138 -1015
  41. package/dist/{network-xkBSpaTn.d.ts → network-BTJl-Sul.d.ts} +1 -1
  42. package/dist/{network-D5lKssVl.d.cts → network-CqgsdUF2.d.cts} +1 -1
  43. package/dist/proto/lrc20.cjs +222 -19
  44. package/dist/proto/lrc20.d.cts +1 -1
  45. package/dist/proto/lrc20.d.ts +1 -1
  46. package/dist/proto/lrc20.js +2 -2
  47. package/dist/proto/spark.cjs +1502 -442
  48. package/dist/proto/spark.d.cts +1 -1
  49. package/dist/proto/spark.d.ts +1 -1
  50. package/dist/proto/spark.js +5 -5
  51. package/dist/proto/spark_token.cjs +1515 -56
  52. package/dist/proto/spark_token.d.cts +153 -15
  53. package/dist/proto/spark_token.d.ts +153 -15
  54. package/dist/proto/spark_token.js +40 -4
  55. package/dist/{sdk-types-B-q9py_P.d.cts → sdk-types-B0SwjolI.d.cts} +1 -1
  56. package/dist/{sdk-types-BPoPgzda.d.ts → sdk-types-Cc4l4kb1.d.ts} +1 -1
  57. package/dist/services/config.cjs +7 -3
  58. package/dist/services/config.d.cts +5 -4
  59. package/dist/services/config.d.ts +5 -4
  60. package/dist/services/config.js +6 -6
  61. package/dist/services/connection.cjs +2938 -646
  62. package/dist/services/connection.d.cts +5 -4
  63. package/dist/services/connection.d.ts +5 -4
  64. package/dist/services/connection.js +4 -4
  65. package/dist/services/index.cjs +6381 -3461
  66. package/dist/services/index.d.cts +7 -6
  67. package/dist/services/index.d.ts +7 -6
  68. package/dist/services/index.js +15 -13
  69. package/dist/services/lrc-connection.cjs +227 -21
  70. package/dist/services/lrc-connection.d.cts +5 -4
  71. package/dist/services/lrc-connection.d.ts +5 -4
  72. package/dist/services/lrc-connection.js +4 -4
  73. package/dist/services/token-transactions.cjs +868 -244
  74. package/dist/services/token-transactions.d.cts +25 -7
  75. package/dist/services/token-transactions.d.ts +25 -7
  76. package/dist/services/token-transactions.js +5 -4
  77. package/dist/services/wallet-config.cjs +4 -1
  78. package/dist/services/wallet-config.d.cts +7 -5
  79. package/dist/services/wallet-config.d.ts +7 -5
  80. package/dist/services/wallet-config.js +3 -1
  81. package/dist/signer/signer.cjs +5 -2
  82. package/dist/signer/signer.d.cts +3 -2
  83. package/dist/signer/signer.d.ts +3 -2
  84. package/dist/signer/signer.js +2 -2
  85. package/dist/{signer-wqesWifN.d.ts → signer-BocS_J6B.d.ts} +2 -6
  86. package/dist/{signer-IO3oMRNj.d.cts → signer-DKS0AJkw.d.cts} +2 -6
  87. package/dist/{spark-CDm4gqS6.d.cts → spark-dM7EYXYQ.d.cts} +138 -42
  88. package/dist/{spark-CDm4gqS6.d.ts → spark-dM7EYXYQ.d.ts} +138 -42
  89. package/dist/spark_bindings/native/index.cjs +183 -0
  90. package/dist/spark_bindings/native/index.d.cts +14 -0
  91. package/dist/spark_bindings/native/index.d.ts +14 -0
  92. package/dist/spark_bindings/native/index.js +141 -0
  93. package/dist/spark_bindings/wasm/index.cjs +1093 -0
  94. package/dist/spark_bindings/wasm/index.d.cts +47 -0
  95. package/dist/spark_bindings/wasm/index.d.ts +47 -0
  96. package/dist/{chunk-K4C4W5FC.js → spark_bindings/wasm/index.js} +7 -6
  97. package/dist/types/index.cjs +1503 -443
  98. package/dist/types/index.d.cts +6 -5
  99. package/dist/types/index.d.ts +6 -5
  100. package/dist/types/index.js +3 -3
  101. package/dist/types-C-Rp0Oo7.d.cts +46 -0
  102. package/dist/types-C-Rp0Oo7.d.ts +46 -0
  103. package/dist/utils/index.cjs +358 -36
  104. package/dist/utils/index.d.cts +14 -134
  105. package/dist/utils/index.d.ts +14 -134
  106. package/dist/utils/index.js +8 -8
  107. package/package.json +21 -1
  108. package/src/constants.ts +5 -1
  109. package/src/graphql/client.ts +28 -0
  110. package/src/graphql/mutations/RequestCoopExit.ts +6 -0
  111. package/src/graphql/mutations/RequestSwapLeaves.ts +2 -0
  112. package/src/graphql/queries/GetCoopExitFeeQuote.ts +20 -0
  113. package/src/index.node.ts +0 -1
  114. package/src/index.ts +0 -1
  115. package/src/native/index.ts +1 -2
  116. package/src/proto/common.ts +5 -5
  117. package/src/proto/google/protobuf/descriptor.ts +34 -34
  118. package/src/proto/google/protobuf/duration.ts +2 -2
  119. package/src/proto/google/protobuf/empty.ts +2 -2
  120. package/src/proto/google/protobuf/timestamp.ts +2 -2
  121. package/src/proto/mock.ts +4 -4
  122. package/src/proto/spark.ts +1924 -525
  123. package/src/proto/spark_authn.ts +7 -7
  124. package/src/proto/spark_token.ts +1668 -105
  125. package/src/proto/validate/validate.ts +24 -24
  126. package/src/services/bolt11-spark.ts +62 -187
  127. package/src/services/coop-exit.ts +3 -0
  128. package/src/services/lrc20.ts +1 -1
  129. package/src/services/token-transactions.ts +209 -9
  130. package/src/services/transfer.ts +22 -3
  131. package/src/services/tree-creation.ts +13 -0
  132. package/src/services/wallet-config.ts +2 -1
  133. package/src/spark-wallet/spark-wallet.node.ts +3 -7
  134. package/src/spark-wallet/spark-wallet.ts +376 -232
  135. package/src/spark-wallet/types.ts +39 -3
  136. package/src/tests/bolt11-spark.test.ts +7 -15
  137. package/src/tests/integration/deposit.test.ts +16 -0
  138. package/src/tests/integration/ssp/coop-exit.test.ts +85 -21
  139. package/src/tests/integration/ssp/swap.test.ts +47 -0
  140. package/src/tests/integration/swap.test.ts +453 -433
  141. package/src/tests/integration/transfer.test.ts +261 -248
  142. package/src/tests/token-identifier.test.ts +54 -0
  143. package/src/tests/tokens.test.ts +218 -22
  144. package/src/utils/token-hashing.ts +346 -52
  145. package/src/utils/token-identifier.ts +88 -0
  146. package/src/utils/token-transaction-validation.ts +350 -5
  147. package/src/utils/token-transactions.ts +12 -8
  148. package/src/utils/transaction.ts +2 -8
  149. package/dist/chunk-VA7MV4MZ.js +0 -1073
  150. package/dist/index-7RYRH5wc.d.ts +0 -815
  151. package/dist/index-BJOc8Ur-.d.cts +0 -815
  152. package/dist/wasm-7OWFHDMS.js +0 -21
  153. package/src/logger.ts +0 -3
@@ -9,6 +9,8 @@ import {
9
9
  SignTokenTransactionResponse,
10
10
  OperatorSpecificOwnerSignature,
11
11
  RevocationSecretWithIndex,
12
+ TokenTransactionWithStatus as TokenTransactionWithStatusV0,
13
+ QueryTokenTransactionsRequest as QueryTokenTransactionsRequestV0,
12
14
  } from "../proto/spark.js";
13
15
  import { secp256k1 } from "@noble/curves/secp256k1";
14
16
  import { SparkCallOptions } from "../types/grpc.js";
@@ -21,7 +23,10 @@ import {
21
23
  calculateAvailableTokenAmount,
22
24
  checkIfSelectedOutputsAreAvailable,
23
25
  } from "../utils/token-transactions.js";
24
- import { validateTokenTransaction } from "../utils/token-transaction-validation.js";
26
+ import {
27
+ validateTokenTransactionV0,
28
+ validateTokenTransaction,
29
+ } from "../utils/token-transaction-validation.js";
25
30
  import { WalletConfigService } from "./config.js";
26
31
  import { ConnectionManager } from "./connection.js";
27
32
  import {
@@ -36,6 +41,8 @@ import {
36
41
  TokenTransaction,
37
42
  SignatureWithIndex,
38
43
  InputTtxoSignaturesPerOperator,
44
+ QueryTokenTransactionsRequest as QueryTokenTransactionsRequestV1,
45
+ TokenTransactionWithStatus as TokenTransactionWithStatusV1,
39
46
  } from "../proto/spark_token.js";
40
47
  import { TokenTransaction as TokenTransactionV0 } from "../proto/spark.js";
41
48
  import { collectResponses } from "../utils/response-validation.js";
@@ -46,6 +53,20 @@ import {
46
53
 
47
54
  const MAX_TOKEN_OUTPUTS = 500;
48
55
 
56
+ export interface FetchOwnedTokenOutputsParams {
57
+ ownerPublicKeys: Uint8Array[];
58
+ issuerPublicKeys?: Uint8Array[];
59
+ tokenIdentifiers?: Uint8Array[];
60
+ }
61
+
62
+ export interface QueryTokenTransactionsParams {
63
+ ownerPublicKeys?: string[];
64
+ issuerPublicKeys?: string[];
65
+ tokenTransactionHashes?: string[];
66
+ tokenIdentifiers?: string[];
67
+ outputIds?: string[];
68
+ }
69
+
49
70
  export class TokenTransactionService {
50
71
  protected readonly config: WalletConfigService;
51
72
  protected readonly connectionManager: ConnectionManager;
@@ -176,6 +197,13 @@ export class TokenTransactionService {
176
197
  tokenAmount: bigint;
177
198
  }>,
178
199
  ): Promise<TokenTransactionV0> {
200
+ // Ensure outputsToSpend are ordered by vout ascending so that the input indices
201
+ // used for owner signatures match the order expected by the SO, which sorts
202
+ // inputs by "prevTokenTransactionVout" before validating signatures.
203
+ selectedOutputs.sort(
204
+ (a, b) => a.previousTransactionVout - b.previousTransactionVout,
205
+ );
206
+
179
207
  const availableTokenAmount = calculateAvailableTokenAmount(selectedOutputs);
180
208
  const totalRequestedAmount = tokenOutputData.reduce(
181
209
  (sum, output) => sum + output.tokenAmount,
@@ -223,6 +251,10 @@ export class TokenTransactionService {
223
251
  tokenAmount: bigint;
224
252
  }>,
225
253
  ): Promise<TokenTransaction> {
254
+ selectedOutputs.sort(
255
+ (a, b) => a.previousTransactionVout - b.previousTransactionVout,
256
+ );
257
+
226
258
  const availableTokenAmount = calculateAvailableTokenAmount(selectedOutputs);
227
259
  const totalRequestedAmount = tokenOutputData.reduce(
228
260
  (sum, output) => sum + output.tokenAmount,
@@ -261,6 +293,7 @@ export class TokenTransactionService {
261
293
  tokenOutputs,
262
294
  sparkOperatorIdentityPublicKeys: this.collectOperatorIdentityPublicKeys(),
263
295
  expiryTime: undefined,
296
+ clientCreatedTimestamp: new Date(),
264
297
  };
265
298
  }
266
299
 
@@ -537,7 +570,7 @@ export class TokenTransactionService {
537
570
  throw new Error("Keyshare info missing in start response");
538
571
  }
539
572
 
540
- validateTokenTransaction(
573
+ validateTokenTransactionV0(
541
574
  startResponse.finalTokenTransaction,
542
575
  tokenTransaction,
543
576
  signingOperators,
@@ -826,6 +859,7 @@ export class TokenTransactionService {
826
859
  await coordinatorClient.commit_transaction(
827
860
  {
828
861
  finalTokenTransaction,
862
+ finalTokenTransactionHash,
829
863
  inputTtxoSignaturesPerOperator,
830
864
  ownerIdentityPublicKey:
831
865
  await this.config.signer.getIdentityPublicKey(),
@@ -855,9 +889,34 @@ export class TokenTransactionService {
855
889
  }
856
890
 
857
891
  public async fetchOwnedTokenOutputs(
858
- ownerPublicKeys: Uint8Array[],
859
- tokenPublicKeys: Uint8Array[],
892
+ params: FetchOwnedTokenOutputsParams,
893
+ ): Promise<OutputWithPreviousTransactionData[]> {
894
+ if (this.config.getTokenTransactionVersion() === "V0") {
895
+ return this.fetchOwnedTokenOutputsV0(params);
896
+ } else {
897
+ return this.fetchOwnedTokenOutputsV1(params);
898
+ }
899
+ }
900
+
901
+ public async queryTokenTransactions(
902
+ params: QueryTokenTransactionsParams,
903
+ ): Promise<TokenTransactionWithStatusV0[] | TokenTransactionWithStatusV1[]> {
904
+ if (this.config.getTokenTransactionVersion() === "V0") {
905
+ return this.queryTokenTransactionsV0(params);
906
+ } else {
907
+ return this.queryTokenTransactionsV1(params);
908
+ }
909
+ }
910
+
911
+ private async fetchOwnedTokenOutputsV0(
912
+ params: FetchOwnedTokenOutputsParams,
860
913
  ): Promise<OutputWithPreviousTransactionData[]> {
914
+ const {
915
+ ownerPublicKeys,
916
+ issuerPublicKeys: tokenPublicKeys = [],
917
+ tokenIdentifiers = [],
918
+ } = params;
919
+
861
920
  const sparkClient = await this.connectionManager.createSparkClient(
862
921
  this.config.getCoordinatorAddress(),
863
922
  );
@@ -866,6 +925,7 @@ export class TokenTransactionService {
866
925
  const result = await sparkClient.query_token_outputs({
867
926
  ownerPublicKeys,
868
927
  tokenPublicKeys,
928
+ tokenIdentifiers,
869
929
  network: this.config.getNetworkProto(),
870
930
  });
871
931
 
@@ -874,7 +934,148 @@ export class TokenTransactionService {
874
934
  throw new NetworkError(
875
935
  "Failed to fetch owned token outputs",
876
936
  {
877
- operation: "query_token_outputs",
937
+ operation: "spark.query_token_outputs",
938
+ errorCount: 1,
939
+ errors: error instanceof Error ? error.message : String(error),
940
+ },
941
+ error as Error,
942
+ );
943
+ }
944
+ }
945
+
946
+ private async fetchOwnedTokenOutputsV1(
947
+ params: FetchOwnedTokenOutputsParams,
948
+ ): Promise<OutputWithPreviousTransactionData[]> {
949
+ const {
950
+ ownerPublicKeys,
951
+ issuerPublicKeys = [],
952
+ tokenIdentifiers = [],
953
+ } = params;
954
+
955
+ const tokenClient = await this.connectionManager.createSparkTokenClient(
956
+ this.config.getCoordinatorAddress(),
957
+ );
958
+
959
+ try {
960
+ const result = await tokenClient.query_token_outputs({
961
+ ownerPublicKeys,
962
+ issuerPublicKeys,
963
+ tokenIdentifiers,
964
+ network: this.config.getNetworkProto(),
965
+ });
966
+
967
+ return result.outputsWithPreviousTransactionData;
968
+ } catch (error) {
969
+ throw new NetworkError(
970
+ "Failed to fetch owned token outputs",
971
+ {
972
+ operation: "spark_token.query_token_outputs",
973
+ errorCount: 1,
974
+ errors: error instanceof Error ? error.message : String(error),
975
+ },
976
+ error as Error,
977
+ );
978
+ }
979
+ }
980
+
981
+ private async queryTokenTransactionsV0(
982
+ params: QueryTokenTransactionsParams,
983
+ ): Promise<TokenTransactionWithStatusV1[]> {
984
+ const {
985
+ ownerPublicKeys,
986
+ issuerPublicKeys,
987
+ tokenTransactionHashes,
988
+ tokenIdentifiers,
989
+ outputIds,
990
+ } = params;
991
+
992
+ const sparkClient = await this.connectionManager.createSparkClient(
993
+ this.config.getCoordinatorAddress(),
994
+ );
995
+
996
+ let queryParams: QueryTokenTransactionsRequestV0 = {
997
+ tokenPublicKeys: issuerPublicKeys?.map(hexToBytes)!,
998
+ ownerPublicKeys: ownerPublicKeys?.map(hexToBytes)!,
999
+ tokenIdentifiers: tokenIdentifiers?.map(hexToBytes)!,
1000
+ tokenTransactionHashes: tokenTransactionHashes?.map(hexToBytes)!,
1001
+ outputIds: outputIds || [],
1002
+ limit: 100,
1003
+ offset: 0,
1004
+ };
1005
+
1006
+ try {
1007
+ const response = await sparkClient.query_token_transactions(queryParams);
1008
+ return response.tokenTransactionsWithStatus.map((tx) => {
1009
+ // Convert V0 structure to V1 structure
1010
+ const v1TokenTransaction: TokenTransaction = {
1011
+ version: 1,
1012
+ network: tx.tokenTransaction!.network,
1013
+ tokenInputs: tx.tokenTransaction!.tokenInputs,
1014
+ tokenOutputs: tx.tokenTransaction!.tokenOutputs!,
1015
+ sparkOperatorIdentityPublicKeys:
1016
+ tx.tokenTransaction!.sparkOperatorIdentityPublicKeys!,
1017
+ expiryTime: undefined, // V0 doesn't have expiry time
1018
+ clientCreatedTimestamp:
1019
+ tx.tokenTransaction?.tokenInputs?.$case === "mintInput"
1020
+ ? new Date(
1021
+ tx.tokenTransaction.tokenInputs.mintInput
1022
+ .issuerProvidedTimestamp * 1000,
1023
+ )
1024
+ : new Date(),
1025
+ };
1026
+
1027
+ return {
1028
+ tokenTransaction: v1TokenTransaction,
1029
+ status: tx.status,
1030
+ confirmationMetadata: tx.confirmationMetadata,
1031
+ };
1032
+ });
1033
+ } catch (error) {
1034
+ throw new NetworkError(
1035
+ "Failed to query token transactions",
1036
+ {
1037
+ operation: "spark.query_token_transactions",
1038
+ errorCount: 1,
1039
+ errors: error instanceof Error ? error.message : String(error),
1040
+ },
1041
+ error as Error,
1042
+ );
1043
+ }
1044
+ }
1045
+
1046
+ private async queryTokenTransactionsV1(
1047
+ params: QueryTokenTransactionsParams,
1048
+ ): Promise<TokenTransactionWithStatusV1[]> {
1049
+ const {
1050
+ ownerPublicKeys,
1051
+ issuerPublicKeys,
1052
+ tokenTransactionHashes,
1053
+ tokenIdentifiers,
1054
+ outputIds,
1055
+ } = params;
1056
+
1057
+ const tokenClient = await this.connectionManager.createSparkTokenClient(
1058
+ this.config.getCoordinatorAddress(),
1059
+ );
1060
+
1061
+ let queryParams: QueryTokenTransactionsRequestV1 = {
1062
+ issuerPublicKeys: issuerPublicKeys?.map(hexToBytes)!,
1063
+ ownerPublicKeys: ownerPublicKeys?.map(hexToBytes)!,
1064
+ tokenIdentifiers: tokenIdentifiers?.map(hexToBytes)!,
1065
+ tokenTransactionHashes: tokenTransactionHashes?.map(hexToBytes)!,
1066
+ outputIds: outputIds || [],
1067
+ limit: 100,
1068
+ offset: 0,
1069
+ };
1070
+
1071
+ try {
1072
+ const response = await tokenClient.query_token_transactions(queryParams);
1073
+ return response.tokenTransactionsWithStatus;
1074
+ } catch (error) {
1075
+ throw new NetworkError(
1076
+ "Failed to query token transactions",
1077
+ {
1078
+ operation: "spark_token.query_token_transactions",
878
1079
  errorCount: 1,
879
1080
  errors: error instanceof Error ? error.message : String(error),
880
1081
  },
@@ -886,10 +1087,9 @@ export class TokenTransactionService {
886
1087
  public async syncTokenOutputs(
887
1088
  tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>,
888
1089
  ) {
889
- const unsortedTokenOutputs = await this.fetchOwnedTokenOutputs(
890
- await this.config.signer.getTrackedPublicKeys(),
891
- [],
892
- );
1090
+ const unsortedTokenOutputs = await this.fetchOwnedTokenOutputs({
1091
+ ownerPublicKeys: await this.config.signer.getTrackedPublicKeys(),
1092
+ });
893
1093
 
894
1094
  unsortedTokenOutputs.forEach((output) => {
895
1095
  const tokenKey = bytesToHex(output.output!.tokenPublicKey!);
@@ -49,7 +49,6 @@ import {
49
49
  getEphemeralAnchorOutput,
50
50
  getNextTransactionSequence,
51
51
  getTransactionSequence,
52
- maybeApplyFee,
53
52
  } from "../utils/transaction.js";
54
53
  import { getTransferPackageSigningPayload } from "../utils/transfer_package.js";
55
54
  import { WalletConfigService } from "./config.js";
@@ -296,6 +295,9 @@ export class BaseTransferService {
296
295
  leavesToSend: leafSigningJobs,
297
296
  keyTweakPackage: encryptedKeyTweaks,
298
297
  userSignature: new Uint8Array(),
298
+ // TODO: Add direct refund signature
299
+ directLeavesToSend: [],
300
+ directFromCpfpLeavesToSend: [],
299
301
  };
300
302
 
301
303
  const transferPackageSigningPayload = getTransferPackageSigningPayload(
@@ -427,9 +429,12 @@ export class BaseTransferService {
427
429
  nodeId: operatorSigningResult.leafId,
428
430
  refundTxSignature: refundAggregate,
429
431
  nodeTxSignature: new Uint8Array(),
432
+ // TODO: Add direct refund signature
433
+ directNodeTxSignature: new Uint8Array(),
434
+ directRefundTxSignature: new Uint8Array(),
435
+ directFromCpfpRefundTxSignature: new Uint8Array(),
430
436
  });
431
437
  }
432
-
433
438
  return nodeSignatures;
434
439
  }
435
440
 
@@ -534,6 +539,9 @@ export class BaseTransferService {
534
539
  secretCipher,
535
540
  signature,
536
541
  refundSignature: refundSignature ?? new Uint8Array(),
542
+ // TODO: Add direct refund signature
543
+ directRefundSignature: new Uint8Array(),
544
+ directFromCpfpRefundSignature: new Uint8Array(),
537
545
  });
538
546
  }
539
547
 
@@ -607,7 +615,6 @@ export class TransferService extends BaseTransferService {
607
615
  leaves,
608
616
  proofMap,
609
617
  );
610
-
611
618
  return await this.finalizeNodeSignatures(signatures);
612
619
  }
613
620
 
@@ -933,6 +940,10 @@ export class TransferService extends BaseTransferService {
933
940
  rawTx: refundTx.toBytes(),
934
941
  signingNonceCommitment: refundNonceCommitmentProto,
935
942
  },
943
+ // TODO: Add direct refund signature
944
+ directRefundTxSigningJob: undefined,
945
+ // TODO: Add direct refund signature
946
+ directFromCpfpRefundTxSigningJob: undefined,
936
947
  });
937
948
  }
938
949
 
@@ -1400,6 +1411,10 @@ export class TransferService extends BaseTransferService {
1400
1411
  nodeId: nodeId,
1401
1412
  nodeTxSignature: signature,
1402
1413
  refundTxSignature: new Uint8Array(),
1414
+ // TODO: Add direct refund signature
1415
+ directNodeTxSignature: new Uint8Array(),
1416
+ directRefundTxSignature: new Uint8Array(),
1417
+ directFromCpfpRefundTxSignature: new Uint8Array(),
1403
1418
  });
1404
1419
  } else if (i === nodes.length) {
1405
1420
  refundSignature = signature;
@@ -1417,6 +1432,10 @@ export class TransferService extends BaseTransferService {
1417
1432
  nodeId: leafNodeId,
1418
1433
  nodeTxSignature: leafSignature,
1419
1434
  refundTxSignature: refundSignature,
1435
+ // TODO: Add direct refund signature
1436
+ directNodeTxSignature: new Uint8Array(),
1437
+ directRefundTxSignature: new Uint8Array(),
1438
+ directFromCpfpRefundTxSignature: new Uint8Array(),
1420
1439
  });
1421
1440
 
1422
1441
  const result = await sparkClient.finalize_node_signatures({
@@ -315,6 +315,9 @@ export class TreeCreationService {
315
315
  nodeTxSigningJob: undefined,
316
316
  refundTxSigningJob: undefined,
317
317
  children: [],
318
+ directNodeTxSigningJob: undefined,
319
+ directRefundTxSigningJob: undefined,
320
+ directFromCpfpRefundTxSigningJob: undefined,
318
321
  };
319
322
 
320
323
  const tx = new Transaction({ version: 3 });
@@ -353,6 +356,9 @@ export class TreeCreationService {
353
356
  nodeTxSigningJob: undefined,
354
357
  refundTxSigningJob: undefined,
355
358
  children: [],
359
+ directNodeTxSigningJob: undefined,
360
+ directRefundTxSigningJob: undefined,
361
+ directFromCpfpRefundTxSigningJob: undefined,
356
362
  };
357
363
 
358
364
  const childTx = new Transaction({ version: 3 });
@@ -464,6 +470,9 @@ export class TreeCreationService {
464
470
  nodeTxSigningJob: rootNodeSigningJob,
465
471
  refundTxSigningJob: undefined,
466
472
  children: [],
473
+ directNodeTxSigningJob: undefined,
474
+ directRefundTxSigningJob: undefined,
475
+ directFromCpfpRefundTxSigningJob: undefined,
467
476
  };
468
477
  rootCreationNode.nodeTxSigningCommitment = rootNodeSigningCommitment;
469
478
 
@@ -584,6 +593,10 @@ export class TreeCreationService {
584
593
  nodeId: creationResponseNode.nodeId,
585
594
  nodeTxSignature: nodeTxSignature,
586
595
  refundTxSignature: refundTxSignature,
596
+ // TODO: Add direct refund signature
597
+ directNodeTxSignature: new Uint8Array(),
598
+ directRefundTxSignature: new Uint8Array(),
599
+ directFromCpfpRefundTxSignature: new Uint8Array(),
587
600
  },
588
601
  };
589
602
  }
@@ -166,7 +166,7 @@ function getLocalFrostSignerAddress(): string {
166
166
  return isHermeticTest() ? "localhost:9999" : "unix:///tmp/frost_0.sock";
167
167
  }
168
168
 
169
- const BASE_CONFIG: Required<ConfigOptions> = {
169
+ export const BASE_CONFIG: Required<ConfigOptions> = {
170
170
  network: "LOCAL",
171
171
  lrc20Address: getLrc20Url("LOCAL"),
172
172
  coodinatorIdentifier:
@@ -194,6 +194,7 @@ const BASE_CONFIG: Required<ConfigOptions> = {
194
194
 
195
195
  export const LOCAL_WALLET_CONFIG: Required<ConfigOptions> = {
196
196
  ...BASE_CONFIG,
197
+ threshold: 3,
197
198
  };
198
199
 
199
200
  export const LOCAL_WALLET_CONFIG_SCHNORR: Required<ConfigOptions> = {
@@ -66,10 +66,6 @@ export class SparkWallet extends BaseSparkWallet {
66
66
  "SparkWallet.getTransfers",
67
67
  this.getTransfers.bind(this),
68
68
  );
69
- this.getTokenInfo = this.wrapWithOtelSpan(
70
- "SparkWallet.getTokenInfo",
71
- this.getTokenInfo.bind(this),
72
- );
73
69
  this.getBalance = this.wrapWithOtelSpan(
74
70
  "SparkWallet.getBalance",
75
71
  this.getBalance.bind(this),
@@ -110,9 +106,9 @@ export class SparkWallet extends BaseSparkWallet {
110
106
  "SparkWallet.withdraw",
111
107
  this.withdraw.bind(this),
112
108
  );
113
- this.getWithdrawalFeeEstimate = this.wrapWithOtelSpan(
114
- "SparkWallet.getWithdrawalFeeEstimate",
115
- this.getWithdrawalFeeEstimate.bind(this),
109
+ this.getWithdrawalFeeQuote = this.wrapWithOtelSpan(
110
+ "SparkWallet.getWithdrawalFeeQuote",
111
+ this.getWithdrawalFeeQuote.bind(this),
116
112
  );
117
113
  }
118
114