@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
package/dist/types/index.d.cts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export { B as BitcoinNetwork } from '../BitcoinNetwork-TnABML0T.cjs';
|
|
2
2
|
export { ClaimStaticDeposit, ClaimStaticDepositInput, ClaimStaticDepositRequestType, ClaimStaticDepositStatus, CompleteCoopExitOutput, CompleteLeavesSwapOutput, CompleteSeedReleaseInput, CompleteSeedReleaseOutput, Connection, CoopExitFeeQuoteOutput, Entity, GetChallengeInput, LeavesSwapFeeEstimateInput, NotifyReceiverTransferInput, Provider, RequestCoopExitOutput, RequestLeavesSwapOutput, RequestLightningReceiveOutput, RequestLightningSendOutput, SparkUserRequestStatus, SparkUserRequestType, SparkWalletUser, SparkWalletUserToUserRequestsConnection, StartSeedReleaseInput, UserRequest, VerifyChallengeInput, WalletUserIdentityPublicKeyInput, WalletUserIdentityPublicKeyOutput, getClaimStaticDepositQuery, getUserRequestQuery } from '../graphql/objects/index.cjs';
|
|
3
|
-
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, k as CurrencyAmount, 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, P as PageInfo, 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
|
+
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, k as CurrencyAmount, 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, P as PageInfo, 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-2cSh_In4.cjs';
|
|
4
4
|
export { L as LightningSendFeeEstimateInput } from '../LightningSendFeeEstimateInput-BgOhEAI-.cjs';
|
|
5
|
-
export { c as CommonProto, s as SparkProto } from '../spark-
|
|
6
|
-
export { T as TransferDirection, W as WalletLeaf, a as WalletTransfer, b as WalletTransferLeaf, c as mapTransferLeafToWalletTransferLeaf, d as mapTransferToWalletTransfer, m as mapTreeNodeToWalletLeaf } from '../sdk-types-
|
|
5
|
+
export { c as CommonProto, s as SparkProto } from '../spark-DbzGfse6.cjs';
|
|
6
|
+
export { T as TransferDirection, W as WalletLeaf, a as WalletTransfer, b as WalletTransferLeaf, c as mapTransferLeafToWalletTransferLeaf, d as mapTransferToWalletTransfer, m as mapTreeNodeToWalletLeaf } from '../sdk-types-Ct8xmN7l.cjs';
|
|
7
7
|
import '@lightsparkdev/core';
|
|
8
|
-
import '../signer-
|
|
8
|
+
import '../signer-BP6F__oR.cjs';
|
|
9
9
|
import '@scure/bip32';
|
|
10
|
+
import '../types-C-Rp0Oo7.cjs';
|
|
10
11
|
import '@buildonspark/lrc20-sdk';
|
|
11
12
|
import '@scure/btc-signer';
|
|
12
13
|
import 'bitcoinjs-lib';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export { B as BitcoinNetwork } from '../BitcoinNetwork-TnABML0T.js';
|
|
2
2
|
export { ClaimStaticDeposit, ClaimStaticDepositInput, ClaimStaticDepositRequestType, ClaimStaticDepositStatus, CompleteCoopExitOutput, CompleteLeavesSwapOutput, CompleteSeedReleaseInput, CompleteSeedReleaseOutput, Connection, CoopExitFeeQuoteOutput, Entity, GetChallengeInput, LeavesSwapFeeEstimateInput, NotifyReceiverTransferInput, Provider, RequestCoopExitOutput, RequestLeavesSwapOutput, RequestLightningReceiveOutput, RequestLightningSendOutput, SparkUserRequestStatus, SparkUserRequestType, SparkWalletUser, SparkWalletUserToUserRequestsConnection, StartSeedReleaseInput, UserRequest, VerifyChallengeInput, WalletUserIdentityPublicKeyInput, WalletUserIdentityPublicKeyOutput, getClaimStaticDepositQuery, getUserRequestQuery } from '../graphql/objects/index.js';
|
|
3
|
-
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, k as CurrencyAmount, 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, P as PageInfo, 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
|
+
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, k as CurrencyAmount, 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, P as PageInfo, 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-CN6BNg_g.js';
|
|
4
4
|
export { L as LightningSendFeeEstimateInput } from '../LightningSendFeeEstimateInput-BgOhEAI-.js';
|
|
5
|
-
export { c as CommonProto, s as SparkProto } from '../spark-
|
|
6
|
-
export { T as TransferDirection, W as WalletLeaf, a as WalletTransfer, b as WalletTransferLeaf, c as mapTransferLeafToWalletTransferLeaf, d as mapTransferToWalletTransfer, m as mapTreeNodeToWalletLeaf } from '../sdk-types-
|
|
5
|
+
export { c as CommonProto, s as SparkProto } from '../spark-DbzGfse6.js';
|
|
6
|
+
export { T as TransferDirection, W as WalletLeaf, a as WalletTransfer, b as WalletTransferLeaf, c as mapTransferLeafToWalletTransferLeaf, d as mapTransferToWalletTransfer, m as mapTreeNodeToWalletLeaf } from '../sdk-types-CKBsylfW.js';
|
|
7
7
|
import '@lightsparkdev/core';
|
|
8
|
-
import '../signer-
|
|
8
|
+
import '../signer-BVZJXcq7.js';
|
|
9
9
|
import '@scure/bip32';
|
|
10
|
+
import '../types-C-Rp0Oo7.js';
|
|
10
11
|
import '@buildonspark/lrc20-sdk';
|
|
11
12
|
import '@scure/btc-signer';
|
|
12
13
|
import 'bitcoinjs-lib';
|
package/dist/types/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
mapTransferLeafToWalletTransferLeaf,
|
|
4
4
|
mapTransferToWalletTransfer,
|
|
5
5
|
mapTreeNodeToWalletLeaf
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-OBFKIEMP.js";
|
|
7
7
|
import {
|
|
8
8
|
ClaimStaticDepositRequestType_default,
|
|
9
9
|
ClaimStaticDepositStatus_default,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
import {
|
|
31
31
|
common_exports,
|
|
32
32
|
spark_exports
|
|
33
|
-
} from "../chunk-
|
|
33
|
+
} from "../chunk-BGGEVUJK.js";
|
|
34
34
|
import "../chunk-MVRQ5US7.js";
|
|
35
35
|
export {
|
|
36
36
|
BitcoinNetwork_default as BitcoinNetwork,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
interface IKeyPackage {
|
|
2
|
+
secretKey: Uint8Array;
|
|
3
|
+
publicKey: Uint8Array;
|
|
4
|
+
verifyingKey: Uint8Array;
|
|
5
|
+
}
|
|
6
|
+
interface ISigningNonce {
|
|
7
|
+
hiding: Uint8Array;
|
|
8
|
+
binding: Uint8Array;
|
|
9
|
+
}
|
|
10
|
+
interface ISigningCommitment {
|
|
11
|
+
hiding: Uint8Array;
|
|
12
|
+
binding: Uint8Array;
|
|
13
|
+
}
|
|
14
|
+
interface DummyTx {
|
|
15
|
+
tx: Uint8Array;
|
|
16
|
+
txid: string;
|
|
17
|
+
}
|
|
18
|
+
type SignFrostParams = {
|
|
19
|
+
message: Uint8Array;
|
|
20
|
+
keyPackage: IKeyPackage;
|
|
21
|
+
nonce: ISigningNonce;
|
|
22
|
+
selfCommitment: ISigningCommitment;
|
|
23
|
+
statechainCommitments: {
|
|
24
|
+
[key: string]: ISigningCommitment;
|
|
25
|
+
} | undefined;
|
|
26
|
+
adaptorPubKey?: Uint8Array;
|
|
27
|
+
};
|
|
28
|
+
type AggregateFrostParams = {
|
|
29
|
+
message: Uint8Array;
|
|
30
|
+
statechainCommitments: {
|
|
31
|
+
[key: string]: ISigningCommitment;
|
|
32
|
+
} | undefined;
|
|
33
|
+
selfCommitment: ISigningCommitment;
|
|
34
|
+
statechainSignatures: {
|
|
35
|
+
[key: string]: Uint8Array;
|
|
36
|
+
} | undefined;
|
|
37
|
+
selfSignature: Uint8Array;
|
|
38
|
+
statechainPublicKeys: {
|
|
39
|
+
[key: string]: Uint8Array;
|
|
40
|
+
} | undefined;
|
|
41
|
+
selfPublicKey: Uint8Array;
|
|
42
|
+
verifyingKey: Uint8Array;
|
|
43
|
+
adaptorPubKey?: Uint8Array;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type { AggregateFrostParams as A, DummyTx as D, ISigningCommitment as I, SignFrostParams as S, IKeyPackage as a, ISigningNonce as b };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
interface IKeyPackage {
|
|
2
|
+
secretKey: Uint8Array;
|
|
3
|
+
publicKey: Uint8Array;
|
|
4
|
+
verifyingKey: Uint8Array;
|
|
5
|
+
}
|
|
6
|
+
interface ISigningNonce {
|
|
7
|
+
hiding: Uint8Array;
|
|
8
|
+
binding: Uint8Array;
|
|
9
|
+
}
|
|
10
|
+
interface ISigningCommitment {
|
|
11
|
+
hiding: Uint8Array;
|
|
12
|
+
binding: Uint8Array;
|
|
13
|
+
}
|
|
14
|
+
interface DummyTx {
|
|
15
|
+
tx: Uint8Array;
|
|
16
|
+
txid: string;
|
|
17
|
+
}
|
|
18
|
+
type SignFrostParams = {
|
|
19
|
+
message: Uint8Array;
|
|
20
|
+
keyPackage: IKeyPackage;
|
|
21
|
+
nonce: ISigningNonce;
|
|
22
|
+
selfCommitment: ISigningCommitment;
|
|
23
|
+
statechainCommitments: {
|
|
24
|
+
[key: string]: ISigningCommitment;
|
|
25
|
+
} | undefined;
|
|
26
|
+
adaptorPubKey?: Uint8Array;
|
|
27
|
+
};
|
|
28
|
+
type AggregateFrostParams = {
|
|
29
|
+
message: Uint8Array;
|
|
30
|
+
statechainCommitments: {
|
|
31
|
+
[key: string]: ISigningCommitment;
|
|
32
|
+
} | undefined;
|
|
33
|
+
selfCommitment: ISigningCommitment;
|
|
34
|
+
statechainSignatures: {
|
|
35
|
+
[key: string]: Uint8Array;
|
|
36
|
+
} | undefined;
|
|
37
|
+
selfSignature: Uint8Array;
|
|
38
|
+
statechainPublicKeys: {
|
|
39
|
+
[key: string]: Uint8Array;
|
|
40
|
+
} | undefined;
|
|
41
|
+
selfPublicKey: Uint8Array;
|
|
42
|
+
verifyingKey: Uint8Array;
|
|
43
|
+
adaptorPubKey?: Uint8Array;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type { AggregateFrostParams as A, DummyTx as D, ISigningCommitment as I, SignFrostParams as S, IKeyPackage as a, ISigningNonce as b };
|
package/dist/utils/index.cjs
CHANGED
|
@@ -357,7 +357,7 @@ var Timestamp = {
|
|
|
357
357
|
},
|
|
358
358
|
decode(input, length) {
|
|
359
359
|
const reader = input instanceof import_wire3.BinaryReader ? input : new import_wire3.BinaryReader(input);
|
|
360
|
-
|
|
360
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
361
361
|
const message = createBaseTimestamp();
|
|
362
362
|
while (reader.pos < end) {
|
|
363
363
|
const tag = reader.uint32();
|
|
@@ -489,7 +489,7 @@ var SigningKeyshare = {
|
|
|
489
489
|
},
|
|
490
490
|
decode(input, length) {
|
|
491
491
|
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
492
|
-
|
|
492
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
493
493
|
const message = createBaseSigningKeyshare();
|
|
494
494
|
while (reader.pos < end) {
|
|
495
495
|
const tag = reader.uint32();
|
|
@@ -613,7 +613,7 @@ var SigningKeyshare_PublicSharesEntry = {
|
|
|
613
613
|
},
|
|
614
614
|
decode(input, length) {
|
|
615
615
|
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
616
|
-
|
|
616
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
617
617
|
const message = createBaseSigningKeyshare_PublicSharesEntry();
|
|
618
618
|
while (reader.pos < end) {
|
|
619
619
|
const tag = reader.uint32();
|
|
@@ -682,7 +682,10 @@ function createBaseTreeNode() {
|
|
|
682
682
|
network: 0,
|
|
683
683
|
createdTime: void 0,
|
|
684
684
|
updatedTime: void 0,
|
|
685
|
-
ownerSigningPublicKey: new Uint8Array(0)
|
|
685
|
+
ownerSigningPublicKey: new Uint8Array(0),
|
|
686
|
+
directTx: new Uint8Array(0),
|
|
687
|
+
directRefundTx: new Uint8Array(0),
|
|
688
|
+
directFromCpfpRefundTx: new Uint8Array(0)
|
|
686
689
|
};
|
|
687
690
|
}
|
|
688
691
|
var TreeNode = {
|
|
@@ -732,11 +735,20 @@ var TreeNode = {
|
|
|
732
735
|
if (message.ownerSigningPublicKey.length !== 0) {
|
|
733
736
|
writer.uint32(122).bytes(message.ownerSigningPublicKey);
|
|
734
737
|
}
|
|
738
|
+
if (message.directTx.length !== 0) {
|
|
739
|
+
writer.uint32(130).bytes(message.directTx);
|
|
740
|
+
}
|
|
741
|
+
if (message.directRefundTx.length !== 0) {
|
|
742
|
+
writer.uint32(138).bytes(message.directRefundTx);
|
|
743
|
+
}
|
|
744
|
+
if (message.directFromCpfpRefundTx.length !== 0) {
|
|
745
|
+
writer.uint32(146).bytes(message.directFromCpfpRefundTx);
|
|
746
|
+
}
|
|
735
747
|
return writer;
|
|
736
748
|
},
|
|
737
749
|
decode(input, length) {
|
|
738
750
|
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
739
|
-
|
|
751
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
740
752
|
const message = createBaseTreeNode();
|
|
741
753
|
while (reader.pos < end) {
|
|
742
754
|
const tag = reader.uint32();
|
|
@@ -846,6 +858,27 @@ var TreeNode = {
|
|
|
846
858
|
message.ownerSigningPublicKey = reader.bytes();
|
|
847
859
|
continue;
|
|
848
860
|
}
|
|
861
|
+
case 16: {
|
|
862
|
+
if (tag !== 130) {
|
|
863
|
+
break;
|
|
864
|
+
}
|
|
865
|
+
message.directTx = reader.bytes();
|
|
866
|
+
continue;
|
|
867
|
+
}
|
|
868
|
+
case 17: {
|
|
869
|
+
if (tag !== 138) {
|
|
870
|
+
break;
|
|
871
|
+
}
|
|
872
|
+
message.directRefundTx = reader.bytes();
|
|
873
|
+
continue;
|
|
874
|
+
}
|
|
875
|
+
case 18: {
|
|
876
|
+
if (tag !== 146) {
|
|
877
|
+
break;
|
|
878
|
+
}
|
|
879
|
+
message.directFromCpfpRefundTx = reader.bytes();
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
849
882
|
}
|
|
850
883
|
if ((tag & 7) === 4 || tag === 0) {
|
|
851
884
|
break;
|
|
@@ -870,7 +903,10 @@ var TreeNode = {
|
|
|
870
903
|
network: isSet2(object.network) ? networkFromJSON(object.network) : 0,
|
|
871
904
|
createdTime: isSet2(object.createdTime) ? fromJsonTimestamp(object.createdTime) : void 0,
|
|
872
905
|
updatedTime: isSet2(object.updatedTime) ? fromJsonTimestamp(object.updatedTime) : void 0,
|
|
873
|
-
ownerSigningPublicKey: isSet2(object.ownerSigningPublicKey) ? bytesFromBase64(object.ownerSigningPublicKey) : new Uint8Array(0)
|
|
906
|
+
ownerSigningPublicKey: isSet2(object.ownerSigningPublicKey) ? bytesFromBase64(object.ownerSigningPublicKey) : new Uint8Array(0),
|
|
907
|
+
directTx: isSet2(object.directTx) ? bytesFromBase64(object.directTx) : new Uint8Array(0),
|
|
908
|
+
directRefundTx: isSet2(object.directRefundTx) ? bytesFromBase64(object.directRefundTx) : new Uint8Array(0),
|
|
909
|
+
directFromCpfpRefundTx: isSet2(object.directFromCpfpRefundTx) ? bytesFromBase64(object.directFromCpfpRefundTx) : new Uint8Array(0)
|
|
874
910
|
};
|
|
875
911
|
},
|
|
876
912
|
toJSON(message) {
|
|
@@ -920,6 +956,15 @@ var TreeNode = {
|
|
|
920
956
|
if (message.ownerSigningPublicKey.length !== 0) {
|
|
921
957
|
obj.ownerSigningPublicKey = base64FromBytes(message.ownerSigningPublicKey);
|
|
922
958
|
}
|
|
959
|
+
if (message.directTx.length !== 0) {
|
|
960
|
+
obj.directTx = base64FromBytes(message.directTx);
|
|
961
|
+
}
|
|
962
|
+
if (message.directRefundTx.length !== 0) {
|
|
963
|
+
obj.directRefundTx = base64FromBytes(message.directRefundTx);
|
|
964
|
+
}
|
|
965
|
+
if (message.directFromCpfpRefundTx.length !== 0) {
|
|
966
|
+
obj.directFromCpfpRefundTx = base64FromBytes(message.directFromCpfpRefundTx);
|
|
967
|
+
}
|
|
923
968
|
return obj;
|
|
924
969
|
},
|
|
925
970
|
create(base) {
|
|
@@ -942,6 +987,9 @@ var TreeNode = {
|
|
|
942
987
|
message.createdTime = object.createdTime ?? void 0;
|
|
943
988
|
message.updatedTime = object.updatedTime ?? void 0;
|
|
944
989
|
message.ownerSigningPublicKey = object.ownerSigningPublicKey ?? new Uint8Array(0);
|
|
990
|
+
message.directTx = object.directTx ?? new Uint8Array(0);
|
|
991
|
+
message.directRefundTx = object.directRefundTx ?? new Uint8Array(0);
|
|
992
|
+
message.directFromCpfpRefundTx = object.directFromCpfpRefundTx ?? new Uint8Array(0);
|
|
945
993
|
return message;
|
|
946
994
|
}
|
|
947
995
|
};
|
|
@@ -960,7 +1008,7 @@ var SparkAddress = {
|
|
|
960
1008
|
},
|
|
961
1009
|
decode(input, length) {
|
|
962
1010
|
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
963
|
-
|
|
1011
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
964
1012
|
const message = createBaseSparkAddress();
|
|
965
1013
|
while (reader.pos < end) {
|
|
966
1014
|
const tag = reader.uint32();
|
|
@@ -1034,7 +1082,7 @@ var PaymentIntentFields = {
|
|
|
1034
1082
|
},
|
|
1035
1083
|
decode(input, length) {
|
|
1036
1084
|
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
1037
|
-
|
|
1085
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1038
1086
|
const message = createBasePaymentIntentFields();
|
|
1039
1087
|
while (reader.pos < end) {
|
|
1040
1088
|
const tag = reader.uint32();
|
|
@@ -1619,7 +1667,7 @@ var BASE_CONFIG = {
|
|
|
1619
1667
|
threshold: 2,
|
|
1620
1668
|
signingOperators: getLocalSigningOperators(),
|
|
1621
1669
|
tokenSignatures: "SCHNORR",
|
|
1622
|
-
tokenTransactionVersion: "
|
|
1670
|
+
tokenTransactionVersion: "V1",
|
|
1623
1671
|
tokenValidityDurationSeconds: 180,
|
|
1624
1672
|
electrsUrl: getElectrsUrl("LOCAL"),
|
|
1625
1673
|
expectedWithdrawBondSats: 1e4,
|
|
@@ -2175,13 +2223,19 @@ function checkIfSelectedOutputsAreAvailable(selectedOutputs, tokenOutputs, token
|
|
|
2175
2223
|
return true;
|
|
2176
2224
|
}
|
|
2177
2225
|
function filterTokenBalanceForTokenPublicKey(tokenBalances, publicKey) {
|
|
2178
|
-
if (!tokenBalances
|
|
2226
|
+
if (!tokenBalances) {
|
|
2227
|
+
return { balance: 0n };
|
|
2228
|
+
}
|
|
2229
|
+
const tokenBalance = [...tokenBalances.entries()].find(
|
|
2230
|
+
([, info]) => info.tokenMetadata.tokenPublicKey === publicKey
|
|
2231
|
+
);
|
|
2232
|
+
if (!tokenBalance) {
|
|
2179
2233
|
return {
|
|
2180
2234
|
balance: 0n
|
|
2181
2235
|
};
|
|
2182
2236
|
}
|
|
2183
2237
|
return {
|
|
2184
|
-
balance:
|
|
2238
|
+
balance: tokenBalance[1].balance
|
|
2185
2239
|
};
|
|
2186
2240
|
}
|
|
2187
2241
|
|
|
@@ -2262,10 +2316,8 @@ function checkIfValidSequence(currSequence) {
|
|
|
2262
2316
|
}
|
|
2263
2317
|
}
|
|
2264
2318
|
function getNextTransactionSequence(currSequence, forRefresh) {
|
|
2265
|
-
checkIfValidSequence(currSequence);
|
|
2266
2319
|
const currentTimelock = getCurrentTimelock(currSequence);
|
|
2267
2320
|
const nextTimelock = currentTimelock - TIME_LOCK_INTERVAL;
|
|
2268
|
-
checkIfValidSequence(nextTimelock);
|
|
2269
2321
|
if (forRefresh && nextTimelock <= 100 && currentTimelock > 0) {
|
|
2270
2322
|
return {
|
|
2271
2323
|
nextSequence: 1 << 30 | nextTimelock,
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,138 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
1
|
+
export { a6 as BroadcastConfig, a7 as BroadcastResult, U as DEFAULT_FEE_SATS, a4 as FeeBumpTxChain, a3 as FeeBumpTxPackage, a2 as FeeRate, a0 as LeafInfo, a5 as TxChain, a1 as Utxo, t as addPrivateKeys, q as addPublicKeys, e as applyAdaptorToSignature, r as applyAdditiveTweakToPublicKey, N as calculateAvailableTokenAmount, O as checkIfSelectedOutputsAreAvailable, Z as checkIfValidSequence, B as collectResponses, f as computeTaprootKeyNoScript, ab as constructFeeBumpTx, aa as constructUnilateralExitFeeBumpPackages, a9 as constructUnilateralExitTxs, W as createRefundTx, K as createSigningCommitment, F as createSigningNonce, M as decodeBytesToSigningCommitment, J as decodeBytesToSigningNonce, L as encodeSigningCommitmentToBytes, H as encodeSigningNonceToBytes, Q as filterTokenBalanceForTokenPublicKey, d as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, X as getCurrentTimelock, $ as getEphemeralAnchorOutput, y as getLatestDepositTxId, _ as getNextTransactionSequence, j as getP2TRAddressFromPkScript, i as getP2TRAddressFromPublicKey, h as getP2TRScriptFromPublicKey, k as getP2WPKHAddressFromPublicKey, E as getRandomSigningNonce, n as getSigHashFromTx, G as getSigningCommitmentFromNonce, ac as getSparkAddressFromTaproot, Y as getTransactionSequence, R as getTransferPackageSigningPayload, m as getTxFromRawTxBytes, l as getTxFromRawTxHex, o as getTxId, p as getTxIdNoReverse, a8 as isEphemeralAnchorOutput, z as isTxBroadcast, x as lastKeyWithTarget, V as maybeApplyFee, A as proofOfPossessionMessageHashForDepositAddress, u as subtractPrivateKeys, s as subtractPublicKeys, w as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from '../index-CKL5DodV.cjs';
|
|
2
|
+
export { L as LRC_WALLET_NETWORK, c as LRC_WALLET_NETWORK_TYPE, N as Network, b as NetworkToProto, a as NetworkType, g as getNetwork, d as getNetworkFromAddress, e as getNetworkFromString } from '../network-Css46DAz.cjs';
|
|
3
|
+
export { V as VerifiableSecretShare, d as bigIntToPrivateKey, c as computerLagrangeCoefficients, e as evaluatePolynomial, f as fieldDiv, a as generatePolynomialForSecretSharing, g as getRandomBigInt, m as modInverse, r as recoverSecret, s as splitSecret, b as splitSecretWithProofs, v as validateShare } from '../signer-BP6F__oR.cjs';
|
|
4
|
+
import '@scure/btc-signer';
|
|
5
|
+
import '@scure/btc-signer/psbt';
|
|
6
|
+
import '../spark-DbzGfse6.cjs';
|
|
7
|
+
import '@bufbuild/protobuf/wire';
|
|
8
|
+
import 'nice-grpc-common';
|
|
9
|
+
import '../services/wallet-config.cjs';
|
|
10
10
|
import '@buildonspark/lrc20-sdk';
|
|
11
|
-
import '
|
|
11
|
+
import '../RequestLightningSendInput-2cSh_In4.cjs';
|
|
12
|
+
import '@lightsparkdev/core';
|
|
12
13
|
import '../BitcoinNetwork-TnABML0T.cjs';
|
|
13
14
|
import '@scure/bip32';
|
|
15
|
+
import '../types-C-Rp0Oo7.cjs';
|
|
16
|
+
import 'bitcoinjs-lib';
|
|
14
17
|
import '@buildonspark/lrc20-sdk/lrc/types';
|
|
15
|
-
import '
|
|
16
|
-
import 'nice-grpc-common';
|
|
17
|
-
|
|
18
|
-
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
19
|
-
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
20
|
-
adaptorSignature: Uint8Array;
|
|
21
|
-
adaptorPrivateKey: Uint8Array;
|
|
22
|
-
};
|
|
23
|
-
declare function validateOutboundAdaptorSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPubkey: Uint8Array): boolean;
|
|
24
|
-
declare function applyAdaptorToSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
25
|
-
|
|
26
|
-
declare function computeTaprootKeyNoScript(pubkey: Uint8Array): Uint8Array;
|
|
27
|
-
declare function getP2TRScriptFromPublicKey(pubKey: Uint8Array, network: Network): Uint8Array;
|
|
28
|
-
declare function getP2TRAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
29
|
-
declare function getP2TRAddressFromPkScript(pkScript: Uint8Array, network: Network): string;
|
|
30
|
-
declare function getP2WPKHAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
31
|
-
declare function getTxFromRawTxHex(rawTxHex: string): btc.Transaction;
|
|
32
|
-
declare function getTxFromRawTxBytes(rawTxBytes: Uint8Array): btc.Transaction;
|
|
33
|
-
declare function getSigHashFromTx(tx: btc.Transaction, inputIndex: number, prevOutput: TransactionOutput): Uint8Array;
|
|
34
|
-
declare function getTxId(tx: btc.Transaction): string;
|
|
35
|
-
declare function getTxIdNoReverse(tx: btc.Transaction): string;
|
|
36
|
-
|
|
37
|
-
declare function addPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
38
|
-
declare function applyAdditiveTweakToPublicKey(pubkey: Uint8Array, tweak: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
39
|
-
declare function subtractPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
40
|
-
declare function addPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
41
|
-
declare function subtractPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
42
|
-
declare function sumOfPrivateKeys(keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
43
|
-
declare function lastKeyWithTarget(target: Uint8Array, keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
44
|
-
|
|
45
|
-
declare function getLatestDepositTxId(address: string): Promise<string | null>;
|
|
46
|
-
declare function isTxBroadcast(txid: string, baseUrl: string, network?: any): Promise<boolean>;
|
|
47
|
-
|
|
48
|
-
declare function proofOfPossessionMessageHashForDepositAddress(userPubkey: Uint8Array, operatorPubkey: Uint8Array, depositAddress: string): Uint8Array;
|
|
49
|
-
|
|
50
|
-
declare function collectResponses<T>(responses: PromiseSettledResult<T>[]): T[];
|
|
51
|
-
|
|
52
|
-
declare function getRandomSigningNonce(): SigningNonce;
|
|
53
|
-
declare function createSigningNonce(binding: Uint8Array, hiding: Uint8Array): SigningNonce;
|
|
54
|
-
declare function getSigningCommitmentFromNonce(nonce: SigningNonce): SigningCommitment;
|
|
55
|
-
declare function encodeSigningNonceToBytes(nonce: SigningNonce): Uint8Array;
|
|
56
|
-
declare function decodeBytesToSigningNonce(bytes: Uint8Array): SigningNonce;
|
|
57
|
-
declare function createSigningCommitment(binding: Uint8Array, hiding: Uint8Array): SigningCommitment;
|
|
58
|
-
declare function encodeSigningCommitmentToBytes(commitment: SigningCommitment): Uint8Array;
|
|
59
|
-
declare function decodeBytesToSigningCommitment(bytes: Uint8Array): SigningCommitment;
|
|
60
|
-
|
|
61
|
-
declare function calculateAvailableTokenAmount(outputLeaves: OutputWithPreviousTransactionData[]): bigint;
|
|
62
|
-
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>, tokenPublicKey: Uint8Array): boolean;
|
|
63
|
-
declare function filterTokenBalanceForTokenPublicKey(tokenBalances: Map<string, {
|
|
64
|
-
balance: bigint;
|
|
65
|
-
}>, publicKey: string): {
|
|
66
|
-
balance: bigint;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
|
|
70
|
-
|
|
71
|
-
declare const DEFAULT_FEE_SATS: number;
|
|
72
|
-
/**
|
|
73
|
-
* Subtracts the default fee from the amount if it's greater than the fee.
|
|
74
|
-
* Returns the original amount if it's less than or equal to the fee.
|
|
75
|
-
*/
|
|
76
|
-
declare function maybeApplyFee(amount: bigint): bigint;
|
|
77
|
-
declare function createRefundTx(sequence: number, nodeOutPoint: TransactionInput, amountSats: bigint, receivingPubkey: Uint8Array, network: Network): Transaction;
|
|
78
|
-
declare function getCurrentTimelock(currSequence?: number): number;
|
|
79
|
-
declare function getTransactionSequence(currSequence?: number): number;
|
|
80
|
-
declare function checkIfValidSequence(currSequence?: number): void;
|
|
81
|
-
declare function getNextTransactionSequence(currSequence?: number, forRefresh?: boolean): {
|
|
82
|
-
nextSequence: number;
|
|
83
|
-
needRefresh: boolean;
|
|
84
|
-
};
|
|
85
|
-
declare function getEphemeralAnchorOutput(): TransactionOutput;
|
|
86
|
-
|
|
87
|
-
interface LeafInfo {
|
|
88
|
-
leafId: string;
|
|
89
|
-
nodeTx: string;
|
|
90
|
-
refundTx: string;
|
|
91
|
-
}
|
|
92
|
-
interface Utxo {
|
|
93
|
-
txid: string;
|
|
94
|
-
vout: number;
|
|
95
|
-
value: bigint;
|
|
96
|
-
script: string;
|
|
97
|
-
publicKey: string;
|
|
98
|
-
}
|
|
99
|
-
interface FeeRate {
|
|
100
|
-
satPerVbyte: number;
|
|
101
|
-
}
|
|
102
|
-
interface FeeBumpTxPackage {
|
|
103
|
-
tx: string;
|
|
104
|
-
feeBumpPsbt?: string;
|
|
105
|
-
}
|
|
106
|
-
interface FeeBumpTxChain {
|
|
107
|
-
leafId: string;
|
|
108
|
-
txPackages: FeeBumpTxPackage[];
|
|
109
|
-
}
|
|
110
|
-
interface TxChain {
|
|
111
|
-
leafId: string;
|
|
112
|
-
transactions: string[];
|
|
113
|
-
}
|
|
114
|
-
interface BroadcastConfig {
|
|
115
|
-
bitcoinCoreRpcUrl?: string;
|
|
116
|
-
rpcUsername?: string;
|
|
117
|
-
rpcPassword?: string;
|
|
118
|
-
autoBroadcast?: boolean;
|
|
119
|
-
network?: "MAINNET" | "REGTEST" | "TESTNET" | "SIGNET" | "LOCAL";
|
|
120
|
-
}
|
|
121
|
-
interface BroadcastResult {
|
|
122
|
-
success: boolean;
|
|
123
|
-
txids?: string[];
|
|
124
|
-
error?: string;
|
|
125
|
-
broadcastedPackages?: number;
|
|
126
|
-
}
|
|
127
|
-
declare function isEphemeralAnchorOutput(script?: Uint8Array, amount?: bigint): boolean;
|
|
128
|
-
declare function constructUnilateralExitTxs(nodeHexStrings: string[], sparkClient?: SparkServiceClient, network?: any): Promise<TxChain[]>;
|
|
129
|
-
declare function constructUnilateralExitFeeBumpPackages(nodeHexStrings: string[], utxos: Utxo[], feeRate: FeeRate, electrsUrl: string, sparkClient?: SparkServiceClient, network?: any): Promise<FeeBumpTxChain[]>;
|
|
130
|
-
declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRate, previousFeeBumpTx?: string): {
|
|
131
|
-
feeBumpPsbt: string;
|
|
132
|
-
usedUtxos: Utxo[];
|
|
133
|
-
correctedParentTx?: string;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
137
|
-
|
|
138
|
-
export { type BroadcastConfig, type BroadcastResult, DEFAULT_FEE_SATS, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, type LeafInfo, Network, type TxChain, type Utxo, addPrivateKeys, addPublicKeys, applyAdaptorToSignature, applyAdditiveTweakToPublicKey, calculateAvailableTokenAmount, checkIfSelectedOutputsAreAvailable, checkIfValidSequence, collectResponses, computeTaprootKeyNoScript, constructFeeBumpTx, constructUnilateralExitFeeBumpPackages, constructUnilateralExitTxs, createRefundTx, createSigningCommitment, createSigningNonce, decodeBytesToSigningCommitment, decodeBytesToSigningNonce, encodeSigningCommitmentToBytes, encodeSigningNonceToBytes, filterTokenBalanceForTokenPublicKey, generateAdaptorFromSignature, generateSignatureFromExistingAdaptor, getCurrentTimelock, getEphemeralAnchorOutput, getLatestDepositTxId, getNextTransactionSequence, getP2TRAddressFromPkScript, getP2TRAddressFromPublicKey, getP2TRScriptFromPublicKey, getP2WPKHAddressFromPublicKey, getRandomSigningNonce, getSigHashFromTx, getSigningCommitmentFromNonce, getSparkAddressFromTaproot, getTransactionSequence, getTransferPackageSigningPayload, getTxFromRawTxBytes, getTxFromRawTxHex, getTxId, getTxIdNoReverse, isEphemeralAnchorOutput, isTxBroadcast, lastKeyWithTarget, maybeApplyFee, proofOfPossessionMessageHashForDepositAddress, subtractPrivateKeys, subtractPublicKeys, sumOfPrivateKeys, validateOutboundAdaptorSignature };
|
|
18
|
+
import '../address/index.cjs';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,138 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
1
|
+
export { a6 as BroadcastConfig, a7 as BroadcastResult, U as DEFAULT_FEE_SATS, a4 as FeeBumpTxChain, a3 as FeeBumpTxPackage, a2 as FeeRate, a0 as LeafInfo, a5 as TxChain, a1 as Utxo, t as addPrivateKeys, q as addPublicKeys, e as applyAdaptorToSignature, r as applyAdditiveTweakToPublicKey, N as calculateAvailableTokenAmount, O as checkIfSelectedOutputsAreAvailable, Z as checkIfValidSequence, B as collectResponses, f as computeTaprootKeyNoScript, ab as constructFeeBumpTx, aa as constructUnilateralExitFeeBumpPackages, a9 as constructUnilateralExitTxs, W as createRefundTx, K as createSigningCommitment, F as createSigningNonce, M as decodeBytesToSigningCommitment, J as decodeBytesToSigningNonce, L as encodeSigningCommitmentToBytes, H as encodeSigningNonceToBytes, Q as filterTokenBalanceForTokenPublicKey, d as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, X as getCurrentTimelock, $ as getEphemeralAnchorOutput, y as getLatestDepositTxId, _ as getNextTransactionSequence, j as getP2TRAddressFromPkScript, i as getP2TRAddressFromPublicKey, h as getP2TRScriptFromPublicKey, k as getP2WPKHAddressFromPublicKey, E as getRandomSigningNonce, n as getSigHashFromTx, G as getSigningCommitmentFromNonce, ac as getSparkAddressFromTaproot, Y as getTransactionSequence, R as getTransferPackageSigningPayload, m as getTxFromRawTxBytes, l as getTxFromRawTxHex, o as getTxId, p as getTxIdNoReverse, a8 as isEphemeralAnchorOutput, z as isTxBroadcast, x as lastKeyWithTarget, V as maybeApplyFee, A as proofOfPossessionMessageHashForDepositAddress, u as subtractPrivateKeys, s as subtractPublicKeys, w as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from '../index-COm59SPw.js';
|
|
2
|
+
export { L as LRC_WALLET_NETWORK, c as LRC_WALLET_NETWORK_TYPE, N as Network, b as NetworkToProto, a as NetworkType, g as getNetwork, d as getNetworkFromAddress, e as getNetworkFromString } from '../network-hynb7iTZ.js';
|
|
3
|
+
export { V as VerifiableSecretShare, d as bigIntToPrivateKey, c as computerLagrangeCoefficients, e as evaluatePolynomial, f as fieldDiv, a as generatePolynomialForSecretSharing, g as getRandomBigInt, m as modInverse, r as recoverSecret, s as splitSecret, b as splitSecretWithProofs, v as validateShare } from '../signer-BVZJXcq7.js';
|
|
4
|
+
import '@scure/btc-signer';
|
|
5
|
+
import '@scure/btc-signer/psbt';
|
|
6
|
+
import '../spark-DbzGfse6.js';
|
|
7
|
+
import '@bufbuild/protobuf/wire';
|
|
8
|
+
import 'nice-grpc-common';
|
|
9
|
+
import '../services/wallet-config.js';
|
|
10
10
|
import '@buildonspark/lrc20-sdk';
|
|
11
|
-
import '
|
|
11
|
+
import '../RequestLightningSendInput-CN6BNg_g.js';
|
|
12
|
+
import '@lightsparkdev/core';
|
|
12
13
|
import '../BitcoinNetwork-TnABML0T.js';
|
|
13
14
|
import '@scure/bip32';
|
|
15
|
+
import '../types-C-Rp0Oo7.js';
|
|
16
|
+
import 'bitcoinjs-lib';
|
|
14
17
|
import '@buildonspark/lrc20-sdk/lrc/types';
|
|
15
|
-
import '
|
|
16
|
-
import 'nice-grpc-common';
|
|
17
|
-
|
|
18
|
-
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
19
|
-
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
20
|
-
adaptorSignature: Uint8Array;
|
|
21
|
-
adaptorPrivateKey: Uint8Array;
|
|
22
|
-
};
|
|
23
|
-
declare function validateOutboundAdaptorSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPubkey: Uint8Array): boolean;
|
|
24
|
-
declare function applyAdaptorToSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
25
|
-
|
|
26
|
-
declare function computeTaprootKeyNoScript(pubkey: Uint8Array): Uint8Array;
|
|
27
|
-
declare function getP2TRScriptFromPublicKey(pubKey: Uint8Array, network: Network): Uint8Array;
|
|
28
|
-
declare function getP2TRAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
29
|
-
declare function getP2TRAddressFromPkScript(pkScript: Uint8Array, network: Network): string;
|
|
30
|
-
declare function getP2WPKHAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
31
|
-
declare function getTxFromRawTxHex(rawTxHex: string): btc.Transaction;
|
|
32
|
-
declare function getTxFromRawTxBytes(rawTxBytes: Uint8Array): btc.Transaction;
|
|
33
|
-
declare function getSigHashFromTx(tx: btc.Transaction, inputIndex: number, prevOutput: TransactionOutput): Uint8Array;
|
|
34
|
-
declare function getTxId(tx: btc.Transaction): string;
|
|
35
|
-
declare function getTxIdNoReverse(tx: btc.Transaction): string;
|
|
36
|
-
|
|
37
|
-
declare function addPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
38
|
-
declare function applyAdditiveTweakToPublicKey(pubkey: Uint8Array, tweak: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
39
|
-
declare function subtractPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
40
|
-
declare function addPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
41
|
-
declare function subtractPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
42
|
-
declare function sumOfPrivateKeys(keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
43
|
-
declare function lastKeyWithTarget(target: Uint8Array, keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
44
|
-
|
|
45
|
-
declare function getLatestDepositTxId(address: string): Promise<string | null>;
|
|
46
|
-
declare function isTxBroadcast(txid: string, baseUrl: string, network?: any): Promise<boolean>;
|
|
47
|
-
|
|
48
|
-
declare function proofOfPossessionMessageHashForDepositAddress(userPubkey: Uint8Array, operatorPubkey: Uint8Array, depositAddress: string): Uint8Array;
|
|
49
|
-
|
|
50
|
-
declare function collectResponses<T>(responses: PromiseSettledResult<T>[]): T[];
|
|
51
|
-
|
|
52
|
-
declare function getRandomSigningNonce(): SigningNonce;
|
|
53
|
-
declare function createSigningNonce(binding: Uint8Array, hiding: Uint8Array): SigningNonce;
|
|
54
|
-
declare function getSigningCommitmentFromNonce(nonce: SigningNonce): SigningCommitment;
|
|
55
|
-
declare function encodeSigningNonceToBytes(nonce: SigningNonce): Uint8Array;
|
|
56
|
-
declare function decodeBytesToSigningNonce(bytes: Uint8Array): SigningNonce;
|
|
57
|
-
declare function createSigningCommitment(binding: Uint8Array, hiding: Uint8Array): SigningCommitment;
|
|
58
|
-
declare function encodeSigningCommitmentToBytes(commitment: SigningCommitment): Uint8Array;
|
|
59
|
-
declare function decodeBytesToSigningCommitment(bytes: Uint8Array): SigningCommitment;
|
|
60
|
-
|
|
61
|
-
declare function calculateAvailableTokenAmount(outputLeaves: OutputWithPreviousTransactionData[]): bigint;
|
|
62
|
-
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>, tokenPublicKey: Uint8Array): boolean;
|
|
63
|
-
declare function filterTokenBalanceForTokenPublicKey(tokenBalances: Map<string, {
|
|
64
|
-
balance: bigint;
|
|
65
|
-
}>, publicKey: string): {
|
|
66
|
-
balance: bigint;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
|
|
70
|
-
|
|
71
|
-
declare const DEFAULT_FEE_SATS: number;
|
|
72
|
-
/**
|
|
73
|
-
* Subtracts the default fee from the amount if it's greater than the fee.
|
|
74
|
-
* Returns the original amount if it's less than or equal to the fee.
|
|
75
|
-
*/
|
|
76
|
-
declare function maybeApplyFee(amount: bigint): bigint;
|
|
77
|
-
declare function createRefundTx(sequence: number, nodeOutPoint: TransactionInput, amountSats: bigint, receivingPubkey: Uint8Array, network: Network): Transaction;
|
|
78
|
-
declare function getCurrentTimelock(currSequence?: number): number;
|
|
79
|
-
declare function getTransactionSequence(currSequence?: number): number;
|
|
80
|
-
declare function checkIfValidSequence(currSequence?: number): void;
|
|
81
|
-
declare function getNextTransactionSequence(currSequence?: number, forRefresh?: boolean): {
|
|
82
|
-
nextSequence: number;
|
|
83
|
-
needRefresh: boolean;
|
|
84
|
-
};
|
|
85
|
-
declare function getEphemeralAnchorOutput(): TransactionOutput;
|
|
86
|
-
|
|
87
|
-
interface LeafInfo {
|
|
88
|
-
leafId: string;
|
|
89
|
-
nodeTx: string;
|
|
90
|
-
refundTx: string;
|
|
91
|
-
}
|
|
92
|
-
interface Utxo {
|
|
93
|
-
txid: string;
|
|
94
|
-
vout: number;
|
|
95
|
-
value: bigint;
|
|
96
|
-
script: string;
|
|
97
|
-
publicKey: string;
|
|
98
|
-
}
|
|
99
|
-
interface FeeRate {
|
|
100
|
-
satPerVbyte: number;
|
|
101
|
-
}
|
|
102
|
-
interface FeeBumpTxPackage {
|
|
103
|
-
tx: string;
|
|
104
|
-
feeBumpPsbt?: string;
|
|
105
|
-
}
|
|
106
|
-
interface FeeBumpTxChain {
|
|
107
|
-
leafId: string;
|
|
108
|
-
txPackages: FeeBumpTxPackage[];
|
|
109
|
-
}
|
|
110
|
-
interface TxChain {
|
|
111
|
-
leafId: string;
|
|
112
|
-
transactions: string[];
|
|
113
|
-
}
|
|
114
|
-
interface BroadcastConfig {
|
|
115
|
-
bitcoinCoreRpcUrl?: string;
|
|
116
|
-
rpcUsername?: string;
|
|
117
|
-
rpcPassword?: string;
|
|
118
|
-
autoBroadcast?: boolean;
|
|
119
|
-
network?: "MAINNET" | "REGTEST" | "TESTNET" | "SIGNET" | "LOCAL";
|
|
120
|
-
}
|
|
121
|
-
interface BroadcastResult {
|
|
122
|
-
success: boolean;
|
|
123
|
-
txids?: string[];
|
|
124
|
-
error?: string;
|
|
125
|
-
broadcastedPackages?: number;
|
|
126
|
-
}
|
|
127
|
-
declare function isEphemeralAnchorOutput(script?: Uint8Array, amount?: bigint): boolean;
|
|
128
|
-
declare function constructUnilateralExitTxs(nodeHexStrings: string[], sparkClient?: SparkServiceClient, network?: any): Promise<TxChain[]>;
|
|
129
|
-
declare function constructUnilateralExitFeeBumpPackages(nodeHexStrings: string[], utxos: Utxo[], feeRate: FeeRate, electrsUrl: string, sparkClient?: SparkServiceClient, network?: any): Promise<FeeBumpTxChain[]>;
|
|
130
|
-
declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRate, previousFeeBumpTx?: string): {
|
|
131
|
-
feeBumpPsbt: string;
|
|
132
|
-
usedUtxos: Utxo[];
|
|
133
|
-
correctedParentTx?: string;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
137
|
-
|
|
138
|
-
export { type BroadcastConfig, type BroadcastResult, DEFAULT_FEE_SATS, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, type LeafInfo, Network, type TxChain, type Utxo, addPrivateKeys, addPublicKeys, applyAdaptorToSignature, applyAdditiveTweakToPublicKey, calculateAvailableTokenAmount, checkIfSelectedOutputsAreAvailable, checkIfValidSequence, collectResponses, computeTaprootKeyNoScript, constructFeeBumpTx, constructUnilateralExitFeeBumpPackages, constructUnilateralExitTxs, createRefundTx, createSigningCommitment, createSigningNonce, decodeBytesToSigningCommitment, decodeBytesToSigningNonce, encodeSigningCommitmentToBytes, encodeSigningNonceToBytes, filterTokenBalanceForTokenPublicKey, generateAdaptorFromSignature, generateSignatureFromExistingAdaptor, getCurrentTimelock, getEphemeralAnchorOutput, getLatestDepositTxId, getNextTransactionSequence, getP2TRAddressFromPkScript, getP2TRAddressFromPublicKey, getP2TRScriptFromPublicKey, getP2WPKHAddressFromPublicKey, getRandomSigningNonce, getSigHashFromTx, getSigningCommitmentFromNonce, getSparkAddressFromTaproot, getTransactionSequence, getTransferPackageSigningPayload, getTxFromRawTxBytes, getTxFromRawTxHex, getTxId, getTxIdNoReverse, isEphemeralAnchorOutput, isTxBroadcast, lastKeyWithTarget, maybeApplyFee, proofOfPossessionMessageHashForDepositAddress, subtractPrivateKeys, subtractPublicKeys, sumOfPrivateKeys, validateOutboundAdaptorSignature };
|
|
18
|
+
import '../address/index.js';
|