@buildonspark/spark-sdk 0.1.44 → 0.1.45
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 +9 -0
- package/dist/{RequestLightningSendInput-RGel43ks.d.ts → RequestLightningSendInput-DEPd_fPO.d.ts} +1 -1
- package/dist/{RequestLightningSendInput-BxbCtwpV.d.cts → RequestLightningSendInput-Du0z7Om7.d.cts} +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-XX4RRWOX.js → chunk-5FUB65LX.js} +5 -7
- package/dist/{chunk-DAXGVPVM.js → chunk-6264CGDM.js} +4 -4
- package/dist/{chunk-UBT6EDVJ.js → chunk-7V6N75CC.js} +1 -1
- package/dist/{chunk-4Q2ZDYYU.js → chunk-BGGEVUJK.js} +1157 -208
- package/dist/{chunk-CIZNCBKE.js → chunk-C2S227QR.js} +648 -45
- package/dist/{chunk-NBCNYDWJ.js → chunk-GZ5IPPJ2.js} +2 -2
- package/dist/{chunk-6AFUC5M2.js → chunk-HWJWKEIU.js} +8 -2
- package/dist/{chunk-A2ZLMH6I.js → chunk-J2IE4Z7Y.js} +231 -299
- package/dist/{chunk-KEKGSH7B.js → chunk-KMUMFYFX.js} +3 -3
- package/dist/chunk-LHRD2WT6.js +2374 -0
- package/dist/{chunk-SQKXGAIR.js → chunk-NTFKFRQ2.js} +1 -1
- package/dist/{chunk-K4BJARWM.js → chunk-OBFKIEMP.js} +1 -1
- package/dist/{chunk-WPTRVD2V.js → chunk-PQN3C2MF.js} +15 -15
- package/dist/{chunk-EKFD62HN.js → chunk-R5PXJZQS.js} +1 -0
- package/dist/{chunk-HTMXTJRK.js → chunk-YUPMXTCJ.js} +4 -4
- package/dist/graphql/objects/index.d.cts +5 -4
- package/dist/graphql/objects/index.d.ts +5 -4
- package/dist/index-B2AwKW5J.d.cts +214 -0
- package/dist/index-CJDi1HWc.d.ts +214 -0
- package/dist/index.cjs +4025 -1314
- package/dist/index.d.cts +764 -19
- package/dist/index.d.ts +764 -19
- package/dist/index.js +16 -20
- package/dist/index.node.cjs +4025 -1318
- package/dist/index.node.d.cts +10 -8
- package/dist/index.node.d.ts +10 -8
- package/dist/index.node.js +16 -24
- package/dist/native/index.cjs +4026 -1315
- package/dist/native/index.d.cts +281 -85
- package/dist/native/index.d.ts +281 -85
- package/dist/native/index.js +4017 -1306
- package/dist/{network-CroCOQ0B.d.ts → network-BTJl-Sul.d.ts} +1 -1
- package/dist/{network-CfxLnaot.d.cts → network-CqgsdUF2.d.cts} +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-BeCBoozO.d.cts → sdk-types-B0SwjolI.d.cts} +1 -1
- package/dist/{sdk-types-CTbTdDbE.d.ts → sdk-types-Cc4l4kb1.d.ts} +1 -1
- package/dist/services/config.cjs +1 -1
- 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 +5936 -3153
- package/dist/services/index.d.cts +7 -6
- package/dist/services/index.d.ts +7 -6
- package/dist/services/index.js +15 -13
- 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 +2 -0
- 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-BocS_J6B.d.ts} +2 -6
- package/dist/{signer-DaY8c60s.d.cts → signer-DKS0AJkw.d.cts} +2 -6
- package/dist/{spark-C4ZrsgjC.d.cts → spark-dM7EYXYQ.d.cts} +93 -15
- package/dist/{spark-C4ZrsgjC.d.ts → spark-dM7EYXYQ.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 +64 -12
- package/dist/utils/index.d.cts +14 -134
- package/dist/utils/index.d.ts +14 -134
- package/dist/utils/index.js +7 -7
- package/package.json +21 -1
- 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 +1 -1
- 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-7V6N75CC.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,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isReactNative
|
|
3
|
-
} from "./chunk-UBT6EDVJ.js";
|
|
4
1
|
import {
|
|
5
2
|
generateAdaptorFromSignature,
|
|
6
3
|
getRandomSigningNonce,
|
|
@@ -10,6 +7,9 @@ import {
|
|
|
10
7
|
import {
|
|
11
8
|
splitSecretWithProofs
|
|
12
9
|
} from "./chunk-QNNSEJ4P.js";
|
|
10
|
+
import {
|
|
11
|
+
isReactNative
|
|
12
|
+
} from "./chunk-7V6N75CC.js";
|
|
13
13
|
import {
|
|
14
14
|
ConfigurationError,
|
|
15
15
|
ValidationError
|
|
@@ -46,7 +46,7 @@ var getSparkFrostModule = async () => {
|
|
|
46
46
|
return void 0;
|
|
47
47
|
}
|
|
48
48
|
if (!sparkFrostModule) {
|
|
49
|
-
sparkFrostModule = await import("./wasm
|
|
49
|
+
sparkFrostModule = await import("./spark_bindings/wasm/index.js");
|
|
50
50
|
}
|
|
51
51
|
return sparkFrostModule;
|
|
52
52
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { B as BitcoinNetwork } from '../../BitcoinNetwork-TnABML0T.cjs';
|
|
2
2
|
import { Query } from '@lightsparkdev/core';
|
|
3
|
-
import { k as CurrencyAmount, P as PageInfo, K as SspClient } from '../../RequestLightningSendInput-
|
|
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-
|
|
3
|
+
import { k as CurrencyAmount, P as PageInfo, K as SspClient } from '../../RequestLightningSendInput-Du0z7Om7.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-Du0z7Om7.cjs';
|
|
5
5
|
export { L as LightningSendFeeEstimateInput } from '../../LightningSendFeeEstimateInput-BgOhEAI-.cjs';
|
|
6
|
-
import '../../signer-
|
|
6
|
+
import '../../signer-DKS0AJkw.cjs';
|
|
7
7
|
import '@scure/bip32';
|
|
8
|
-
import '../../spark-
|
|
8
|
+
import '../../spark-dM7EYXYQ.cjs';
|
|
9
9
|
import '@bufbuild/protobuf/wire';
|
|
10
10
|
import 'nice-grpc-common';
|
|
11
|
+
import '../../types-C-Rp0Oo7.cjs';
|
|
11
12
|
import '@buildonspark/lrc20-sdk';
|
|
12
13
|
import '@scure/btc-signer';
|
|
13
14
|
import 'bitcoinjs-lib';
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { B as BitcoinNetwork } from '../../BitcoinNetwork-TnABML0T.js';
|
|
2
2
|
import { Query } from '@lightsparkdev/core';
|
|
3
|
-
import { k as CurrencyAmount, P as PageInfo, K as SspClient } from '../../RequestLightningSendInput-
|
|
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-
|
|
3
|
+
import { k as CurrencyAmount, P as PageInfo, K as SspClient } from '../../RequestLightningSendInput-DEPd_fPO.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-DEPd_fPO.js';
|
|
5
5
|
export { L as LightningSendFeeEstimateInput } from '../../LightningSendFeeEstimateInput-BgOhEAI-.js';
|
|
6
|
-
import '../../signer-
|
|
6
|
+
import '../../signer-BocS_J6B.js';
|
|
7
7
|
import '@scure/bip32';
|
|
8
|
-
import '../../spark-
|
|
8
|
+
import '../../spark-dM7EYXYQ.js';
|
|
9
9
|
import '@bufbuild/protobuf/wire';
|
|
10
10
|
import 'nice-grpc-common';
|
|
11
|
+
import '../../types-C-Rp0Oo7.js';
|
|
11
12
|
import '@buildonspark/lrc20-sdk';
|
|
12
13
|
import '@scure/btc-signer';
|
|
13
14
|
import 'bitcoinjs-lib';
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import * as btc from '@scure/btc-signer';
|
|
2
|
+
import { Transaction } from '@scure/btc-signer';
|
|
3
|
+
import { TransactionOutput, TransactionInput } from '@scure/btc-signer/psbt';
|
|
4
|
+
import { N as Network } from './network-CqgsdUF2.cjs';
|
|
5
|
+
import { S as SparkSigner, i as SigningNonce, h as SigningCommitment } from './signer-DKS0AJkw.cjs';
|
|
6
|
+
import { j as OutputWithPreviousTransactionData, l as TransferPackage, g as SparkServiceClient } from './spark-dM7EYXYQ.cjs';
|
|
7
|
+
import { ConfigOptions } from './services/wallet-config.cjs';
|
|
8
|
+
import { SparkAddressFormat } from './address/index.cjs';
|
|
9
|
+
|
|
10
|
+
type HumanReadableTokenIdentifier = `btk1${string}` | `btkrt1${string}` | `btkt1${string}` | `btks1${string}` | `btkl1${string}`;
|
|
11
|
+
|
|
12
|
+
type CreateLightningInvoiceParams = {
|
|
13
|
+
amountSats: number;
|
|
14
|
+
memo?: string;
|
|
15
|
+
expirySeconds?: number;
|
|
16
|
+
includeSparkAddress?: boolean;
|
|
17
|
+
receiverIdentityPubkey?: string;
|
|
18
|
+
descriptionHash?: string;
|
|
19
|
+
};
|
|
20
|
+
type PayLightningInvoiceParams = {
|
|
21
|
+
invoice: string;
|
|
22
|
+
maxFeeSats: number;
|
|
23
|
+
preferSpark?: boolean;
|
|
24
|
+
amountSatsToSend?: number;
|
|
25
|
+
};
|
|
26
|
+
type TransferParams = {
|
|
27
|
+
amountSats: number;
|
|
28
|
+
receiverSparkAddress: string;
|
|
29
|
+
};
|
|
30
|
+
type DepositParams = {
|
|
31
|
+
signingPubKey: Uint8Array;
|
|
32
|
+
verifyingKey: Uint8Array;
|
|
33
|
+
depositTx: Transaction;
|
|
34
|
+
vout: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Token metadata containing essential information about a token.
|
|
38
|
+
* This is the wallet's internal representation with JavaScript-friendly types.
|
|
39
|
+
*
|
|
40
|
+
* rawTokenIdentifier: This is the raw binary token identifier - This is used to encode the human readable token identifier.
|
|
41
|
+
*
|
|
42
|
+
* tokenPublicKey: This is the hex-encoded public key of the token issuer - Same as issuerPublicKey.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const tokenMetadata: TokenMetadata = {
|
|
47
|
+
* rawTokenIdentifier: new Uint8Array([1, 2, 3]),
|
|
48
|
+
* tokenPublicKey: "0348fbb...",
|
|
49
|
+
* tokenName: "SparkToken",
|
|
50
|
+
* tokenTicker: "SPK",
|
|
51
|
+
* decimals: 8,
|
|
52
|
+
* maxSupply: 1000000n
|
|
53
|
+
* };
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
type TokenMetadata = {
|
|
57
|
+
/** Raw binary token identifier - This is used to encode the human readable token identifier */
|
|
58
|
+
rawTokenIdentifier: Uint8Array;
|
|
59
|
+
/** Hex-encoded public key of the token issuer - Same as issuerPublicKey */
|
|
60
|
+
tokenPublicKey: string;
|
|
61
|
+
/** Human-readable name of the token (e.g., SparkToken)*/
|
|
62
|
+
tokenName: string;
|
|
63
|
+
/** Short ticker symbol for the token (e.g., "SPK") */
|
|
64
|
+
tokenTicker: string;
|
|
65
|
+
/** Number of decimal places for token amounts */
|
|
66
|
+
decimals: number;
|
|
67
|
+
/** Maximum supply of tokens that can ever be minted */
|
|
68
|
+
maxSupply: bigint;
|
|
69
|
+
};
|
|
70
|
+
type TokenBalanceMap = Map<HumanReadableTokenIdentifier, {
|
|
71
|
+
balance: bigint;
|
|
72
|
+
tokenMetadata: TokenMetadata;
|
|
73
|
+
}>;
|
|
74
|
+
type InitWalletResponse = {
|
|
75
|
+
mnemonic?: string | undefined;
|
|
76
|
+
};
|
|
77
|
+
interface SparkWalletProps {
|
|
78
|
+
mnemonicOrSeed?: Uint8Array | string;
|
|
79
|
+
accountNumber?: number;
|
|
80
|
+
signer?: SparkSigner;
|
|
81
|
+
options?: ConfigOptions;
|
|
82
|
+
}
|
|
83
|
+
interface SparkWalletEvents {
|
|
84
|
+
/** Emitted when an incoming transfer is successfully claimed. Includes the transfer ID and new total balance. */
|
|
85
|
+
"transfer:claimed": (transferId: string, updatedBalance: number) => void;
|
|
86
|
+
/** Emitted when a deposit is marked as available. Includes the deposit ID and new total balance. */
|
|
87
|
+
"deposit:confirmed": (depositId: string, updatedBalance: number) => void;
|
|
88
|
+
/** Emitted when the stream is connected */
|
|
89
|
+
"stream:connected": () => void;
|
|
90
|
+
/** Emitted when the stream disconnects and fails to reconnect after max attempts */
|
|
91
|
+
"stream:disconnected": (reason: string) => void;
|
|
92
|
+
/** Emitted when attempting to reconnect the stream */
|
|
93
|
+
"stream:reconnecting": (attempt: number, maxAttempts: number, delayMs: number, error: string) => void;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
97
|
+
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
98
|
+
adaptorSignature: Uint8Array;
|
|
99
|
+
adaptorPrivateKey: Uint8Array;
|
|
100
|
+
};
|
|
101
|
+
declare function validateOutboundAdaptorSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPubkey: Uint8Array): boolean;
|
|
102
|
+
declare function applyAdaptorToSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
103
|
+
|
|
104
|
+
declare function computeTaprootKeyNoScript(pubkey: Uint8Array): Uint8Array;
|
|
105
|
+
declare function getP2TRScriptFromPublicKey(pubKey: Uint8Array, network: Network): Uint8Array;
|
|
106
|
+
declare function getP2TRAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
107
|
+
declare function getP2TRAddressFromPkScript(pkScript: Uint8Array, network: Network): string;
|
|
108
|
+
declare function getP2WPKHAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
109
|
+
declare function getTxFromRawTxHex(rawTxHex: string): btc.Transaction;
|
|
110
|
+
declare function getTxFromRawTxBytes(rawTxBytes: Uint8Array): btc.Transaction;
|
|
111
|
+
declare function getSigHashFromTx(tx: btc.Transaction, inputIndex: number, prevOutput: TransactionOutput): Uint8Array;
|
|
112
|
+
declare function getTxId(tx: btc.Transaction): string;
|
|
113
|
+
declare function getTxIdNoReverse(tx: btc.Transaction): string;
|
|
114
|
+
|
|
115
|
+
declare function addPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
116
|
+
declare function applyAdditiveTweakToPublicKey(pubkey: Uint8Array, tweak: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
117
|
+
declare function subtractPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
118
|
+
declare function addPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
119
|
+
declare function subtractPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
120
|
+
declare function sumOfPrivateKeys(keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
121
|
+
declare function lastKeyWithTarget(target: Uint8Array, keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
122
|
+
|
|
123
|
+
declare function getLatestDepositTxId(address: string): Promise<string | null>;
|
|
124
|
+
declare function isTxBroadcast(txid: string, baseUrl: string, network?: any): Promise<boolean>;
|
|
125
|
+
|
|
126
|
+
declare function proofOfPossessionMessageHashForDepositAddress(userPubkey: Uint8Array, operatorPubkey: Uint8Array, depositAddress: string): Uint8Array;
|
|
127
|
+
|
|
128
|
+
declare function collectResponses<T>(responses: PromiseSettledResult<T>[]): T[];
|
|
129
|
+
|
|
130
|
+
declare function getRandomSigningNonce(): SigningNonce;
|
|
131
|
+
declare function createSigningNonce(binding: Uint8Array, hiding: Uint8Array): SigningNonce;
|
|
132
|
+
declare function getSigningCommitmentFromNonce(nonce: SigningNonce): SigningCommitment;
|
|
133
|
+
declare function encodeSigningNonceToBytes(nonce: SigningNonce): Uint8Array;
|
|
134
|
+
declare function decodeBytesToSigningNonce(bytes: Uint8Array): SigningNonce;
|
|
135
|
+
declare function createSigningCommitment(binding: Uint8Array, hiding: Uint8Array): SigningCommitment;
|
|
136
|
+
declare function encodeSigningCommitmentToBytes(commitment: SigningCommitment): Uint8Array;
|
|
137
|
+
declare function decodeBytesToSigningCommitment(bytes: Uint8Array): SigningCommitment;
|
|
138
|
+
|
|
139
|
+
declare function calculateAvailableTokenAmount(outputLeaves: OutputWithPreviousTransactionData[]): bigint;
|
|
140
|
+
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>, tokenPublicKey: Uint8Array): boolean;
|
|
141
|
+
declare function filterTokenBalanceForTokenPublicKey(tokenBalances: TokenBalanceMap, publicKey: string): {
|
|
142
|
+
balance: bigint;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
|
|
146
|
+
|
|
147
|
+
declare const DEFAULT_FEE_SATS: number;
|
|
148
|
+
/**
|
|
149
|
+
* Subtracts the default fee from the amount if it's greater than the fee.
|
|
150
|
+
* Returns the original amount if it's less than or equal to the fee.
|
|
151
|
+
*/
|
|
152
|
+
declare function maybeApplyFee(amount: bigint): bigint;
|
|
153
|
+
declare function createRefundTx(sequence: number, nodeOutPoint: TransactionInput, amountSats: bigint, receivingPubkey: Uint8Array, network: Network): Transaction;
|
|
154
|
+
declare function getCurrentTimelock(currSequence?: number): number;
|
|
155
|
+
declare function getTransactionSequence(currSequence?: number): number;
|
|
156
|
+
declare function checkIfValidSequence(currSequence?: number): void;
|
|
157
|
+
declare function getNextTransactionSequence(currSequence?: number, forRefresh?: boolean): {
|
|
158
|
+
nextSequence: number;
|
|
159
|
+
needRefresh: boolean;
|
|
160
|
+
};
|
|
161
|
+
declare function getEphemeralAnchorOutput(): TransactionOutput;
|
|
162
|
+
|
|
163
|
+
interface LeafInfo {
|
|
164
|
+
leafId: string;
|
|
165
|
+
nodeTx: string;
|
|
166
|
+
refundTx: string;
|
|
167
|
+
}
|
|
168
|
+
interface Utxo {
|
|
169
|
+
txid: string;
|
|
170
|
+
vout: number;
|
|
171
|
+
value: bigint;
|
|
172
|
+
script: string;
|
|
173
|
+
publicKey: string;
|
|
174
|
+
}
|
|
175
|
+
interface FeeRate {
|
|
176
|
+
satPerVbyte: number;
|
|
177
|
+
}
|
|
178
|
+
interface FeeBumpTxPackage {
|
|
179
|
+
tx: string;
|
|
180
|
+
feeBumpPsbt?: string;
|
|
181
|
+
}
|
|
182
|
+
interface FeeBumpTxChain {
|
|
183
|
+
leafId: string;
|
|
184
|
+
txPackages: FeeBumpTxPackage[];
|
|
185
|
+
}
|
|
186
|
+
interface TxChain {
|
|
187
|
+
leafId: string;
|
|
188
|
+
transactions: string[];
|
|
189
|
+
}
|
|
190
|
+
interface BroadcastConfig {
|
|
191
|
+
bitcoinCoreRpcUrl?: string;
|
|
192
|
+
rpcUsername?: string;
|
|
193
|
+
rpcPassword?: string;
|
|
194
|
+
autoBroadcast?: boolean;
|
|
195
|
+
network?: "MAINNET" | "REGTEST" | "TESTNET" | "SIGNET" | "LOCAL";
|
|
196
|
+
}
|
|
197
|
+
interface BroadcastResult {
|
|
198
|
+
success: boolean;
|
|
199
|
+
txids?: string[];
|
|
200
|
+
error?: string;
|
|
201
|
+
broadcastedPackages?: number;
|
|
202
|
+
}
|
|
203
|
+
declare function isEphemeralAnchorOutput(script?: Uint8Array, amount?: bigint): boolean;
|
|
204
|
+
declare function constructUnilateralExitTxs(nodeHexStrings: string[], sparkClient?: SparkServiceClient, network?: any): Promise<TxChain[]>;
|
|
205
|
+
declare function constructUnilateralExitFeeBumpPackages(nodeHexStrings: string[], utxos: Utxo[], feeRate: FeeRate, electrsUrl: string, sparkClient?: SparkServiceClient, network?: any): Promise<FeeBumpTxChain[]>;
|
|
206
|
+
declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRate, previousFeeBumpTx?: string): {
|
|
207
|
+
feeBumpPsbt: string;
|
|
208
|
+
usedUtxos: Utxo[];
|
|
209
|
+
correctedParentTx?: string;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
213
|
+
|
|
214
|
+
export { getEphemeralAnchorOutput as $, proofOfPossessionMessageHashForDepositAddress as A, collectResponses as B, type CreateLightningInvoiceParams as C, type DepositParams as D, getRandomSigningNonce as E, createSigningNonce as F, getSigningCommitmentFromNonce as G, encodeSigningNonceToBytes as H, type InitWalletResponse as I, decodeBytesToSigningNonce as J, createSigningCommitment as K, encodeSigningCommitmentToBytes as L, decodeBytesToSigningCommitment as M, calculateAvailableTokenAmount as N, checkIfSelectedOutputsAreAvailable as O, type PayLightningInvoiceParams as P, filterTokenBalanceForTokenPublicKey as Q, getTransferPackageSigningPayload as R, type SparkWalletProps as S, type TransferParams as T, DEFAULT_FEE_SATS as U, maybeApplyFee as V, createRefundTx as W, getCurrentTimelock as X, getTransactionSequence as Y, checkIfValidSequence as Z, getNextTransactionSequence as _, type TokenMetadata as a, type LeafInfo as a0, type Utxo as a1, type FeeRate as a2, type FeeBumpTxPackage as a3, type FeeBumpTxChain as a4, type TxChain as a5, type BroadcastConfig as a6, type BroadcastResult as a7, isEphemeralAnchorOutput as a8, constructUnilateralExitTxs as a9, constructUnilateralExitFeeBumpPackages as aa, constructFeeBumpTx as ab, getSparkAddressFromTaproot as ac, type TokenBalanceMap as b, type SparkWalletEvents as c, generateAdaptorFromSignature as d, applyAdaptorToSignature as e, computeTaprootKeyNoScript as f, generateSignatureFromExistingAdaptor as g, getP2TRScriptFromPublicKey as h, getP2TRAddressFromPublicKey as i, getP2TRAddressFromPkScript as j, getP2WPKHAddressFromPublicKey as k, getTxFromRawTxHex as l, getTxFromRawTxBytes as m, getSigHashFromTx as n, getTxId as o, getTxIdNoReverse as p, addPublicKeys as q, applyAdditiveTweakToPublicKey as r, subtractPublicKeys as s, addPrivateKeys as t, subtractPrivateKeys as u, validateOutboundAdaptorSignature as v, sumOfPrivateKeys as w, lastKeyWithTarget as x, getLatestDepositTxId as y, isTxBroadcast as z };
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import * as btc from '@scure/btc-signer';
|
|
2
|
+
import { Transaction } from '@scure/btc-signer';
|
|
3
|
+
import { TransactionOutput, TransactionInput } from '@scure/btc-signer/psbt';
|
|
4
|
+
import { N as Network } from './network-BTJl-Sul.js';
|
|
5
|
+
import { S as SparkSigner, i as SigningNonce, h as SigningCommitment } from './signer-BocS_J6B.js';
|
|
6
|
+
import { j as OutputWithPreviousTransactionData, l as TransferPackage, g as SparkServiceClient } from './spark-dM7EYXYQ.js';
|
|
7
|
+
import { ConfigOptions } from './services/wallet-config.js';
|
|
8
|
+
import { SparkAddressFormat } from './address/index.js';
|
|
9
|
+
|
|
10
|
+
type HumanReadableTokenIdentifier = `btk1${string}` | `btkrt1${string}` | `btkt1${string}` | `btks1${string}` | `btkl1${string}`;
|
|
11
|
+
|
|
12
|
+
type CreateLightningInvoiceParams = {
|
|
13
|
+
amountSats: number;
|
|
14
|
+
memo?: string;
|
|
15
|
+
expirySeconds?: number;
|
|
16
|
+
includeSparkAddress?: boolean;
|
|
17
|
+
receiverIdentityPubkey?: string;
|
|
18
|
+
descriptionHash?: string;
|
|
19
|
+
};
|
|
20
|
+
type PayLightningInvoiceParams = {
|
|
21
|
+
invoice: string;
|
|
22
|
+
maxFeeSats: number;
|
|
23
|
+
preferSpark?: boolean;
|
|
24
|
+
amountSatsToSend?: number;
|
|
25
|
+
};
|
|
26
|
+
type TransferParams = {
|
|
27
|
+
amountSats: number;
|
|
28
|
+
receiverSparkAddress: string;
|
|
29
|
+
};
|
|
30
|
+
type DepositParams = {
|
|
31
|
+
signingPubKey: Uint8Array;
|
|
32
|
+
verifyingKey: Uint8Array;
|
|
33
|
+
depositTx: Transaction;
|
|
34
|
+
vout: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Token metadata containing essential information about a token.
|
|
38
|
+
* This is the wallet's internal representation with JavaScript-friendly types.
|
|
39
|
+
*
|
|
40
|
+
* rawTokenIdentifier: This is the raw binary token identifier - This is used to encode the human readable token identifier.
|
|
41
|
+
*
|
|
42
|
+
* tokenPublicKey: This is the hex-encoded public key of the token issuer - Same as issuerPublicKey.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const tokenMetadata: TokenMetadata = {
|
|
47
|
+
* rawTokenIdentifier: new Uint8Array([1, 2, 3]),
|
|
48
|
+
* tokenPublicKey: "0348fbb...",
|
|
49
|
+
* tokenName: "SparkToken",
|
|
50
|
+
* tokenTicker: "SPK",
|
|
51
|
+
* decimals: 8,
|
|
52
|
+
* maxSupply: 1000000n
|
|
53
|
+
* };
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
type TokenMetadata = {
|
|
57
|
+
/** Raw binary token identifier - This is used to encode the human readable token identifier */
|
|
58
|
+
rawTokenIdentifier: Uint8Array;
|
|
59
|
+
/** Hex-encoded public key of the token issuer - Same as issuerPublicKey */
|
|
60
|
+
tokenPublicKey: string;
|
|
61
|
+
/** Human-readable name of the token (e.g., SparkToken)*/
|
|
62
|
+
tokenName: string;
|
|
63
|
+
/** Short ticker symbol for the token (e.g., "SPK") */
|
|
64
|
+
tokenTicker: string;
|
|
65
|
+
/** Number of decimal places for token amounts */
|
|
66
|
+
decimals: number;
|
|
67
|
+
/** Maximum supply of tokens that can ever be minted */
|
|
68
|
+
maxSupply: bigint;
|
|
69
|
+
};
|
|
70
|
+
type TokenBalanceMap = Map<HumanReadableTokenIdentifier, {
|
|
71
|
+
balance: bigint;
|
|
72
|
+
tokenMetadata: TokenMetadata;
|
|
73
|
+
}>;
|
|
74
|
+
type InitWalletResponse = {
|
|
75
|
+
mnemonic?: string | undefined;
|
|
76
|
+
};
|
|
77
|
+
interface SparkWalletProps {
|
|
78
|
+
mnemonicOrSeed?: Uint8Array | string;
|
|
79
|
+
accountNumber?: number;
|
|
80
|
+
signer?: SparkSigner;
|
|
81
|
+
options?: ConfigOptions;
|
|
82
|
+
}
|
|
83
|
+
interface SparkWalletEvents {
|
|
84
|
+
/** Emitted when an incoming transfer is successfully claimed. Includes the transfer ID and new total balance. */
|
|
85
|
+
"transfer:claimed": (transferId: string, updatedBalance: number) => void;
|
|
86
|
+
/** Emitted when a deposit is marked as available. Includes the deposit ID and new total balance. */
|
|
87
|
+
"deposit:confirmed": (depositId: string, updatedBalance: number) => void;
|
|
88
|
+
/** Emitted when the stream is connected */
|
|
89
|
+
"stream:connected": () => void;
|
|
90
|
+
/** Emitted when the stream disconnects and fails to reconnect after max attempts */
|
|
91
|
+
"stream:disconnected": (reason: string) => void;
|
|
92
|
+
/** Emitted when attempting to reconnect the stream */
|
|
93
|
+
"stream:reconnecting": (attempt: number, maxAttempts: number, delayMs: number, error: string) => void;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
97
|
+
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
98
|
+
adaptorSignature: Uint8Array;
|
|
99
|
+
adaptorPrivateKey: Uint8Array;
|
|
100
|
+
};
|
|
101
|
+
declare function validateOutboundAdaptorSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPubkey: Uint8Array): boolean;
|
|
102
|
+
declare function applyAdaptorToSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
103
|
+
|
|
104
|
+
declare function computeTaprootKeyNoScript(pubkey: Uint8Array): Uint8Array;
|
|
105
|
+
declare function getP2TRScriptFromPublicKey(pubKey: Uint8Array, network: Network): Uint8Array;
|
|
106
|
+
declare function getP2TRAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
107
|
+
declare function getP2TRAddressFromPkScript(pkScript: Uint8Array, network: Network): string;
|
|
108
|
+
declare function getP2WPKHAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
109
|
+
declare function getTxFromRawTxHex(rawTxHex: string): btc.Transaction;
|
|
110
|
+
declare function getTxFromRawTxBytes(rawTxBytes: Uint8Array): btc.Transaction;
|
|
111
|
+
declare function getSigHashFromTx(tx: btc.Transaction, inputIndex: number, prevOutput: TransactionOutput): Uint8Array;
|
|
112
|
+
declare function getTxId(tx: btc.Transaction): string;
|
|
113
|
+
declare function getTxIdNoReverse(tx: btc.Transaction): string;
|
|
114
|
+
|
|
115
|
+
declare function addPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
116
|
+
declare function applyAdditiveTweakToPublicKey(pubkey: Uint8Array, tweak: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
117
|
+
declare function subtractPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
118
|
+
declare function addPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
119
|
+
declare function subtractPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
120
|
+
declare function sumOfPrivateKeys(keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
121
|
+
declare function lastKeyWithTarget(target: Uint8Array, keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
122
|
+
|
|
123
|
+
declare function getLatestDepositTxId(address: string): Promise<string | null>;
|
|
124
|
+
declare function isTxBroadcast(txid: string, baseUrl: string, network?: any): Promise<boolean>;
|
|
125
|
+
|
|
126
|
+
declare function proofOfPossessionMessageHashForDepositAddress(userPubkey: Uint8Array, operatorPubkey: Uint8Array, depositAddress: string): Uint8Array;
|
|
127
|
+
|
|
128
|
+
declare function collectResponses<T>(responses: PromiseSettledResult<T>[]): T[];
|
|
129
|
+
|
|
130
|
+
declare function getRandomSigningNonce(): SigningNonce;
|
|
131
|
+
declare function createSigningNonce(binding: Uint8Array, hiding: Uint8Array): SigningNonce;
|
|
132
|
+
declare function getSigningCommitmentFromNonce(nonce: SigningNonce): SigningCommitment;
|
|
133
|
+
declare function encodeSigningNonceToBytes(nonce: SigningNonce): Uint8Array;
|
|
134
|
+
declare function decodeBytesToSigningNonce(bytes: Uint8Array): SigningNonce;
|
|
135
|
+
declare function createSigningCommitment(binding: Uint8Array, hiding: Uint8Array): SigningCommitment;
|
|
136
|
+
declare function encodeSigningCommitmentToBytes(commitment: SigningCommitment): Uint8Array;
|
|
137
|
+
declare function decodeBytesToSigningCommitment(bytes: Uint8Array): SigningCommitment;
|
|
138
|
+
|
|
139
|
+
declare function calculateAvailableTokenAmount(outputLeaves: OutputWithPreviousTransactionData[]): bigint;
|
|
140
|
+
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>, tokenPublicKey: Uint8Array): boolean;
|
|
141
|
+
declare function filterTokenBalanceForTokenPublicKey(tokenBalances: TokenBalanceMap, publicKey: string): {
|
|
142
|
+
balance: bigint;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
|
|
146
|
+
|
|
147
|
+
declare const DEFAULT_FEE_SATS: number;
|
|
148
|
+
/**
|
|
149
|
+
* Subtracts the default fee from the amount if it's greater than the fee.
|
|
150
|
+
* Returns the original amount if it's less than or equal to the fee.
|
|
151
|
+
*/
|
|
152
|
+
declare function maybeApplyFee(amount: bigint): bigint;
|
|
153
|
+
declare function createRefundTx(sequence: number, nodeOutPoint: TransactionInput, amountSats: bigint, receivingPubkey: Uint8Array, network: Network): Transaction;
|
|
154
|
+
declare function getCurrentTimelock(currSequence?: number): number;
|
|
155
|
+
declare function getTransactionSequence(currSequence?: number): number;
|
|
156
|
+
declare function checkIfValidSequence(currSequence?: number): void;
|
|
157
|
+
declare function getNextTransactionSequence(currSequence?: number, forRefresh?: boolean): {
|
|
158
|
+
nextSequence: number;
|
|
159
|
+
needRefresh: boolean;
|
|
160
|
+
};
|
|
161
|
+
declare function getEphemeralAnchorOutput(): TransactionOutput;
|
|
162
|
+
|
|
163
|
+
interface LeafInfo {
|
|
164
|
+
leafId: string;
|
|
165
|
+
nodeTx: string;
|
|
166
|
+
refundTx: string;
|
|
167
|
+
}
|
|
168
|
+
interface Utxo {
|
|
169
|
+
txid: string;
|
|
170
|
+
vout: number;
|
|
171
|
+
value: bigint;
|
|
172
|
+
script: string;
|
|
173
|
+
publicKey: string;
|
|
174
|
+
}
|
|
175
|
+
interface FeeRate {
|
|
176
|
+
satPerVbyte: number;
|
|
177
|
+
}
|
|
178
|
+
interface FeeBumpTxPackage {
|
|
179
|
+
tx: string;
|
|
180
|
+
feeBumpPsbt?: string;
|
|
181
|
+
}
|
|
182
|
+
interface FeeBumpTxChain {
|
|
183
|
+
leafId: string;
|
|
184
|
+
txPackages: FeeBumpTxPackage[];
|
|
185
|
+
}
|
|
186
|
+
interface TxChain {
|
|
187
|
+
leafId: string;
|
|
188
|
+
transactions: string[];
|
|
189
|
+
}
|
|
190
|
+
interface BroadcastConfig {
|
|
191
|
+
bitcoinCoreRpcUrl?: string;
|
|
192
|
+
rpcUsername?: string;
|
|
193
|
+
rpcPassword?: string;
|
|
194
|
+
autoBroadcast?: boolean;
|
|
195
|
+
network?: "MAINNET" | "REGTEST" | "TESTNET" | "SIGNET" | "LOCAL";
|
|
196
|
+
}
|
|
197
|
+
interface BroadcastResult {
|
|
198
|
+
success: boolean;
|
|
199
|
+
txids?: string[];
|
|
200
|
+
error?: string;
|
|
201
|
+
broadcastedPackages?: number;
|
|
202
|
+
}
|
|
203
|
+
declare function isEphemeralAnchorOutput(script?: Uint8Array, amount?: bigint): boolean;
|
|
204
|
+
declare function constructUnilateralExitTxs(nodeHexStrings: string[], sparkClient?: SparkServiceClient, network?: any): Promise<TxChain[]>;
|
|
205
|
+
declare function constructUnilateralExitFeeBumpPackages(nodeHexStrings: string[], utxos: Utxo[], feeRate: FeeRate, electrsUrl: string, sparkClient?: SparkServiceClient, network?: any): Promise<FeeBumpTxChain[]>;
|
|
206
|
+
declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRate, previousFeeBumpTx?: string): {
|
|
207
|
+
feeBumpPsbt: string;
|
|
208
|
+
usedUtxos: Utxo[];
|
|
209
|
+
correctedParentTx?: string;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
213
|
+
|
|
214
|
+
export { getEphemeralAnchorOutput as $, proofOfPossessionMessageHashForDepositAddress as A, collectResponses as B, type CreateLightningInvoiceParams as C, type DepositParams as D, getRandomSigningNonce as E, createSigningNonce as F, getSigningCommitmentFromNonce as G, encodeSigningNonceToBytes as H, type InitWalletResponse as I, decodeBytesToSigningNonce as J, createSigningCommitment as K, encodeSigningCommitmentToBytes as L, decodeBytesToSigningCommitment as M, calculateAvailableTokenAmount as N, checkIfSelectedOutputsAreAvailable as O, type PayLightningInvoiceParams as P, filterTokenBalanceForTokenPublicKey as Q, getTransferPackageSigningPayload as R, type SparkWalletProps as S, type TransferParams as T, DEFAULT_FEE_SATS as U, maybeApplyFee as V, createRefundTx as W, getCurrentTimelock as X, getTransactionSequence as Y, checkIfValidSequence as Z, getNextTransactionSequence as _, type TokenMetadata as a, type LeafInfo as a0, type Utxo as a1, type FeeRate as a2, type FeeBumpTxPackage as a3, type FeeBumpTxChain as a4, type TxChain as a5, type BroadcastConfig as a6, type BroadcastResult as a7, isEphemeralAnchorOutput as a8, constructUnilateralExitTxs as a9, constructUnilateralExitFeeBumpPackages as aa, constructFeeBumpTx as ab, getSparkAddressFromTaproot as ac, type TokenBalanceMap as b, type SparkWalletEvents as c, generateAdaptorFromSignature as d, applyAdaptorToSignature as e, computeTaprootKeyNoScript as f, generateSignatureFromExistingAdaptor as g, getP2TRScriptFromPublicKey as h, getP2TRAddressFromPublicKey as i, getP2TRAddressFromPkScript as j, getP2WPKHAddressFromPublicKey as k, getTxFromRawTxHex as l, getTxFromRawTxBytes as m, getSigHashFromTx as n, getTxId as o, getTxIdNoReverse as p, addPublicKeys as q, applyAdditiveTweakToPublicKey as r, subtractPublicKeys as s, addPrivateKeys as t, subtractPrivateKeys as u, validateOutboundAdaptorSignature as v, sumOfPrivateKeys as w, lastKeyWithTarget as x, getLatestDepositTxId as y, isTxBroadcast as z };
|