@buildonspark/spark-sdk 0.1.43 → 0.1.44

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 (112) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/{RequestLightningSendInput-Na1mHdWg.d.cts → RequestLightningSendInput-BxbCtwpV.d.cts} +43 -4
  3. package/dist/{RequestLightningSendInput-D7fZdT4A.d.ts → RequestLightningSendInput-RGel43ks.d.ts} +43 -4
  4. package/dist/address/index.d.cts +2 -2
  5. package/dist/address/index.d.ts +2 -2
  6. package/dist/address/index.js +2 -2
  7. package/dist/{chunk-M6A4KFIG.js → chunk-4Q2ZDYYU.js} +332 -221
  8. package/dist/{chunk-WWOTVNPP.js → chunk-A2ZLMH6I.js} +323 -142
  9. package/dist/{chunk-VA7MV4MZ.js → chunk-B3AMIGJG.js} +1 -1
  10. package/dist/{chunk-DQYKQJRZ.js → chunk-CIZNCBKE.js} +29 -9
  11. package/dist/{chunk-BUTZWYBW.js → chunk-DAXGVPVM.js} +2 -2
  12. package/dist/{chunk-DOA6QXYQ.js → chunk-EKFD62HN.js} +2 -1
  13. package/dist/{chunk-TIUBYNN5.js → chunk-HTMXTJRK.js} +1 -1
  14. package/dist/{chunk-TOSP3INR.js → chunk-I54FARY2.js} +4 -2
  15. package/dist/{chunk-MIVX3GHD.js → chunk-K4BJARWM.js} +1 -1
  16. package/dist/{chunk-O4RYNJNB.js → chunk-KEKGSH7B.js} +1 -1
  17. package/dist/{chunk-GYQR4B4P.js → chunk-NBCNYDWJ.js} +2 -2
  18. package/dist/{chunk-ABZA6R5S.js → chunk-SQKXGAIR.js} +1 -1
  19. package/dist/{chunk-VFJQNBFX.js → chunk-UBT6EDVJ.js} +5 -2
  20. package/dist/{chunk-HRQRRDSS.js → chunk-WPTRVD2V.js} +3 -3
  21. package/dist/{chunk-IRW5TWMH.js → chunk-XX4RRWOX.js} +5 -5
  22. package/dist/graphql/objects/index.d.cts +5 -43
  23. package/dist/graphql/objects/index.d.ts +5 -43
  24. package/dist/graphql/objects/index.js +1 -1
  25. package/dist/{index-BJOc8Ur-.d.cts → index-CZmDdSts.d.cts} +24 -10
  26. package/dist/{index-7RYRH5wc.d.ts → index-ClIRO_3y.d.ts} +24 -10
  27. package/dist/index.cjs +827 -414
  28. package/dist/index.d.cts +6 -6
  29. package/dist/index.d.ts +6 -6
  30. package/dist/index.js +15 -15
  31. package/dist/index.node.cjs +830 -417
  32. package/dist/index.node.d.cts +7 -7
  33. package/dist/index.node.d.ts +7 -7
  34. package/dist/index.node.js +18 -18
  35. package/dist/native/index.cjs +827 -414
  36. package/dist/native/index.d.cts +88 -23
  37. package/dist/native/index.d.ts +88 -23
  38. package/dist/native/index.js +819 -407
  39. package/dist/{network-D5lKssVl.d.cts → network-CfxLnaot.d.cts} +1 -1
  40. package/dist/{network-xkBSpaTn.d.ts → network-CroCOQ0B.d.ts} +1 -1
  41. package/dist/proto/lrc20.d.cts +1 -1
  42. package/dist/proto/lrc20.d.ts +1 -1
  43. package/dist/proto/lrc20.js +2 -2
  44. package/dist/proto/spark.cjs +332 -221
  45. package/dist/proto/spark.d.cts +1 -1
  46. package/dist/proto/spark.d.ts +1 -1
  47. package/dist/proto/spark.js +3 -5
  48. package/dist/proto/spark_token.cjs +149 -9
  49. package/dist/proto/spark_token.d.cts +1 -1
  50. package/dist/proto/spark_token.d.ts +1 -1
  51. package/dist/proto/spark_token.js +2 -2
  52. package/dist/{sdk-types-B-q9py_P.d.cts → sdk-types-BeCBoozO.d.cts} +1 -1
  53. package/dist/{sdk-types-BPoPgzda.d.ts → sdk-types-CTbTdDbE.d.ts} +1 -1
  54. package/dist/services/config.cjs +7 -3
  55. package/dist/services/config.d.cts +4 -4
  56. package/dist/services/config.d.ts +4 -4
  57. package/dist/services/config.js +5 -5
  58. package/dist/services/connection.cjs +334 -218
  59. package/dist/services/connection.d.cts +4 -4
  60. package/dist/services/connection.d.ts +4 -4
  61. package/dist/services/connection.js +4 -4
  62. package/dist/services/index.cjs +364 -227
  63. package/dist/services/index.d.cts +4 -4
  64. package/dist/services/index.d.ts +4 -4
  65. package/dist/services/index.js +9 -9
  66. package/dist/services/lrc-connection.cjs +5 -2
  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 +4 -4
  70. package/dist/services/token-transactions.cjs +28 -8
  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.cjs +2 -1
  75. package/dist/services/wallet-config.d.cts +4 -4
  76. package/dist/services/wallet-config.d.ts +4 -4
  77. package/dist/services/wallet-config.js +1 -1
  78. package/dist/signer/signer.cjs +5 -2
  79. package/dist/signer/signer.d.cts +2 -2
  80. package/dist/signer/signer.d.ts +2 -2
  81. package/dist/signer/signer.js +2 -2
  82. package/dist/{signer-wqesWifN.d.ts → signer-D7vfYik9.d.ts} +1 -1
  83. package/dist/{signer-IO3oMRNj.d.cts → signer-DaY8c60s.d.cts} +1 -1
  84. package/dist/{spark-CDm4gqS6.d.ts → spark-C4ZrsgjC.d.cts} +47 -29
  85. package/dist/{spark-CDm4gqS6.d.cts → spark-C4ZrsgjC.d.ts} +47 -29
  86. package/dist/types/index.cjs +331 -219
  87. package/dist/types/index.d.cts +5 -5
  88. package/dist/types/index.d.ts +5 -5
  89. package/dist/types/index.js +3 -3
  90. package/dist/utils/index.cjs +298 -28
  91. package/dist/utils/index.d.cts +5 -5
  92. package/dist/utils/index.d.ts +5 -5
  93. package/dist/utils/index.js +6 -6
  94. package/package.json +1 -1
  95. package/src/constants.ts +5 -1
  96. package/src/graphql/client.ts +28 -0
  97. package/src/graphql/mutations/RequestCoopExit.ts +6 -0
  98. package/src/graphql/mutations/RequestSwapLeaves.ts +2 -0
  99. package/src/graphql/queries/GetCoopExitFeeQuote.ts +20 -0
  100. package/src/proto/spark.ts +454 -322
  101. package/src/services/token-transactions.ts +12 -0
  102. package/src/services/transfer.ts +0 -3
  103. package/src/services/wallet-config.ts +1 -0
  104. package/src/spark-wallet/spark-wallet.node.ts +3 -3
  105. package/src/spark-wallet/spark-wallet.ts +301 -125
  106. package/src/tests/integration/deposit.test.ts +16 -0
  107. package/src/tests/integration/ssp/coop-exit.test.ts +85 -21
  108. package/src/tests/integration/ssp/swap.test.ts +47 -0
  109. package/src/tests/tokens.test.ts +3 -2
  110. package/src/utils/token-hashing.ts +28 -10
  111. package/src/utils/transaction.ts +2 -2
  112. package/src/logger.ts +0 -3
@@ -230,7 +230,7 @@ declare enum TransferStatus {
230
230
  TRANSFER_STATUS_SENDER_KEY_TWEAK_PENDING = 1,
231
231
  TRANSFER_STATUS_SENDER_KEY_TWEAKED = 2,
232
232
  TRANSFER_STATUS_RECEIVER_KEY_TWEAKED = 3,
233
- TRANSFER_STATUSR_RECEIVER_REFUND_SIGNED = 4,
233
+ TRANSFER_STATUS_RECEIVER_REFUND_SIGNED = 4,
234
234
  TRANSFER_STATUS_COMPLETED = 5,
235
235
  TRANSFER_STATUS_EXPIRED = 6,
236
236
  TRANSFER_STATUS_RETURNED = 7,
@@ -394,6 +394,12 @@ interface SigningKeyshare {
394
394
  threshold: number;
395
395
  /** The public key of the keyshare. */
396
396
  publicKey: Uint8Array;
397
+ /** The public shares of the keyshare. */
398
+ publicShares: {
399
+ [key: string]: Uint8Array;
400
+ };
401
+ /** The latest update time of the keyshare. */
402
+ updatedTime: Date | undefined;
397
403
  }
398
404
  declare const SigningKeyshare: MessageFns$3<SigningKeyshare>;
399
405
  /**
@@ -587,6 +593,7 @@ interface StartTokenTransactionRequest {
587
593
  partialTokenTransaction: TokenTransaction$1 | undefined;
588
594
  /** List of ecdsa signatures authorizing movement of tokens from the token input. */
589
595
  tokenTransactionSignatures: TokenTransactionSignatures | undefined;
596
+ sparkPaymentIntent: string;
590
597
  }
591
598
  declare const StartTokenTransactionRequest: MessageFns$3<StartTokenTransactionRequest>;
592
599
  interface StartTokenTransactionResponse {
@@ -647,6 +654,7 @@ interface FinalizeTokenTransactionRequest {
647
654
  */
648
655
  revocationSecrets: RevocationSecretWithIndex[];
649
656
  identityPublicKey: Uint8Array;
657
+ sparkPaymentIntent: string;
650
658
  }
651
659
  declare const FinalizeTokenTransactionRequest: MessageFns$3<FinalizeTokenTransactionRequest>;
652
660
  interface FreezeTokensPayload$1 {
@@ -733,6 +741,12 @@ interface TreeNode {
733
741
  status: string;
734
742
  /** The network of the node. */
735
743
  network: Network$1;
744
+ /** The creation time of the node. */
745
+ createdTime: Date | undefined;
746
+ /** The latest update time of the node. */
747
+ updatedTime: Date | undefined;
748
+ /** The signing public key of the owner of the node. */
749
+ ownerSigningPublicKey: Uint8Array;
736
750
  }
737
751
  declare const TreeNode: MessageFns$3<TreeNode>;
738
752
  /** FinalizeNodeSignaturesRequest is the request to finalize the signatures for a node. */
@@ -800,6 +814,7 @@ interface StartTransferRequest {
800
814
  expiryTime: Date | undefined;
801
815
  /** If this field is set, the leaves_to_send and key_tweak_proofs will be ignored. */
802
816
  transferPackage: TransferPackage | undefined;
817
+ sparkPaymentIntent: string;
803
818
  }
804
819
  declare const StartTransferRequest: MessageFns$3<StartTransferRequest>;
805
820
  interface StartTransferResponse {
@@ -839,6 +854,7 @@ interface FinalizeTransferRequest {
839
854
  transferId: string;
840
855
  ownerIdentityPublicKey: Uint8Array;
841
856
  leavesToSend: SendLeafKeyTweak[];
857
+ sparkPaymentIntent: string;
842
858
  }
843
859
  declare const FinalizeTransferRequest: MessageFns$3<FinalizeTransferRequest>;
844
860
  interface FinalizeTransferWithTransferPackageRequest {
@@ -890,6 +906,7 @@ interface TransferFilter {
890
906
  types: TransferType[];
891
907
  /** defaults to mainnet when no network is provided. */
892
908
  network: Network$1;
909
+ statuses: TransferStatus[];
893
910
  }
894
911
  declare const TransferFilter: MessageFns$3<TransferFilter>;
895
912
  interface QueryTransfersResponse {
@@ -921,20 +938,6 @@ interface ClaimTransferSignRefundsResponse {
921
938
  signingResults: LeafRefundTxSigningResult[];
922
939
  }
923
940
  declare const ClaimTransferSignRefundsResponse: MessageFns$3<ClaimTransferSignRefundsResponse>;
924
- interface AggregateNodesRequest {
925
- nodeIds: string[];
926
- signingJob: SigningJob | undefined;
927
- /** Serves as a temporary identity public key, this should be get from auth process. */
928
- ownerIdentityPublicKey: Uint8Array;
929
- }
930
- declare const AggregateNodesRequest: MessageFns$3<AggregateNodesRequest>;
931
- interface AggregateNodesResponse {
932
- aggregateSignature: SigningResult | undefined;
933
- verifyingKey: Uint8Array;
934
- parentNodeTx: Uint8Array;
935
- parentNodeVout: number;
936
- }
937
- declare const AggregateNodesResponse: MessageFns$3<AggregateNodesResponse>;
938
941
  interface StorePreimageShareRequest {
939
942
  paymentHash: Uint8Array;
940
943
  preimageShare: SecretShare$1 | undefined;
@@ -1195,6 +1198,10 @@ interface QueryUnusedDepositAddressesRequest {
1195
1198
  identityPublicKey: Uint8Array;
1196
1199
  /** defaults to mainnet when no network is provided. */
1197
1200
  network: Network$1;
1201
+ /** defaults to 100 if not set. */
1202
+ limit: number;
1203
+ /** defaults to 0 if not set. */
1204
+ offset: number;
1198
1205
  }
1199
1206
  declare const QueryUnusedDepositAddressesRequest: MessageFns$3<QueryUnusedDepositAddressesRequest>;
1200
1207
  interface QueryStaticDepositAddressesRequest {
@@ -1214,6 +1221,8 @@ interface DepositAddressQueryResult {
1214
1221
  declare const DepositAddressQueryResult: MessageFns$3<DepositAddressQueryResult>;
1215
1222
  interface QueryUnusedDepositAddressesResponse {
1216
1223
  depositAddresses: DepositAddressQueryResult[];
1224
+ /** defaults to -1 if there are no more results */
1225
+ offset: number;
1217
1226
  }
1218
1227
  declare const QueryUnusedDepositAddressesResponse: MessageFns$3<QueryUnusedDepositAddressesResponse>;
1219
1228
  interface QueryStaticDepositAddressesResponse {
@@ -1318,6 +1327,11 @@ interface SparkServiceClient$1<CallOptionsExt = {}> {
1318
1327
  start_tree_creation(request: DeepPartial$3<StartTreeCreationRequest>, options?: CallOptions & CallOptionsExt): Promise<StartTreeCreationResponse>;
1319
1328
  finalize_node_signatures(request: DeepPartial$3<FinalizeNodeSignaturesRequest>, options?: CallOptions & CallOptionsExt): Promise<FinalizeNodeSignaturesResponse>;
1320
1329
  start_transfer(request: DeepPartial$3<StartTransferRequest>, options?: CallOptions & CallOptionsExt): Promise<StartTransferResponse>;
1330
+ /**
1331
+ * This is deprecated, please use finalize_transfer_with_transfer_package instead.
1332
+ *
1333
+ * @deprecated
1334
+ */
1321
1335
  finalize_transfer(request: DeepPartial$3<FinalizeTransferRequest>, options?: CallOptions & CallOptionsExt): Promise<FinalizeTransferResponse>;
1322
1336
  finalize_transfer_with_transfer_package(request: DeepPartial$3<FinalizeTransferWithTransferPackageRequest>, options?: CallOptions & CallOptionsExt): Promise<FinalizeTransferResponse>;
1323
1337
  cancel_transfer(request: DeepPartial$3<CancelTransferRequest>, options?: CallOptions & CallOptionsExt): Promise<CancelTransferResponse>;
@@ -1325,7 +1339,6 @@ interface SparkServiceClient$1<CallOptionsExt = {}> {
1325
1339
  query_all_transfers(request: DeepPartial$3<TransferFilter>, options?: CallOptions & CallOptionsExt): Promise<QueryTransfersResponse>;
1326
1340
  claim_transfer_tweak_keys(request: DeepPartial$3<ClaimTransferTweakKeysRequest>, options?: CallOptions & CallOptionsExt): Promise<Empty>;
1327
1341
  claim_transfer_sign_refunds(request: DeepPartial$3<ClaimTransferSignRefundsRequest>, options?: CallOptions & CallOptionsExt): Promise<ClaimTransferSignRefundsResponse>;
1328
- aggregate_nodes(request: DeepPartial$3<AggregateNodesRequest>, options?: CallOptions & CallOptionsExt): Promise<AggregateNodesResponse>;
1329
1342
  store_preimage_share(request: DeepPartial$3<StorePreimageShareRequest>, options?: CallOptions & CallOptionsExt): Promise<Empty>;
1330
1343
  get_signing_commitments(request: DeepPartial$3<GetSigningCommitmentsRequest>, options?: CallOptions & CallOptionsExt): Promise<GetSigningCommitmentsResponse>;
1331
1344
  cooperative_exit(request: DeepPartial$3<CooperativeExitRequest>, options?: CallOptions & CallOptionsExt): Promise<CooperativeExitResponse>;
@@ -1674,6 +1687,43 @@ interface CoopExitFeeEstimatesOutput {
1674
1687
  speedSlow?: CoopExitFeeEstimate | undefined;
1675
1688
  }
1676
1689
 
1690
+ interface CoopExitFeeQuote {
1691
+ /**
1692
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
1693
+ * string.
1694
+ **/
1695
+ id: string;
1696
+ /** The date and time when the entity was first created. **/
1697
+ createdAt: string;
1698
+ /** The date and time when the entity was last updated. **/
1699
+ updatedAt: string;
1700
+ /** The network the coop exit fee quote is on. **/
1701
+ network: BitcoinNetwork;
1702
+ /** The total currency amount of all the nodes user swapped for the coop exit quote. **/
1703
+ totalAmount: CurrencyAmount;
1704
+ /** The fee user pays for the coop exit not including the L1 broadcast fee when exit speed is fast. **/
1705
+ userFeeFast: CurrencyAmount;
1706
+ /** The fee user pays for the coop exit not including the L1 broadcast fee when exit speed is medium. **/
1707
+ userFeeMedium: CurrencyAmount;
1708
+ /** The fee user pays for the coop exit not including the L1 broadcast fee when exit speed is slow. **/
1709
+ userFeeSlow: CurrencyAmount;
1710
+ /** The L1 broadcast fee user pays for the coop exit when exit speed is fast. **/
1711
+ l1BroadcastFeeFast: CurrencyAmount;
1712
+ /** The L1 broadcast fee user pays for the coop exit when exit speed is medium. **/
1713
+ l1BroadcastFeeMedium: CurrencyAmount;
1714
+ /** The L1 broadcast fee user pays for the coop exit when exit speed is slow. **/
1715
+ l1BroadcastFeeSlow: CurrencyAmount;
1716
+ /** The time when the coop exit fee quote expires. **/
1717
+ expiresAt: string;
1718
+ /** The typename of the object **/
1719
+ typename: string;
1720
+ }
1721
+
1722
+ interface CoopExitFeeQuoteInput {
1723
+ leafExternalIds: string[];
1724
+ withdrawalAddress: string;
1725
+ }
1726
+
1677
1727
  declare enum ExitSpeed {
1678
1728
  /**
1679
1729
  * This is an enum value that represents values that could be added in the future.
@@ -1864,10 +1914,10 @@ declare class SspClient {
1864
1914
  getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
1865
1915
  getCurrentUser(): Promise<void>;
1866
1916
  completeCoopExit({ userOutboundTransferExternalId, coopExitRequestId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
1867
- requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
1917
+ requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
1868
1918
  requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
1869
1919
  requestLightningSend({ encodedInvoice, idempotencyKey, amountSats, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
1870
- requestLeaveSwap({ adaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
1920
+ requestLeaveSwap({ adaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, targetAmountSatsList, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
1871
1921
  completeLeaveSwap({ adaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
1872
1922
  getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
1873
1923
  getLightningSendRequest(id: string): Promise<LightningSendRequest | null>;
@@ -1887,6 +1937,7 @@ declare class SspClient {
1887
1937
  getChallenge(): Promise<GetChallengeOutput | null>;
1888
1938
  verifyChallenge(signature: string, protectedChallenge: string): Promise<VerifyChallengeOutput | null>;
1889
1939
  authenticate(): Promise<void>;
1940
+ getCoopExitFeeQuote({ leafExternalIds, withdrawalAddress, }: CoopExitFeeQuoteInput): Promise<CoopExitFeeQuote | null>;
1890
1941
  }
1891
1942
 
1892
1943
  interface Leaf {
@@ -3097,6 +3148,15 @@ declare class SparkWallet extends EventEmitter {
3097
3148
  * @returns {Promise<string[]>} The unused deposit addresses
3098
3149
  */
3099
3150
  getUnusedDepositAddresses(): Promise<string[]>;
3151
+ /**
3152
+ * Gets all unused deposit addresses for the wallet.
3153
+ *
3154
+ * @param {Object} params - Parameters for querying unused deposit addresses
3155
+ * @param {Uint8Array<ArrayBufferLike>} [params.identityPublicKey] - The identity public key
3156
+ * @param {NetworkProto} [params.network] - The network
3157
+ * @returns {Promise<DepositAddressQueryResult[]>} The unused deposit addresses
3158
+ */
3159
+ private queryAllUnusedDepositAddresses;
3100
3160
  /**
3101
3161
  * Claims a deposit to the wallet.
3102
3162
  * Note that if you used advancedDeposit, you don't need to call this function.
@@ -3219,13 +3279,18 @@ declare class SparkWallet extends EventEmitter {
3219
3279
  *
3220
3280
  * @param {Object} params - Parameters for the withdrawal
3221
3281
  * @param {string} params.onchainAddress - The Bitcoin address where the funds should be sent
3222
- * @param {number} [params.amountSats] - The amount in satoshis to withdraw. If not specified, attempts to withdraw all available funds
3282
+ * @param {CoopExitFeeQuote} params.feeQuote - The fee quote for the withdrawal
3283
+ * @param {ExitSpeed} params.exitSpeed - The exit speed chosen for the withdrawal
3284
+ * @param {number} [params.amountSats] - The amount in satoshis to withdraw. If not specified, attempts to withdraw all available funds and deductFeeFromWithdrawalAmount is set to true.
3285
+ * @param {boolean} [params.deductFeeFromWithdrawalAmount] - Controls how the withdrawal fee is handled. If true, the fee is deducted from the withdrawal amount (amountSats), meaning the recipient will receive amountSats minus the fee. If false, the fee is paid separately from the wallet balance, meaning the recipient will receive the full amountSats.
3223
3286
  * @returns {Promise<CoopExitRequest | null | undefined>} The withdrawal request details, or null/undefined if the request cannot be completed
3224
3287
  */
3225
- withdraw({ onchainAddress, exitSpeed, amountSats, }: {
3288
+ withdraw({ onchainAddress, exitSpeed, feeQuote, amountSats, deductFeeFromWithdrawalAmount, }: {
3226
3289
  onchainAddress: string;
3227
3290
  exitSpeed: ExitSpeed;
3291
+ feeQuote: CoopExitFeeQuote;
3228
3292
  amountSats?: number;
3293
+ deductFeeFromWithdrawalAmount?: boolean;
3229
3294
  }): Promise<CoopExitRequest | null>;
3230
3295
  /**
3231
3296
  * Internal method to perform a cooperative exit (withdrawal).
@@ -3242,12 +3307,12 @@ declare class SparkWallet extends EventEmitter {
3242
3307
  * @param {Object} params - Input parameters for fee estimation
3243
3308
  * @param {number} params.amountSats - The amount in satoshis to withdraw
3244
3309
  * @param {string} params.withdrawalAddress - The Bitcoin address where the funds should be sent
3245
- * @returns {Promise<CoopExitFeeEstimatesOutput | null>} Fee estimate for the withdrawal
3310
+ * @returns {Promise<CoopExitFeeQuote | null>} Fee estimate for the withdrawal
3246
3311
  */
3247
- getWithdrawalFeeEstimate({ amountSats, withdrawalAddress, }: {
3312
+ getWithdrawalFeeQuote({ amountSats, withdrawalAddress, }: {
3248
3313
  amountSats: number;
3249
3314
  withdrawalAddress: string;
3250
- }): Promise<CoopExitFeeEstimatesOutput | null>;
3315
+ }): Promise<CoopExitFeeQuote | null>;
3251
3316
  /**
3252
3317
  * Gets a transfer that has been sent by the SSP to the wallet.
3253
3318
  *
@@ -230,7 +230,7 @@ declare enum TransferStatus {
230
230
  TRANSFER_STATUS_SENDER_KEY_TWEAK_PENDING = 1,
231
231
  TRANSFER_STATUS_SENDER_KEY_TWEAKED = 2,
232
232
  TRANSFER_STATUS_RECEIVER_KEY_TWEAKED = 3,
233
- TRANSFER_STATUSR_RECEIVER_REFUND_SIGNED = 4,
233
+ TRANSFER_STATUS_RECEIVER_REFUND_SIGNED = 4,
234
234
  TRANSFER_STATUS_COMPLETED = 5,
235
235
  TRANSFER_STATUS_EXPIRED = 6,
236
236
  TRANSFER_STATUS_RETURNED = 7,
@@ -394,6 +394,12 @@ interface SigningKeyshare {
394
394
  threshold: number;
395
395
  /** The public key of the keyshare. */
396
396
  publicKey: Uint8Array;
397
+ /** The public shares of the keyshare. */
398
+ publicShares: {
399
+ [key: string]: Uint8Array;
400
+ };
401
+ /** The latest update time of the keyshare. */
402
+ updatedTime: Date | undefined;
397
403
  }
398
404
  declare const SigningKeyshare: MessageFns$3<SigningKeyshare>;
399
405
  /**
@@ -587,6 +593,7 @@ interface StartTokenTransactionRequest {
587
593
  partialTokenTransaction: TokenTransaction$1 | undefined;
588
594
  /** List of ecdsa signatures authorizing movement of tokens from the token input. */
589
595
  tokenTransactionSignatures: TokenTransactionSignatures | undefined;
596
+ sparkPaymentIntent: string;
590
597
  }
591
598
  declare const StartTokenTransactionRequest: MessageFns$3<StartTokenTransactionRequest>;
592
599
  interface StartTokenTransactionResponse {
@@ -647,6 +654,7 @@ interface FinalizeTokenTransactionRequest {
647
654
  */
648
655
  revocationSecrets: RevocationSecretWithIndex[];
649
656
  identityPublicKey: Uint8Array;
657
+ sparkPaymentIntent: string;
650
658
  }
651
659
  declare const FinalizeTokenTransactionRequest: MessageFns$3<FinalizeTokenTransactionRequest>;
652
660
  interface FreezeTokensPayload$1 {
@@ -733,6 +741,12 @@ interface TreeNode {
733
741
  status: string;
734
742
  /** The network of the node. */
735
743
  network: Network$1;
744
+ /** The creation time of the node. */
745
+ createdTime: Date | undefined;
746
+ /** The latest update time of the node. */
747
+ updatedTime: Date | undefined;
748
+ /** The signing public key of the owner of the node. */
749
+ ownerSigningPublicKey: Uint8Array;
736
750
  }
737
751
  declare const TreeNode: MessageFns$3<TreeNode>;
738
752
  /** FinalizeNodeSignaturesRequest is the request to finalize the signatures for a node. */
@@ -800,6 +814,7 @@ interface StartTransferRequest {
800
814
  expiryTime: Date | undefined;
801
815
  /** If this field is set, the leaves_to_send and key_tweak_proofs will be ignored. */
802
816
  transferPackage: TransferPackage | undefined;
817
+ sparkPaymentIntent: string;
803
818
  }
804
819
  declare const StartTransferRequest: MessageFns$3<StartTransferRequest>;
805
820
  interface StartTransferResponse {
@@ -839,6 +854,7 @@ interface FinalizeTransferRequest {
839
854
  transferId: string;
840
855
  ownerIdentityPublicKey: Uint8Array;
841
856
  leavesToSend: SendLeafKeyTweak[];
857
+ sparkPaymentIntent: string;
842
858
  }
843
859
  declare const FinalizeTransferRequest: MessageFns$3<FinalizeTransferRequest>;
844
860
  interface FinalizeTransferWithTransferPackageRequest {
@@ -890,6 +906,7 @@ interface TransferFilter {
890
906
  types: TransferType[];
891
907
  /** defaults to mainnet when no network is provided. */
892
908
  network: Network$1;
909
+ statuses: TransferStatus[];
893
910
  }
894
911
  declare const TransferFilter: MessageFns$3<TransferFilter>;
895
912
  interface QueryTransfersResponse {
@@ -921,20 +938,6 @@ interface ClaimTransferSignRefundsResponse {
921
938
  signingResults: LeafRefundTxSigningResult[];
922
939
  }
923
940
  declare const ClaimTransferSignRefundsResponse: MessageFns$3<ClaimTransferSignRefundsResponse>;
924
- interface AggregateNodesRequest {
925
- nodeIds: string[];
926
- signingJob: SigningJob | undefined;
927
- /** Serves as a temporary identity public key, this should be get from auth process. */
928
- ownerIdentityPublicKey: Uint8Array;
929
- }
930
- declare const AggregateNodesRequest: MessageFns$3<AggregateNodesRequest>;
931
- interface AggregateNodesResponse {
932
- aggregateSignature: SigningResult | undefined;
933
- verifyingKey: Uint8Array;
934
- parentNodeTx: Uint8Array;
935
- parentNodeVout: number;
936
- }
937
- declare const AggregateNodesResponse: MessageFns$3<AggregateNodesResponse>;
938
941
  interface StorePreimageShareRequest {
939
942
  paymentHash: Uint8Array;
940
943
  preimageShare: SecretShare$1 | undefined;
@@ -1195,6 +1198,10 @@ interface QueryUnusedDepositAddressesRequest {
1195
1198
  identityPublicKey: Uint8Array;
1196
1199
  /** defaults to mainnet when no network is provided. */
1197
1200
  network: Network$1;
1201
+ /** defaults to 100 if not set. */
1202
+ limit: number;
1203
+ /** defaults to 0 if not set. */
1204
+ offset: number;
1198
1205
  }
1199
1206
  declare const QueryUnusedDepositAddressesRequest: MessageFns$3<QueryUnusedDepositAddressesRequest>;
1200
1207
  interface QueryStaticDepositAddressesRequest {
@@ -1214,6 +1221,8 @@ interface DepositAddressQueryResult {
1214
1221
  declare const DepositAddressQueryResult: MessageFns$3<DepositAddressQueryResult>;
1215
1222
  interface QueryUnusedDepositAddressesResponse {
1216
1223
  depositAddresses: DepositAddressQueryResult[];
1224
+ /** defaults to -1 if there are no more results */
1225
+ offset: number;
1217
1226
  }
1218
1227
  declare const QueryUnusedDepositAddressesResponse: MessageFns$3<QueryUnusedDepositAddressesResponse>;
1219
1228
  interface QueryStaticDepositAddressesResponse {
@@ -1318,6 +1327,11 @@ interface SparkServiceClient$1<CallOptionsExt = {}> {
1318
1327
  start_tree_creation(request: DeepPartial$3<StartTreeCreationRequest>, options?: CallOptions & CallOptionsExt): Promise<StartTreeCreationResponse>;
1319
1328
  finalize_node_signatures(request: DeepPartial$3<FinalizeNodeSignaturesRequest>, options?: CallOptions & CallOptionsExt): Promise<FinalizeNodeSignaturesResponse>;
1320
1329
  start_transfer(request: DeepPartial$3<StartTransferRequest>, options?: CallOptions & CallOptionsExt): Promise<StartTransferResponse>;
1330
+ /**
1331
+ * This is deprecated, please use finalize_transfer_with_transfer_package instead.
1332
+ *
1333
+ * @deprecated
1334
+ */
1321
1335
  finalize_transfer(request: DeepPartial$3<FinalizeTransferRequest>, options?: CallOptions & CallOptionsExt): Promise<FinalizeTransferResponse>;
1322
1336
  finalize_transfer_with_transfer_package(request: DeepPartial$3<FinalizeTransferWithTransferPackageRequest>, options?: CallOptions & CallOptionsExt): Promise<FinalizeTransferResponse>;
1323
1337
  cancel_transfer(request: DeepPartial$3<CancelTransferRequest>, options?: CallOptions & CallOptionsExt): Promise<CancelTransferResponse>;
@@ -1325,7 +1339,6 @@ interface SparkServiceClient$1<CallOptionsExt = {}> {
1325
1339
  query_all_transfers(request: DeepPartial$3<TransferFilter>, options?: CallOptions & CallOptionsExt): Promise<QueryTransfersResponse>;
1326
1340
  claim_transfer_tweak_keys(request: DeepPartial$3<ClaimTransferTweakKeysRequest>, options?: CallOptions & CallOptionsExt): Promise<Empty>;
1327
1341
  claim_transfer_sign_refunds(request: DeepPartial$3<ClaimTransferSignRefundsRequest>, options?: CallOptions & CallOptionsExt): Promise<ClaimTransferSignRefundsResponse>;
1328
- aggregate_nodes(request: DeepPartial$3<AggregateNodesRequest>, options?: CallOptions & CallOptionsExt): Promise<AggregateNodesResponse>;
1329
1342
  store_preimage_share(request: DeepPartial$3<StorePreimageShareRequest>, options?: CallOptions & CallOptionsExt): Promise<Empty>;
1330
1343
  get_signing_commitments(request: DeepPartial$3<GetSigningCommitmentsRequest>, options?: CallOptions & CallOptionsExt): Promise<GetSigningCommitmentsResponse>;
1331
1344
  cooperative_exit(request: DeepPartial$3<CooperativeExitRequest>, options?: CallOptions & CallOptionsExt): Promise<CooperativeExitResponse>;
@@ -1674,6 +1687,43 @@ interface CoopExitFeeEstimatesOutput {
1674
1687
  speedSlow?: CoopExitFeeEstimate | undefined;
1675
1688
  }
1676
1689
 
1690
+ interface CoopExitFeeQuote {
1691
+ /**
1692
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
1693
+ * string.
1694
+ **/
1695
+ id: string;
1696
+ /** The date and time when the entity was first created. **/
1697
+ createdAt: string;
1698
+ /** The date and time when the entity was last updated. **/
1699
+ updatedAt: string;
1700
+ /** The network the coop exit fee quote is on. **/
1701
+ network: BitcoinNetwork;
1702
+ /** The total currency amount of all the nodes user swapped for the coop exit quote. **/
1703
+ totalAmount: CurrencyAmount;
1704
+ /** The fee user pays for the coop exit not including the L1 broadcast fee when exit speed is fast. **/
1705
+ userFeeFast: CurrencyAmount;
1706
+ /** The fee user pays for the coop exit not including the L1 broadcast fee when exit speed is medium. **/
1707
+ userFeeMedium: CurrencyAmount;
1708
+ /** The fee user pays for the coop exit not including the L1 broadcast fee when exit speed is slow. **/
1709
+ userFeeSlow: CurrencyAmount;
1710
+ /** The L1 broadcast fee user pays for the coop exit when exit speed is fast. **/
1711
+ l1BroadcastFeeFast: CurrencyAmount;
1712
+ /** The L1 broadcast fee user pays for the coop exit when exit speed is medium. **/
1713
+ l1BroadcastFeeMedium: CurrencyAmount;
1714
+ /** The L1 broadcast fee user pays for the coop exit when exit speed is slow. **/
1715
+ l1BroadcastFeeSlow: CurrencyAmount;
1716
+ /** The time when the coop exit fee quote expires. **/
1717
+ expiresAt: string;
1718
+ /** The typename of the object **/
1719
+ typename: string;
1720
+ }
1721
+
1722
+ interface CoopExitFeeQuoteInput {
1723
+ leafExternalIds: string[];
1724
+ withdrawalAddress: string;
1725
+ }
1726
+
1677
1727
  declare enum ExitSpeed {
1678
1728
  /**
1679
1729
  * This is an enum value that represents values that could be added in the future.
@@ -1864,10 +1914,10 @@ declare class SspClient {
1864
1914
  getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
1865
1915
  getCurrentUser(): Promise<void>;
1866
1916
  completeCoopExit({ userOutboundTransferExternalId, coopExitRequestId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
1867
- requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
1917
+ requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
1868
1918
  requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
1869
1919
  requestLightningSend({ encodedInvoice, idempotencyKey, amountSats, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
1870
- requestLeaveSwap({ adaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
1920
+ requestLeaveSwap({ adaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, targetAmountSatsList, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
1871
1921
  completeLeaveSwap({ adaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
1872
1922
  getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
1873
1923
  getLightningSendRequest(id: string): Promise<LightningSendRequest | null>;
@@ -1887,6 +1937,7 @@ declare class SspClient {
1887
1937
  getChallenge(): Promise<GetChallengeOutput | null>;
1888
1938
  verifyChallenge(signature: string, protectedChallenge: string): Promise<VerifyChallengeOutput | null>;
1889
1939
  authenticate(): Promise<void>;
1940
+ getCoopExitFeeQuote({ leafExternalIds, withdrawalAddress, }: CoopExitFeeQuoteInput): Promise<CoopExitFeeQuote | null>;
1890
1941
  }
1891
1942
 
1892
1943
  interface Leaf {
@@ -3097,6 +3148,15 @@ declare class SparkWallet extends EventEmitter {
3097
3148
  * @returns {Promise<string[]>} The unused deposit addresses
3098
3149
  */
3099
3150
  getUnusedDepositAddresses(): Promise<string[]>;
3151
+ /**
3152
+ * Gets all unused deposit addresses for the wallet.
3153
+ *
3154
+ * @param {Object} params - Parameters for querying unused deposit addresses
3155
+ * @param {Uint8Array<ArrayBufferLike>} [params.identityPublicKey] - The identity public key
3156
+ * @param {NetworkProto} [params.network] - The network
3157
+ * @returns {Promise<DepositAddressQueryResult[]>} The unused deposit addresses
3158
+ */
3159
+ private queryAllUnusedDepositAddresses;
3100
3160
  /**
3101
3161
  * Claims a deposit to the wallet.
3102
3162
  * Note that if you used advancedDeposit, you don't need to call this function.
@@ -3219,13 +3279,18 @@ declare class SparkWallet extends EventEmitter {
3219
3279
  *
3220
3280
  * @param {Object} params - Parameters for the withdrawal
3221
3281
  * @param {string} params.onchainAddress - The Bitcoin address where the funds should be sent
3222
- * @param {number} [params.amountSats] - The amount in satoshis to withdraw. If not specified, attempts to withdraw all available funds
3282
+ * @param {CoopExitFeeQuote} params.feeQuote - The fee quote for the withdrawal
3283
+ * @param {ExitSpeed} params.exitSpeed - The exit speed chosen for the withdrawal
3284
+ * @param {number} [params.amountSats] - The amount in satoshis to withdraw. If not specified, attempts to withdraw all available funds and deductFeeFromWithdrawalAmount is set to true.
3285
+ * @param {boolean} [params.deductFeeFromWithdrawalAmount] - Controls how the withdrawal fee is handled. If true, the fee is deducted from the withdrawal amount (amountSats), meaning the recipient will receive amountSats minus the fee. If false, the fee is paid separately from the wallet balance, meaning the recipient will receive the full amountSats.
3223
3286
  * @returns {Promise<CoopExitRequest | null | undefined>} The withdrawal request details, or null/undefined if the request cannot be completed
3224
3287
  */
3225
- withdraw({ onchainAddress, exitSpeed, amountSats, }: {
3288
+ withdraw({ onchainAddress, exitSpeed, feeQuote, amountSats, deductFeeFromWithdrawalAmount, }: {
3226
3289
  onchainAddress: string;
3227
3290
  exitSpeed: ExitSpeed;
3291
+ feeQuote: CoopExitFeeQuote;
3228
3292
  amountSats?: number;
3293
+ deductFeeFromWithdrawalAmount?: boolean;
3229
3294
  }): Promise<CoopExitRequest | null>;
3230
3295
  /**
3231
3296
  * Internal method to perform a cooperative exit (withdrawal).
@@ -3242,12 +3307,12 @@ declare class SparkWallet extends EventEmitter {
3242
3307
  * @param {Object} params - Input parameters for fee estimation
3243
3308
  * @param {number} params.amountSats - The amount in satoshis to withdraw
3244
3309
  * @param {string} params.withdrawalAddress - The Bitcoin address where the funds should be sent
3245
- * @returns {Promise<CoopExitFeeEstimatesOutput | null>} Fee estimate for the withdrawal
3310
+ * @returns {Promise<CoopExitFeeQuote | null>} Fee estimate for the withdrawal
3246
3311
  */
3247
- getWithdrawalFeeEstimate({ amountSats, withdrawalAddress, }: {
3312
+ getWithdrawalFeeQuote({ amountSats, withdrawalAddress, }: {
3248
3313
  amountSats: number;
3249
3314
  withdrawalAddress: string;
3250
- }): Promise<CoopExitFeeEstimatesOutput | null>;
3315
+ }): Promise<CoopExitFeeQuote | null>;
3251
3316
  /**
3252
3317
  * Gets a transfer that has been sent by the SSP to the wallet.
3253
3318
  *