@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.
- package/CHANGELOG.md +15 -0
- package/android/src/main/jniLibs/arm64-v8a/libuniffi_spark_frost.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libuniffi_spark_frost.so +0 -0
- package/android/src/main/jniLibs/x86/libuniffi_spark_frost.so +0 -0
- package/android/src/main/jniLibs/x86_64/libuniffi_spark_frost.so +0 -0
- package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.cts +10 -0
- package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.ts +10 -0
- package/dist/{RequestLightningSendInput-mXUWn_cp.d.ts → RequestLightningSendInput-D7fZdT4A.d.ts} +35 -16
- package/dist/{RequestLightningSendInput-DXcLoiCe.d.cts → RequestLightningSendInput-Na1mHdWg.d.cts} +35 -16
- package/dist/address/index.cjs +38 -7
- package/dist/address/index.d.cts +2 -2
- package/dist/address/index.d.ts +2 -2
- package/dist/address/index.js +3 -3
- package/dist/{chunk-ATEHMLKP.js → chunk-6AFUC5M2.js} +1 -1
- package/dist/{chunk-ZXDE2XMU.js → chunk-BUTZWYBW.js} +9 -6
- package/dist/{chunk-7EFSUADA.js → chunk-DOA6QXYQ.js} +1 -0
- package/dist/{chunk-J5W5Q2ZP.js → chunk-DQYKQJRZ.js} +291 -7
- package/dist/{chunk-TWF35O6M.js → chunk-GSI4OLXZ.js} +32 -1
- package/dist/{chunk-2ZXXLPG2.js → chunk-GYQR4B4P.js} +5 -4
- package/dist/{chunk-ROKY5KS4.js → chunk-HRQRRDSS.js} +53 -15
- package/dist/{chunk-YEZDPUFY.js → chunk-IRW5TWMH.js} +8 -8
- package/dist/{chunk-7VMYMQLF.js → chunk-NSJF5F5O.js} +1 -1
- package/dist/{chunk-TM4TOEOX.js → chunk-O4RYNJNB.js} +3 -3
- package/dist/{chunk-MGPRLH6Q.js → chunk-QNNSEJ4P.js} +1 -1
- package/dist/{chunk-UKT6OFLO.js → chunk-TIUBYNN5.js} +13 -7
- package/dist/{chunk-6YVPOQ2A.js → chunk-TOSP3INR.js} +235 -143
- package/dist/chunk-VFJQNBFX.js +21 -0
- package/dist/{chunk-KKSU7OZO.js → chunk-WWOTVNPP.js} +195 -67
- package/dist/{chunk-HK6LPV6Z.js → chunk-Z5HIAYFT.js} +1 -1
- package/dist/graphql/objects/index.cjs +229 -135
- package/dist/graphql/objects/index.d.cts +54 -9
- package/dist/graphql/objects/index.d.ts +54 -9
- package/dist/graphql/objects/index.js +3 -3
- package/dist/{index-OSDtPMmC.d.ts → index-7RYRH5wc.d.ts} +10 -8
- package/dist/{index-CFh4uWzi.d.cts → index-BJOc8Ur-.d.cts} +10 -8
- package/dist/index.cjs +790 -315
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +26 -26
- package/dist/index.node.cjs +790 -315
- package/dist/index.node.d.cts +9 -8
- package/dist/index.node.d.ts +9 -8
- package/dist/index.node.js +26 -26
- package/dist/native/index.cjs +812 -332
- package/dist/native/index.d.cts +53 -18
- package/dist/native/index.d.ts +53 -18
- package/dist/native/index.js +659 -181
- package/dist/{network-BiwBmoOg.d.cts → network-D5lKssVl.d.cts} +1 -1
- package/dist/{network-BF2GYPye.d.ts → network-xkBSpaTn.d.ts} +1 -1
- package/dist/proto/lrc20.d.cts +1 -1
- package/dist/proto/lrc20.d.ts +1 -1
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark_token.d.cts +1 -1
- package/dist/proto/spark_token.d.ts +1 -1
- package/dist/{sdk-types-CfhdFnsA.d.cts → sdk-types-B-q9py_P.d.cts} +1 -1
- package/dist/{sdk-types-MnQrHolg.d.ts → sdk-types-BPoPgzda.d.ts} +1 -1
- package/dist/services/config.cjs +118 -69
- package/dist/services/config.d.cts +6 -4
- package/dist/services/config.d.ts +6 -4
- package/dist/services/config.js +9 -9
- package/dist/services/connection.cjs +95 -15
- package/dist/services/connection.d.cts +6 -4
- package/dist/services/connection.d.ts +6 -4
- package/dist/services/connection.js +3 -3
- package/dist/services/index.cjs +487 -117
- package/dist/services/index.d.cts +5 -4
- package/dist/services/index.d.ts +5 -4
- package/dist/services/index.js +19 -19
- package/dist/services/lrc-connection.cjs +50 -7
- package/dist/services/lrc-connection.d.cts +5 -4
- package/dist/services/lrc-connection.d.ts +5 -4
- package/dist/services/lrc-connection.js +3 -3
- package/dist/services/token-transactions.cjs +351 -36
- package/dist/services/token-transactions.d.cts +5 -4
- package/dist/services/token-transactions.d.ts +5 -4
- package/dist/services/token-transactions.js +6 -6
- package/dist/services/wallet-config.cjs +1 -0
- package/dist/services/wallet-config.d.cts +6 -4
- package/dist/services/wallet-config.d.ts +6 -4
- package/dist/services/wallet-config.js +1 -1
- package/dist/signer/signer.cjs +117 -64
- package/dist/signer/signer.d.cts +4 -3
- package/dist/signer/signer.d.ts +4 -3
- package/dist/signer/signer.js +15 -7
- package/dist/{signer-CylxIujU.d.ts → signer-IO3oMRNj.d.cts} +2 -1
- package/dist/{signer-BhLS7SYR.d.cts → signer-wqesWifN.d.ts} +2 -1
- package/dist/{spark-DjR1b3TC.d.cts → spark-CDm4gqS6.d.cts} +1 -1
- package/dist/{spark-DjR1b3TC.d.ts → spark-CDm4gqS6.d.ts} +1 -1
- package/dist/types/index.cjs +282 -188
- package/dist/types/index.d.cts +7 -6
- package/dist/types/index.d.ts +7 -6
- package/dist/types/index.js +3 -3
- package/dist/utils/index.cjs +90 -58
- package/dist/utils/index.d.cts +6 -5
- package/dist/utils/index.d.ts +6 -5
- package/dist/utils/index.js +16 -16
- package/ios/spark_frostFFI.xcframework/ios-arm64/SparkFrost +0 -0
- package/ios/spark_frostFFI.xcframework/ios-arm64/spark_frostFFI.framework/spark_frostFFI +0 -0
- package/ios/spark_frostFFI.xcframework/ios-arm64_x86_64-simulator/SparkFrost +0 -0
- package/ios/spark_frostFFI.xcframework/ios-arm64_x86_64-simulator/spark_frostFFI.framework/spark_frostFFI +0 -0
- package/ios/spark_frostFFI.xcframework/macos-arm64_x86_64/spark_frostFFI.framework/spark_frostFFI +0 -0
- package/package.json +4 -4
- package/src/constants.ts +21 -0
- package/src/errors/base.ts +43 -1
- package/src/graphql/client.ts +4 -0
- package/src/graphql/mutations/RequestLightningSend.ts +2 -0
- package/src/graphql/objects/ClaimStaticDepositInput.ts +1 -1
- package/src/graphql/objects/ClaimStaticDepositStatus.ts +4 -2
- package/src/graphql/objects/Connection.ts +7 -7
- package/src/graphql/objects/CoopExitFeeEstimate.ts +1 -1
- package/src/graphql/objects/CoopExitFeeQuote.ts +202 -0
- package/src/graphql/objects/CoopExitFeeQuoteInput.ts +41 -0
- package/src/graphql/objects/CoopExitFeeQuoteOutput.ts +45 -0
- package/src/graphql/objects/CoopExitRequest.ts +21 -0
- package/src/graphql/objects/CurrencyUnit.ts +26 -28
- package/src/graphql/objects/Entity.ts +84 -0
- package/src/graphql/objects/Invoice.ts +2 -2
- package/src/graphql/objects/Leaf.ts +1 -1
- package/src/graphql/objects/LeavesSwapFeeEstimateOutput.ts +1 -1
- package/src/graphql/objects/LeavesSwapRequest.ts +6 -0
- package/src/graphql/objects/LightningReceiveRequest.ts +11 -0
- package/src/graphql/objects/LightningSendFeeEstimateInput.ts +8 -0
- package/src/graphql/objects/LightningSendFeeEstimateOutput.ts +1 -1
- package/src/graphql/objects/LightningSendRequest.ts +3 -0
- package/src/graphql/objects/RequestCoopExitInput.ts +8 -0
- package/src/graphql/objects/RequestLeavesSwapInput.ts +5 -1
- package/src/graphql/objects/RequestLightningReceiveInput.ts +9 -2
- package/src/graphql/objects/RequestLightningSendInput.ts +8 -0
- package/src/graphql/objects/SparkCoopExitRequestStatus.ts +2 -0
- package/src/graphql/objects/SparkUserRequestType.ts +2 -0
- package/src/graphql/objects/SparkWalletUser.ts +20 -0
- package/src/graphql/objects/UserRequest.ts +32 -0
- package/src/graphql/objects/VerifyChallengeInput.ts +1 -1
- package/src/graphql/objects/index.ts +12 -3
- package/src/graphql/queries/LightningSendFeeEstimate.ts +2 -0
- package/src/logger.ts +3 -0
- package/src/native/index.ts +1 -0
- package/src/services/config.ts +4 -0
- package/src/services/connection.ts +68 -29
- package/src/services/coop-exit.ts +1 -1
- package/src/services/lightning.ts +25 -1
- package/src/services/lrc-connection.ts +3 -3
- package/src/services/token-transactions.ts +6 -2
- package/src/services/wallet-config.ts +2 -0
- package/src/signer/signer.ts +4 -1
- package/src/spark-wallet/spark-wallet.ts +51 -15
- package/src/spark-wallet/types.ts +1 -0
- package/src/tests/errors.test.ts +58 -0
- package/src/tests/integration/lightning.test.ts +184 -0
- package/src/tests/integration/ssp/static_deposit.test.ts +1 -2
- package/src/tests/tokens.test.ts +52 -3
- package/src/utils/token-hashing.ts +335 -1
- package/dist/LightningSendFeeEstimateInput-CJvPnCSB.d.cts +0 -5
- package/dist/LightningSendFeeEstimateInput-CJvPnCSB.d.ts +0 -5
- package/dist/chunk-HKAKEKCE.js +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @buildonspark/spark-sdk
|
|
2
2
|
|
|
3
|
+
## 0.1.43
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- - Improve serialization for some error context values (be15609)
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @buildonspark/lrc20-sdk@0.0.58
|
|
10
|
+
|
|
11
|
+
## 0.1.42
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- - Add X-Client-Env with SDK and env information
|
|
16
|
+
- Make use of Swap V2 endpoints in coop exit + lightning sends
|
|
17
|
+
|
|
3
18
|
## 0.1.41
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface LightningSendFeeEstimateInput {
|
|
2
|
+
encodedInvoice: string;
|
|
3
|
+
/**
|
|
4
|
+
* The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
|
|
5
|
+
* zero.
|
|
6
|
+
**/
|
|
7
|
+
amountSats?: number | undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type { LightningSendFeeEstimateInput as L };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface LightningSendFeeEstimateInput {
|
|
2
|
+
encodedInvoice: string;
|
|
3
|
+
/**
|
|
4
|
+
* The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
|
|
5
|
+
* zero.
|
|
6
|
+
**/
|
|
7
|
+
amountSats?: number | undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type { LightningSendFeeEstimateInput as L };
|
package/dist/{RequestLightningSendInput-mXUWn_cp.d.ts → RequestLightningSendInput-D7fZdT4A.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Query } from '@lightsparkdev/core';
|
|
2
2
|
import { B as BitcoinNetwork } from './BitcoinNetwork-TnABML0T.js';
|
|
3
|
-
import { S as SparkSigner } from './signer-
|
|
3
|
+
import { S as SparkSigner } from './signer-wqesWifN.js';
|
|
4
4
|
|
|
5
5
|
/** This enum identifies the unit of currency associated with a CurrencyAmount. **/
|
|
6
6
|
declare enum CurrencyUnit {
|
|
@@ -90,6 +90,17 @@ interface CoopExitFeeEstimatesOutput {
|
|
|
90
90
|
speedSlow?: CoopExitFeeEstimate | undefined;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
declare enum ExitSpeed {
|
|
94
|
+
/**
|
|
95
|
+
* This is an enum value that represents values that could be added in the future.
|
|
96
|
+
* Clients should support unknown values as more of them could be added without notice.
|
|
97
|
+
*/
|
|
98
|
+
FUTURE_VALUE = "FUTURE_VALUE",
|
|
99
|
+
FAST = "FAST",
|
|
100
|
+
MEDIUM = "MEDIUM",
|
|
101
|
+
SLOW = "SLOW"
|
|
102
|
+
}
|
|
103
|
+
|
|
93
104
|
declare enum SparkCoopExitRequestStatus {
|
|
94
105
|
/**
|
|
95
106
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -97,6 +108,7 @@ declare enum SparkCoopExitRequestStatus {
|
|
|
97
108
|
*/
|
|
98
109
|
FUTURE_VALUE = "FUTURE_VALUE",
|
|
99
110
|
INITIATED = "INITIATED",
|
|
111
|
+
INBOUND_TRANSFER_CHECKED = "INBOUND_TRANSFER_CHECKED",
|
|
100
112
|
TX_SIGNED = "TX_SIGNED",
|
|
101
113
|
TX_BROADCASTED = "TX_BROADCASTED",
|
|
102
114
|
WAITING_ON_TX_CONFIRMATIONS = "WAITING_ON_TX_CONFIRMATIONS",
|
|
@@ -210,6 +222,8 @@ interface LightningReceiveRequest {
|
|
|
210
222
|
transfer?: Transfer | undefined;
|
|
211
223
|
/** The payment preimage of the invoice if retrieved from SE. **/
|
|
212
224
|
paymentPreimage?: string | undefined;
|
|
225
|
+
/** The receiver's identity public key if different from owner of the request. **/
|
|
226
|
+
receiverIdentityPublicKey?: string | undefined;
|
|
213
227
|
}
|
|
214
228
|
declare const getLightningReceiveRequestQuery: (id: string) => Query<LightningReceiveRequest>;
|
|
215
229
|
|
|
@@ -264,13 +278,13 @@ declare class SspClient {
|
|
|
264
278
|
});
|
|
265
279
|
executeRawQuery<T>(query: Query<T>, needsAuth?: boolean): Promise<T | null>;
|
|
266
280
|
getSwapFeeEstimate(amountSats: number): Promise<LeavesSwapFeeEstimateOutput | null>;
|
|
267
|
-
getLightningSendFeeEstimate(encodedInvoice: string): Promise<LightningSendFeeEstimateOutput | null>;
|
|
281
|
+
getLightningSendFeeEstimate(encodedInvoice: string, amountSats?: number): Promise<LightningSendFeeEstimateOutput | null>;
|
|
268
282
|
getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
|
|
269
283
|
getCurrentUser(): Promise<void>;
|
|
270
284
|
completeCoopExit({ userOutboundTransferExternalId, coopExitRequestId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
|
|
271
285
|
requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
|
|
272
286
|
requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
|
|
273
|
-
requestLightningSend({ encodedInvoice, idempotencyKey, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
|
|
287
|
+
requestLightningSend({ encodedInvoice, idempotencyKey, amountSats, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
|
|
274
288
|
requestLeaveSwap({ adaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
|
|
275
289
|
completeLeaveSwap({ adaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
|
|
276
290
|
getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
|
|
@@ -368,22 +382,15 @@ interface CoopExitRequest {
|
|
|
368
382
|
coopExitTxid: string;
|
|
369
383
|
/** The typename of the object **/
|
|
370
384
|
typename: string;
|
|
385
|
+
/** The fee quote user requested for this coop exit. **/
|
|
386
|
+
feeQuoteId?: string | undefined;
|
|
387
|
+
/** The exit speed user requested for this coop exit. **/
|
|
388
|
+
exitSpeed?: ExitSpeed | undefined;
|
|
371
389
|
/** The swap transfer. **/
|
|
372
390
|
transfer?: Transfer | undefined;
|
|
373
391
|
}
|
|
374
392
|
declare const getCoopExitRequestQuery: (id: string) => Query<CoopExitRequest>;
|
|
375
393
|
|
|
376
|
-
declare enum ExitSpeed {
|
|
377
|
-
/**
|
|
378
|
-
* This is an enum value that represents values that could be added in the future.
|
|
379
|
-
* Clients should support unknown values as more of them could be added without notice.
|
|
380
|
-
*/
|
|
381
|
-
FUTURE_VALUE = "FUTURE_VALUE",
|
|
382
|
-
FAST = "FAST",
|
|
383
|
-
MEDIUM = "MEDIUM",
|
|
384
|
-
SLOW = "SLOW"
|
|
385
|
-
}
|
|
386
|
-
|
|
387
394
|
interface GetChallengeOutput {
|
|
388
395
|
protectedChallenge: string;
|
|
389
396
|
}
|
|
@@ -442,6 +449,8 @@ interface RequestCoopExitInput {
|
|
|
442
449
|
idempotencyKey: string;
|
|
443
450
|
exitSpeed: ExitSpeed;
|
|
444
451
|
withdrawAll: boolean;
|
|
452
|
+
feeLeafExternalIds?: string[] | undefined;
|
|
453
|
+
feeQuoteId?: string | undefined;
|
|
445
454
|
}
|
|
446
455
|
|
|
447
456
|
interface UserLeafInput {
|
|
@@ -457,6 +466,7 @@ interface RequestLeavesSwapInput {
|
|
|
457
466
|
feeSats: number;
|
|
458
467
|
userLeaves: UserLeafInput[];
|
|
459
468
|
idempotencyKey: string;
|
|
469
|
+
targetAmountSatsList?: number[] | undefined;
|
|
460
470
|
}
|
|
461
471
|
|
|
462
472
|
interface RequestLightningReceiveInput {
|
|
@@ -474,7 +484,10 @@ interface RequestLightningReceiveInput {
|
|
|
474
484
|
includeSparkAddress: boolean;
|
|
475
485
|
/** The expiry of the lightning invoice in seconds. Default value is 86400 (1 day). **/
|
|
476
486
|
expirySecs?: number | undefined;
|
|
477
|
-
/**
|
|
487
|
+
/**
|
|
488
|
+
* The memo to include in the lightning invoice. Should not be provided if the description_hash is
|
|
489
|
+
* provided.
|
|
490
|
+
**/
|
|
478
491
|
memo?: string | undefined;
|
|
479
492
|
/**
|
|
480
493
|
* The public key of the user receiving the lightning invoice. If not present, the receiver will be
|
|
@@ -483,7 +496,8 @@ interface RequestLightningReceiveInput {
|
|
|
483
496
|
receiverIdentityPubkey?: string | undefined;
|
|
484
497
|
/**
|
|
485
498
|
* The h tag of the invoice. This is the hash of a longer description to include in the lightning
|
|
486
|
-
* invoice. It is used in LNURL and UMA as the hash of the metadata.
|
|
499
|
+
* invoice. It is used in LNURL and UMA as the hash of the metadata. This field is mutually exclusive
|
|
500
|
+
* with the memo field. Only one or the other should be provided.
|
|
487
501
|
**/
|
|
488
502
|
descriptionHash?: string | undefined;
|
|
489
503
|
}
|
|
@@ -491,6 +505,11 @@ interface RequestLightningReceiveInput {
|
|
|
491
505
|
interface RequestLightningSendInput {
|
|
492
506
|
encodedInvoice: string;
|
|
493
507
|
idempotencyKey: string;
|
|
508
|
+
/**
|
|
509
|
+
* The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
|
|
510
|
+
* zero.
|
|
511
|
+
**/
|
|
512
|
+
amountSats?: number | undefined;
|
|
494
513
|
}
|
|
495
514
|
|
|
496
515
|
export { type SwapLeaf as A, type SspClientOptions as B, type ClaimStaticDepositOutput as C, SspClient as D, ExitSpeed as E, type GetChallengeOutput as G, type HasSspClientOptions as H, type Invoice as I, type Leaf as L, type MayHaveSspClientOptions as M, type PageInfo as P, type RequestCoopExitInput as R, SparkCoopExitRequestStatus as S, Transfer as T, type UserLeafInput as U, type VerifyChallengeOutput as V, type CompleteCoopExitInput as a, type CompleteLeavesSwapInput as b, type CoopExitFeeEstimate as c, type CoopExitFeeEstimatesInput as d, type CoopExitFeeEstimatesOutput as e, type CoopExitRequest as f, getCoopExitRequestQuery as g, type CurrencyAmount as h, CurrencyUnit as i, type LeavesSwapFeeEstimateOutput as j, getLeavesSwapRequestQuery as k, type LeavesSwapRequest as l, getLightningReceiveRequestQuery as m, type LightningReceiveRequest as n, LightningReceiveRequestStatus as o, type LightningSendFeeEstimateOutput as p, getLightningSendRequestQuery as q, type LightningSendRequest as r, LightningSendRequestStatus as s, type RequestLeavesSwapInput as t, type RequestLightningReceiveInput as u, type RequestLightningSendInput as v, SparkLeavesSwapRequestStatus as w, type SparkTransferToLeavesConnection as x, type StaticDepositQuoteInput as y, type StaticDepositQuoteOutput as z };
|
package/dist/{RequestLightningSendInput-DXcLoiCe.d.cts → RequestLightningSendInput-Na1mHdWg.d.cts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Query } from '@lightsparkdev/core';
|
|
2
2
|
import { B as BitcoinNetwork } from './BitcoinNetwork-TnABML0T.cjs';
|
|
3
|
-
import { S as SparkSigner } from './signer-
|
|
3
|
+
import { S as SparkSigner } from './signer-IO3oMRNj.cjs';
|
|
4
4
|
|
|
5
5
|
/** This enum identifies the unit of currency associated with a CurrencyAmount. **/
|
|
6
6
|
declare enum CurrencyUnit {
|
|
@@ -90,6 +90,17 @@ interface CoopExitFeeEstimatesOutput {
|
|
|
90
90
|
speedSlow?: CoopExitFeeEstimate | undefined;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
declare enum ExitSpeed {
|
|
94
|
+
/**
|
|
95
|
+
* This is an enum value that represents values that could be added in the future.
|
|
96
|
+
* Clients should support unknown values as more of them could be added without notice.
|
|
97
|
+
*/
|
|
98
|
+
FUTURE_VALUE = "FUTURE_VALUE",
|
|
99
|
+
FAST = "FAST",
|
|
100
|
+
MEDIUM = "MEDIUM",
|
|
101
|
+
SLOW = "SLOW"
|
|
102
|
+
}
|
|
103
|
+
|
|
93
104
|
declare enum SparkCoopExitRequestStatus {
|
|
94
105
|
/**
|
|
95
106
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -97,6 +108,7 @@ declare enum SparkCoopExitRequestStatus {
|
|
|
97
108
|
*/
|
|
98
109
|
FUTURE_VALUE = "FUTURE_VALUE",
|
|
99
110
|
INITIATED = "INITIATED",
|
|
111
|
+
INBOUND_TRANSFER_CHECKED = "INBOUND_TRANSFER_CHECKED",
|
|
100
112
|
TX_SIGNED = "TX_SIGNED",
|
|
101
113
|
TX_BROADCASTED = "TX_BROADCASTED",
|
|
102
114
|
WAITING_ON_TX_CONFIRMATIONS = "WAITING_ON_TX_CONFIRMATIONS",
|
|
@@ -210,6 +222,8 @@ interface LightningReceiveRequest {
|
|
|
210
222
|
transfer?: Transfer | undefined;
|
|
211
223
|
/** The payment preimage of the invoice if retrieved from SE. **/
|
|
212
224
|
paymentPreimage?: string | undefined;
|
|
225
|
+
/** The receiver's identity public key if different from owner of the request. **/
|
|
226
|
+
receiverIdentityPublicKey?: string | undefined;
|
|
213
227
|
}
|
|
214
228
|
declare const getLightningReceiveRequestQuery: (id: string) => Query<LightningReceiveRequest>;
|
|
215
229
|
|
|
@@ -264,13 +278,13 @@ declare class SspClient {
|
|
|
264
278
|
});
|
|
265
279
|
executeRawQuery<T>(query: Query<T>, needsAuth?: boolean): Promise<T | null>;
|
|
266
280
|
getSwapFeeEstimate(amountSats: number): Promise<LeavesSwapFeeEstimateOutput | null>;
|
|
267
|
-
getLightningSendFeeEstimate(encodedInvoice: string): Promise<LightningSendFeeEstimateOutput | null>;
|
|
281
|
+
getLightningSendFeeEstimate(encodedInvoice: string, amountSats?: number): Promise<LightningSendFeeEstimateOutput | null>;
|
|
268
282
|
getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
|
|
269
283
|
getCurrentUser(): Promise<void>;
|
|
270
284
|
completeCoopExit({ userOutboundTransferExternalId, coopExitRequestId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
|
|
271
285
|
requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
|
|
272
286
|
requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
|
|
273
|
-
requestLightningSend({ encodedInvoice, idempotencyKey, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
|
|
287
|
+
requestLightningSend({ encodedInvoice, idempotencyKey, amountSats, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
|
|
274
288
|
requestLeaveSwap({ adaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
|
|
275
289
|
completeLeaveSwap({ adaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
|
|
276
290
|
getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
|
|
@@ -368,22 +382,15 @@ interface CoopExitRequest {
|
|
|
368
382
|
coopExitTxid: string;
|
|
369
383
|
/** The typename of the object **/
|
|
370
384
|
typename: string;
|
|
385
|
+
/** The fee quote user requested for this coop exit. **/
|
|
386
|
+
feeQuoteId?: string | undefined;
|
|
387
|
+
/** The exit speed user requested for this coop exit. **/
|
|
388
|
+
exitSpeed?: ExitSpeed | undefined;
|
|
371
389
|
/** The swap transfer. **/
|
|
372
390
|
transfer?: Transfer | undefined;
|
|
373
391
|
}
|
|
374
392
|
declare const getCoopExitRequestQuery: (id: string) => Query<CoopExitRequest>;
|
|
375
393
|
|
|
376
|
-
declare enum ExitSpeed {
|
|
377
|
-
/**
|
|
378
|
-
* This is an enum value that represents values that could be added in the future.
|
|
379
|
-
* Clients should support unknown values as more of them could be added without notice.
|
|
380
|
-
*/
|
|
381
|
-
FUTURE_VALUE = "FUTURE_VALUE",
|
|
382
|
-
FAST = "FAST",
|
|
383
|
-
MEDIUM = "MEDIUM",
|
|
384
|
-
SLOW = "SLOW"
|
|
385
|
-
}
|
|
386
|
-
|
|
387
394
|
interface GetChallengeOutput {
|
|
388
395
|
protectedChallenge: string;
|
|
389
396
|
}
|
|
@@ -442,6 +449,8 @@ interface RequestCoopExitInput {
|
|
|
442
449
|
idempotencyKey: string;
|
|
443
450
|
exitSpeed: ExitSpeed;
|
|
444
451
|
withdrawAll: boolean;
|
|
452
|
+
feeLeafExternalIds?: string[] | undefined;
|
|
453
|
+
feeQuoteId?: string | undefined;
|
|
445
454
|
}
|
|
446
455
|
|
|
447
456
|
interface UserLeafInput {
|
|
@@ -457,6 +466,7 @@ interface RequestLeavesSwapInput {
|
|
|
457
466
|
feeSats: number;
|
|
458
467
|
userLeaves: UserLeafInput[];
|
|
459
468
|
idempotencyKey: string;
|
|
469
|
+
targetAmountSatsList?: number[] | undefined;
|
|
460
470
|
}
|
|
461
471
|
|
|
462
472
|
interface RequestLightningReceiveInput {
|
|
@@ -474,7 +484,10 @@ interface RequestLightningReceiveInput {
|
|
|
474
484
|
includeSparkAddress: boolean;
|
|
475
485
|
/** The expiry of the lightning invoice in seconds. Default value is 86400 (1 day). **/
|
|
476
486
|
expirySecs?: number | undefined;
|
|
477
|
-
/**
|
|
487
|
+
/**
|
|
488
|
+
* The memo to include in the lightning invoice. Should not be provided if the description_hash is
|
|
489
|
+
* provided.
|
|
490
|
+
**/
|
|
478
491
|
memo?: string | undefined;
|
|
479
492
|
/**
|
|
480
493
|
* The public key of the user receiving the lightning invoice. If not present, the receiver will be
|
|
@@ -483,7 +496,8 @@ interface RequestLightningReceiveInput {
|
|
|
483
496
|
receiverIdentityPubkey?: string | undefined;
|
|
484
497
|
/**
|
|
485
498
|
* The h tag of the invoice. This is the hash of a longer description to include in the lightning
|
|
486
|
-
* invoice. It is used in LNURL and UMA as the hash of the metadata.
|
|
499
|
+
* invoice. It is used in LNURL and UMA as the hash of the metadata. This field is mutually exclusive
|
|
500
|
+
* with the memo field. Only one or the other should be provided.
|
|
487
501
|
**/
|
|
488
502
|
descriptionHash?: string | undefined;
|
|
489
503
|
}
|
|
@@ -491,6 +505,11 @@ interface RequestLightningReceiveInput {
|
|
|
491
505
|
interface RequestLightningSendInput {
|
|
492
506
|
encodedInvoice: string;
|
|
493
507
|
idempotencyKey: string;
|
|
508
|
+
/**
|
|
509
|
+
* The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
|
|
510
|
+
* zero.
|
|
511
|
+
**/
|
|
512
|
+
amountSats?: number | undefined;
|
|
494
513
|
}
|
|
495
514
|
|
|
496
515
|
export { type SwapLeaf as A, type SspClientOptions as B, type ClaimStaticDepositOutput as C, SspClient as D, ExitSpeed as E, type GetChallengeOutput as G, type HasSspClientOptions as H, type Invoice as I, type Leaf as L, type MayHaveSspClientOptions as M, type PageInfo as P, type RequestCoopExitInput as R, SparkCoopExitRequestStatus as S, Transfer as T, type UserLeafInput as U, type VerifyChallengeOutput as V, type CompleteCoopExitInput as a, type CompleteLeavesSwapInput as b, type CoopExitFeeEstimate as c, type CoopExitFeeEstimatesInput as d, type CoopExitFeeEstimatesOutput as e, type CoopExitRequest as f, getCoopExitRequestQuery as g, type CurrencyAmount as h, CurrencyUnit as i, type LeavesSwapFeeEstimateOutput as j, getLeavesSwapRequestQuery as k, type LeavesSwapRequest as l, getLightningReceiveRequestQuery as m, type LightningReceiveRequest as n, LightningReceiveRequestStatus as o, type LightningSendFeeEstimateOutput as p, getLightningSendRequestQuery as q, type LightningSendRequest as r, LightningSendRequestStatus as s, type RequestLeavesSwapInput as t, type RequestLightningReceiveInput as u, type RequestLightningSendInput as v, SparkLeavesSwapRequestStatus as w, type SparkTransferToLeavesConnection as x, type StaticDepositQuoteInput as y, type StaticDepositQuoteOutput as z };
|
package/dist/address/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@ if (typeof window !== "undefined") {
|
|
|
43
43
|
|
|
44
44
|
// src/address/address.ts
|
|
45
45
|
var import_secp256k1 = require("@noble/curves/secp256k1");
|
|
46
|
-
var
|
|
46
|
+
var import_utils2 = require("@noble/hashes/utils");
|
|
47
47
|
var import_base2 = require("@scure/base");
|
|
48
48
|
|
|
49
49
|
// src/proto/spark.ts
|
|
@@ -253,6 +253,7 @@ function isSet(value) {
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
// src/errors/base.ts
|
|
256
|
+
var import_utils = require("@noble/hashes/utils");
|
|
256
257
|
var SparkSDKError = class extends Error {
|
|
257
258
|
context;
|
|
258
259
|
originalError;
|
|
@@ -284,12 +285,42 @@ var SparkSDKError = class extends Error {
|
|
|
284
285
|
}
|
|
285
286
|
};
|
|
286
287
|
function getMessage(message, context = {}, originalError) {
|
|
287
|
-
const contextStr = Object.entries(context).map(([key, value]) => `${key}: ${
|
|
288
|
+
const contextStr = Object.entries(context).map(([key, value]) => `${key}: ${safeStringify(value)}`).join(", ");
|
|
288
289
|
const originalErrorStr = originalError ? `
|
|
289
290
|
Original Error: ${originalError.message}` : "";
|
|
290
291
|
return `SparkSDKError: ${message}${contextStr ? `
|
|
291
292
|
Context: ${contextStr}` : ""}${originalErrorStr}`;
|
|
292
293
|
}
|
|
294
|
+
function safeStringify(value) {
|
|
295
|
+
const replacer = (_, v) => {
|
|
296
|
+
if (typeof v === "bigint") {
|
|
297
|
+
return v.toString();
|
|
298
|
+
}
|
|
299
|
+
if (v instanceof Uint8Array) {
|
|
300
|
+
return formatUint8Array(v);
|
|
301
|
+
}
|
|
302
|
+
return v;
|
|
303
|
+
};
|
|
304
|
+
if (typeof value === "bigint") {
|
|
305
|
+
return `"${value.toString()}"`;
|
|
306
|
+
}
|
|
307
|
+
if (value instanceof Uint8Array) {
|
|
308
|
+
return `"${formatUint8Array(value)}"`;
|
|
309
|
+
}
|
|
310
|
+
try {
|
|
311
|
+
const result = JSON.stringify(value, replacer);
|
|
312
|
+
return result === void 0 ? String(value) : result;
|
|
313
|
+
} catch {
|
|
314
|
+
try {
|
|
315
|
+
return String(value);
|
|
316
|
+
} catch {
|
|
317
|
+
return "[Unserializable]";
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
function formatUint8Array(arr) {
|
|
322
|
+
return `Uint8Array(0x${(0, import_utils.bytesToHex)(arr)})`;
|
|
323
|
+
}
|
|
293
324
|
|
|
294
325
|
// src/errors/types.ts
|
|
295
326
|
var ValidationError = class extends SparkSDKError {
|
|
@@ -300,7 +331,7 @@ var ValidationError = class extends SparkSDKError {
|
|
|
300
331
|
|
|
301
332
|
// src/address/address.ts
|
|
302
333
|
var import_uuidv7 = require("uuidv7");
|
|
303
|
-
var
|
|
334
|
+
var import_utils3 = require("@noble/curves/abstract/utils");
|
|
304
335
|
var AddressNetwork = {
|
|
305
336
|
MAINNET: "sp",
|
|
306
337
|
TESTNET: "spt",
|
|
@@ -316,7 +347,7 @@ function encodeSparkAddress(payload) {
|
|
|
316
347
|
paymentIntentFields = payload.paymentIntentFields;
|
|
317
348
|
}
|
|
318
349
|
const sparkAddressProto = SparkAddress.create({
|
|
319
|
-
identityPublicKey: (0,
|
|
350
|
+
identityPublicKey: (0, import_utils2.hexToBytes)(payload.identityPublicKey),
|
|
320
351
|
paymentIntentFields
|
|
321
352
|
});
|
|
322
353
|
const serializedPayload = SparkAddress.encode(sparkAddressProto).finish();
|
|
@@ -348,7 +379,7 @@ function decodeSparkAddress(address, network) {
|
|
|
348
379
|
});
|
|
349
380
|
}
|
|
350
381
|
const payload = SparkAddress.decode(import_base2.bech32m.fromWords(decoded.words));
|
|
351
|
-
const publicKey = (0,
|
|
382
|
+
const publicKey = (0, import_utils2.bytesToHex)(payload.identityPublicKey);
|
|
352
383
|
isValidPublicKey(publicKey);
|
|
353
384
|
const paymentIntentFields = payload.paymentIntentFields;
|
|
354
385
|
return {
|
|
@@ -356,8 +387,8 @@ function decodeSparkAddress(address, network) {
|
|
|
356
387
|
network,
|
|
357
388
|
paymentIntentFields: paymentIntentFields && {
|
|
358
389
|
id: import_uuidv7.UUID.ofInner(paymentIntentFields.id).toString(),
|
|
359
|
-
assetIdentifier: paymentIntentFields.assetIdentifier ? (0,
|
|
360
|
-
assetAmount: (0,
|
|
390
|
+
assetIdentifier: paymentIntentFields.assetIdentifier ? (0, import_utils2.bytesToHex)(paymentIntentFields.assetIdentifier) : void 0,
|
|
391
|
+
assetAmount: (0, import_utils3.bytesToNumberBE)(paymentIntentFields.assetAmount),
|
|
361
392
|
memo: paymentIntentFields.memo
|
|
362
393
|
}
|
|
363
394
|
};
|
package/dist/address/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PaymentIntentFields } from '../spark-
|
|
2
|
-
import { a as NetworkType } from '../network-
|
|
1
|
+
import { P as PaymentIntentFields } from '../spark-CDm4gqS6.cjs';
|
|
2
|
+
import { a as NetworkType } from '../network-D5lKssVl.cjs';
|
|
3
3
|
import '@bufbuild/protobuf/wire';
|
|
4
4
|
import 'nice-grpc-common';
|
|
5
5
|
import '@buildonspark/lrc20-sdk';
|
package/dist/address/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PaymentIntentFields } from '../spark-
|
|
2
|
-
import { a as NetworkType } from '../network-
|
|
1
|
+
import { P as PaymentIntentFields } from '../spark-CDm4gqS6.js';
|
|
2
|
+
import { a as NetworkType } from '../network-xkBSpaTn.js';
|
|
3
3
|
import '@bufbuild/protobuf/wire';
|
|
4
4
|
import 'nice-grpc-common';
|
|
5
5
|
import '@buildonspark/lrc20-sdk';
|
package/dist/address/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
encodeSparkAddress,
|
|
5
5
|
isValidPublicKey,
|
|
6
6
|
isValidSparkAddress
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-VTUGIIWI.js";
|
|
9
|
-
import "../chunk-TWF35O6M.js";
|
|
7
|
+
} from "../chunk-O4RYNJNB.js";
|
|
10
8
|
import "../chunk-M6A4KFIG.js";
|
|
9
|
+
import "../chunk-VTUGIIWI.js";
|
|
10
|
+
import "../chunk-GSI4OLXZ.js";
|
|
11
11
|
import "../chunk-MVRQ5US7.js";
|
|
12
12
|
export {
|
|
13
13
|
decodeSparkAddress,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DefaultSparkSigner
|
|
3
|
-
} from "./chunk-UKT6OFLO.js";
|
|
4
1
|
import {
|
|
5
2
|
Network,
|
|
6
3
|
NetworkToProto
|
|
7
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Z5HIAYFT.js";
|
|
8
5
|
import {
|
|
9
6
|
LOCAL_WALLET_CONFIG,
|
|
10
7
|
MAINNET_WALLET_CONFIG,
|
|
11
8
|
REGTEST_WALLET_CONFIG
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DOA6QXYQ.js";
|
|
10
|
+
import {
|
|
11
|
+
DefaultSparkSigner
|
|
12
|
+
} from "./chunk-TIUBYNN5.js";
|
|
13
13
|
import {
|
|
14
14
|
ConfigurationError
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GSI4OLXZ.js";
|
|
16
16
|
|
|
17
17
|
// src/services/config.ts
|
|
18
18
|
var WalletConfigService = class {
|
|
@@ -97,6 +97,9 @@ var WalletConfigService = class {
|
|
|
97
97
|
getTokenTransactionVersion() {
|
|
98
98
|
return this.config.tokenTransactionVersion;
|
|
99
99
|
}
|
|
100
|
+
getTokenValidityDurationSeconds() {
|
|
101
|
+
return this.config.tokenValidityDurationSeconds;
|
|
102
|
+
}
|
|
100
103
|
getElectrsUrl() {
|
|
101
104
|
return this.config.electrsUrl;
|
|
102
105
|
}
|
|
@@ -130,6 +130,7 @@ var BASE_CONFIG = {
|
|
|
130
130
|
signingOperators: getLocalSigningOperators(),
|
|
131
131
|
tokenSignatures: "SCHNORR",
|
|
132
132
|
tokenTransactionVersion: "V0",
|
|
133
|
+
tokenValidityDurationSeconds: 180,
|
|
133
134
|
electrsUrl: getElectrsUrl("LOCAL"),
|
|
134
135
|
expectedWithdrawBondSats: 1e4,
|
|
135
136
|
expectedWithdrawRelativeBlockLocktime: 1e3,
|