@buildonspark/spark-sdk 0.1.38 → 0.1.40

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 (104) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +1 -1
  3. package/android/build/intermediates/library_jni/debug/copyDebugJniLibsProjectOnly/jni/arm64-v8a/libspark_frost.so +0 -0
  4. package/android/build/intermediates/library_jni/debug/copyDebugJniLibsProjectOnly/jni/arm64-v8a/libuniffi_spark_frost.so +0 -0
  5. package/android/build/intermediates/library_jni/debug/copyDebugJniLibsProjectOnly/jni/armeabi-v7a/libspark_frost.so +0 -0
  6. package/android/build/intermediates/library_jni/debug/copyDebugJniLibsProjectOnly/jni/armeabi-v7a/libuniffi_spark_frost.so +0 -0
  7. package/android/build/intermediates/library_jni/debug/copyDebugJniLibsProjectOnly/jni/x86/libspark_frost.so +0 -0
  8. package/android/build/intermediates/library_jni/debug/copyDebugJniLibsProjectOnly/jni/x86/libuniffi_spark_frost.so +0 -0
  9. package/android/build/intermediates/library_jni/debug/copyDebugJniLibsProjectOnly/jni/x86_64/libspark_frost.so +0 -0
  10. package/android/build/intermediates/library_jni/debug/copyDebugJniLibsProjectOnly/jni/x86_64/libuniffi_spark_frost.so +0 -0
  11. package/android/build/intermediates/merged_jni_libs/debug/mergeDebugJniLibFolders/out/arm64-v8a/libspark_frost.so +0 -0
  12. package/android/build/intermediates/merged_jni_libs/debug/mergeDebugJniLibFolders/out/arm64-v8a/libuniffi_spark_frost.so +0 -0
  13. package/android/build/intermediates/merged_jni_libs/debug/mergeDebugJniLibFolders/out/armeabi-v7a/libspark_frost.so +0 -0
  14. package/android/build/intermediates/merged_jni_libs/debug/mergeDebugJniLibFolders/out/armeabi-v7a/libuniffi_spark_frost.so +0 -0
  15. package/android/build/intermediates/merged_jni_libs/debug/mergeDebugJniLibFolders/out/x86/libspark_frost.so +0 -0
  16. package/android/build/intermediates/merged_jni_libs/debug/mergeDebugJniLibFolders/out/x86/libuniffi_spark_frost.so +0 -0
  17. package/android/build/intermediates/merged_jni_libs/debug/mergeDebugJniLibFolders/out/x86_64/libspark_frost.so +0 -0
  18. package/android/build/intermediates/merged_jni_libs/debug/mergeDebugJniLibFolders/out/x86_64/libuniffi_spark_frost.so +0 -0
  19. package/android/build/intermediates/merged_native_libs/debug/mergeDebugNativeLibs/out/lib/arm64-v8a/libspark_frost.so +0 -0
  20. package/android/build/intermediates/merged_native_libs/debug/mergeDebugNativeLibs/out/lib/arm64-v8a/libuniffi_spark_frost.so +0 -0
  21. package/android/build/intermediates/merged_native_libs/debug/mergeDebugNativeLibs/out/lib/armeabi-v7a/libspark_frost.so +0 -0
  22. package/android/build/intermediates/merged_native_libs/debug/mergeDebugNativeLibs/out/lib/armeabi-v7a/libuniffi_spark_frost.so +0 -0
  23. package/android/build/intermediates/merged_native_libs/debug/mergeDebugNativeLibs/out/lib/x86/libspark_frost.so +0 -0
  24. package/android/build/intermediates/merged_native_libs/debug/mergeDebugNativeLibs/out/lib/x86/libuniffi_spark_frost.so +0 -0
  25. package/android/build/intermediates/merged_native_libs/debug/mergeDebugNativeLibs/out/lib/x86_64/libspark_frost.so +0 -0
  26. package/android/build/intermediates/merged_native_libs/debug/mergeDebugNativeLibs/out/lib/x86_64/libuniffi_spark_frost.so +0 -0
  27. package/dist/{RequestLightningSendInput-B4JdzclX.d.ts → RequestLightningSendInput-CJtcHOnu.d.ts} +1 -1
  28. package/dist/{RequestLightningSendInput-39_zGri6.d.cts → RequestLightningSendInput-DfmfqzZo.d.cts} +1 -1
  29. package/dist/address/index.d.cts +1 -1
  30. package/dist/address/index.d.ts +1 -1
  31. package/dist/address/index.js +2 -2
  32. package/dist/{chunk-W3EC5XSA.js → chunk-5MNQB2T4.js} +2 -2
  33. package/dist/chunk-ED3ZAFDI.js +784 -0
  34. package/dist/{chunk-VJTDG4BQ.js → chunk-HK6LPV6Z.js} +10 -1
  35. package/dist/{chunk-7WRK6WNJ.js → chunk-LHT4QTFK.js} +556 -41
  36. package/dist/{chunk-RAPBVYJY.js → chunk-RFCXPGDM.js} +26 -4
  37. package/dist/{chunk-DI7QXUQJ.js → chunk-W2VXS35Y.js} +4 -4
  38. package/dist/graphql/objects/index.d.cts +5 -4
  39. package/dist/graphql/objects/index.d.ts +5 -4
  40. package/dist/{index-CxAi2L8y.d.ts → index-BDEYgYxP.d.ts} +42 -4
  41. package/dist/{index-Dm17Ggfe.d.cts → index-CLdtdMU4.d.cts} +42 -4
  42. package/dist/index.cjs +1069 -40
  43. package/dist/index.d.cts +6 -6
  44. package/dist/index.d.ts +6 -6
  45. package/dist/index.js +33 -17
  46. package/dist/index.node.cjs +1069 -40
  47. package/dist/index.node.d.cts +6 -6
  48. package/dist/index.node.d.ts +6 -6
  49. package/dist/index.node.js +33 -17
  50. package/dist/native/index.cjs +1069 -40
  51. package/dist/native/index.d.cts +108 -5
  52. package/dist/native/index.d.ts +108 -5
  53. package/dist/native/index.js +1065 -40
  54. package/dist/{network-GFGEHkS4.d.cts → network-B10hBoHp.d.cts} +8 -1
  55. package/dist/{network-DobHpaV6.d.ts → network-CCgyIsGl.d.ts} +8 -1
  56. package/dist/services/config.cjs +29 -12
  57. package/dist/services/config.d.cts +4 -4
  58. package/dist/services/config.d.ts +4 -4
  59. package/dist/services/config.js +5 -5
  60. package/dist/services/connection.d.cts +4 -4
  61. package/dist/services/connection.d.ts +4 -4
  62. package/dist/services/connection.js +2 -2
  63. package/dist/services/index.cjs +30 -13
  64. package/dist/services/index.d.cts +4 -4
  65. package/dist/services/index.d.ts +4 -4
  66. package/dist/services/index.js +8 -8
  67. package/dist/services/lrc-connection.d.cts +4 -4
  68. package/dist/services/lrc-connection.d.ts +4 -4
  69. package/dist/services/lrc-connection.js +1 -1
  70. package/dist/services/token-transactions.cjs +1 -1
  71. package/dist/services/token-transactions.d.cts +4 -4
  72. package/dist/services/token-transactions.d.ts +4 -4
  73. package/dist/services/token-transactions.js +3 -3
  74. package/dist/services/wallet-config.d.cts +4 -4
  75. package/dist/services/wallet-config.d.ts +4 -4
  76. package/dist/signer/signer.cjs +23 -6
  77. package/dist/signer/signer.d.cts +3 -2
  78. package/dist/signer/signer.d.ts +3 -2
  79. package/dist/signer/signer.js +1 -1
  80. package/dist/{signer-DFGw9RRp.d.ts → signer-C5h1DpjF.d.ts} +4 -1
  81. package/dist/{signer-C1t40Wus.d.cts → signer-CYwn7h9U.d.cts} +4 -1
  82. package/dist/types/index.d.cts +4 -3
  83. package/dist/types/index.d.ts +4 -3
  84. package/dist/utils/index.cjs +891 -2
  85. package/dist/utils/index.d.cts +62 -6
  86. package/dist/utils/index.d.ts +62 -6
  87. package/dist/utils/index.js +23 -7
  88. package/package.json +1 -1
  89. package/src/services/deposit.ts +23 -5
  90. package/src/services/token-transactions.ts +1 -1
  91. package/src/services/transfer.ts +218 -11
  92. package/src/services/tree-creation.ts +29 -14
  93. package/src/signer/signer.ts +47 -5
  94. package/src/spark-wallet/spark-wallet.ts +430 -4
  95. package/src/tests/integration/swap.test.ts +225 -0
  96. package/src/tests/integration/tree-creation.test.ts +5 -1
  97. package/src/utils/index.ts +1 -0
  98. package/src/utils/mempool.ts +26 -1
  99. package/src/utils/network.ts +15 -0
  100. package/src/utils/transaction.ts +22 -2
  101. package/src/utils/unilateral-exit.ts +729 -0
  102. package/dist/chunk-E5SL7XTO.js +0 -301
  103. package/dist/{chunk-LIP2K6KR.js → chunk-2CDJZQN4.js} +3 -3
  104. package/dist/{chunk-RGWBSZIO.js → chunk-I4JI6TYN.js} +4 -4
@@ -22,6 +22,7 @@ import {
22
22
  import {
23
23
  bytesToHex,
24
24
  bytesToNumberBE,
25
+ equalBytes,
25
26
  hexToBytes
26
27
  } from "@noble/curves/abstract/utils";
27
28
  import { schnorr, secp256k1 } from "@noble/curves/secp256k1";
@@ -29,11 +30,13 @@ import { HDKey } from "@scure/bip32";
29
30
  import { generateMnemonic, mnemonicToSeed } from "@scure/bip39";
30
31
  import { wordlist } from "@scure/bip39/wordlists/english";
31
32
  import * as ecies from "eciesjs";
32
- import { PARITY } from "@buildonspark/lrc20-sdk";
33
- import { Receipt } from "@buildonspark/lrc20-sdk";
34
- import { privateNegate, privateAdd } from "@bitcoinerlab/secp256k1";
33
+ import { privateAdd, privateNegate } from "@bitcoinerlab/secp256k1";
34
+ import {
35
+ fromPrivateKey,
36
+ PARITY,
37
+ Receipt
38
+ } from "@buildonspark/lrc20-sdk";
35
39
  import { sha256 } from "@noble/hashes/sha2";
36
- import { fromPrivateKey } from "@buildonspark/lrc20-sdk";
37
40
  var sparkFrostModule = void 0;
38
41
  var getSparkFrostModule = async () => {
39
42
  if (isReactNative) {
@@ -519,6 +522,25 @@ var DefaultSparkSigner = class {
519
522
  const receiptProof = privateAdd(privateKey, pxhPubkey);
520
523
  return Buffer.from(receiptProof);
521
524
  }
525
+ signTransactionIndex(tx, index, publicKey) {
526
+ let privateKey;
527
+ if (equalBytes(publicKey, this.identityKey?.publicKey ?? new Uint8Array())) {
528
+ privateKey = this.identityKey?.privateKey;
529
+ } else if (equalBytes(publicKey, this.depositKey?.publicKey ?? new Uint8Array())) {
530
+ privateKey = this.depositKey?.privateKey;
531
+ } else {
532
+ privateKey = hexToBytes(
533
+ this.publicKeyToPrivateKeyMap.get(bytesToHex(publicKey)) ?? ""
534
+ );
535
+ }
536
+ if (!privateKey) {
537
+ throw new ValidationError("Private key not found for public key", {
538
+ field: "privateKey",
539
+ value: bytesToHex(publicKey)
540
+ });
541
+ }
542
+ tx.signIdx(privateKey, index);
543
+ }
522
544
  };
523
545
 
524
546
  export {
@@ -1,15 +1,15 @@
1
+ import {
2
+ DefaultSparkSigner
3
+ } from "./chunk-RFCXPGDM.js";
1
4
  import {
2
5
  Network,
3
6
  NetworkToProto
4
- } from "./chunk-VJTDG4BQ.js";
7
+ } from "./chunk-HK6LPV6Z.js";
5
8
  import {
6
9
  LOCAL_WALLET_CONFIG,
7
10
  MAINNET_WALLET_CONFIG,
8
11
  REGTEST_WALLET_CONFIG
9
12
  } from "./chunk-ZUVYYR5T.js";
10
- import {
11
- DefaultSparkSigner
12
- } from "./chunk-RAPBVYJY.js";
13
13
  import {
14
14
  ConfigurationError
15
15
  } from "./chunk-TWF35O6M.js";
@@ -1,15 +1,16 @@
1
1
  import { B as BitcoinNetwork } from '../../BitcoinNetwork-TnABML0T.cjs';
2
2
  import { Query } from '@lightsparkdev/core';
3
- import { h as CurrencyAmount, P as PageInfo, D as SspClient } from '../../RequestLightningSendInput-39_zGri6.cjs';
4
- export { C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as CoopExitRequest, i as CurrencyUnit, E as ExitSpeed, G as GetChallengeOutput, I as Invoice, L as Leaf, j as LeavesSwapFeeEstimateOutput, l as LeavesSwapRequest, n as LightningReceiveRequest, o as LightningReceiveRequestStatus, p as LightningSendFeeEstimateOutput, r as LightningSendRequest, s as LightningSendRequestStatus, R as RequestCoopExitInput, t as RequestLeavesSwapInput, u as RequestLightningReceiveInput, v as RequestLightningSendInput, S as SparkCoopExitRequestStatus, w as SparkLeavesSwapRequestStatus, x as SparkTransferToLeavesConnection, y as StaticDepositQuoteInput, z as StaticDepositQuoteOutput, A as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitRequestQuery, k as getLeavesSwapRequestQuery, m as getLightningReceiveRequestQuery, q as getLightningSendRequestQuery } from '../../RequestLightningSendInput-39_zGri6.cjs';
3
+ import { h as CurrencyAmount, P as PageInfo, D as SspClient } from '../../RequestLightningSendInput-DfmfqzZo.cjs';
4
+ export { C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as CoopExitRequest, i as CurrencyUnit, E as ExitSpeed, G as GetChallengeOutput, I as Invoice, L as Leaf, j as LeavesSwapFeeEstimateOutput, l as LeavesSwapRequest, n as LightningReceiveRequest, o as LightningReceiveRequestStatus, p as LightningSendFeeEstimateOutput, r as LightningSendRequest, s as LightningSendRequestStatus, R as RequestCoopExitInput, t as RequestLeavesSwapInput, u as RequestLightningReceiveInput, v as RequestLightningSendInput, S as SparkCoopExitRequestStatus, w as SparkLeavesSwapRequestStatus, x as SparkTransferToLeavesConnection, y as StaticDepositQuoteInput, z as StaticDepositQuoteOutput, A as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitRequestQuery, k as getLeavesSwapRequestQuery, m as getLightningReceiveRequestQuery, q as getLightningSendRequestQuery } from '../../RequestLightningSendInput-DfmfqzZo.cjs';
5
5
  export { L as LightningSendFeeEstimateInput } from '../../LightningSendFeeEstimateInput-CJvPnCSB.cjs';
6
- import '../../signer-C1t40Wus.cjs';
6
+ import '../../signer-CYwn7h9U.cjs';
7
7
  import '@scure/bip32';
8
8
  import '../../spark-DXYE9gMM.cjs';
9
9
  import '@bufbuild/protobuf/wire';
10
10
  import 'nice-grpc-common';
11
- import 'bitcoinjs-lib';
12
11
  import '@buildonspark/lrc20-sdk';
12
+ import '@scure/btc-signer';
13
+ import 'bitcoinjs-lib';
13
14
 
14
15
  declare enum ClaimStaticDepositStatus {
15
16
  /**
@@ -1,15 +1,16 @@
1
1
  import { B as BitcoinNetwork } from '../../BitcoinNetwork-TnABML0T.js';
2
2
  import { Query } from '@lightsparkdev/core';
3
- import { h as CurrencyAmount, P as PageInfo, D as SspClient } from '../../RequestLightningSendInput-B4JdzclX.js';
4
- export { C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as CoopExitRequest, i as CurrencyUnit, E as ExitSpeed, G as GetChallengeOutput, I as Invoice, L as Leaf, j as LeavesSwapFeeEstimateOutput, l as LeavesSwapRequest, n as LightningReceiveRequest, o as LightningReceiveRequestStatus, p as LightningSendFeeEstimateOutput, r as LightningSendRequest, s as LightningSendRequestStatus, R as RequestCoopExitInput, t as RequestLeavesSwapInput, u as RequestLightningReceiveInput, v as RequestLightningSendInput, S as SparkCoopExitRequestStatus, w as SparkLeavesSwapRequestStatus, x as SparkTransferToLeavesConnection, y as StaticDepositQuoteInput, z as StaticDepositQuoteOutput, A as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitRequestQuery, k as getLeavesSwapRequestQuery, m as getLightningReceiveRequestQuery, q as getLightningSendRequestQuery } from '../../RequestLightningSendInput-B4JdzclX.js';
3
+ import { h as CurrencyAmount, P as PageInfo, D as SspClient } from '../../RequestLightningSendInput-CJtcHOnu.js';
4
+ export { C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as CoopExitRequest, i as CurrencyUnit, E as ExitSpeed, G as GetChallengeOutput, I as Invoice, L as Leaf, j as LeavesSwapFeeEstimateOutput, l as LeavesSwapRequest, n as LightningReceiveRequest, o as LightningReceiveRequestStatus, p as LightningSendFeeEstimateOutput, r as LightningSendRequest, s as LightningSendRequestStatus, R as RequestCoopExitInput, t as RequestLeavesSwapInput, u as RequestLightningReceiveInput, v as RequestLightningSendInput, S as SparkCoopExitRequestStatus, w as SparkLeavesSwapRequestStatus, x as SparkTransferToLeavesConnection, y as StaticDepositQuoteInput, z as StaticDepositQuoteOutput, A as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitRequestQuery, k as getLeavesSwapRequestQuery, m as getLightningReceiveRequestQuery, q as getLightningSendRequestQuery } from '../../RequestLightningSendInput-CJtcHOnu.js';
5
5
  export { L as LightningSendFeeEstimateInput } from '../../LightningSendFeeEstimateInput-CJvPnCSB.js';
6
- import '../../signer-DFGw9RRp.js';
6
+ import '../../signer-C5h1DpjF.js';
7
7
  import '@scure/bip32';
8
8
  import '../../spark-DXYE9gMM.js';
9
9
  import '@bufbuild/protobuf/wire';
10
10
  import 'nice-grpc-common';
11
- import 'bitcoinjs-lib';
12
11
  import '@buildonspark/lrc20-sdk';
12
+ import '@scure/btc-signer';
13
+ import 'bitcoinjs-lib';
13
14
 
14
15
  declare enum ClaimStaticDepositStatus {
15
16
  /**
@@ -1,5 +1,5 @@
1
- import { j as LeavesSwapFeeEstimateOutput, z as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, n as LightningReceiveRequest, r as LightningSendRequest, E as ExitSpeed, f as CoopExitRequest, e as CoopExitFeeEstimatesOutput } from './RequestLightningSendInput-B4JdzclX.js';
2
- import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-DFGw9RRp.js';
1
+ import { j as LeavesSwapFeeEstimateOutput, z as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, n as LightningReceiveRequest, r as LightningSendRequest, E as ExitSpeed, f as CoopExitRequest, e as CoopExitFeeEstimatesOutput } from './RequestLightningSendInput-CJtcHOnu.js';
2
+ import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-C5h1DpjF.js';
3
3
  import { L as LightningSendFeeEstimateInput } from './LightningSendFeeEstimateInput-CJvPnCSB.js';
4
4
  import { h as RequestedSigningCommitments, U as UserSignedTxSigningJob, d as TreeNode, f as Transfer, L as LeafRefundTxSigningResult, i as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, j as OutputWithPreviousTransactionData, k as TokenTransactionWithStatus } from './spark-DXYE9gMM.js';
5
5
  import { WalletConfigService } from './services/config.js';
@@ -12,7 +12,7 @@ import { EventEmitter } from 'eventemitter3';
12
12
  import { SparkAddressFormat } from './address/index.js';
13
13
  import { a as WalletTransfer, W as WalletLeaf } from './sdk-types-BeI6DM_M.js';
14
14
  import './utils/index.js';
15
- import './network-DobHpaV6.js';
15
+ import './network-CCgyIsGl.js';
16
16
 
17
17
  declare class SparkSDKError extends Error {
18
18
  readonly context: Record<string, unknown>;
@@ -171,6 +171,7 @@ declare class BaseTransferService {
171
171
  protected readonly signingService: SigningService;
172
172
  constructor(config: WalletConfigService, connectionManager: ConnectionManager, signingService: SigningService);
173
173
  sendTransferTweakKey(transfer: Transfer, leaves: LeafKeyTweak[], refundSignatureMap: Map<string, Uint8Array>): Promise<Transfer>;
174
+ deliverTransferPackage(transfer: Transfer, leaves: LeafKeyTweak[], refundSignatureMap: Map<string, Uint8Array>): Promise<Transfer>;
174
175
  sendTransferWithKeyTweaks(leaves: LeafKeyTweak[], receiverIdentityPubkey: Uint8Array): Promise<Transfer>;
175
176
  private prepareTransferPackage;
176
177
  private finalizeTransfer;
@@ -224,6 +225,7 @@ declare class TransferService extends BaseTransferService {
224
225
  queryPendingTransfersBySender(operatorAddress: string): Promise<QueryTransfersResponse>;
225
226
  refreshTimelockNodes(nodes: TreeNode[], parentNode: TreeNode, signingPubKey: Uint8Array): Promise<FinalizeNodeSignaturesResponse>;
226
227
  extendTimelock(node: TreeNode, signingPubKey: Uint8Array): Promise<FinalizeNodeSignaturesResponse>;
228
+ refreshTimelockRefundTx(node: TreeNode, signingPubKey: Uint8Array): Promise<FinalizeNodeSignaturesResponse>;
227
229
  }
228
230
 
229
231
  type CreateLightningInvoiceParams = {
@@ -317,7 +319,7 @@ declare class SparkWallet extends EventEmitter {
317
319
  private getSspClient;
318
320
  private handleStreamEvent;
319
321
  protected setupBackgroundStream(): Promise<void>;
320
- private getLeaves;
322
+ getLeaves(isBalanceCheck?: boolean): Promise<TreeNode[]>;
321
323
  private selectLeaves;
322
324
  private selectLeavesForSwap;
323
325
  private areLeavesInefficient;
@@ -715,6 +717,18 @@ declare class SparkWallet extends EventEmitter {
715
717
  * @returns {Promise<boolean>} Whether the message is valid
716
718
  */
717
719
  validateMessageWithIdentityKey(message: string, signature: string | Uint8Array): Promise<boolean>;
720
+ /**
721
+ * Signs a transaction with wallet keys.
722
+ *
723
+ * @param {string} txHex - The transaction hex to sign
724
+ * @param {string} keyType - The type of key to use for signing ("identity", "deposit", or "auto-detect")
725
+ * @returns {Promise<string>} The signed transaction hex
726
+ */
727
+ signTransaction(txHex: string, keyType?: string): Promise<string>;
728
+ /**
729
+ * Helper method to auto-detect which key should be used for signing a transaction.
730
+ */
731
+ private detectKeyForTransaction;
718
732
  /**
719
733
  * Get a Lightning receive request by ID.
720
734
  *
@@ -736,6 +750,30 @@ declare class SparkWallet extends EventEmitter {
736
750
  * @returns {Promise<CoopExitRequest | null>} The coop exit request
737
751
  */
738
752
  getCoopExitRequest(id: string): Promise<CoopExitRequest | null>;
753
+ /**
754
+ * Check the remaining timelock on a given node.
755
+ *
756
+ * @param {string} nodeId - The ID of the node to check
757
+ * @returns {Promise<{nodeTimelock: number, refundTimelock: number}>} The remaining timelocks in blocks for both node and refund transactions
758
+ */
759
+ checkTimelock(nodeId: string): Promise<{
760
+ nodeTimelock: number;
761
+ refundTimelock: number;
762
+ }>;
763
+ /**
764
+ * Refresh the timelock of a specific node.
765
+ *
766
+ * @param {string} nodeId - The ID of the node to refresh
767
+ * @returns {Promise<void>} Promise that resolves when the timelock is refreshed
768
+ */
769
+ testOnly_expireTimelock(nodeId: string): Promise<void>;
770
+ /**
771
+ * Refresh the timelock of a specific node's refund transaction only.
772
+ *
773
+ * @param {string} nodeId - The ID of the node whose refund transaction to refresh
774
+ * @returns {Promise<void>} Promise that resolves when the refund timelock is refreshed
775
+ */
776
+ testOnly_expireTimelockRefundTx(nodeId: string): Promise<void>;
739
777
  private cleanup;
740
778
  cleanupConnections(): Promise<void>;
741
779
  private startPeriodicClaimTransfers;
@@ -1,5 +1,5 @@
1
- import { j as LeavesSwapFeeEstimateOutput, z as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, n as LightningReceiveRequest, r as LightningSendRequest, E as ExitSpeed, f as CoopExitRequest, e as CoopExitFeeEstimatesOutput } from './RequestLightningSendInput-39_zGri6.cjs';
2
- import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-C1t40Wus.cjs';
1
+ import { j as LeavesSwapFeeEstimateOutput, z as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, n as LightningReceiveRequest, r as LightningSendRequest, E as ExitSpeed, f as CoopExitRequest, e as CoopExitFeeEstimatesOutput } from './RequestLightningSendInput-DfmfqzZo.cjs';
2
+ import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-CYwn7h9U.cjs';
3
3
  import { L as LightningSendFeeEstimateInput } from './LightningSendFeeEstimateInput-CJvPnCSB.cjs';
4
4
  import { h as RequestedSigningCommitments, U as UserSignedTxSigningJob, d as TreeNode, f as Transfer, L as LeafRefundTxSigningResult, i as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, j as OutputWithPreviousTransactionData, k as TokenTransactionWithStatus } from './spark-DXYE9gMM.cjs';
5
5
  import { WalletConfigService } from './services/config.cjs';
@@ -12,7 +12,7 @@ import { EventEmitter } from 'eventemitter3';
12
12
  import { SparkAddressFormat } from './address/index.cjs';
13
13
  import { a as WalletTransfer, W as WalletLeaf } from './sdk-types-BuVMn2rX.cjs';
14
14
  import './utils/index.cjs';
15
- import './network-GFGEHkS4.cjs';
15
+ import './network-B10hBoHp.cjs';
16
16
 
17
17
  declare class SparkSDKError extends Error {
18
18
  readonly context: Record<string, unknown>;
@@ -171,6 +171,7 @@ declare class BaseTransferService {
171
171
  protected readonly signingService: SigningService;
172
172
  constructor(config: WalletConfigService, connectionManager: ConnectionManager, signingService: SigningService);
173
173
  sendTransferTweakKey(transfer: Transfer, leaves: LeafKeyTweak[], refundSignatureMap: Map<string, Uint8Array>): Promise<Transfer>;
174
+ deliverTransferPackage(transfer: Transfer, leaves: LeafKeyTweak[], refundSignatureMap: Map<string, Uint8Array>): Promise<Transfer>;
174
175
  sendTransferWithKeyTweaks(leaves: LeafKeyTweak[], receiverIdentityPubkey: Uint8Array): Promise<Transfer>;
175
176
  private prepareTransferPackage;
176
177
  private finalizeTransfer;
@@ -224,6 +225,7 @@ declare class TransferService extends BaseTransferService {
224
225
  queryPendingTransfersBySender(operatorAddress: string): Promise<QueryTransfersResponse>;
225
226
  refreshTimelockNodes(nodes: TreeNode[], parentNode: TreeNode, signingPubKey: Uint8Array): Promise<FinalizeNodeSignaturesResponse>;
226
227
  extendTimelock(node: TreeNode, signingPubKey: Uint8Array): Promise<FinalizeNodeSignaturesResponse>;
228
+ refreshTimelockRefundTx(node: TreeNode, signingPubKey: Uint8Array): Promise<FinalizeNodeSignaturesResponse>;
227
229
  }
228
230
 
229
231
  type CreateLightningInvoiceParams = {
@@ -317,7 +319,7 @@ declare class SparkWallet extends EventEmitter {
317
319
  private getSspClient;
318
320
  private handleStreamEvent;
319
321
  protected setupBackgroundStream(): Promise<void>;
320
- private getLeaves;
322
+ getLeaves(isBalanceCheck?: boolean): Promise<TreeNode[]>;
321
323
  private selectLeaves;
322
324
  private selectLeavesForSwap;
323
325
  private areLeavesInefficient;
@@ -715,6 +717,18 @@ declare class SparkWallet extends EventEmitter {
715
717
  * @returns {Promise<boolean>} Whether the message is valid
716
718
  */
717
719
  validateMessageWithIdentityKey(message: string, signature: string | Uint8Array): Promise<boolean>;
720
+ /**
721
+ * Signs a transaction with wallet keys.
722
+ *
723
+ * @param {string} txHex - The transaction hex to sign
724
+ * @param {string} keyType - The type of key to use for signing ("identity", "deposit", or "auto-detect")
725
+ * @returns {Promise<string>} The signed transaction hex
726
+ */
727
+ signTransaction(txHex: string, keyType?: string): Promise<string>;
728
+ /**
729
+ * Helper method to auto-detect which key should be used for signing a transaction.
730
+ */
731
+ private detectKeyForTransaction;
718
732
  /**
719
733
  * Get a Lightning receive request by ID.
720
734
  *
@@ -736,6 +750,30 @@ declare class SparkWallet extends EventEmitter {
736
750
  * @returns {Promise<CoopExitRequest | null>} The coop exit request
737
751
  */
738
752
  getCoopExitRequest(id: string): Promise<CoopExitRequest | null>;
753
+ /**
754
+ * Check the remaining timelock on a given node.
755
+ *
756
+ * @param {string} nodeId - The ID of the node to check
757
+ * @returns {Promise<{nodeTimelock: number, refundTimelock: number}>} The remaining timelocks in blocks for both node and refund transactions
758
+ */
759
+ checkTimelock(nodeId: string): Promise<{
760
+ nodeTimelock: number;
761
+ refundTimelock: number;
762
+ }>;
763
+ /**
764
+ * Refresh the timelock of a specific node.
765
+ *
766
+ * @param {string} nodeId - The ID of the node to refresh
767
+ * @returns {Promise<void>} Promise that resolves when the timelock is refreshed
768
+ */
769
+ testOnly_expireTimelock(nodeId: string): Promise<void>;
770
+ /**
771
+ * Refresh the timelock of a specific node's refund transaction only.
772
+ *
773
+ * @param {string} nodeId - The ID of the node whose refund transaction to refresh
774
+ * @returns {Promise<void>} Promise that resolves when the refund timelock is refreshed
775
+ */
776
+ testOnly_expireTimelockRefundTx(nodeId: string): Promise<void>;
739
777
  private cleanup;
740
778
  cleanupConnections(): Promise<void>;
741
779
  private startPeriodicClaimTransfers;