@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.
- package/CHANGELOG.md +7 -0
- package/dist/{RequestLightningSendInput-Na1mHdWg.d.cts → RequestLightningSendInput-BxbCtwpV.d.cts} +43 -4
- package/dist/{RequestLightningSendInput-D7fZdT4A.d.ts → RequestLightningSendInput-RGel43ks.d.ts} +43 -4
- package/dist/address/index.d.cts +2 -2
- package/dist/address/index.d.ts +2 -2
- package/dist/address/index.js +2 -2
- package/dist/{chunk-M6A4KFIG.js → chunk-4Q2ZDYYU.js} +332 -221
- package/dist/{chunk-WWOTVNPP.js → chunk-A2ZLMH6I.js} +323 -142
- package/dist/{chunk-VA7MV4MZ.js → chunk-B3AMIGJG.js} +1 -1
- package/dist/{chunk-DQYKQJRZ.js → chunk-CIZNCBKE.js} +29 -9
- package/dist/{chunk-BUTZWYBW.js → chunk-DAXGVPVM.js} +2 -2
- package/dist/{chunk-DOA6QXYQ.js → chunk-EKFD62HN.js} +2 -1
- package/dist/{chunk-TIUBYNN5.js → chunk-HTMXTJRK.js} +1 -1
- package/dist/{chunk-TOSP3INR.js → chunk-I54FARY2.js} +4 -2
- package/dist/{chunk-MIVX3GHD.js → chunk-K4BJARWM.js} +1 -1
- package/dist/{chunk-O4RYNJNB.js → chunk-KEKGSH7B.js} +1 -1
- package/dist/{chunk-GYQR4B4P.js → chunk-NBCNYDWJ.js} +2 -2
- package/dist/{chunk-ABZA6R5S.js → chunk-SQKXGAIR.js} +1 -1
- package/dist/{chunk-VFJQNBFX.js → chunk-UBT6EDVJ.js} +5 -2
- package/dist/{chunk-HRQRRDSS.js → chunk-WPTRVD2V.js} +3 -3
- package/dist/{chunk-IRW5TWMH.js → chunk-XX4RRWOX.js} +5 -5
- package/dist/graphql/objects/index.d.cts +5 -43
- package/dist/graphql/objects/index.d.ts +5 -43
- package/dist/graphql/objects/index.js +1 -1
- package/dist/{index-BJOc8Ur-.d.cts → index-CZmDdSts.d.cts} +24 -10
- package/dist/{index-7RYRH5wc.d.ts → index-ClIRO_3y.d.ts} +24 -10
- package/dist/index.cjs +827 -414
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +15 -15
- package/dist/index.node.cjs +830 -417
- package/dist/index.node.d.cts +7 -7
- package/dist/index.node.d.ts +7 -7
- package/dist/index.node.js +18 -18
- package/dist/native/index.cjs +827 -414
- package/dist/native/index.d.cts +88 -23
- package/dist/native/index.d.ts +88 -23
- package/dist/native/index.js +819 -407
- package/dist/{network-D5lKssVl.d.cts → network-CfxLnaot.d.cts} +1 -1
- package/dist/{network-xkBSpaTn.d.ts → network-CroCOQ0B.d.ts} +1 -1
- package/dist/proto/lrc20.d.cts +1 -1
- package/dist/proto/lrc20.d.ts +1 -1
- package/dist/proto/lrc20.js +2 -2
- package/dist/proto/spark.cjs +332 -221
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +3 -5
- package/dist/proto/spark_token.cjs +149 -9
- package/dist/proto/spark_token.d.cts +1 -1
- package/dist/proto/spark_token.d.ts +1 -1
- package/dist/proto/spark_token.js +2 -2
- package/dist/{sdk-types-B-q9py_P.d.cts → sdk-types-BeCBoozO.d.cts} +1 -1
- package/dist/{sdk-types-BPoPgzda.d.ts → sdk-types-CTbTdDbE.d.ts} +1 -1
- package/dist/services/config.cjs +7 -3
- package/dist/services/config.d.cts +4 -4
- package/dist/services/config.d.ts +4 -4
- package/dist/services/config.js +5 -5
- package/dist/services/connection.cjs +334 -218
- package/dist/services/connection.d.cts +4 -4
- package/dist/services/connection.d.ts +4 -4
- package/dist/services/connection.js +4 -4
- package/dist/services/index.cjs +364 -227
- package/dist/services/index.d.cts +4 -4
- package/dist/services/index.d.ts +4 -4
- package/dist/services/index.js +9 -9
- package/dist/services/lrc-connection.cjs +5 -2
- package/dist/services/lrc-connection.d.cts +4 -4
- package/dist/services/lrc-connection.d.ts +4 -4
- package/dist/services/lrc-connection.js +4 -4
- package/dist/services/token-transactions.cjs +28 -8
- package/dist/services/token-transactions.d.cts +4 -4
- package/dist/services/token-transactions.d.ts +4 -4
- package/dist/services/token-transactions.js +3 -3
- package/dist/services/wallet-config.cjs +2 -1
- package/dist/services/wallet-config.d.cts +4 -4
- package/dist/services/wallet-config.d.ts +4 -4
- package/dist/services/wallet-config.js +1 -1
- package/dist/signer/signer.cjs +5 -2
- package/dist/signer/signer.d.cts +2 -2
- package/dist/signer/signer.d.ts +2 -2
- package/dist/signer/signer.js +2 -2
- package/dist/{signer-wqesWifN.d.ts → signer-D7vfYik9.d.ts} +1 -1
- package/dist/{signer-IO3oMRNj.d.cts → signer-DaY8c60s.d.cts} +1 -1
- package/dist/{spark-CDm4gqS6.d.ts → spark-C4ZrsgjC.d.cts} +47 -29
- package/dist/{spark-CDm4gqS6.d.cts → spark-C4ZrsgjC.d.ts} +47 -29
- package/dist/types/index.cjs +331 -219
- package/dist/types/index.d.cts +5 -5
- package/dist/types/index.d.ts +5 -5
- package/dist/types/index.js +3 -3
- package/dist/utils/index.cjs +298 -28
- package/dist/utils/index.d.cts +5 -5
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.js +6 -6
- package/package.json +1 -1
- package/src/constants.ts +5 -1
- package/src/graphql/client.ts +28 -0
- package/src/graphql/mutations/RequestCoopExit.ts +6 -0
- package/src/graphql/mutations/RequestSwapLeaves.ts +2 -0
- package/src/graphql/queries/GetCoopExitFeeQuote.ts +20 -0
- package/src/proto/spark.ts +454 -322
- package/src/services/token-transactions.ts +12 -0
- package/src/services/transfer.ts +0 -3
- package/src/services/wallet-config.ts +1 -0
- package/src/spark-wallet/spark-wallet.node.ts +3 -3
- package/src/spark-wallet/spark-wallet.ts +301 -125
- package/src/tests/integration/deposit.test.ts +16 -0
- package/src/tests/integration/ssp/coop-exit.test.ts +85 -21
- package/src/tests/integration/ssp/swap.test.ts +47 -0
- package/src/tests/tokens.test.ts +3 -2
- package/src/utils/token-hashing.ts +28 -10
- package/src/utils/transaction.ts +2 -2
- package/src/logger.ts +0 -3
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-6AFUC5M2.js";
|
|
6
6
|
import {
|
|
7
7
|
decodeSparkAddress
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KEKGSH7B.js";
|
|
9
9
|
import {
|
|
10
10
|
bigIntToPrivateKey,
|
|
11
11
|
recoverSecret
|
|
@@ -536,17 +536,30 @@ function hashTokenTransactionV1(tokenTransaction, partialHash = false) {
|
|
|
536
536
|
);
|
|
537
537
|
hashObj.update(networkBytes);
|
|
538
538
|
allHashes.push(hashObj.digest());
|
|
539
|
-
const
|
|
540
|
-
const
|
|
541
|
-
const
|
|
542
|
-
new
|
|
539
|
+
const clientTimestampHashObj = sha256.create();
|
|
540
|
+
const clientCreatedTs = tokenTransaction.clientCreatedTimestamp;
|
|
541
|
+
const clientUnixTime = clientCreatedTs ? Math.floor(clientCreatedTs.getTime() / 1e3) : 0;
|
|
542
|
+
const clientTimestampBytes = new Uint8Array(8);
|
|
543
|
+
new DataView(clientTimestampBytes.buffer).setBigUint64(
|
|
543
544
|
0,
|
|
544
|
-
BigInt(
|
|
545
|
+
BigInt(clientUnixTime),
|
|
545
546
|
false
|
|
546
|
-
// false for big-endian
|
|
547
547
|
);
|
|
548
|
-
|
|
549
|
-
allHashes.push(
|
|
548
|
+
clientTimestampHashObj.update(clientTimestampBytes);
|
|
549
|
+
allHashes.push(clientTimestampHashObj.digest());
|
|
550
|
+
if (!partialHash) {
|
|
551
|
+
const expiryHashObj = sha256.create();
|
|
552
|
+
const expiryTimeBytes = new Uint8Array(8);
|
|
553
|
+
const expiryUnixTime = tokenTransaction.expiryTime ? Math.floor(tokenTransaction.expiryTime.getTime() / 1e3) : 0;
|
|
554
|
+
new DataView(expiryTimeBytes.buffer).setBigUint64(
|
|
555
|
+
0,
|
|
556
|
+
BigInt(expiryUnixTime),
|
|
557
|
+
false
|
|
558
|
+
// false for big-endian
|
|
559
|
+
);
|
|
560
|
+
expiryHashObj.update(expiryTimeBytes);
|
|
561
|
+
allHashes.push(expiryHashObj.digest());
|
|
562
|
+
}
|
|
550
563
|
const finalHashObj = sha256.create();
|
|
551
564
|
const concatenatedHashes = new Uint8Array(
|
|
552
565
|
allHashes.reduce((sum, hash) => sum + hash.length, 0)
|
|
@@ -976,6 +989,9 @@ var TokenTransactionService = class {
|
|
|
976
989
|
return txId;
|
|
977
990
|
}
|
|
978
991
|
async constructTransferTokenTransactionV0(selectedOutputs, tokenOutputData) {
|
|
992
|
+
selectedOutputs.sort(
|
|
993
|
+
(a, b) => a.previousTransactionVout - b.previousTransactionVout
|
|
994
|
+
);
|
|
979
995
|
const availableTokenAmount = calculateAvailableTokenAmount(selectedOutputs);
|
|
980
996
|
const totalRequestedAmount = tokenOutputData.reduce(
|
|
981
997
|
(sum, output) => sum + output.tokenAmount,
|
|
@@ -1011,6 +1027,9 @@ var TokenTransactionService = class {
|
|
|
1011
1027
|
};
|
|
1012
1028
|
}
|
|
1013
1029
|
async constructTransferTokenTransaction(selectedOutputs, tokenOutputData) {
|
|
1030
|
+
selectedOutputs.sort(
|
|
1031
|
+
(a, b) => a.previousTransactionVout - b.previousTransactionVout
|
|
1032
|
+
);
|
|
1014
1033
|
const availableTokenAmount = calculateAvailableTokenAmount(selectedOutputs);
|
|
1015
1034
|
const totalRequestedAmount = tokenOutputData.reduce(
|
|
1016
1035
|
(sum, output) => sum + output.tokenAmount,
|
|
@@ -1477,6 +1496,7 @@ var TokenTransactionService = class {
|
|
|
1477
1496
|
await coordinatorClient.commit_transaction(
|
|
1478
1497
|
{
|
|
1479
1498
|
finalTokenTransaction,
|
|
1499
|
+
finalTokenTransactionHash,
|
|
1480
1500
|
inputTtxoSignaturesPerOperator,
|
|
1481
1501
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey()
|
|
1482
1502
|
},
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
LOCAL_WALLET_CONFIG,
|
|
7
7
|
MAINNET_WALLET_CONFIG,
|
|
8
8
|
REGTEST_WALLET_CONFIG
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EKFD62HN.js";
|
|
10
10
|
import {
|
|
11
11
|
DefaultSparkSigner
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HTMXTJRK.js";
|
|
13
13
|
import {
|
|
14
14
|
ConfigurationError
|
|
15
15
|
} from "./chunk-GSI4OLXZ.js";
|
|
@@ -1479,11 +1479,13 @@ export {
|
|
|
1479
1479
|
FRAGMENT6 as FRAGMENT4,
|
|
1480
1480
|
getLightningSendRequestQuery,
|
|
1481
1481
|
ClaimStaticDepositRequestType_default,
|
|
1482
|
+
CoopExitFeeQuoteFromJson,
|
|
1483
|
+
FRAGMENT2 as FRAGMENT5,
|
|
1484
|
+
getCoopExitFeeQuoteQuery,
|
|
1482
1485
|
ClaimStaticDepositStatus_default,
|
|
1483
|
-
FRAGMENT7 as
|
|
1486
|
+
FRAGMENT7 as FRAGMENT6,
|
|
1484
1487
|
getUserRequestQuery,
|
|
1485
1488
|
getClaimStaticDepositQuery,
|
|
1486
|
-
getCoopExitFeeQuoteQuery,
|
|
1487
1489
|
SparkUserRequestStatus_default,
|
|
1488
1490
|
SparkUserRequestType_default,
|
|
1489
1491
|
SparkWalletUser_default
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SparkServiceDefinition
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SQKXGAIR.js";
|
|
4
4
|
import {
|
|
5
5
|
clientEnv,
|
|
6
6
|
isBun,
|
|
7
7
|
isReactNative
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-UBT6EDVJ.js";
|
|
9
9
|
import {
|
|
10
10
|
NetworkError
|
|
11
11
|
} from "./chunk-GSI4OLXZ.js";
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
import { isNode } from "@lightsparkdev/core";
|
|
3
3
|
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
4
4
|
var isBun = globalThis.Bun !== void 0;
|
|
5
|
-
var packageVersion = true ? "0.1.
|
|
5
|
+
var packageVersion = true ? "0.1.44" : "unknown";
|
|
6
6
|
var baseEnvStr = "unknown";
|
|
7
|
-
if (
|
|
7
|
+
if (isBun) {
|
|
8
|
+
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
9
|
+
baseEnvStr = `bun/${bunVersion}`;
|
|
10
|
+
} else if (isNode) {
|
|
8
11
|
baseEnvStr = `node/${process.version}`;
|
|
9
12
|
} else if (isReactNative) {
|
|
10
13
|
baseEnvStr = "react-native";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SparkTokenServiceDefinition
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B3AMIGJG.js";
|
|
4
4
|
import {
|
|
5
5
|
Empty,
|
|
6
6
|
SparkServiceDefinition
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4Q2ZDYYU.js";
|
|
8
8
|
import {
|
|
9
9
|
clientEnv,
|
|
10
10
|
isBun,
|
|
11
11
|
isReactNative
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UBT6EDVJ.js";
|
|
13
13
|
import {
|
|
14
14
|
AuthenticationError,
|
|
15
15
|
NetworkError
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
encodeSparkAddress
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KEKGSH7B.js";
|
|
4
4
|
import {
|
|
5
5
|
getNetwork,
|
|
6
6
|
getNetworkFromAddress
|
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
ELECTRS_CREDENTIALS,
|
|
10
10
|
getElectrsUrl
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EKFD62HN.js";
|
|
12
12
|
import {
|
|
13
13
|
BitcoinNetwork_default
|
|
14
14
|
} from "./chunk-HMLOC6TE.js";
|
|
15
15
|
import {
|
|
16
16
|
TreeNode
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4Q2ZDYYU.js";
|
|
18
18
|
import {
|
|
19
19
|
ValidationError
|
|
20
20
|
} from "./chunk-GSI4OLXZ.js";
|
|
@@ -316,8 +316,8 @@ function getNextTransactionSequence(currSequence, forRefresh) {
|
|
|
316
316
|
needRefresh: true
|
|
317
317
|
};
|
|
318
318
|
}
|
|
319
|
-
if (nextTimelock <
|
|
320
|
-
throw new ValidationError("timelock interval is less than
|
|
319
|
+
if (nextTimelock < 0) {
|
|
320
|
+
throw new ValidationError("timelock interval is less than 0", {
|
|
321
321
|
field: "nextTimelock",
|
|
322
322
|
value: nextTimelock
|
|
323
323
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { B as BitcoinNetwork } from '../../BitcoinNetwork-TnABML0T.cjs';
|
|
2
2
|
import { Query } from '@lightsparkdev/core';
|
|
3
|
-
import {
|
|
4
|
-
export { C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as
|
|
3
|
+
import { k as CurrencyAmount, P as PageInfo, K as SspClient } from '../../RequestLightningSendInput-BxbCtwpV.cjs';
|
|
4
|
+
export { C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as CoopExitFeeQuote, h as CoopExitFeeQuoteInput, i as CoopExitRequest, l as CurrencyUnit, E as ExitSpeed, G as GetChallengeOutput, I as Invoice, L as Leaf, m as LeavesSwapFeeEstimateOutput, o as LeavesSwapRequest, q as LightningReceiveRequest, r as LightningReceiveRequestStatus, s as LightningSendFeeEstimateOutput, u as LightningSendRequest, v as LightningSendRequestStatus, R as RequestCoopExitInput, w as RequestLeavesSwapInput, x as RequestLightningReceiveInput, y as RequestLightningSendInput, S as SparkCoopExitRequestStatus, z as SparkLeavesSwapRequestStatus, A as SparkTransferToLeavesConnection, B as StaticDepositQuoteInput, D as StaticDepositQuoteOutput, F as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitFeeQuoteQuery, j as getCoopExitRequestQuery, n as getLeavesSwapRequestQuery, p as getLightningReceiveRequestQuery, t as getLightningSendRequestQuery } from '../../RequestLightningSendInput-BxbCtwpV.cjs';
|
|
5
5
|
export { L as LightningSendFeeEstimateInput } from '../../LightningSendFeeEstimateInput-BgOhEAI-.cjs';
|
|
6
|
-
import '../../signer-
|
|
6
|
+
import '../../signer-DaY8c60s.cjs';
|
|
7
7
|
import '@scure/bip32';
|
|
8
|
-
import '../../spark-
|
|
8
|
+
import '../../spark-C4ZrsgjC.cjs';
|
|
9
9
|
import '@bufbuild/protobuf/wire';
|
|
10
10
|
import 'nice-grpc-common';
|
|
11
11
|
import '@buildonspark/lrc20-sdk';
|
|
@@ -121,44 +121,6 @@ interface Connection {
|
|
|
121
121
|
typename: string;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
interface CoopExitFeeQuote {
|
|
125
|
-
/**
|
|
126
|
-
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
127
|
-
* string.
|
|
128
|
-
**/
|
|
129
|
-
id: string;
|
|
130
|
-
/** The date and time when the entity was first created. **/
|
|
131
|
-
createdAt: string;
|
|
132
|
-
/** The date and time when the entity was last updated. **/
|
|
133
|
-
updatedAt: string;
|
|
134
|
-
/** The network the coop exit fee quote is on. **/
|
|
135
|
-
network: BitcoinNetwork;
|
|
136
|
-
/** The total currency amount of all the nodes user swapped for the coop exit quote. **/
|
|
137
|
-
totalAmount: CurrencyAmount;
|
|
138
|
-
/** The fee user pays for the coop exit not including the L1 broadcast fee when exit speed is fast. **/
|
|
139
|
-
userFeeFast: CurrencyAmount;
|
|
140
|
-
/** The fee user pays for the coop exit not including the L1 broadcast fee when exit speed is medium. **/
|
|
141
|
-
userFeeMedium: CurrencyAmount;
|
|
142
|
-
/** The fee user pays for the coop exit not including the L1 broadcast fee when exit speed is slow. **/
|
|
143
|
-
userFeeSlow: CurrencyAmount;
|
|
144
|
-
/** The L1 broadcast fee user pays for the coop exit when exit speed is fast. **/
|
|
145
|
-
l1BroadcastFeeFast: CurrencyAmount;
|
|
146
|
-
/** The L1 broadcast fee user pays for the coop exit when exit speed is medium. **/
|
|
147
|
-
l1BroadcastFeeMedium: CurrencyAmount;
|
|
148
|
-
/** The L1 broadcast fee user pays for the coop exit when exit speed is slow. **/
|
|
149
|
-
l1BroadcastFeeSlow: CurrencyAmount;
|
|
150
|
-
/** The time when the coop exit fee quote expires. **/
|
|
151
|
-
expiresAt: string;
|
|
152
|
-
/** The typename of the object **/
|
|
153
|
-
typename: string;
|
|
154
|
-
}
|
|
155
|
-
declare const getCoopExitFeeQuoteQuery: (id: string) => Query<CoopExitFeeQuote>;
|
|
156
|
-
|
|
157
|
-
interface CoopExitFeeQuoteInput {
|
|
158
|
-
leafExternalIds: string[];
|
|
159
|
-
withdrawalAddress: string;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
124
|
interface CoopExitFeeQuoteOutput {
|
|
163
125
|
quoteId: string;
|
|
164
126
|
}
|
|
@@ -328,4 +290,4 @@ interface WalletUserIdentityPublicKeyOutput {
|
|
|
328
290
|
identityPublicKey: string;
|
|
329
291
|
}
|
|
330
292
|
|
|
331
|
-
export { BitcoinNetwork, type ClaimStaticDeposit, type ClaimStaticDepositInput, ClaimStaticDepositRequestType, ClaimStaticDepositStatus, type CompleteCoopExitOutput, type CompleteLeavesSwapOutput, type CompleteSeedReleaseInput, type CompleteSeedReleaseOutput, type Connection, type
|
|
293
|
+
export { BitcoinNetwork, type ClaimStaticDeposit, type ClaimStaticDepositInput, ClaimStaticDepositRequestType, ClaimStaticDepositStatus, type CompleteCoopExitOutput, type CompleteLeavesSwapOutput, type CompleteSeedReleaseInput, type CompleteSeedReleaseOutput, type Connection, type CoopExitFeeQuoteOutput, CurrencyAmount, type Entity, type GetChallengeInput, type LeavesSwapFeeEstimateInput, type NotifyReceiverTransferInput, PageInfo, type Provider, type RequestCoopExitOutput, type RequestLeavesSwapOutput, type RequestLightningReceiveOutput, type RequestLightningSendOutput, SparkUserRequestStatus, SparkUserRequestType, SparkWalletUser, type SparkWalletUserToUserRequestsConnection, type StartSeedReleaseInput, type UserRequest, type VerifyChallengeInput, type WalletUserIdentityPublicKeyInput, type WalletUserIdentityPublicKeyOutput, getClaimStaticDepositQuery, getUserRequestQuery };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { B as BitcoinNetwork } from '../../BitcoinNetwork-TnABML0T.js';
|
|
2
2
|
import { Query } from '@lightsparkdev/core';
|
|
3
|
-
import {
|
|
4
|
-
export { C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as
|
|
3
|
+
import { k as CurrencyAmount, P as PageInfo, K as SspClient } from '../../RequestLightningSendInput-RGel43ks.js';
|
|
4
|
+
export { C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as CoopExitFeeQuote, h as CoopExitFeeQuoteInput, i as CoopExitRequest, l as CurrencyUnit, E as ExitSpeed, G as GetChallengeOutput, I as Invoice, L as Leaf, m as LeavesSwapFeeEstimateOutput, o as LeavesSwapRequest, q as LightningReceiveRequest, r as LightningReceiveRequestStatus, s as LightningSendFeeEstimateOutput, u as LightningSendRequest, v as LightningSendRequestStatus, R as RequestCoopExitInput, w as RequestLeavesSwapInput, x as RequestLightningReceiveInput, y as RequestLightningSendInput, S as SparkCoopExitRequestStatus, z as SparkLeavesSwapRequestStatus, A as SparkTransferToLeavesConnection, B as StaticDepositQuoteInput, D as StaticDepositQuoteOutput, F as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitFeeQuoteQuery, j as getCoopExitRequestQuery, n as getLeavesSwapRequestQuery, p as getLightningReceiveRequestQuery, t as getLightningSendRequestQuery } from '../../RequestLightningSendInput-RGel43ks.js';
|
|
5
5
|
export { L as LightningSendFeeEstimateInput } from '../../LightningSendFeeEstimateInput-BgOhEAI-.js';
|
|
6
|
-
import '../../signer-
|
|
6
|
+
import '../../signer-D7vfYik9.js';
|
|
7
7
|
import '@scure/bip32';
|
|
8
|
-
import '../../spark-
|
|
8
|
+
import '../../spark-C4ZrsgjC.js';
|
|
9
9
|
import '@bufbuild/protobuf/wire';
|
|
10
10
|
import 'nice-grpc-common';
|
|
11
11
|
import '@buildonspark/lrc20-sdk';
|
|
@@ -121,44 +121,6 @@ interface Connection {
|
|
|
121
121
|
typename: string;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
interface CoopExitFeeQuote {
|
|
125
|
-
/**
|
|
126
|
-
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
127
|
-
* string.
|
|
128
|
-
**/
|
|
129
|
-
id: string;
|
|
130
|
-
/** The date and time when the entity was first created. **/
|
|
131
|
-
createdAt: string;
|
|
132
|
-
/** The date and time when the entity was last updated. **/
|
|
133
|
-
updatedAt: string;
|
|
134
|
-
/** The network the coop exit fee quote is on. **/
|
|
135
|
-
network: BitcoinNetwork;
|
|
136
|
-
/** The total currency amount of all the nodes user swapped for the coop exit quote. **/
|
|
137
|
-
totalAmount: CurrencyAmount;
|
|
138
|
-
/** The fee user pays for the coop exit not including the L1 broadcast fee when exit speed is fast. **/
|
|
139
|
-
userFeeFast: CurrencyAmount;
|
|
140
|
-
/** The fee user pays for the coop exit not including the L1 broadcast fee when exit speed is medium. **/
|
|
141
|
-
userFeeMedium: CurrencyAmount;
|
|
142
|
-
/** The fee user pays for the coop exit not including the L1 broadcast fee when exit speed is slow. **/
|
|
143
|
-
userFeeSlow: CurrencyAmount;
|
|
144
|
-
/** The L1 broadcast fee user pays for the coop exit when exit speed is fast. **/
|
|
145
|
-
l1BroadcastFeeFast: CurrencyAmount;
|
|
146
|
-
/** The L1 broadcast fee user pays for the coop exit when exit speed is medium. **/
|
|
147
|
-
l1BroadcastFeeMedium: CurrencyAmount;
|
|
148
|
-
/** The L1 broadcast fee user pays for the coop exit when exit speed is slow. **/
|
|
149
|
-
l1BroadcastFeeSlow: CurrencyAmount;
|
|
150
|
-
/** The time when the coop exit fee quote expires. **/
|
|
151
|
-
expiresAt: string;
|
|
152
|
-
/** The typename of the object **/
|
|
153
|
-
typename: string;
|
|
154
|
-
}
|
|
155
|
-
declare const getCoopExitFeeQuoteQuery: (id: string) => Query<CoopExitFeeQuote>;
|
|
156
|
-
|
|
157
|
-
interface CoopExitFeeQuoteInput {
|
|
158
|
-
leafExternalIds: string[];
|
|
159
|
-
withdrawalAddress: string;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
124
|
interface CoopExitFeeQuoteOutput {
|
|
163
125
|
quoteId: string;
|
|
164
126
|
}
|
|
@@ -328,4 +290,4 @@ interface WalletUserIdentityPublicKeyOutput {
|
|
|
328
290
|
identityPublicKey: string;
|
|
329
291
|
}
|
|
330
292
|
|
|
331
|
-
export { BitcoinNetwork, type ClaimStaticDeposit, type ClaimStaticDepositInput, ClaimStaticDepositRequestType, ClaimStaticDepositStatus, type CompleteCoopExitOutput, type CompleteLeavesSwapOutput, type CompleteSeedReleaseInput, type CompleteSeedReleaseOutput, type Connection, type
|
|
293
|
+
export { BitcoinNetwork, type ClaimStaticDeposit, type ClaimStaticDepositInput, ClaimStaticDepositRequestType, ClaimStaticDepositStatus, type CompleteCoopExitOutput, type CompleteLeavesSwapOutput, type CompleteSeedReleaseInput, type CompleteSeedReleaseOutput, type Connection, type CoopExitFeeQuoteOutput, CurrencyAmount, type Entity, type GetChallengeInput, type LeavesSwapFeeEstimateInput, type NotifyReceiverTransferInput, PageInfo, type Provider, type RequestCoopExitOutput, type RequestLeavesSwapOutput, type RequestLightningReceiveOutput, type RequestLightningSendOutput, SparkUserRequestStatus, SparkUserRequestType, SparkWalletUser, type SparkWalletUserToUserRequestsConnection, type StartSeedReleaseInput, type UserRequest, type VerifyChallengeInput, type WalletUserIdentityPublicKeyInput, type WalletUserIdentityPublicKeyOutput, getClaimStaticDepositQuery, getUserRequestQuery };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as LeavesSwapFeeEstimateOutput, D as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, q as LightningReceiveRequest, u as LightningSendRequest, E as ExitSpeed, f as CoopExitFeeQuote, i as CoopExitRequest, T as Transfer$1 } from './RequestLightningSendInput-BxbCtwpV.cjs';
|
|
2
2
|
import { L as LightningSendFeeEstimateInput } from './LightningSendFeeEstimateInput-BgOhEAI-.cjs';
|
|
3
|
-
import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-
|
|
4
|
-
import { h as RequestedSigningCommitments, U as UserSignedTxSigningJob, d as TreeNode, f as Transfer, L as LeafRefundTxSigningResult, i as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, j as OutputWithPreviousTransactionData, k as TokenTransactionWithStatus } from './spark-
|
|
3
|
+
import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-DaY8c60s.cjs';
|
|
4
|
+
import { h as RequestedSigningCommitments, U as UserSignedTxSigningJob, d as TreeNode, f as Transfer, L as LeafRefundTxSigningResult, i as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, j as OutputWithPreviousTransactionData, k as TokenTransactionWithStatus } from './spark-C4ZrsgjC.cjs';
|
|
5
5
|
import { WalletConfigService } from './services/config.cjs';
|
|
6
6
|
import { ConnectionManager } from './services/connection.cjs';
|
|
7
7
|
import { Lrc20ConnectionManager } from './services/lrc-connection.cjs';
|
|
@@ -10,9 +10,9 @@ import { ConfigOptions } from './services/wallet-config.cjs';
|
|
|
10
10
|
import { LRCWallet } from '@buildonspark/lrc20-sdk';
|
|
11
11
|
import { EventEmitter } from 'eventemitter3';
|
|
12
12
|
import { SparkAddressFormat } from './address/index.cjs';
|
|
13
|
-
import { a as WalletTransfer, W as WalletLeaf } from './sdk-types-
|
|
13
|
+
import { a as WalletTransfer, W as WalletLeaf } from './sdk-types-BeCBoozO.cjs';
|
|
14
14
|
import './utils/index.cjs';
|
|
15
|
-
import './network-
|
|
15
|
+
import './network-CfxLnaot.cjs';
|
|
16
16
|
|
|
17
17
|
declare class SparkSDKError extends Error {
|
|
18
18
|
readonly context: Record<string, unknown>;
|
|
@@ -504,6 +504,15 @@ declare class SparkWallet extends EventEmitter {
|
|
|
504
504
|
* @returns {Promise<string[]>} The unused deposit addresses
|
|
505
505
|
*/
|
|
506
506
|
getUnusedDepositAddresses(): Promise<string[]>;
|
|
507
|
+
/**
|
|
508
|
+
* Gets all unused deposit addresses for the wallet.
|
|
509
|
+
*
|
|
510
|
+
* @param {Object} params - Parameters for querying unused deposit addresses
|
|
511
|
+
* @param {Uint8Array<ArrayBufferLike>} [params.identityPublicKey] - The identity public key
|
|
512
|
+
* @param {NetworkProto} [params.network] - The network
|
|
513
|
+
* @returns {Promise<DepositAddressQueryResult[]>} The unused deposit addresses
|
|
514
|
+
*/
|
|
515
|
+
private queryAllUnusedDepositAddresses;
|
|
507
516
|
/**
|
|
508
517
|
* Claims a deposit to the wallet.
|
|
509
518
|
* Note that if you used advancedDeposit, you don't need to call this function.
|
|
@@ -626,13 +635,18 @@ declare class SparkWallet extends EventEmitter {
|
|
|
626
635
|
*
|
|
627
636
|
* @param {Object} params - Parameters for the withdrawal
|
|
628
637
|
* @param {string} params.onchainAddress - The Bitcoin address where the funds should be sent
|
|
629
|
-
* @param {
|
|
638
|
+
* @param {CoopExitFeeQuote} params.feeQuote - The fee quote for the withdrawal
|
|
639
|
+
* @param {ExitSpeed} params.exitSpeed - The exit speed chosen for the withdrawal
|
|
640
|
+
* @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.
|
|
641
|
+
* @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.
|
|
630
642
|
* @returns {Promise<CoopExitRequest | null | undefined>} The withdrawal request details, or null/undefined if the request cannot be completed
|
|
631
643
|
*/
|
|
632
|
-
withdraw({ onchainAddress, exitSpeed, amountSats, }: {
|
|
644
|
+
withdraw({ onchainAddress, exitSpeed, feeQuote, amountSats, deductFeeFromWithdrawalAmount, }: {
|
|
633
645
|
onchainAddress: string;
|
|
634
646
|
exitSpeed: ExitSpeed;
|
|
647
|
+
feeQuote: CoopExitFeeQuote;
|
|
635
648
|
amountSats?: number;
|
|
649
|
+
deductFeeFromWithdrawalAmount?: boolean;
|
|
636
650
|
}): Promise<CoopExitRequest | null>;
|
|
637
651
|
/**
|
|
638
652
|
* Internal method to perform a cooperative exit (withdrawal).
|
|
@@ -649,12 +663,12 @@ declare class SparkWallet extends EventEmitter {
|
|
|
649
663
|
* @param {Object} params - Input parameters for fee estimation
|
|
650
664
|
* @param {number} params.amountSats - The amount in satoshis to withdraw
|
|
651
665
|
* @param {string} params.withdrawalAddress - The Bitcoin address where the funds should be sent
|
|
652
|
-
* @returns {Promise<
|
|
666
|
+
* @returns {Promise<CoopExitFeeQuote | null>} Fee estimate for the withdrawal
|
|
653
667
|
*/
|
|
654
|
-
|
|
668
|
+
getWithdrawalFeeQuote({ amountSats, withdrawalAddress, }: {
|
|
655
669
|
amountSats: number;
|
|
656
670
|
withdrawalAddress: string;
|
|
657
|
-
}): Promise<
|
|
671
|
+
}): Promise<CoopExitFeeQuote | null>;
|
|
658
672
|
/**
|
|
659
673
|
* Gets a transfer that has been sent by the SSP to the wallet.
|
|
660
674
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as LeavesSwapFeeEstimateOutput, D as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, q as LightningReceiveRequest, u as LightningSendRequest, E as ExitSpeed, f as CoopExitFeeQuote, i as CoopExitRequest, T as Transfer$1 } from './RequestLightningSendInput-RGel43ks.js';
|
|
2
2
|
import { L as LightningSendFeeEstimateInput } from './LightningSendFeeEstimateInput-BgOhEAI-.js';
|
|
3
|
-
import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-
|
|
4
|
-
import { h as RequestedSigningCommitments, U as UserSignedTxSigningJob, d as TreeNode, f as Transfer, L as LeafRefundTxSigningResult, i as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, j as OutputWithPreviousTransactionData, k as TokenTransactionWithStatus } from './spark-
|
|
3
|
+
import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-D7vfYik9.js';
|
|
4
|
+
import { h as RequestedSigningCommitments, U as UserSignedTxSigningJob, d as TreeNode, f as Transfer, L as LeafRefundTxSigningResult, i as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, j as OutputWithPreviousTransactionData, k as TokenTransactionWithStatus } from './spark-C4ZrsgjC.js';
|
|
5
5
|
import { WalletConfigService } from './services/config.js';
|
|
6
6
|
import { ConnectionManager } from './services/connection.js';
|
|
7
7
|
import { Lrc20ConnectionManager } from './services/lrc-connection.js';
|
|
@@ -10,9 +10,9 @@ import { ConfigOptions } from './services/wallet-config.js';
|
|
|
10
10
|
import { LRCWallet } from '@buildonspark/lrc20-sdk';
|
|
11
11
|
import { EventEmitter } from 'eventemitter3';
|
|
12
12
|
import { SparkAddressFormat } from './address/index.js';
|
|
13
|
-
import { a as WalletTransfer, W as WalletLeaf } from './sdk-types-
|
|
13
|
+
import { a as WalletTransfer, W as WalletLeaf } from './sdk-types-CTbTdDbE.js';
|
|
14
14
|
import './utils/index.js';
|
|
15
|
-
import './network-
|
|
15
|
+
import './network-CroCOQ0B.js';
|
|
16
16
|
|
|
17
17
|
declare class SparkSDKError extends Error {
|
|
18
18
|
readonly context: Record<string, unknown>;
|
|
@@ -504,6 +504,15 @@ declare class SparkWallet extends EventEmitter {
|
|
|
504
504
|
* @returns {Promise<string[]>} The unused deposit addresses
|
|
505
505
|
*/
|
|
506
506
|
getUnusedDepositAddresses(): Promise<string[]>;
|
|
507
|
+
/**
|
|
508
|
+
* Gets all unused deposit addresses for the wallet.
|
|
509
|
+
*
|
|
510
|
+
* @param {Object} params - Parameters for querying unused deposit addresses
|
|
511
|
+
* @param {Uint8Array<ArrayBufferLike>} [params.identityPublicKey] - The identity public key
|
|
512
|
+
* @param {NetworkProto} [params.network] - The network
|
|
513
|
+
* @returns {Promise<DepositAddressQueryResult[]>} The unused deposit addresses
|
|
514
|
+
*/
|
|
515
|
+
private queryAllUnusedDepositAddresses;
|
|
507
516
|
/**
|
|
508
517
|
* Claims a deposit to the wallet.
|
|
509
518
|
* Note that if you used advancedDeposit, you don't need to call this function.
|
|
@@ -626,13 +635,18 @@ declare class SparkWallet extends EventEmitter {
|
|
|
626
635
|
*
|
|
627
636
|
* @param {Object} params - Parameters for the withdrawal
|
|
628
637
|
* @param {string} params.onchainAddress - The Bitcoin address where the funds should be sent
|
|
629
|
-
* @param {
|
|
638
|
+
* @param {CoopExitFeeQuote} params.feeQuote - The fee quote for the withdrawal
|
|
639
|
+
* @param {ExitSpeed} params.exitSpeed - The exit speed chosen for the withdrawal
|
|
640
|
+
* @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.
|
|
641
|
+
* @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.
|
|
630
642
|
* @returns {Promise<CoopExitRequest | null | undefined>} The withdrawal request details, or null/undefined if the request cannot be completed
|
|
631
643
|
*/
|
|
632
|
-
withdraw({ onchainAddress, exitSpeed, amountSats, }: {
|
|
644
|
+
withdraw({ onchainAddress, exitSpeed, feeQuote, amountSats, deductFeeFromWithdrawalAmount, }: {
|
|
633
645
|
onchainAddress: string;
|
|
634
646
|
exitSpeed: ExitSpeed;
|
|
647
|
+
feeQuote: CoopExitFeeQuote;
|
|
635
648
|
amountSats?: number;
|
|
649
|
+
deductFeeFromWithdrawalAmount?: boolean;
|
|
636
650
|
}): Promise<CoopExitRequest | null>;
|
|
637
651
|
/**
|
|
638
652
|
* Internal method to perform a cooperative exit (withdrawal).
|
|
@@ -649,12 +663,12 @@ declare class SparkWallet extends EventEmitter {
|
|
|
649
663
|
* @param {Object} params - Input parameters for fee estimation
|
|
650
664
|
* @param {number} params.amountSats - The amount in satoshis to withdraw
|
|
651
665
|
* @param {string} params.withdrawalAddress - The Bitcoin address where the funds should be sent
|
|
652
|
-
* @returns {Promise<
|
|
666
|
+
* @returns {Promise<CoopExitFeeQuote | null>} Fee estimate for the withdrawal
|
|
653
667
|
*/
|
|
654
|
-
|
|
668
|
+
getWithdrawalFeeQuote({ amountSats, withdrawalAddress, }: {
|
|
655
669
|
amountSats: number;
|
|
656
670
|
withdrawalAddress: string;
|
|
657
|
-
}): Promise<
|
|
671
|
+
}): Promise<CoopExitFeeQuote | null>;
|
|
658
672
|
/**
|
|
659
673
|
* Gets a transfer that has been sent by the SSP to the wallet.
|
|
660
674
|
*
|