@buildonspark/spark-sdk 0.1.41 → 0.1.43

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 (156) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/android/src/main/jniLibs/arm64-v8a/libuniffi_spark_frost.so +0 -0
  3. package/android/src/main/jniLibs/armeabi-v7a/libuniffi_spark_frost.so +0 -0
  4. package/android/src/main/jniLibs/x86/libuniffi_spark_frost.so +0 -0
  5. package/android/src/main/jniLibs/x86_64/libuniffi_spark_frost.so +0 -0
  6. package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.cts +10 -0
  7. package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.ts +10 -0
  8. package/dist/{RequestLightningSendInput-mXUWn_cp.d.ts → RequestLightningSendInput-D7fZdT4A.d.ts} +35 -16
  9. package/dist/{RequestLightningSendInput-DXcLoiCe.d.cts → RequestLightningSendInput-Na1mHdWg.d.cts} +35 -16
  10. package/dist/address/index.cjs +38 -7
  11. package/dist/address/index.d.cts +2 -2
  12. package/dist/address/index.d.ts +2 -2
  13. package/dist/address/index.js +3 -3
  14. package/dist/{chunk-ATEHMLKP.js → chunk-6AFUC5M2.js} +1 -1
  15. package/dist/{chunk-ZXDE2XMU.js → chunk-BUTZWYBW.js} +9 -6
  16. package/dist/{chunk-7EFSUADA.js → chunk-DOA6QXYQ.js} +1 -0
  17. package/dist/{chunk-J5W5Q2ZP.js → chunk-DQYKQJRZ.js} +291 -7
  18. package/dist/{chunk-TWF35O6M.js → chunk-GSI4OLXZ.js} +32 -1
  19. package/dist/{chunk-2ZXXLPG2.js → chunk-GYQR4B4P.js} +5 -4
  20. package/dist/{chunk-ROKY5KS4.js → chunk-HRQRRDSS.js} +53 -15
  21. package/dist/{chunk-YEZDPUFY.js → chunk-IRW5TWMH.js} +8 -8
  22. package/dist/{chunk-7VMYMQLF.js → chunk-NSJF5F5O.js} +1 -1
  23. package/dist/{chunk-TM4TOEOX.js → chunk-O4RYNJNB.js} +3 -3
  24. package/dist/{chunk-MGPRLH6Q.js → chunk-QNNSEJ4P.js} +1 -1
  25. package/dist/{chunk-UKT6OFLO.js → chunk-TIUBYNN5.js} +13 -7
  26. package/dist/{chunk-6YVPOQ2A.js → chunk-TOSP3INR.js} +235 -143
  27. package/dist/chunk-VFJQNBFX.js +21 -0
  28. package/dist/{chunk-KKSU7OZO.js → chunk-WWOTVNPP.js} +195 -67
  29. package/dist/{chunk-HK6LPV6Z.js → chunk-Z5HIAYFT.js} +1 -1
  30. package/dist/graphql/objects/index.cjs +229 -135
  31. package/dist/graphql/objects/index.d.cts +54 -9
  32. package/dist/graphql/objects/index.d.ts +54 -9
  33. package/dist/graphql/objects/index.js +3 -3
  34. package/dist/{index-OSDtPMmC.d.ts → index-7RYRH5wc.d.ts} +10 -8
  35. package/dist/{index-CFh4uWzi.d.cts → index-BJOc8Ur-.d.cts} +10 -8
  36. package/dist/index.cjs +790 -315
  37. package/dist/index.d.cts +8 -7
  38. package/dist/index.d.ts +8 -7
  39. package/dist/index.js +26 -26
  40. package/dist/index.node.cjs +790 -315
  41. package/dist/index.node.d.cts +9 -8
  42. package/dist/index.node.d.ts +9 -8
  43. package/dist/index.node.js +26 -26
  44. package/dist/native/index.cjs +812 -332
  45. package/dist/native/index.d.cts +53 -18
  46. package/dist/native/index.d.ts +53 -18
  47. package/dist/native/index.js +659 -181
  48. package/dist/{network-BiwBmoOg.d.cts → network-D5lKssVl.d.cts} +1 -1
  49. package/dist/{network-BF2GYPye.d.ts → network-xkBSpaTn.d.ts} +1 -1
  50. package/dist/proto/lrc20.d.cts +1 -1
  51. package/dist/proto/lrc20.d.ts +1 -1
  52. package/dist/proto/spark.d.cts +1 -1
  53. package/dist/proto/spark.d.ts +1 -1
  54. package/dist/proto/spark_token.d.cts +1 -1
  55. package/dist/proto/spark_token.d.ts +1 -1
  56. package/dist/{sdk-types-CfhdFnsA.d.cts → sdk-types-B-q9py_P.d.cts} +1 -1
  57. package/dist/{sdk-types-MnQrHolg.d.ts → sdk-types-BPoPgzda.d.ts} +1 -1
  58. package/dist/services/config.cjs +118 -69
  59. package/dist/services/config.d.cts +6 -4
  60. package/dist/services/config.d.ts +6 -4
  61. package/dist/services/config.js +9 -9
  62. package/dist/services/connection.cjs +95 -15
  63. package/dist/services/connection.d.cts +6 -4
  64. package/dist/services/connection.d.ts +6 -4
  65. package/dist/services/connection.js +3 -3
  66. package/dist/services/index.cjs +487 -117
  67. package/dist/services/index.d.cts +5 -4
  68. package/dist/services/index.d.ts +5 -4
  69. package/dist/services/index.js +19 -19
  70. package/dist/services/lrc-connection.cjs +50 -7
  71. package/dist/services/lrc-connection.d.cts +5 -4
  72. package/dist/services/lrc-connection.d.ts +5 -4
  73. package/dist/services/lrc-connection.js +3 -3
  74. package/dist/services/token-transactions.cjs +351 -36
  75. package/dist/services/token-transactions.d.cts +5 -4
  76. package/dist/services/token-transactions.d.ts +5 -4
  77. package/dist/services/token-transactions.js +6 -6
  78. package/dist/services/wallet-config.cjs +1 -0
  79. package/dist/services/wallet-config.d.cts +6 -4
  80. package/dist/services/wallet-config.d.ts +6 -4
  81. package/dist/services/wallet-config.js +1 -1
  82. package/dist/signer/signer.cjs +117 -64
  83. package/dist/signer/signer.d.cts +4 -3
  84. package/dist/signer/signer.d.ts +4 -3
  85. package/dist/signer/signer.js +15 -7
  86. package/dist/{signer-CylxIujU.d.ts → signer-IO3oMRNj.d.cts} +2 -1
  87. package/dist/{signer-BhLS7SYR.d.cts → signer-wqesWifN.d.ts} +2 -1
  88. package/dist/{spark-DjR1b3TC.d.cts → spark-CDm4gqS6.d.cts} +1 -1
  89. package/dist/{spark-DjR1b3TC.d.ts → spark-CDm4gqS6.d.ts} +1 -1
  90. package/dist/types/index.cjs +282 -188
  91. package/dist/types/index.d.cts +7 -6
  92. package/dist/types/index.d.ts +7 -6
  93. package/dist/types/index.js +3 -3
  94. package/dist/utils/index.cjs +90 -58
  95. package/dist/utils/index.d.cts +6 -5
  96. package/dist/utils/index.d.ts +6 -5
  97. package/dist/utils/index.js +16 -16
  98. package/ios/spark_frostFFI.xcframework/ios-arm64/SparkFrost +0 -0
  99. package/ios/spark_frostFFI.xcframework/ios-arm64/spark_frostFFI.framework/spark_frostFFI +0 -0
  100. package/ios/spark_frostFFI.xcframework/ios-arm64_x86_64-simulator/SparkFrost +0 -0
  101. package/ios/spark_frostFFI.xcframework/ios-arm64_x86_64-simulator/spark_frostFFI.framework/spark_frostFFI +0 -0
  102. package/ios/spark_frostFFI.xcframework/macos-arm64_x86_64/spark_frostFFI.framework/spark_frostFFI +0 -0
  103. package/package.json +4 -4
  104. package/src/constants.ts +21 -0
  105. package/src/errors/base.ts +43 -1
  106. package/src/graphql/client.ts +4 -0
  107. package/src/graphql/mutations/RequestLightningSend.ts +2 -0
  108. package/src/graphql/objects/ClaimStaticDepositInput.ts +1 -1
  109. package/src/graphql/objects/ClaimStaticDepositStatus.ts +4 -2
  110. package/src/graphql/objects/Connection.ts +7 -7
  111. package/src/graphql/objects/CoopExitFeeEstimate.ts +1 -1
  112. package/src/graphql/objects/CoopExitFeeQuote.ts +202 -0
  113. package/src/graphql/objects/CoopExitFeeQuoteInput.ts +41 -0
  114. package/src/graphql/objects/CoopExitFeeQuoteOutput.ts +45 -0
  115. package/src/graphql/objects/CoopExitRequest.ts +21 -0
  116. package/src/graphql/objects/CurrencyUnit.ts +26 -28
  117. package/src/graphql/objects/Entity.ts +84 -0
  118. package/src/graphql/objects/Invoice.ts +2 -2
  119. package/src/graphql/objects/Leaf.ts +1 -1
  120. package/src/graphql/objects/LeavesSwapFeeEstimateOutput.ts +1 -1
  121. package/src/graphql/objects/LeavesSwapRequest.ts +6 -0
  122. package/src/graphql/objects/LightningReceiveRequest.ts +11 -0
  123. package/src/graphql/objects/LightningSendFeeEstimateInput.ts +8 -0
  124. package/src/graphql/objects/LightningSendFeeEstimateOutput.ts +1 -1
  125. package/src/graphql/objects/LightningSendRequest.ts +3 -0
  126. package/src/graphql/objects/RequestCoopExitInput.ts +8 -0
  127. package/src/graphql/objects/RequestLeavesSwapInput.ts +5 -1
  128. package/src/graphql/objects/RequestLightningReceiveInput.ts +9 -2
  129. package/src/graphql/objects/RequestLightningSendInput.ts +8 -0
  130. package/src/graphql/objects/SparkCoopExitRequestStatus.ts +2 -0
  131. package/src/graphql/objects/SparkUserRequestType.ts +2 -0
  132. package/src/graphql/objects/SparkWalletUser.ts +20 -0
  133. package/src/graphql/objects/UserRequest.ts +32 -0
  134. package/src/graphql/objects/VerifyChallengeInput.ts +1 -1
  135. package/src/graphql/objects/index.ts +12 -3
  136. package/src/graphql/queries/LightningSendFeeEstimate.ts +2 -0
  137. package/src/logger.ts +3 -0
  138. package/src/native/index.ts +1 -0
  139. package/src/services/config.ts +4 -0
  140. package/src/services/connection.ts +68 -29
  141. package/src/services/coop-exit.ts +1 -1
  142. package/src/services/lightning.ts +25 -1
  143. package/src/services/lrc-connection.ts +3 -3
  144. package/src/services/token-transactions.ts +6 -2
  145. package/src/services/wallet-config.ts +2 -0
  146. package/src/signer/signer.ts +4 -1
  147. package/src/spark-wallet/spark-wallet.ts +51 -15
  148. package/src/spark-wallet/types.ts +1 -0
  149. package/src/tests/errors.test.ts +58 -0
  150. package/src/tests/integration/lightning.test.ts +184 -0
  151. package/src/tests/integration/ssp/static_deposit.test.ts +1 -2
  152. package/src/tests/tokens.test.ts +52 -3
  153. package/src/utils/token-hashing.ts +335 -1
  154. package/dist/LightningSendFeeEstimateInput-CJvPnCSB.d.cts +0 -5
  155. package/dist/LightningSendFeeEstimateInput-CJvPnCSB.d.ts +0 -5
  156. package/dist/chunk-HKAKEKCE.js +0 -8
@@ -1395,6 +1395,10 @@ interface ISigningCommitment {
1395
1395
  hiding: Uint8Array;
1396
1396
  binding: Uint8Array;
1397
1397
  }
1398
+ interface DummyTx {
1399
+ tx: Uint8Array;
1400
+ txid: string;
1401
+ }
1398
1402
 
1399
1403
  type Polynomial = {
1400
1404
  fieldModulus: bigint;
@@ -1670,6 +1674,17 @@ interface CoopExitFeeEstimatesOutput {
1670
1674
  speedSlow?: CoopExitFeeEstimate | undefined;
1671
1675
  }
1672
1676
 
1677
+ declare enum ExitSpeed {
1678
+ /**
1679
+ * This is an enum value that represents values that could be added in the future.
1680
+ * Clients should support unknown values as more of them could be added without notice.
1681
+ */
1682
+ FUTURE_VALUE = "FUTURE_VALUE",
1683
+ FAST = "FAST",
1684
+ MEDIUM = "MEDIUM",
1685
+ SLOW = "SLOW"
1686
+ }
1687
+
1673
1688
  declare enum SparkCoopExitRequestStatus {
1674
1689
  /**
1675
1690
  * This is an enum value that represents values that could be added in the future.
@@ -1677,6 +1692,7 @@ declare enum SparkCoopExitRequestStatus {
1677
1692
  */
1678
1693
  FUTURE_VALUE = "FUTURE_VALUE",
1679
1694
  INITIATED = "INITIATED",
1695
+ INBOUND_TRANSFER_CHECKED = "INBOUND_TRANSFER_CHECKED",
1680
1696
  TX_SIGNED = "TX_SIGNED",
1681
1697
  TX_BROADCASTED = "TX_BROADCASTED",
1682
1698
  WAITING_ON_TX_CONFIRMATIONS = "WAITING_ON_TX_CONFIRMATIONS",
@@ -1789,6 +1805,8 @@ interface LightningReceiveRequest {
1789
1805
  transfer?: Transfer | undefined;
1790
1806
  /** The payment preimage of the invoice if retrieved from SE. **/
1791
1807
  paymentPreimage?: string | undefined;
1808
+ /** The receiver's identity public key if different from owner of the request. **/
1809
+ receiverIdentityPublicKey?: string | undefined;
1792
1810
  }
1793
1811
 
1794
1812
  interface LightningSendFeeEstimateOutput {
@@ -1842,13 +1860,13 @@ declare class SspClient {
1842
1860
  });
1843
1861
  executeRawQuery<T>(query: Query<T>, needsAuth?: boolean): Promise<T | null>;
1844
1862
  getSwapFeeEstimate(amountSats: number): Promise<LeavesSwapFeeEstimateOutput | null>;
1845
- getLightningSendFeeEstimate(encodedInvoice: string): Promise<LightningSendFeeEstimateOutput | null>;
1863
+ getLightningSendFeeEstimate(encodedInvoice: string, amountSats?: number): Promise<LightningSendFeeEstimateOutput | null>;
1846
1864
  getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
1847
1865
  getCurrentUser(): Promise<void>;
1848
1866
  completeCoopExit({ userOutboundTransferExternalId, coopExitRequestId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
1849
1867
  requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
1850
1868
  requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
1851
- requestLightningSend({ encodedInvoice, idempotencyKey, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
1869
+ requestLightningSend({ encodedInvoice, idempotencyKey, amountSats, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
1852
1870
  requestLeaveSwap({ adaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
1853
1871
  completeLeaveSwap({ adaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
1854
1872
  getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
@@ -1946,21 +1964,14 @@ interface CoopExitRequest {
1946
1964
  coopExitTxid: string;
1947
1965
  /** The typename of the object **/
1948
1966
  typename: string;
1967
+ /** The fee quote user requested for this coop exit. **/
1968
+ feeQuoteId?: string | undefined;
1969
+ /** The exit speed user requested for this coop exit. **/
1970
+ exitSpeed?: ExitSpeed | undefined;
1949
1971
  /** The swap transfer. **/
1950
1972
  transfer?: Transfer | undefined;
1951
1973
  }
1952
1974
 
1953
- declare enum ExitSpeed {
1954
- /**
1955
- * This is an enum value that represents values that could be added in the future.
1956
- * Clients should support unknown values as more of them could be added without notice.
1957
- */
1958
- FUTURE_VALUE = "FUTURE_VALUE",
1959
- FAST = "FAST",
1960
- MEDIUM = "MEDIUM",
1961
- SLOW = "SLOW"
1962
- }
1963
-
1964
1975
  interface GetChallengeOutput {
1965
1976
  protectedChallenge: string;
1966
1977
  }
@@ -1971,6 +1982,11 @@ interface LeavesSwapFeeEstimateOutput {
1971
1982
 
1972
1983
  interface LightningSendFeeEstimateInput {
1973
1984
  encodedInvoice: string;
1985
+ /**
1986
+ * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
1987
+ * zero.
1988
+ **/
1989
+ amountSats?: number | undefined;
1974
1990
  }
1975
1991
 
1976
1992
  declare enum LightningSendRequestStatus {
@@ -2022,6 +2038,8 @@ interface RequestCoopExitInput {
2022
2038
  idempotencyKey: string;
2023
2039
  exitSpeed: ExitSpeed;
2024
2040
  withdrawAll: boolean;
2041
+ feeLeafExternalIds?: string[] | undefined;
2042
+ feeQuoteId?: string | undefined;
2025
2043
  }
2026
2044
 
2027
2045
  interface UserLeafInput {
@@ -2037,6 +2055,7 @@ interface RequestLeavesSwapInput {
2037
2055
  feeSats: number;
2038
2056
  userLeaves: UserLeafInput[];
2039
2057
  idempotencyKey: string;
2058
+ targetAmountSatsList?: number[] | undefined;
2040
2059
  }
2041
2060
 
2042
2061
  interface RequestLightningReceiveInput {
@@ -2054,7 +2073,10 @@ interface RequestLightningReceiveInput {
2054
2073
  includeSparkAddress: boolean;
2055
2074
  /** The expiry of the lightning invoice in seconds. Default value is 86400 (1 day). **/
2056
2075
  expirySecs?: number | undefined;
2057
- /** The memo to include in the lightning invoice. **/
2076
+ /**
2077
+ * The memo to include in the lightning invoice. Should not be provided if the description_hash is
2078
+ * provided.
2079
+ **/
2058
2080
  memo?: string | undefined;
2059
2081
  /**
2060
2082
  * The public key of the user receiving the lightning invoice. If not present, the receiver will be
@@ -2063,7 +2085,8 @@ interface RequestLightningReceiveInput {
2063
2085
  receiverIdentityPubkey?: string | undefined;
2064
2086
  /**
2065
2087
  * The h tag of the invoice. This is the hash of a longer description to include in the lightning
2066
- * invoice. It is used in LNURL and UMA as the hash of the metadata.
2088
+ * invoice. It is used in LNURL and UMA as the hash of the metadata. This field is mutually exclusive
2089
+ * with the memo field. Only one or the other should be provided.
2067
2090
  **/
2068
2091
  descriptionHash?: string | undefined;
2069
2092
  }
@@ -2071,6 +2094,11 @@ interface RequestLightningReceiveInput {
2071
2094
  interface RequestLightningSendInput {
2072
2095
  encodedInvoice: string;
2073
2096
  idempotencyKey: string;
2097
+ /**
2098
+ * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
2099
+ * zero.
2100
+ **/
2101
+ amountSats?: number | undefined;
2074
2102
  }
2075
2103
 
2076
2104
  declare enum Network {
@@ -2126,6 +2154,7 @@ type ConfigOptions = MayHaveLrc20WalletApiConfig & MayHaveSspClientOptions & {
2126
2154
  readonly lrc20Address?: string;
2127
2155
  readonly threshold?: number;
2128
2156
  readonly tokenSignatures?: "ECDSA" | "SCHNORR";
2157
+ readonly tokenValidityDurationSeconds?: number;
2129
2158
  readonly tokenTransactionVersion?: "V0" | "V1";
2130
2159
  readonly electrsUrl?: string;
2131
2160
  readonly lrc20ApiConfig?: LRC20WalletApiConfig;
@@ -2154,6 +2183,7 @@ declare class WalletConfigService implements HasLrc20WalletApiConfig, HasSspClie
2154
2183
  getNetworkProto(): number;
2155
2184
  getTokenSignatures(): "ECDSA" | "SCHNORR";
2156
2185
  getTokenTransactionVersion(): "V0" | "V1";
2186
+ getTokenValidityDurationSeconds(): number;
2157
2187
  getElectrsUrl(): string;
2158
2188
  getSspIdentityPublicKey(): string;
2159
2189
  }
@@ -2385,6 +2415,7 @@ declare class ConnectionManager {
2385
2415
  getStreamChannel(address: string): Promise<Channel | Channel$1 | undefined>;
2386
2416
  private authenticate;
2387
2417
  private createSparkAuthnGrpcConnection;
2418
+ private createAuthnMiddleware;
2388
2419
  private createMiddleware;
2389
2420
  private createNodeMiddleware;
2390
2421
  private createBrowserMiddleware;
@@ -2820,6 +2851,7 @@ type PayLightningInvoiceParams = {
2820
2851
  invoice: string;
2821
2852
  maxFeeSats: number;
2822
2853
  preferSpark?: boolean;
2854
+ amountSatsToSend?: number;
2823
2855
  };
2824
2856
  type TransferParams = {
2825
2857
  amountSats: number;
@@ -3148,16 +3180,17 @@ declare class SparkWallet extends EventEmitter {
3148
3180
  * @param {Object} params - Parameters for paying the invoice
3149
3181
  * @param {string} params.invoice - The BOLT11-encoded Lightning invoice to pay
3150
3182
  * @param {boolean} [params.preferSpark] - Whether to prefer a spark transfer over lightning for the payment
3183
+ * @param {number} [params.amountSatsToSend] - The amount in sats to send. This is only valid for 0 amount lightning invoices.
3151
3184
  * @returns {Promise<LightningSendRequest>} The Lightning payment request details
3152
3185
  */
3153
- payLightningInvoice({ invoice, maxFeeSats, preferSpark, }: PayLightningInvoiceParams): Promise<LightningSendRequest | WalletTransfer>;
3186
+ payLightningInvoice({ invoice, maxFeeSats, preferSpark, amountSatsToSend, }: PayLightningInvoiceParams): Promise<LightningSendRequest | WalletTransfer>;
3154
3187
  /**
3155
3188
  * Gets fee estimate for sending Lightning payments.
3156
3189
  *
3157
3190
  * @param {LightningSendFeeEstimateInput} params - Input parameters for fee estimation
3158
3191
  * @returns {Promise<number>} Fee estimate for sending Lightning payments
3159
3192
  */
3160
- getLightningSendFeeEstimate({ encodedInvoice, }: LightningSendFeeEstimateInput): Promise<number>;
3193
+ getLightningSendFeeEstimate({ encodedInvoice, amountSats, }: LightningSendFeeEstimateInput): Promise<number>;
3161
3194
  /**
3162
3195
  * Generates a deposit address for a tree.
3163
3196
  *
@@ -3363,6 +3396,8 @@ declare class SparkWallet extends EventEmitter {
3363
3396
  declare function getLatestDepositTxId(address: string): Promise<string | null>;
3364
3397
  declare function isTxBroadcast(txid: string, baseUrl: string, network?: any): Promise<boolean>;
3365
3398
 
3399
+ declare function createDummyTx(address: string, amountSats: bigint): Promise<DummyTx>;
3400
+
3366
3401
  declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
3367
3402
  declare function generateAdaptorFromSignature(signature: Uint8Array): {
3368
3403
  adaptorSignature: Uint8Array;
@@ -3480,4 +3515,4 @@ declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRa
3480
3515
 
3481
3516
  declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
3482
3517
 
3483
- export { AuthenticationError, type BroadcastConfig, type BroadcastResult, ConfigurationError, DEFAULT_FEE_SATS, ReactNativeSparkSigner as DefaultSparkSigner, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, InternalValidationError, LRC_WALLET_NETWORK, LRC_WALLET_NETWORK_TYPE, type LeafInfo, Network, NetworkError, NetworkToProto, type NetworkType, NotImplementedError, RPCError, ReactNativeSparkSigner, SparkSDKError, SparkWallet, type TxChain, type Utxo, ValidationError, type VerifiableSecretShare, addPrivateKeys, addPublicKeys, applyAdaptorToSignature, applyAdditiveTweakToPublicKey, bigIntToPrivateKey, calculateAvailableTokenAmount, checkIfSelectedOutputsAreAvailable, checkIfValidSequence, collectResponses, computeTaprootKeyNoScript, computerLagrangeCoefficients, constructFeeBumpTx, constructUnilateralExitFeeBumpPackages, constructUnilateralExitTxs, createRefundTx, createSigningCommitment, createSigningNonce, decodeBytesToSigningCommitment, decodeBytesToSigningNonce, encodeSigningCommitmentToBytes, encodeSigningNonceToBytes, evaluatePolynomial, fieldDiv, filterTokenBalanceForTokenPublicKey, generateAdaptorFromSignature, generatePolynomialForSecretSharing, generateSignatureFromExistingAdaptor, getCurrentTimelock, getEphemeralAnchorOutput, getLatestDepositTxId, getNetwork, getNetworkFromAddress, getNetworkFromString, getNextTransactionSequence, getP2TRAddressFromPkScript, getP2TRAddressFromPublicKey, getP2TRScriptFromPublicKey, getP2WPKHAddressFromPublicKey, getRandomBigInt, getRandomSigningNonce, getSigHashFromTx, getSigningCommitmentFromNonce, getSparkAddressFromTaproot, getTransactionSequence, getTransferPackageSigningPayload, getTxFromRawTxBytes, getTxFromRawTxHex, getTxId, getTxIdNoReverse, isEphemeralAnchorOutput, isTxBroadcast, lastKeyWithTarget, maybeApplyFee, modInverse, proofOfPossessionMessageHashForDepositAddress, recoverSecret, splitSecret, splitSecretWithProofs, subtractPrivateKeys, subtractPublicKeys, sumOfPrivateKeys, validateOutboundAdaptorSignature, validateShare };
3518
+ export { AuthenticationError, type BroadcastConfig, type BroadcastResult, ConfigurationError, DEFAULT_FEE_SATS, ReactNativeSparkSigner as DefaultSparkSigner, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, InternalValidationError, LRC_WALLET_NETWORK, LRC_WALLET_NETWORK_TYPE, type LeafInfo, Network, NetworkError, NetworkToProto, type NetworkType, NotImplementedError, RPCError, ReactNativeSparkSigner, SparkSDKError, SparkWallet, type TxChain, type Utxo, ValidationError, type VerifiableSecretShare, addPrivateKeys, addPublicKeys, applyAdaptorToSignature, applyAdditiveTweakToPublicKey, bigIntToPrivateKey, calculateAvailableTokenAmount, checkIfSelectedOutputsAreAvailable, checkIfValidSequence, collectResponses, computeTaprootKeyNoScript, computerLagrangeCoefficients, constructFeeBumpTx, constructUnilateralExitFeeBumpPackages, constructUnilateralExitTxs, createDummyTx, createRefundTx, createSigningCommitment, createSigningNonce, decodeBytesToSigningCommitment, decodeBytesToSigningNonce, encodeSigningCommitmentToBytes, encodeSigningNonceToBytes, evaluatePolynomial, fieldDiv, filterTokenBalanceForTokenPublicKey, generateAdaptorFromSignature, generatePolynomialForSecretSharing, generateSignatureFromExistingAdaptor, getCurrentTimelock, getEphemeralAnchorOutput, getLatestDepositTxId, getNetwork, getNetworkFromAddress, getNetworkFromString, getNextTransactionSequence, getP2TRAddressFromPkScript, getP2TRAddressFromPublicKey, getP2TRScriptFromPublicKey, getP2WPKHAddressFromPublicKey, getRandomBigInt, getRandomSigningNonce, getSigHashFromTx, getSigningCommitmentFromNonce, getSparkAddressFromTaproot, getTransactionSequence, getTransferPackageSigningPayload, getTxFromRawTxBytes, getTxFromRawTxHex, getTxId, getTxIdNoReverse, isEphemeralAnchorOutput, isTxBroadcast, lastKeyWithTarget, maybeApplyFee, modInverse, proofOfPossessionMessageHashForDepositAddress, recoverSecret, splitSecret, splitSecretWithProofs, subtractPrivateKeys, subtractPublicKeys, sumOfPrivateKeys, validateOutboundAdaptorSignature, validateShare };
@@ -1395,6 +1395,10 @@ interface ISigningCommitment {
1395
1395
  hiding: Uint8Array;
1396
1396
  binding: Uint8Array;
1397
1397
  }
1398
+ interface DummyTx {
1399
+ tx: Uint8Array;
1400
+ txid: string;
1401
+ }
1398
1402
 
1399
1403
  type Polynomial = {
1400
1404
  fieldModulus: bigint;
@@ -1670,6 +1674,17 @@ interface CoopExitFeeEstimatesOutput {
1670
1674
  speedSlow?: CoopExitFeeEstimate | undefined;
1671
1675
  }
1672
1676
 
1677
+ declare enum ExitSpeed {
1678
+ /**
1679
+ * This is an enum value that represents values that could be added in the future.
1680
+ * Clients should support unknown values as more of them could be added without notice.
1681
+ */
1682
+ FUTURE_VALUE = "FUTURE_VALUE",
1683
+ FAST = "FAST",
1684
+ MEDIUM = "MEDIUM",
1685
+ SLOW = "SLOW"
1686
+ }
1687
+
1673
1688
  declare enum SparkCoopExitRequestStatus {
1674
1689
  /**
1675
1690
  * This is an enum value that represents values that could be added in the future.
@@ -1677,6 +1692,7 @@ declare enum SparkCoopExitRequestStatus {
1677
1692
  */
1678
1693
  FUTURE_VALUE = "FUTURE_VALUE",
1679
1694
  INITIATED = "INITIATED",
1695
+ INBOUND_TRANSFER_CHECKED = "INBOUND_TRANSFER_CHECKED",
1680
1696
  TX_SIGNED = "TX_SIGNED",
1681
1697
  TX_BROADCASTED = "TX_BROADCASTED",
1682
1698
  WAITING_ON_TX_CONFIRMATIONS = "WAITING_ON_TX_CONFIRMATIONS",
@@ -1789,6 +1805,8 @@ interface LightningReceiveRequest {
1789
1805
  transfer?: Transfer | undefined;
1790
1806
  /** The payment preimage of the invoice if retrieved from SE. **/
1791
1807
  paymentPreimage?: string | undefined;
1808
+ /** The receiver's identity public key if different from owner of the request. **/
1809
+ receiverIdentityPublicKey?: string | undefined;
1792
1810
  }
1793
1811
 
1794
1812
  interface LightningSendFeeEstimateOutput {
@@ -1842,13 +1860,13 @@ declare class SspClient {
1842
1860
  });
1843
1861
  executeRawQuery<T>(query: Query<T>, needsAuth?: boolean): Promise<T | null>;
1844
1862
  getSwapFeeEstimate(amountSats: number): Promise<LeavesSwapFeeEstimateOutput | null>;
1845
- getLightningSendFeeEstimate(encodedInvoice: string): Promise<LightningSendFeeEstimateOutput | null>;
1863
+ getLightningSendFeeEstimate(encodedInvoice: string, amountSats?: number): Promise<LightningSendFeeEstimateOutput | null>;
1846
1864
  getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
1847
1865
  getCurrentUser(): Promise<void>;
1848
1866
  completeCoopExit({ userOutboundTransferExternalId, coopExitRequestId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
1849
1867
  requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
1850
1868
  requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
1851
- requestLightningSend({ encodedInvoice, idempotencyKey, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
1869
+ requestLightningSend({ encodedInvoice, idempotencyKey, amountSats, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
1852
1870
  requestLeaveSwap({ adaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
1853
1871
  completeLeaveSwap({ adaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
1854
1872
  getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
@@ -1946,21 +1964,14 @@ interface CoopExitRequest {
1946
1964
  coopExitTxid: string;
1947
1965
  /** The typename of the object **/
1948
1966
  typename: string;
1967
+ /** The fee quote user requested for this coop exit. **/
1968
+ feeQuoteId?: string | undefined;
1969
+ /** The exit speed user requested for this coop exit. **/
1970
+ exitSpeed?: ExitSpeed | undefined;
1949
1971
  /** The swap transfer. **/
1950
1972
  transfer?: Transfer | undefined;
1951
1973
  }
1952
1974
 
1953
- declare enum ExitSpeed {
1954
- /**
1955
- * This is an enum value that represents values that could be added in the future.
1956
- * Clients should support unknown values as more of them could be added without notice.
1957
- */
1958
- FUTURE_VALUE = "FUTURE_VALUE",
1959
- FAST = "FAST",
1960
- MEDIUM = "MEDIUM",
1961
- SLOW = "SLOW"
1962
- }
1963
-
1964
1975
  interface GetChallengeOutput {
1965
1976
  protectedChallenge: string;
1966
1977
  }
@@ -1971,6 +1982,11 @@ interface LeavesSwapFeeEstimateOutput {
1971
1982
 
1972
1983
  interface LightningSendFeeEstimateInput {
1973
1984
  encodedInvoice: string;
1985
+ /**
1986
+ * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
1987
+ * zero.
1988
+ **/
1989
+ amountSats?: number | undefined;
1974
1990
  }
1975
1991
 
1976
1992
  declare enum LightningSendRequestStatus {
@@ -2022,6 +2038,8 @@ interface RequestCoopExitInput {
2022
2038
  idempotencyKey: string;
2023
2039
  exitSpeed: ExitSpeed;
2024
2040
  withdrawAll: boolean;
2041
+ feeLeafExternalIds?: string[] | undefined;
2042
+ feeQuoteId?: string | undefined;
2025
2043
  }
2026
2044
 
2027
2045
  interface UserLeafInput {
@@ -2037,6 +2055,7 @@ interface RequestLeavesSwapInput {
2037
2055
  feeSats: number;
2038
2056
  userLeaves: UserLeafInput[];
2039
2057
  idempotencyKey: string;
2058
+ targetAmountSatsList?: number[] | undefined;
2040
2059
  }
2041
2060
 
2042
2061
  interface RequestLightningReceiveInput {
@@ -2054,7 +2073,10 @@ interface RequestLightningReceiveInput {
2054
2073
  includeSparkAddress: boolean;
2055
2074
  /** The expiry of the lightning invoice in seconds. Default value is 86400 (1 day). **/
2056
2075
  expirySecs?: number | undefined;
2057
- /** The memo to include in the lightning invoice. **/
2076
+ /**
2077
+ * The memo to include in the lightning invoice. Should not be provided if the description_hash is
2078
+ * provided.
2079
+ **/
2058
2080
  memo?: string | undefined;
2059
2081
  /**
2060
2082
  * The public key of the user receiving the lightning invoice. If not present, the receiver will be
@@ -2063,7 +2085,8 @@ interface RequestLightningReceiveInput {
2063
2085
  receiverIdentityPubkey?: string | undefined;
2064
2086
  /**
2065
2087
  * The h tag of the invoice. This is the hash of a longer description to include in the lightning
2066
- * invoice. It is used in LNURL and UMA as the hash of the metadata.
2088
+ * invoice. It is used in LNURL and UMA as the hash of the metadata. This field is mutually exclusive
2089
+ * with the memo field. Only one or the other should be provided.
2067
2090
  **/
2068
2091
  descriptionHash?: string | undefined;
2069
2092
  }
@@ -2071,6 +2094,11 @@ interface RequestLightningReceiveInput {
2071
2094
  interface RequestLightningSendInput {
2072
2095
  encodedInvoice: string;
2073
2096
  idempotencyKey: string;
2097
+ /**
2098
+ * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
2099
+ * zero.
2100
+ **/
2101
+ amountSats?: number | undefined;
2074
2102
  }
2075
2103
 
2076
2104
  declare enum Network {
@@ -2126,6 +2154,7 @@ type ConfigOptions = MayHaveLrc20WalletApiConfig & MayHaveSspClientOptions & {
2126
2154
  readonly lrc20Address?: string;
2127
2155
  readonly threshold?: number;
2128
2156
  readonly tokenSignatures?: "ECDSA" | "SCHNORR";
2157
+ readonly tokenValidityDurationSeconds?: number;
2129
2158
  readonly tokenTransactionVersion?: "V0" | "V1";
2130
2159
  readonly electrsUrl?: string;
2131
2160
  readonly lrc20ApiConfig?: LRC20WalletApiConfig;
@@ -2154,6 +2183,7 @@ declare class WalletConfigService implements HasLrc20WalletApiConfig, HasSspClie
2154
2183
  getNetworkProto(): number;
2155
2184
  getTokenSignatures(): "ECDSA" | "SCHNORR";
2156
2185
  getTokenTransactionVersion(): "V0" | "V1";
2186
+ getTokenValidityDurationSeconds(): number;
2157
2187
  getElectrsUrl(): string;
2158
2188
  getSspIdentityPublicKey(): string;
2159
2189
  }
@@ -2385,6 +2415,7 @@ declare class ConnectionManager {
2385
2415
  getStreamChannel(address: string): Promise<Channel | Channel$1 | undefined>;
2386
2416
  private authenticate;
2387
2417
  private createSparkAuthnGrpcConnection;
2418
+ private createAuthnMiddleware;
2388
2419
  private createMiddleware;
2389
2420
  private createNodeMiddleware;
2390
2421
  private createBrowserMiddleware;
@@ -2820,6 +2851,7 @@ type PayLightningInvoiceParams = {
2820
2851
  invoice: string;
2821
2852
  maxFeeSats: number;
2822
2853
  preferSpark?: boolean;
2854
+ amountSatsToSend?: number;
2823
2855
  };
2824
2856
  type TransferParams = {
2825
2857
  amountSats: number;
@@ -3148,16 +3180,17 @@ declare class SparkWallet extends EventEmitter {
3148
3180
  * @param {Object} params - Parameters for paying the invoice
3149
3181
  * @param {string} params.invoice - The BOLT11-encoded Lightning invoice to pay
3150
3182
  * @param {boolean} [params.preferSpark] - Whether to prefer a spark transfer over lightning for the payment
3183
+ * @param {number} [params.amountSatsToSend] - The amount in sats to send. This is only valid for 0 amount lightning invoices.
3151
3184
  * @returns {Promise<LightningSendRequest>} The Lightning payment request details
3152
3185
  */
3153
- payLightningInvoice({ invoice, maxFeeSats, preferSpark, }: PayLightningInvoiceParams): Promise<LightningSendRequest | WalletTransfer>;
3186
+ payLightningInvoice({ invoice, maxFeeSats, preferSpark, amountSatsToSend, }: PayLightningInvoiceParams): Promise<LightningSendRequest | WalletTransfer>;
3154
3187
  /**
3155
3188
  * Gets fee estimate for sending Lightning payments.
3156
3189
  *
3157
3190
  * @param {LightningSendFeeEstimateInput} params - Input parameters for fee estimation
3158
3191
  * @returns {Promise<number>} Fee estimate for sending Lightning payments
3159
3192
  */
3160
- getLightningSendFeeEstimate({ encodedInvoice, }: LightningSendFeeEstimateInput): Promise<number>;
3193
+ getLightningSendFeeEstimate({ encodedInvoice, amountSats, }: LightningSendFeeEstimateInput): Promise<number>;
3161
3194
  /**
3162
3195
  * Generates a deposit address for a tree.
3163
3196
  *
@@ -3363,6 +3396,8 @@ declare class SparkWallet extends EventEmitter {
3363
3396
  declare function getLatestDepositTxId(address: string): Promise<string | null>;
3364
3397
  declare function isTxBroadcast(txid: string, baseUrl: string, network?: any): Promise<boolean>;
3365
3398
 
3399
+ declare function createDummyTx(address: string, amountSats: bigint): Promise<DummyTx>;
3400
+
3366
3401
  declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
3367
3402
  declare function generateAdaptorFromSignature(signature: Uint8Array): {
3368
3403
  adaptorSignature: Uint8Array;
@@ -3480,4 +3515,4 @@ declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRa
3480
3515
 
3481
3516
  declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
3482
3517
 
3483
- export { AuthenticationError, type BroadcastConfig, type BroadcastResult, ConfigurationError, DEFAULT_FEE_SATS, ReactNativeSparkSigner as DefaultSparkSigner, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, InternalValidationError, LRC_WALLET_NETWORK, LRC_WALLET_NETWORK_TYPE, type LeafInfo, Network, NetworkError, NetworkToProto, type NetworkType, NotImplementedError, RPCError, ReactNativeSparkSigner, SparkSDKError, SparkWallet, type TxChain, type Utxo, ValidationError, type VerifiableSecretShare, addPrivateKeys, addPublicKeys, applyAdaptorToSignature, applyAdditiveTweakToPublicKey, bigIntToPrivateKey, calculateAvailableTokenAmount, checkIfSelectedOutputsAreAvailable, checkIfValidSequence, collectResponses, computeTaprootKeyNoScript, computerLagrangeCoefficients, constructFeeBumpTx, constructUnilateralExitFeeBumpPackages, constructUnilateralExitTxs, createRefundTx, createSigningCommitment, createSigningNonce, decodeBytesToSigningCommitment, decodeBytesToSigningNonce, encodeSigningCommitmentToBytes, encodeSigningNonceToBytes, evaluatePolynomial, fieldDiv, filterTokenBalanceForTokenPublicKey, generateAdaptorFromSignature, generatePolynomialForSecretSharing, generateSignatureFromExistingAdaptor, getCurrentTimelock, getEphemeralAnchorOutput, getLatestDepositTxId, getNetwork, getNetworkFromAddress, getNetworkFromString, getNextTransactionSequence, getP2TRAddressFromPkScript, getP2TRAddressFromPublicKey, getP2TRScriptFromPublicKey, getP2WPKHAddressFromPublicKey, getRandomBigInt, getRandomSigningNonce, getSigHashFromTx, getSigningCommitmentFromNonce, getSparkAddressFromTaproot, getTransactionSequence, getTransferPackageSigningPayload, getTxFromRawTxBytes, getTxFromRawTxHex, getTxId, getTxIdNoReverse, isEphemeralAnchorOutput, isTxBroadcast, lastKeyWithTarget, maybeApplyFee, modInverse, proofOfPossessionMessageHashForDepositAddress, recoverSecret, splitSecret, splitSecretWithProofs, subtractPrivateKeys, subtractPublicKeys, sumOfPrivateKeys, validateOutboundAdaptorSignature, validateShare };
3518
+ export { AuthenticationError, type BroadcastConfig, type BroadcastResult, ConfigurationError, DEFAULT_FEE_SATS, ReactNativeSparkSigner as DefaultSparkSigner, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, InternalValidationError, LRC_WALLET_NETWORK, LRC_WALLET_NETWORK_TYPE, type LeafInfo, Network, NetworkError, NetworkToProto, type NetworkType, NotImplementedError, RPCError, ReactNativeSparkSigner, SparkSDKError, SparkWallet, type TxChain, type Utxo, ValidationError, type VerifiableSecretShare, addPrivateKeys, addPublicKeys, applyAdaptorToSignature, applyAdditiveTweakToPublicKey, bigIntToPrivateKey, calculateAvailableTokenAmount, checkIfSelectedOutputsAreAvailable, checkIfValidSequence, collectResponses, computeTaprootKeyNoScript, computerLagrangeCoefficients, constructFeeBumpTx, constructUnilateralExitFeeBumpPackages, constructUnilateralExitTxs, createDummyTx, createRefundTx, createSigningCommitment, createSigningNonce, decodeBytesToSigningCommitment, decodeBytesToSigningNonce, encodeSigningCommitmentToBytes, encodeSigningNonceToBytes, evaluatePolynomial, fieldDiv, filterTokenBalanceForTokenPublicKey, generateAdaptorFromSignature, generatePolynomialForSecretSharing, generateSignatureFromExistingAdaptor, getCurrentTimelock, getEphemeralAnchorOutput, getLatestDepositTxId, getNetwork, getNetworkFromAddress, getNetworkFromString, getNextTransactionSequence, getP2TRAddressFromPkScript, getP2TRAddressFromPublicKey, getP2TRScriptFromPublicKey, getP2WPKHAddressFromPublicKey, getRandomBigInt, getRandomSigningNonce, getSigHashFromTx, getSigningCommitmentFromNonce, getSparkAddressFromTaproot, getTransactionSequence, getTransferPackageSigningPayload, getTxFromRawTxBytes, getTxFromRawTxHex, getTxId, getTxIdNoReverse, isEphemeralAnchorOutput, isTxBroadcast, lastKeyWithTarget, maybeApplyFee, modInverse, proofOfPossessionMessageHashForDepositAddress, recoverSecret, splitSecret, splitSecretWithProofs, subtractPrivateKeys, subtractPublicKeys, sumOfPrivateKeys, validateOutboundAdaptorSignature, validateShare };