@buildonspark/spark-sdk 0.1.44 → 0.1.46
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 +17 -0
- package/dist/{RequestLightningSendInput-BxbCtwpV.d.cts → RequestLightningSendInput-2cSh_In4.d.cts} +1 -1
- package/dist/{RequestLightningSendInput-RGel43ks.d.ts → RequestLightningSendInput-CN6BNg_g.d.ts} +1 -1
- package/dist/address/index.cjs +2 -2
- 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-EKFD62HN.js → chunk-4EMV7HHW.js} +2 -1
- package/dist/{chunk-4Q2ZDYYU.js → chunk-BGGEVUJK.js} +1157 -208
- package/dist/{chunk-CIZNCBKE.js → chunk-C2S227QR.js} +648 -45
- package/dist/{chunk-WPTRVD2V.js → chunk-DXR2PXJU.js} +15 -15
- package/dist/{chunk-NBCNYDWJ.js → chunk-HHNQ3ZHC.js} +2 -2
- package/dist/{chunk-DAXGVPVM.js → chunk-HSCLBJEL.js} +2 -2
- package/dist/{chunk-6AFUC5M2.js → chunk-HWJWKEIU.js} +8 -2
- package/dist/{chunk-A2ZLMH6I.js → chunk-JB64OQES.js} +259 -327
- package/dist/{chunk-KEKGSH7B.js → chunk-KMUMFYFX.js} +3 -3
- package/dist/chunk-LHRD2WT6.js +2374 -0
- package/dist/{chunk-HTMXTJRK.js → chunk-N5VZVCGJ.js} +4 -4
- package/dist/{chunk-SQKXGAIR.js → chunk-NTFKFRQ2.js} +1 -1
- package/dist/{chunk-K4BJARWM.js → chunk-OBFKIEMP.js} +1 -1
- package/dist/{chunk-UBT6EDVJ.js → chunk-OFCJFZ4I.js} +1 -1
- package/dist/{chunk-XX4RRWOX.js → chunk-UXDODSDT.js} +8 -10
- package/dist/graphql/objects/index.d.cts +5 -4
- package/dist/graphql/objects/index.d.ts +5 -4
- package/dist/index-CKL5DodV.d.cts +214 -0
- package/dist/index-COm59SPw.d.ts +214 -0
- package/dist/index.cjs +4026 -1315
- package/dist/index.d.cts +764 -19
- package/dist/index.d.ts +764 -19
- package/dist/index.js +23 -27
- package/dist/index.node.cjs +4026 -1319
- package/dist/index.node.d.cts +10 -8
- package/dist/index.node.d.ts +10 -8
- package/dist/index.node.js +23 -31
- package/dist/native/index.cjs +4027 -1316
- package/dist/native/index.d.cts +281 -85
- package/dist/native/index.d.ts +281 -85
- package/dist/native/index.js +4018 -1307
- package/dist/{network-CfxLnaot.d.cts → network-Css46DAz.d.cts} +1 -1
- package/dist/{network-CroCOQ0B.d.ts → network-hynb7iTZ.d.ts} +1 -1
- package/dist/proto/lrc20.cjs +222 -19
- 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 +1154 -205
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +3 -1
- package/dist/proto/spark_token.cjs +1377 -58
- package/dist/proto/spark_token.d.cts +153 -15
- package/dist/proto/spark_token.d.ts +153 -15
- package/dist/proto/spark_token.js +40 -4
- package/dist/{sdk-types-CTbTdDbE.d.ts → sdk-types-CKBsylfW.d.ts} +1 -1
- package/dist/{sdk-types-BeCBoozO.d.cts → sdk-types-Ct8xmN7l.d.cts} +1 -1
- package/dist/services/config.cjs +2 -2
- package/dist/services/config.d.cts +5 -4
- package/dist/services/config.d.ts +5 -4
- package/dist/services/config.js +6 -6
- package/dist/services/connection.cjs +2438 -262
- package/dist/services/connection.d.cts +5 -4
- package/dist/services/connection.d.ts +5 -4
- package/dist/services/connection.js +4 -4
- package/dist/services/index.cjs +5937 -3154
- package/dist/services/index.d.cts +7 -6
- package/dist/services/index.d.ts +7 -6
- package/dist/services/index.js +17 -15
- package/dist/services/lrc-connection.cjs +223 -20
- package/dist/services/lrc-connection.d.cts +5 -4
- package/dist/services/lrc-connection.d.ts +5 -4
- package/dist/services/lrc-connection.js +4 -4
- package/dist/services/token-transactions.cjs +840 -236
- package/dist/services/token-transactions.d.cts +25 -7
- package/dist/services/token-transactions.d.ts +25 -7
- package/dist/services/token-transactions.js +5 -4
- package/dist/services/wallet-config.cjs +3 -1
- package/dist/services/wallet-config.d.cts +7 -5
- package/dist/services/wallet-config.d.ts +7 -5
- package/dist/services/wallet-config.js +3 -1
- package/dist/signer/signer.cjs +1 -1
- package/dist/signer/signer.d.cts +3 -2
- package/dist/signer/signer.d.ts +3 -2
- package/dist/signer/signer.js +2 -2
- package/dist/{signer-D7vfYik9.d.ts → signer-BP6F__oR.d.cts} +2 -6
- package/dist/{signer-DaY8c60s.d.cts → signer-BVZJXcq7.d.ts} +2 -6
- package/dist/{spark-C4ZrsgjC.d.cts → spark-DbzGfse6.d.cts} +93 -15
- package/dist/{spark-C4ZrsgjC.d.ts → spark-DbzGfse6.d.ts} +93 -15
- package/dist/spark_bindings/native/index.cjs +183 -0
- package/dist/spark_bindings/native/index.d.cts +14 -0
- package/dist/spark_bindings/native/index.d.ts +14 -0
- package/dist/spark_bindings/native/index.js +141 -0
- package/dist/spark_bindings/wasm/index.cjs +1093 -0
- package/dist/spark_bindings/wasm/index.d.cts +47 -0
- package/dist/spark_bindings/wasm/index.d.ts +47 -0
- package/dist/{chunk-K4C4W5FC.js → spark_bindings/wasm/index.js} +7 -6
- package/dist/types/index.cjs +1156 -208
- package/dist/types/index.d.cts +5 -4
- package/dist/types/index.d.ts +5 -4
- package/dist/types/index.js +2 -2
- package/dist/types-C-Rp0Oo7.d.cts +46 -0
- package/dist/types-C-Rp0Oo7.d.ts +46 -0
- package/dist/utils/index.cjs +65 -13
- package/dist/utils/index.d.cts +14 -134
- package/dist/utils/index.d.ts +14 -134
- package/dist/utils/index.js +13 -13
- package/package.json +22 -2
- package/src/index.node.ts +0 -1
- package/src/index.ts +0 -1
- package/src/native/index.ts +1 -2
- package/src/proto/common.ts +5 -5
- package/src/proto/google/protobuf/descriptor.ts +34 -34
- package/src/proto/google/protobuf/duration.ts +2 -2
- package/src/proto/google/protobuf/empty.ts +2 -2
- package/src/proto/google/protobuf/timestamp.ts +2 -2
- package/src/proto/mock.ts +4 -4
- package/src/proto/spark.ts +1452 -185
- package/src/proto/spark_authn.ts +7 -7
- package/src/proto/spark_token.ts +1668 -105
- package/src/proto/validate/validate.ts +24 -24
- package/src/services/bolt11-spark.ts +62 -187
- package/src/services/coop-exit.ts +3 -0
- package/src/services/lrc20.ts +1 -1
- package/src/services/token-transactions.ts +197 -9
- package/src/services/transfer.ts +22 -0
- package/src/services/tree-creation.ts +13 -0
- package/src/services/wallet-config.ts +2 -2
- package/src/spark-wallet/spark-wallet.node.ts +0 -4
- package/src/spark-wallet/spark-wallet.ts +76 -108
- package/src/spark-wallet/types.ts +39 -3
- package/src/tests/bolt11-spark.test.ts +7 -15
- package/src/tests/integration/ssp/coop-exit.test.ts +7 -7
- package/src/tests/integration/swap.test.ts +453 -433
- package/src/tests/integration/transfer.test.ts +261 -248
- package/src/tests/token-identifier.test.ts +54 -0
- package/src/tests/tokens.test.ts +218 -23
- package/src/utils/token-hashing.ts +320 -44
- package/src/utils/token-identifier.ts +88 -0
- package/src/utils/token-transaction-validation.ts +350 -5
- package/src/utils/token-transactions.ts +12 -8
- package/src/utils/transaction.ts +0 -6
- package/dist/chunk-B3AMIGJG.js +0 -1073
- package/dist/index-CZmDdSts.d.cts +0 -829
- package/dist/index-ClIRO_3y.d.ts +0 -829
- package/dist/wasm-7OWFHDMS.js +0 -21
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SparkTokenServiceDefinition
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
Empty,
|
|
6
|
-
SparkServiceDefinition
|
|
7
|
-
} from "./chunk-4Q2ZDYYU.js";
|
|
3
|
+
} from "./chunk-LHRD2WT6.js";
|
|
8
4
|
import {
|
|
9
5
|
clientEnv,
|
|
10
6
|
isBun,
|
|
11
7
|
isReactNative
|
|
12
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OFCJFZ4I.js";
|
|
13
9
|
import {
|
|
14
10
|
AuthenticationError,
|
|
15
11
|
NetworkError
|
|
16
12
|
} from "./chunk-GSI4OLXZ.js";
|
|
13
|
+
import {
|
|
14
|
+
Empty,
|
|
15
|
+
SparkServiceDefinition
|
|
16
|
+
} from "./chunk-BGGEVUJK.js";
|
|
17
17
|
|
|
18
18
|
// src/services/connection.ts
|
|
19
19
|
import { isNode } from "@lightsparkdev/core";
|
|
@@ -65,7 +65,7 @@ var CleanUpPreimageShareRequest = {
|
|
|
65
65
|
},
|
|
66
66
|
decode(input, length) {
|
|
67
67
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
68
|
-
|
|
68
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
69
69
|
const message = createBaseCleanUpPreimageShareRequest();
|
|
70
70
|
while (reader.pos < end) {
|
|
71
71
|
const tag = reader.uint32();
|
|
@@ -116,7 +116,7 @@ var InterruptTransferRequest = {
|
|
|
116
116
|
},
|
|
117
117
|
decode(input, length) {
|
|
118
118
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
119
|
-
|
|
119
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
120
120
|
const message = createBaseInterruptTransferRequest();
|
|
121
121
|
while (reader.pos < end) {
|
|
122
122
|
const tag = reader.uint32();
|
|
@@ -172,7 +172,7 @@ var UpdateNodesStatusRequest = {
|
|
|
172
172
|
},
|
|
173
173
|
decode(input, length) {
|
|
174
174
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
175
|
-
|
|
175
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
176
176
|
const message = createBaseUpdateNodesStatusRequest();
|
|
177
177
|
while (reader.pos < end) {
|
|
178
178
|
const tag = reader.uint32();
|
|
@@ -305,7 +305,7 @@ var Challenge = {
|
|
|
305
305
|
},
|
|
306
306
|
decode(input, length) {
|
|
307
307
|
const reader = input instanceof BinaryReader2 ? input : new BinaryReader2(input);
|
|
308
|
-
|
|
308
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
309
309
|
const message = createBaseChallenge();
|
|
310
310
|
while (reader.pos < end) {
|
|
311
311
|
const tag = reader.uint32();
|
|
@@ -400,7 +400,7 @@ var ProtectedChallenge = {
|
|
|
400
400
|
},
|
|
401
401
|
decode(input, length) {
|
|
402
402
|
const reader = input instanceof BinaryReader2 ? input : new BinaryReader2(input);
|
|
403
|
-
|
|
403
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
404
404
|
const message = createBaseProtectedChallenge();
|
|
405
405
|
while (reader.pos < end) {
|
|
406
406
|
const tag = reader.uint32();
|
|
@@ -477,7 +477,7 @@ var GetChallengeRequest = {
|
|
|
477
477
|
},
|
|
478
478
|
decode(input, length) {
|
|
479
479
|
const reader = input instanceof BinaryReader2 ? input : new BinaryReader2(input);
|
|
480
|
-
|
|
480
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
481
481
|
const message = createBaseGetChallengeRequest();
|
|
482
482
|
while (reader.pos < end) {
|
|
483
483
|
const tag = reader.uint32();
|
|
@@ -528,7 +528,7 @@ var GetChallengeResponse = {
|
|
|
528
528
|
},
|
|
529
529
|
decode(input, length) {
|
|
530
530
|
const reader = input instanceof BinaryReader2 ? input : new BinaryReader2(input);
|
|
531
|
-
|
|
531
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
532
532
|
const message = createBaseGetChallengeResponse();
|
|
533
533
|
while (reader.pos < end) {
|
|
534
534
|
const tag = reader.uint32();
|
|
@@ -587,7 +587,7 @@ var VerifyChallengeRequest = {
|
|
|
587
587
|
},
|
|
588
588
|
decode(input, length) {
|
|
589
589
|
const reader = input instanceof BinaryReader2 ? input : new BinaryReader2(input);
|
|
590
|
-
|
|
590
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
591
591
|
const message = createBaseVerifyChallengeRequest();
|
|
592
592
|
while (reader.pos < end) {
|
|
593
593
|
const tag = reader.uint32();
|
|
@@ -667,7 +667,7 @@ var VerifyChallengeResponse = {
|
|
|
667
667
|
},
|
|
668
668
|
decode(input, length) {
|
|
669
669
|
const reader = input instanceof BinaryReader2 ? input : new BinaryReader2(input);
|
|
670
|
-
|
|
670
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
671
671
|
const message = createBaseVerifyChallengeResponse();
|
|
672
672
|
while (reader.pos < end) {
|
|
673
673
|
const tag = reader.uint32();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SparkServiceDefinition
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NTFKFRQ2.js";
|
|
4
4
|
import {
|
|
5
5
|
clientEnv,
|
|
6
6
|
isBun,
|
|
7
7
|
isReactNative
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OFCJFZ4I.js";
|
|
9
9
|
import {
|
|
10
10
|
NetworkError
|
|
11
11
|
} from "./chunk-GSI4OLXZ.js";
|
|
@@ -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-4EMV7HHW.js";
|
|
10
10
|
import {
|
|
11
11
|
DefaultSparkSigner
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-N5VZVCGJ.js";
|
|
13
13
|
import {
|
|
14
14
|
ConfigurationError
|
|
15
15
|
} from "./chunk-GSI4OLXZ.js";
|
|
@@ -30,13 +30,19 @@ function checkIfSelectedOutputsAreAvailable(selectedOutputs, tokenOutputs, token
|
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
32
|
function filterTokenBalanceForTokenPublicKey(tokenBalances, publicKey) {
|
|
33
|
-
if (!tokenBalances
|
|
33
|
+
if (!tokenBalances) {
|
|
34
|
+
return { balance: 0n };
|
|
35
|
+
}
|
|
36
|
+
const tokenBalance = [...tokenBalances.entries()].find(
|
|
37
|
+
([, info]) => info.tokenMetadata.tokenPublicKey === publicKey
|
|
38
|
+
);
|
|
39
|
+
if (!tokenBalance) {
|
|
34
40
|
return {
|
|
35
41
|
balance: 0n
|
|
36
42
|
};
|
|
37
43
|
}
|
|
38
44
|
return {
|
|
39
|
-
balance:
|
|
45
|
+
balance: tokenBalance[1].balance
|
|
40
46
|
};
|
|
41
47
|
}
|
|
42
48
|
|