@buildonspark/spark-sdk 0.2.1 → 0.2.2
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 +6 -0
- package/dist/{chunk-KFDVDUIS.js → chunk-2TUM3R6C.js} +88 -19
- package/dist/{chunk-N4JAOOIN.js → chunk-S2AL73MZ.js} +1 -1
- package/dist/{client-DKbwpcnl.d.ts → client-CGTRS23n.d.ts} +21 -4
- package/dist/{client-Drs5Lapg.d.cts → client-CcYzmpmj.d.cts} +21 -4
- package/dist/debug.cjs +29 -19
- package/dist/debug.d.cts +3 -3
- package/dist/debug.d.ts +3 -3
- package/dist/debug.js +1 -1
- package/dist/graphql/objects/index.d.cts +2 -2
- package/dist/graphql/objects/index.d.ts +2 -2
- package/dist/index.cjs +89 -19
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -2
- package/dist/index.node.cjs +91 -23
- package/dist/index.node.d.cts +4 -4
- package/dist/index.node.d.ts +4 -4
- package/dist/index.node.js +3 -1
- package/dist/native/index.cjs +33 -22
- package/dist/native/index.d.cts +9 -5
- package/dist/native/index.d.ts +9 -5
- package/dist/native/index.js +33 -22
- package/dist/{spark-wallet-DbCjWOfP.d.ts → spark-wallet-B_96y9BS.d.ts} +3 -3
- package/dist/{spark-wallet-BslnB-4H.d.cts → spark-wallet-CHwKQYJu.d.cts} +3 -3
- package/dist/tests/test-utils.cjs +76 -9
- package/dist/tests/test-utils.d.cts +7 -3
- package/dist/tests/test-utils.d.ts +7 -3
- package/dist/tests/test-utils.js +10 -3
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{xchain-address-C3B-Jfk5.d.cts → xchain-address-D5MIHCDL.d.cts} +2 -2
- package/dist/{xchain-address-BIcYZU3K.d.ts → xchain-address-DLbW1iDh.d.ts} +2 -2
- package/package.json +1 -1
- package/src/index.node.ts +6 -6
- package/src/index.ts +5 -5
- package/src/services/connection.ts +3 -3
- package/src/services/coop-exit.ts +1 -1
- package/src/services/deposit.ts +2 -2
- package/src/services/signing.ts +1 -1
- package/src/services/transfer.ts +25 -9
- package/src/services/tree-creation.ts +10 -7
- package/src/signer/signer.react-native.ts +4 -3
- package/src/signer/signer.ts +84 -6
- package/src/signer/types.ts +7 -1
- package/src/spark-wallet/spark-wallet.ts +1 -1
- package/src/tests/integration/coop-exit.test.ts +5 -3
- package/src/tests/integration/deposit.test.ts +20 -10
- package/src/tests/integration/lightning.test.ts +13 -7
- package/src/tests/integration/message-signing.test.ts +10 -7
- package/src/tests/integration/swap.test.ts +8 -4
- package/src/tests/integration/transfer.test.ts +25 -11
- package/src/tests/integration/wallet.test.ts +9 -4
- package/src/tests/test-utils.ts +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -577,7 +577,7 @@ import * as ecies from "eciesjs";
|
|
|
577
577
|
import { isNode } from "@lightsparkdev/core";
|
|
578
578
|
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
579
579
|
var isBun = globalThis.Bun !== void 0;
|
|
580
|
-
var packageVersion = true ? "0.2.
|
|
580
|
+
var packageVersion = true ? "0.2.2" : "unknown";
|
|
581
581
|
var baseEnvStr = "unknown";
|
|
582
582
|
if (isBun) {
|
|
583
583
|
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
@@ -897,7 +897,8 @@ var DefaultSparkSigner = class {
|
|
|
897
897
|
field: "privateKey"
|
|
898
898
|
});
|
|
899
899
|
}
|
|
900
|
-
const
|
|
900
|
+
const commitment = selfCommitment.commitment;
|
|
901
|
+
const nonce = this.commitmentToNonceMap.get(commitment);
|
|
901
902
|
if (!nonce) {
|
|
902
903
|
throw new ValidationError("Nonce not found for commitment", {
|
|
903
904
|
field: "nonce"
|
|
@@ -912,7 +913,7 @@ var DefaultSparkSigner = class {
|
|
|
912
913
|
message,
|
|
913
914
|
keyPackage,
|
|
914
915
|
nonce,
|
|
915
|
-
selfCommitment,
|
|
916
|
+
selfCommitment: commitment,
|
|
916
917
|
statechainCommitments,
|
|
917
918
|
adaptorPubKey
|
|
918
919
|
});
|
|
@@ -940,7 +941,7 @@ var DefaultSparkSigner = class {
|
|
|
940
941
|
statechainPublicKeys,
|
|
941
942
|
verifyingKey,
|
|
942
943
|
statechainCommitments,
|
|
943
|
-
selfCommitment,
|
|
944
|
+
selfCommitment: selfCommitment.commitment,
|
|
944
945
|
selfPublicKey: publicKey,
|
|
945
946
|
selfSignature,
|
|
946
947
|
adaptorPubKey
|
|
@@ -991,7 +992,9 @@ var DefaultSparkSigner = class {
|
|
|
991
992
|
const nonce = getRandomSigningNonce();
|
|
992
993
|
const commitment = getSigningCommitmentFromNonce(nonce);
|
|
993
994
|
this.commitmentToNonceMap.set(commitment, nonce);
|
|
994
|
-
return
|
|
995
|
+
return {
|
|
996
|
+
commitment
|
|
997
|
+
};
|
|
995
998
|
}
|
|
996
999
|
async validateMessageWithIdentityKey(message, signature) {
|
|
997
1000
|
if (!this.identityKey?.publicKey) {
|
|
@@ -1045,6 +1048,64 @@ var DefaultSparkSigner = class {
|
|
|
1045
1048
|
tx.signIdx(privateKey, index);
|
|
1046
1049
|
}
|
|
1047
1050
|
};
|
|
1051
|
+
var UnsafeStatelessSparkSigner = class extends DefaultSparkSigner {
|
|
1052
|
+
constructor({
|
|
1053
|
+
sparkKeysGenerator
|
|
1054
|
+
} = {}) {
|
|
1055
|
+
super({
|
|
1056
|
+
sparkKeysGenerator
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
async getRandomSigningCommitment() {
|
|
1060
|
+
const nonce = getRandomSigningNonce();
|
|
1061
|
+
const commitment = getSigningCommitmentFromNonce(nonce);
|
|
1062
|
+
return {
|
|
1063
|
+
commitment,
|
|
1064
|
+
nonce
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
async signFrost({
|
|
1068
|
+
message,
|
|
1069
|
+
keyDerivation,
|
|
1070
|
+
publicKey,
|
|
1071
|
+
verifyingKey,
|
|
1072
|
+
selfCommitment,
|
|
1073
|
+
statechainCommitments,
|
|
1074
|
+
adaptorPubKey
|
|
1075
|
+
}) {
|
|
1076
|
+
const SparkFrost = await getSparkFrostModule();
|
|
1077
|
+
if (!SparkFrost) {
|
|
1078
|
+
throw new ValidationError("SparkFrost module not found", {
|
|
1079
|
+
field: "SparkFrost"
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
const signingPrivateKey = await this.getSigningPrivateKeyFromDerivation(keyDerivation);
|
|
1083
|
+
if (!signingPrivateKey) {
|
|
1084
|
+
throw new ValidationError("Private key not found for public key", {
|
|
1085
|
+
field: "privateKey"
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
const { commitment, nonce } = selfCommitment;
|
|
1089
|
+
if (!nonce) {
|
|
1090
|
+
throw new ValidationError("Nonce not found for commitment", {
|
|
1091
|
+
field: "nonce"
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
const keyPackage = {
|
|
1095
|
+
secretKey: signingPrivateKey,
|
|
1096
|
+
publicKey,
|
|
1097
|
+
verifyingKey
|
|
1098
|
+
};
|
|
1099
|
+
return SparkFrost.signFrost({
|
|
1100
|
+
message,
|
|
1101
|
+
keyPackage,
|
|
1102
|
+
nonce,
|
|
1103
|
+
selfCommitment: commitment,
|
|
1104
|
+
statechainCommitments,
|
|
1105
|
+
adaptorPubKey
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1048
1109
|
var TaprootSparkSigner = class extends DefaultSparkSigner {
|
|
1049
1110
|
constructor(useAddressIndex = false) {
|
|
1050
1111
|
super({
|
|
@@ -3159,12 +3220,12 @@ var DepositService = class {
|
|
|
3159
3220
|
rootTxSigningJob: {
|
|
3160
3221
|
rawTx: rootTx.toBytes(),
|
|
3161
3222
|
signingPublicKey: signingPubKey,
|
|
3162
|
-
signingNonceCommitment: rootNonceCommitment
|
|
3223
|
+
signingNonceCommitment: rootNonceCommitment.commitment
|
|
3163
3224
|
},
|
|
3164
3225
|
refundTxSigningJob: {
|
|
3165
3226
|
rawTx: refundTx.toBytes(),
|
|
3166
3227
|
signingPublicKey: signingPubKey,
|
|
3167
|
-
signingNonceCommitment: refundNonceCommitment
|
|
3228
|
+
signingNonceCommitment: refundNonceCommitment.commitment
|
|
3168
3229
|
}
|
|
3169
3230
|
});
|
|
3170
3231
|
} catch (error) {
|
|
@@ -7439,6 +7500,13 @@ var DEFAULT_EXPIRY_TIME = 10 * 60 * 1e3;
|
|
|
7439
7500
|
function initialSequence() {
|
|
7440
7501
|
return 1 << 30 | INITIAL_TIME_LOCK2;
|
|
7441
7502
|
}
|
|
7503
|
+
function getSigningJobProto(signingJob) {
|
|
7504
|
+
return {
|
|
7505
|
+
signingPublicKey: signingJob.signingPublicKey,
|
|
7506
|
+
rawTx: signingJob.rawTx,
|
|
7507
|
+
signingNonceCommitment: signingJob.signingNonceCommitment.commitment
|
|
7508
|
+
};
|
|
7509
|
+
}
|
|
7442
7510
|
var BaseTransferService = class {
|
|
7443
7511
|
config;
|
|
7444
7512
|
connectionManager;
|
|
@@ -8065,7 +8133,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
8065
8133
|
refundSigningData.keyDerivation
|
|
8066
8134
|
),
|
|
8067
8135
|
rawTx: refundTx.toBytes(),
|
|
8068
|
-
signingNonceCommitment: refundNonceCommitmentProto
|
|
8136
|
+
signingNonceCommitment: refundNonceCommitmentProto.commitment
|
|
8069
8137
|
},
|
|
8070
8138
|
// TODO: Add direct refund signature
|
|
8071
8139
|
directRefundTxSigningJob: void 0,
|
|
@@ -8377,7 +8445,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
8377
8445
|
const response = await sparkClient.refresh_timelock({
|
|
8378
8446
|
leafId: leaf.id,
|
|
8379
8447
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
8380
|
-
signingJobs
|
|
8448
|
+
signingJobs: signingJobs.map(getSigningJobProto)
|
|
8381
8449
|
});
|
|
8382
8450
|
if (signingJobs.length !== response.signingResults.length) {
|
|
8383
8451
|
throw Error(
|
|
@@ -8543,8 +8611,8 @@ var TransferService = class extends BaseTransferService {
|
|
|
8543
8611
|
const response = await sparkClient.extend_leaf({
|
|
8544
8612
|
leafId: node.id,
|
|
8545
8613
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
8546
|
-
nodeTxSigningJob: newNodeSigningJob,
|
|
8547
|
-
refundTxSigningJob: newRefundSigningJob
|
|
8614
|
+
nodeTxSigningJob: getSigningJobProto(newNodeSigningJob),
|
|
8615
|
+
refundTxSigningJob: getSigningJobProto(newRefundSigningJob)
|
|
8548
8616
|
});
|
|
8549
8617
|
if (!response.nodeTxSigningResult || !response.refundTxSigningResult) {
|
|
8550
8618
|
throw new Error("Signing result does not exist");
|
|
@@ -8652,7 +8720,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
8652
8720
|
const response = await sparkClient.refresh_timelock({
|
|
8653
8721
|
leafId: node.id,
|
|
8654
8722
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
8655
|
-
signingJobs: [refundSigningJob]
|
|
8723
|
+
signingJobs: [getSigningJobProto(refundSigningJob)]
|
|
8656
8724
|
});
|
|
8657
8725
|
if (response.signingResults.length !== 1) {
|
|
8658
8726
|
throw Error(
|
|
@@ -8804,7 +8872,7 @@ var CoopExitService = class extends BaseTransferService {
|
|
|
8804
8872
|
leaf.keyDerivation
|
|
8805
8873
|
),
|
|
8806
8874
|
rawTx: refundTx.toBytes(),
|
|
8807
|
-
signingNonceCommitment
|
|
8875
|
+
signingNonceCommitment: signingNonceCommitment.commitment
|
|
8808
8876
|
},
|
|
8809
8877
|
// TODO: Add direct refund signature
|
|
8810
8878
|
directRefundTxSigningJob: void 0,
|
|
@@ -9437,7 +9505,7 @@ var TreeCreationService = class {
|
|
|
9437
9505
|
const signingJob = {
|
|
9438
9506
|
signingPublicKey: node.signingPublicKey,
|
|
9439
9507
|
rawTx: tx.toBytes(),
|
|
9440
|
-
signingNonceCommitment
|
|
9508
|
+
signingNonceCommitment: signingNonceCommitment.commitment
|
|
9441
9509
|
};
|
|
9442
9510
|
internalCreationNode.nodeTxSigningCommitment = signingNonceCommitment;
|
|
9443
9511
|
internalCreationNode.nodeTxSigningJob = signingJob;
|
|
@@ -9466,7 +9534,7 @@ var TreeCreationService = class {
|
|
|
9466
9534
|
const childSigningJob = {
|
|
9467
9535
|
signingPublicKey: node.signingPublicKey,
|
|
9468
9536
|
rawTx: childTx.toBytes(),
|
|
9469
|
-
signingNonceCommitment: childSigningNonceCommitment
|
|
9537
|
+
signingNonceCommitment: childSigningNonceCommitment.commitment
|
|
9470
9538
|
};
|
|
9471
9539
|
childCreationNode.nodeTxSigningCommitment = childSigningNonceCommitment;
|
|
9472
9540
|
childCreationNode.nodeTxSigningJob = childSigningJob;
|
|
@@ -9493,7 +9561,7 @@ var TreeCreationService = class {
|
|
|
9493
9561
|
const refundSigningJob = {
|
|
9494
9562
|
signingPublicKey: node.signingPublicKey,
|
|
9495
9563
|
rawTx: refundTx.toBytes(),
|
|
9496
|
-
signingNonceCommitment: refundSigningNonceCommitment
|
|
9564
|
+
signingNonceCommitment: refundSigningNonceCommitment.commitment
|
|
9497
9565
|
};
|
|
9498
9566
|
childCreationNode.refundTxSigningCommitment = refundSigningNonceCommitment;
|
|
9499
9567
|
childCreationNode.refundTxSigningJob = refundSigningJob;
|
|
@@ -9528,7 +9596,7 @@ var TreeCreationService = class {
|
|
|
9528
9596
|
const rootNodeSigningJob = {
|
|
9529
9597
|
signingPublicKey: root.signingPublicKey,
|
|
9530
9598
|
rawTx: rootNodeTx.toBytes(),
|
|
9531
|
-
signingNonceCommitment: rootNodeSigningCommitment
|
|
9599
|
+
signingNonceCommitment: rootNodeSigningCommitment.commitment
|
|
9532
9600
|
};
|
|
9533
9601
|
const rootCreationNode = {
|
|
9534
9602
|
nodeTxSigningJob: rootNodeSigningJob,
|
|
@@ -9760,7 +9828,7 @@ var SigningService = class {
|
|
|
9760
9828
|
leaf.keyDerivation
|
|
9761
9829
|
),
|
|
9762
9830
|
rawTx: refundTx.toBytes(),
|
|
9763
|
-
signingNonceCommitment: signingCommitment,
|
|
9831
|
+
signingNonceCommitment: signingCommitment.commitment,
|
|
9764
9832
|
userSignature: signingResult,
|
|
9765
9833
|
signingCommitments: {
|
|
9766
9834
|
signingCommitments: signingNonceCommitments
|
|
@@ -10903,7 +10971,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
10903
10971
|
const signingJob = {
|
|
10904
10972
|
rawTx: tx.toBytes(),
|
|
10905
10973
|
signingPublicKey: await this.config.signer.getStaticDepositSigningKey(0),
|
|
10906
|
-
signingNonceCommitment
|
|
10974
|
+
signingNonceCommitment: signingNonceCommitment.commitment
|
|
10907
10975
|
};
|
|
10908
10976
|
const message = await this.getStaticDepositSigningPayload(
|
|
10909
10977
|
depositTransactionId,
|
|
@@ -13492,6 +13560,7 @@ export {
|
|
|
13492
13560
|
MultisigReceiptInput,
|
|
13493
13561
|
TaprootOutputKeysGenerator,
|
|
13494
13562
|
DefaultSparkSigner,
|
|
13563
|
+
UnsafeStatelessSparkSigner,
|
|
13495
13564
|
TaprootSparkSigner,
|
|
13496
13565
|
Network2 as Network,
|
|
13497
13566
|
NetworkToProto,
|
|
@@ -31,6 +31,10 @@ declare function recoverSecret(shares: VerifiableSecretShare[]): bigint;
|
|
|
31
31
|
declare function validateShare(share: VerifiableSecretShare): void;
|
|
32
32
|
declare function bigIntToPrivateKey(value: bigint): Uint8Array;
|
|
33
33
|
|
|
34
|
+
type SigningCommitmentWithOptionalNonce = {
|
|
35
|
+
commitment: SigningCommitment;
|
|
36
|
+
nonce?: SigningNonce;
|
|
37
|
+
};
|
|
34
38
|
type SigningNonce = {
|
|
35
39
|
binding: Uint8Array;
|
|
36
40
|
hiding: Uint8Array;
|
|
@@ -65,7 +69,7 @@ type SignFrostParams = {
|
|
|
65
69
|
keyDerivation: KeyDerivation;
|
|
66
70
|
publicKey: Uint8Array;
|
|
67
71
|
verifyingKey: Uint8Array;
|
|
68
|
-
selfCommitment:
|
|
72
|
+
selfCommitment: SigningCommitmentWithOptionalNonce;
|
|
69
73
|
statechainCommitments?: {
|
|
70
74
|
[key: string]: ISigningCommitment;
|
|
71
75
|
} | undefined;
|
|
@@ -144,7 +148,7 @@ interface SparkSigner extends TokenSigner {
|
|
|
144
148
|
validateMessageWithIdentityKey(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
145
149
|
signTransactionIndex(tx: Transaction, index: number, publicKey: Uint8Array): void;
|
|
146
150
|
decryptEcies(ciphertext: Uint8Array): Promise<Uint8Array>;
|
|
147
|
-
getRandomSigningCommitment(): Promise<
|
|
151
|
+
getRandomSigningCommitment(): Promise<SigningCommitmentWithOptionalNonce>;
|
|
148
152
|
getDepositSigningKey(): Promise<Uint8Array>;
|
|
149
153
|
}
|
|
150
154
|
declare class DefaultSparkSigner implements SparkSigner {
|
|
@@ -187,12 +191,25 @@ declare class DefaultSparkSigner implements SparkSigner {
|
|
|
187
191
|
createSparkWalletFromSeed(seed: Uint8Array | string, accountNumber?: number): Promise<string>;
|
|
188
192
|
signMessageWithIdentityKey(message: Uint8Array, compact?: boolean): Promise<Uint8Array>;
|
|
189
193
|
decryptEcies(ciphertext: Uint8Array): Promise<Uint8Array>;
|
|
190
|
-
getRandomSigningCommitment(): Promise<
|
|
194
|
+
getRandomSigningCommitment(): Promise<SigningCommitmentWithOptionalNonce>;
|
|
191
195
|
validateMessageWithIdentityKey(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
192
196
|
signPsbt(psbt: Psbt, input: number, sighashTypes?: number[], receipt?: Receipt): Promise<Psbt>;
|
|
193
197
|
private getReceiptPrivateKey;
|
|
194
198
|
signTransactionIndex(tx: Transaction, index: number, publicKey: Uint8Array): void;
|
|
195
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* StatelessSparkSigner is different from DefaultSparkSigner in that it does not store
|
|
202
|
+
* nonces in internal state. StatelessSparkSigner should only be used in a secure environment.
|
|
203
|
+
*
|
|
204
|
+
* @extends DefaultSparkSigner
|
|
205
|
+
*/
|
|
206
|
+
declare class UnsafeStatelessSparkSigner extends DefaultSparkSigner {
|
|
207
|
+
constructor({ sparkKeysGenerator, }?: {
|
|
208
|
+
sparkKeysGenerator?: SparkKeysGenerator;
|
|
209
|
+
});
|
|
210
|
+
getRandomSigningCommitment(): Promise<SigningCommitmentWithOptionalNonce>;
|
|
211
|
+
signFrost({ message, keyDerivation, publicKey, verifyingKey, selfCommitment, statechainCommitments, adaptorPubKey, }: SignFrostParams): Promise<Uint8Array>;
|
|
212
|
+
}
|
|
196
213
|
declare class TaprootSparkSigner extends DefaultSparkSigner {
|
|
197
214
|
constructor(useAddressIndex?: boolean);
|
|
198
215
|
}
|
|
@@ -773,4 +790,4 @@ declare class SspClient {
|
|
|
773
790
|
getCoopExitFeeQuote({ leafExternalIds, withdrawalAddress, }: CoopExitFeeQuoteInput): Promise<CoopExitFeeQuote | null>;
|
|
774
791
|
}
|
|
775
792
|
|
|
776
|
-
export { splitSecretWithProofs as $, SparkLeavesSwapRequestStatus as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, type SparkTransferToLeavesConnection as D, ExitSpeed as E, type StaticDepositQuoteInput as F, type GetChallengeOutput as G, type StaticDepositQuoteOutput as H, type Invoice as I, type SwapLeaf as J, type VerifiableSecretShare as K, type Leaf as L, bigIntToPrivateKey as M, computerLagrangeCoefficients as N, evaluatePolynomial as O, type PageInfo as P, fieldDiv as Q, type RequestCoopExitInput as R, SparkCoopExitRequestStatus as S, Transfer as T, type UserLeafInput as U, type VerifyChallengeOutput as V, generatePolynomialForSecretSharing as W, getRandomBigInt as X, modInverse as Y, recoverSecret as Z, splitSecret as _, type CompleteCoopExitInput as a, validateShare as a0, type SparkSigner as a1,
|
|
793
|
+
export { splitSecretWithProofs as $, SparkLeavesSwapRequestStatus as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, type SparkTransferToLeavesConnection as D, ExitSpeed as E, type StaticDepositQuoteInput as F, type GetChallengeOutput as G, type StaticDepositQuoteOutput as H, type Invoice as I, type SwapLeaf as J, type VerifiableSecretShare as K, type Leaf as L, bigIntToPrivateKey as M, computerLagrangeCoefficients as N, evaluatePolynomial as O, type PageInfo as P, fieldDiv as Q, type RequestCoopExitInput as R, SparkCoopExitRequestStatus as S, Transfer as T, type UserLeafInput as U, type VerifyChallengeOutput as V, generatePolynomialForSecretSharing as W, getRandomBigInt as X, modInverse as Y, recoverSecret as Z, splitSecret as _, type CompleteCoopExitInput as a, validateShare as a0, type SparkSigner as a1, DefaultSparkSigner as a2, type MayHaveSspClientOptions as a3, type SspClientOptions as a4, type HasSspClientOptions as a5, type KeyDerivation as a6, type SigningCommitmentWithOptionalNonce as a7, type SigningNonce as a8, type SigningCommitment as a9, SspClient as aa, TaprootOutputKeysGenerator as ab, TaprootSparkSigner as ac, UnsafeStatelessSparkSigner as ad, KeyDerivationType as ae, type SignFrostParams as af, type AggregateFrostParams as ag, type SplitSecretWithProofsParams as ah, type DerivedHDKey as ai, type KeyPair as aj, type CompleteLeavesSwapInput as b, type CoopExitFeeEstimate as c, type CoopExitFeeEstimatesInput as d, type CoopExitFeeEstimatesOutput as e, type CoopExitFeeQuote as f, getCoopExitFeeQuoteQuery as g, type CoopExitFeeQuoteInput as h, type CoopExitRequest as i, getCoopExitRequestQuery as j, type CurrencyAmount as k, CurrencyUnit as l, type LeavesSwapFeeEstimateOutput as m, getLeavesSwapRequestQuery as n, type LeavesSwapRequest as o, getLightningReceiveRequestQuery as p, type LightningReceiveRequest as q, LightningReceiveRequestStatus as r, type LightningSendFeeEstimateInput as s, type LightningSendFeeEstimateOutput as t, getLightningSendRequestQuery as u, type LightningSendRequest as v, LightningSendRequestStatus as w, type RequestLeavesSwapInput as x, type RequestLightningReceiveInput as y, type RequestLightningSendInput as z };
|
|
@@ -31,6 +31,10 @@ declare function recoverSecret(shares: VerifiableSecretShare[]): bigint;
|
|
|
31
31
|
declare function validateShare(share: VerifiableSecretShare): void;
|
|
32
32
|
declare function bigIntToPrivateKey(value: bigint): Uint8Array;
|
|
33
33
|
|
|
34
|
+
type SigningCommitmentWithOptionalNonce = {
|
|
35
|
+
commitment: SigningCommitment;
|
|
36
|
+
nonce?: SigningNonce;
|
|
37
|
+
};
|
|
34
38
|
type SigningNonce = {
|
|
35
39
|
binding: Uint8Array;
|
|
36
40
|
hiding: Uint8Array;
|
|
@@ -65,7 +69,7 @@ type SignFrostParams = {
|
|
|
65
69
|
keyDerivation: KeyDerivation;
|
|
66
70
|
publicKey: Uint8Array;
|
|
67
71
|
verifyingKey: Uint8Array;
|
|
68
|
-
selfCommitment:
|
|
72
|
+
selfCommitment: SigningCommitmentWithOptionalNonce;
|
|
69
73
|
statechainCommitments?: {
|
|
70
74
|
[key: string]: ISigningCommitment;
|
|
71
75
|
} | undefined;
|
|
@@ -144,7 +148,7 @@ interface SparkSigner extends TokenSigner {
|
|
|
144
148
|
validateMessageWithIdentityKey(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
145
149
|
signTransactionIndex(tx: Transaction, index: number, publicKey: Uint8Array): void;
|
|
146
150
|
decryptEcies(ciphertext: Uint8Array): Promise<Uint8Array>;
|
|
147
|
-
getRandomSigningCommitment(): Promise<
|
|
151
|
+
getRandomSigningCommitment(): Promise<SigningCommitmentWithOptionalNonce>;
|
|
148
152
|
getDepositSigningKey(): Promise<Uint8Array>;
|
|
149
153
|
}
|
|
150
154
|
declare class DefaultSparkSigner implements SparkSigner {
|
|
@@ -187,12 +191,25 @@ declare class DefaultSparkSigner implements SparkSigner {
|
|
|
187
191
|
createSparkWalletFromSeed(seed: Uint8Array | string, accountNumber?: number): Promise<string>;
|
|
188
192
|
signMessageWithIdentityKey(message: Uint8Array, compact?: boolean): Promise<Uint8Array>;
|
|
189
193
|
decryptEcies(ciphertext: Uint8Array): Promise<Uint8Array>;
|
|
190
|
-
getRandomSigningCommitment(): Promise<
|
|
194
|
+
getRandomSigningCommitment(): Promise<SigningCommitmentWithOptionalNonce>;
|
|
191
195
|
validateMessageWithIdentityKey(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
192
196
|
signPsbt(psbt: Psbt, input: number, sighashTypes?: number[], receipt?: Receipt): Promise<Psbt>;
|
|
193
197
|
private getReceiptPrivateKey;
|
|
194
198
|
signTransactionIndex(tx: Transaction, index: number, publicKey: Uint8Array): void;
|
|
195
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* StatelessSparkSigner is different from DefaultSparkSigner in that it does not store
|
|
202
|
+
* nonces in internal state. StatelessSparkSigner should only be used in a secure environment.
|
|
203
|
+
*
|
|
204
|
+
* @extends DefaultSparkSigner
|
|
205
|
+
*/
|
|
206
|
+
declare class UnsafeStatelessSparkSigner extends DefaultSparkSigner {
|
|
207
|
+
constructor({ sparkKeysGenerator, }?: {
|
|
208
|
+
sparkKeysGenerator?: SparkKeysGenerator;
|
|
209
|
+
});
|
|
210
|
+
getRandomSigningCommitment(): Promise<SigningCommitmentWithOptionalNonce>;
|
|
211
|
+
signFrost({ message, keyDerivation, publicKey, verifyingKey, selfCommitment, statechainCommitments, adaptorPubKey, }: SignFrostParams): Promise<Uint8Array>;
|
|
212
|
+
}
|
|
196
213
|
declare class TaprootSparkSigner extends DefaultSparkSigner {
|
|
197
214
|
constructor(useAddressIndex?: boolean);
|
|
198
215
|
}
|
|
@@ -773,4 +790,4 @@ declare class SspClient {
|
|
|
773
790
|
getCoopExitFeeQuote({ leafExternalIds, withdrawalAddress, }: CoopExitFeeQuoteInput): Promise<CoopExitFeeQuote | null>;
|
|
774
791
|
}
|
|
775
792
|
|
|
776
|
-
export { splitSecretWithProofs as $, SparkLeavesSwapRequestStatus as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, type SparkTransferToLeavesConnection as D, ExitSpeed as E, type StaticDepositQuoteInput as F, type GetChallengeOutput as G, type StaticDepositQuoteOutput as H, type Invoice as I, type SwapLeaf as J, type VerifiableSecretShare as K, type Leaf as L, bigIntToPrivateKey as M, computerLagrangeCoefficients as N, evaluatePolynomial as O, type PageInfo as P, fieldDiv as Q, type RequestCoopExitInput as R, SparkCoopExitRequestStatus as S, Transfer as T, type UserLeafInput as U, type VerifyChallengeOutput as V, generatePolynomialForSecretSharing as W, getRandomBigInt as X, modInverse as Y, recoverSecret as Z, splitSecret as _, type CompleteCoopExitInput as a, validateShare as a0, type SparkSigner as a1,
|
|
793
|
+
export { splitSecretWithProofs as $, SparkLeavesSwapRequestStatus as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, type SparkTransferToLeavesConnection as D, ExitSpeed as E, type StaticDepositQuoteInput as F, type GetChallengeOutput as G, type StaticDepositQuoteOutput as H, type Invoice as I, type SwapLeaf as J, type VerifiableSecretShare as K, type Leaf as L, bigIntToPrivateKey as M, computerLagrangeCoefficients as N, evaluatePolynomial as O, type PageInfo as P, fieldDiv as Q, type RequestCoopExitInput as R, SparkCoopExitRequestStatus as S, Transfer as T, type UserLeafInput as U, type VerifyChallengeOutput as V, generatePolynomialForSecretSharing as W, getRandomBigInt as X, modInverse as Y, recoverSecret as Z, splitSecret as _, type CompleteCoopExitInput as a, validateShare as a0, type SparkSigner as a1, DefaultSparkSigner as a2, type MayHaveSspClientOptions as a3, type SspClientOptions as a4, type HasSspClientOptions as a5, type KeyDerivation as a6, type SigningCommitmentWithOptionalNonce as a7, type SigningNonce as a8, type SigningCommitment as a9, SspClient as aa, TaprootOutputKeysGenerator as ab, TaprootSparkSigner as ac, UnsafeStatelessSparkSigner as ad, KeyDerivationType as ae, type SignFrostParams as af, type AggregateFrostParams as ag, type SplitSecretWithProofsParams as ah, type DerivedHDKey as ai, type KeyPair as aj, type CompleteLeavesSwapInput as b, type CoopExitFeeEstimate as c, type CoopExitFeeEstimatesInput as d, type CoopExitFeeEstimatesOutput as e, type CoopExitFeeQuote as f, getCoopExitFeeQuoteQuery as g, type CoopExitFeeQuoteInput as h, type CoopExitRequest as i, getCoopExitRequestQuery as j, type CurrencyAmount as k, CurrencyUnit as l, type LeavesSwapFeeEstimateOutput as m, getLeavesSwapRequestQuery as n, type LeavesSwapRequest as o, getLightningReceiveRequestQuery as p, type LightningReceiveRequest as q, LightningReceiveRequestStatus as r, type LightningSendFeeEstimateInput as s, type LightningSendFeeEstimateOutput as t, getLightningSendRequestQuery as u, type LightningSendRequest as v, LightningSendRequestStatus as w, type RequestLeavesSwapInput as x, type RequestLightningReceiveInput as y, type RequestLightningSendInput as z };
|
package/dist/debug.cjs
CHANGED
|
@@ -17872,7 +17872,7 @@ init_buffer();
|
|
|
17872
17872
|
var import_core10 = require("@lightsparkdev/core");
|
|
17873
17873
|
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
17874
17874
|
var isBun = globalThis.Bun !== void 0;
|
|
17875
|
-
var packageVersion = true ? "0.2.
|
|
17875
|
+
var packageVersion = true ? "0.2.2" : "unknown";
|
|
17876
17876
|
var baseEnvStr = "unknown";
|
|
17877
17877
|
if (isBun) {
|
|
17878
17878
|
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
@@ -18540,7 +18540,8 @@ var DefaultSparkSigner = class {
|
|
|
18540
18540
|
field: "privateKey"
|
|
18541
18541
|
});
|
|
18542
18542
|
}
|
|
18543
|
-
const
|
|
18543
|
+
const commitment = selfCommitment.commitment;
|
|
18544
|
+
const nonce = this.commitmentToNonceMap.get(commitment);
|
|
18544
18545
|
if (!nonce) {
|
|
18545
18546
|
throw new ValidationError("Nonce not found for commitment", {
|
|
18546
18547
|
field: "nonce"
|
|
@@ -18555,7 +18556,7 @@ var DefaultSparkSigner = class {
|
|
|
18555
18556
|
message,
|
|
18556
18557
|
keyPackage,
|
|
18557
18558
|
nonce,
|
|
18558
|
-
selfCommitment,
|
|
18559
|
+
selfCommitment: commitment,
|
|
18559
18560
|
statechainCommitments,
|
|
18560
18561
|
adaptorPubKey
|
|
18561
18562
|
});
|
|
@@ -18583,7 +18584,7 @@ var DefaultSparkSigner = class {
|
|
|
18583
18584
|
statechainPublicKeys,
|
|
18584
18585
|
verifyingKey,
|
|
18585
18586
|
statechainCommitments,
|
|
18586
|
-
selfCommitment,
|
|
18587
|
+
selfCommitment: selfCommitment.commitment,
|
|
18587
18588
|
selfPublicKey: publicKey,
|
|
18588
18589
|
selfSignature,
|
|
18589
18590
|
adaptorPubKey
|
|
@@ -18634,7 +18635,9 @@ var DefaultSparkSigner = class {
|
|
|
18634
18635
|
const nonce = getRandomSigningNonce();
|
|
18635
18636
|
const commitment = getSigningCommitmentFromNonce(nonce);
|
|
18636
18637
|
this.commitmentToNonceMap.set(commitment, nonce);
|
|
18637
|
-
return
|
|
18638
|
+
return {
|
|
18639
|
+
commitment
|
|
18640
|
+
};
|
|
18638
18641
|
}
|
|
18639
18642
|
async validateMessageWithIdentityKey(message, signature) {
|
|
18640
18643
|
if (!this.identityKey?.publicKey) {
|
|
@@ -22918,6 +22921,13 @@ var DEFAULT_EXPIRY_TIME = 10 * 60 * 1e3;
|
|
|
22918
22921
|
function initialSequence() {
|
|
22919
22922
|
return 1 << 30 | INITIAL_TIME_LOCK;
|
|
22920
22923
|
}
|
|
22924
|
+
function getSigningJobProto(signingJob) {
|
|
22925
|
+
return {
|
|
22926
|
+
signingPublicKey: signingJob.signingPublicKey,
|
|
22927
|
+
rawTx: signingJob.rawTx,
|
|
22928
|
+
signingNonceCommitment: signingJob.signingNonceCommitment.commitment
|
|
22929
|
+
};
|
|
22930
|
+
}
|
|
22921
22931
|
var BaseTransferService = class {
|
|
22922
22932
|
config;
|
|
22923
22933
|
connectionManager;
|
|
@@ -23544,7 +23554,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
23544
23554
|
refundSigningData.keyDerivation
|
|
23545
23555
|
),
|
|
23546
23556
|
rawTx: refundTx.toBytes(),
|
|
23547
|
-
signingNonceCommitment: refundNonceCommitmentProto
|
|
23557
|
+
signingNonceCommitment: refundNonceCommitmentProto.commitment
|
|
23548
23558
|
},
|
|
23549
23559
|
// TODO: Add direct refund signature
|
|
23550
23560
|
directRefundTxSigningJob: void 0,
|
|
@@ -23856,7 +23866,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
23856
23866
|
const response = await sparkClient.refresh_timelock({
|
|
23857
23867
|
leafId: leaf.id,
|
|
23858
23868
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
23859
|
-
signingJobs
|
|
23869
|
+
signingJobs: signingJobs.map(getSigningJobProto)
|
|
23860
23870
|
});
|
|
23861
23871
|
if (signingJobs.length !== response.signingResults.length) {
|
|
23862
23872
|
throw Error(
|
|
@@ -24022,8 +24032,8 @@ var TransferService = class extends BaseTransferService {
|
|
|
24022
24032
|
const response = await sparkClient.extend_leaf({
|
|
24023
24033
|
leafId: node.id,
|
|
24024
24034
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
24025
|
-
nodeTxSigningJob: newNodeSigningJob,
|
|
24026
|
-
refundTxSigningJob: newRefundSigningJob
|
|
24035
|
+
nodeTxSigningJob: getSigningJobProto(newNodeSigningJob),
|
|
24036
|
+
refundTxSigningJob: getSigningJobProto(newRefundSigningJob)
|
|
24027
24037
|
});
|
|
24028
24038
|
if (!response.nodeTxSigningResult || !response.refundTxSigningResult) {
|
|
24029
24039
|
throw new Error("Signing result does not exist");
|
|
@@ -24131,7 +24141,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
24131
24141
|
const response = await sparkClient.refresh_timelock({
|
|
24132
24142
|
leafId: node.id,
|
|
24133
24143
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
24134
|
-
signingJobs: [refundSigningJob]
|
|
24144
|
+
signingJobs: [getSigningJobProto(refundSigningJob)]
|
|
24135
24145
|
});
|
|
24136
24146
|
if (response.signingResults.length !== 1) {
|
|
24137
24147
|
throw Error(
|
|
@@ -24283,7 +24293,7 @@ var CoopExitService = class extends BaseTransferService {
|
|
|
24283
24293
|
leaf.keyDerivation
|
|
24284
24294
|
),
|
|
24285
24295
|
rawTx: refundTx.toBytes(),
|
|
24286
|
-
signingNonceCommitment
|
|
24296
|
+
signingNonceCommitment: signingNonceCommitment.commitment
|
|
24287
24297
|
},
|
|
24288
24298
|
// TODO: Add direct refund signature
|
|
24289
24299
|
directRefundTxSigningJob: void 0,
|
|
@@ -24554,12 +24564,12 @@ var DepositService = class {
|
|
|
24554
24564
|
rootTxSigningJob: {
|
|
24555
24565
|
rawTx: rootTx.toBytes(),
|
|
24556
24566
|
signingPublicKey: signingPubKey,
|
|
24557
|
-
signingNonceCommitment: rootNonceCommitment
|
|
24567
|
+
signingNonceCommitment: rootNonceCommitment.commitment
|
|
24558
24568
|
},
|
|
24559
24569
|
refundTxSigningJob: {
|
|
24560
24570
|
rawTx: refundTx.toBytes(),
|
|
24561
24571
|
signingPublicKey: signingPubKey,
|
|
24562
|
-
signingNonceCommitment: refundNonceCommitment
|
|
24572
|
+
signingNonceCommitment: refundNonceCommitment.commitment
|
|
24563
24573
|
}
|
|
24564
24574
|
});
|
|
24565
24575
|
} catch (error) {
|
|
@@ -27887,7 +27897,7 @@ var TreeCreationService = class {
|
|
|
27887
27897
|
const signingJob = {
|
|
27888
27898
|
signingPublicKey: node.signingPublicKey,
|
|
27889
27899
|
rawTx: tx.toBytes(),
|
|
27890
|
-
signingNonceCommitment
|
|
27900
|
+
signingNonceCommitment: signingNonceCommitment.commitment
|
|
27891
27901
|
};
|
|
27892
27902
|
internalCreationNode.nodeTxSigningCommitment = signingNonceCommitment;
|
|
27893
27903
|
internalCreationNode.nodeTxSigningJob = signingJob;
|
|
@@ -27916,7 +27926,7 @@ var TreeCreationService = class {
|
|
|
27916
27926
|
const childSigningJob = {
|
|
27917
27927
|
signingPublicKey: node.signingPublicKey,
|
|
27918
27928
|
rawTx: childTx.toBytes(),
|
|
27919
|
-
signingNonceCommitment: childSigningNonceCommitment
|
|
27929
|
+
signingNonceCommitment: childSigningNonceCommitment.commitment
|
|
27920
27930
|
};
|
|
27921
27931
|
childCreationNode.nodeTxSigningCommitment = childSigningNonceCommitment;
|
|
27922
27932
|
childCreationNode.nodeTxSigningJob = childSigningJob;
|
|
@@ -27943,7 +27953,7 @@ var TreeCreationService = class {
|
|
|
27943
27953
|
const refundSigningJob = {
|
|
27944
27954
|
signingPublicKey: node.signingPublicKey,
|
|
27945
27955
|
rawTx: refundTx.toBytes(),
|
|
27946
|
-
signingNonceCommitment: refundSigningNonceCommitment
|
|
27956
|
+
signingNonceCommitment: refundSigningNonceCommitment.commitment
|
|
27947
27957
|
};
|
|
27948
27958
|
childCreationNode.refundTxSigningCommitment = refundSigningNonceCommitment;
|
|
27949
27959
|
childCreationNode.refundTxSigningJob = refundSigningJob;
|
|
@@ -27978,7 +27988,7 @@ var TreeCreationService = class {
|
|
|
27978
27988
|
const rootNodeSigningJob = {
|
|
27979
27989
|
signingPublicKey: root.signingPublicKey,
|
|
27980
27990
|
rawTx: rootNodeTx.toBytes(),
|
|
27981
|
-
signingNonceCommitment: rootNodeSigningCommitment
|
|
27991
|
+
signingNonceCommitment: rootNodeSigningCommitment.commitment
|
|
27982
27992
|
};
|
|
27983
27993
|
const rootCreationNode = {
|
|
27984
27994
|
nodeTxSigningJob: rootNodeSigningJob,
|
|
@@ -28333,7 +28343,7 @@ var SigningService = class {
|
|
|
28333
28343
|
leaf.keyDerivation
|
|
28334
28344
|
),
|
|
28335
28345
|
rawTx: refundTx.toBytes(),
|
|
28336
|
-
signingNonceCommitment: signingCommitment,
|
|
28346
|
+
signingNonceCommitment: signingCommitment.commitment,
|
|
28337
28347
|
userSignature: signingResult,
|
|
28338
28348
|
signingCommitments: {
|
|
28339
28349
|
signingCommitments: signingNonceCommitments
|
|
@@ -29826,7 +29836,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29826
29836
|
const signingJob = {
|
|
29827
29837
|
rawTx: tx.toBytes(),
|
|
29828
29838
|
signingPublicKey: await this.config.signer.getStaticDepositSigningKey(0),
|
|
29829
|
-
signingNonceCommitment
|
|
29839
|
+
signingNonceCommitment: signingNonceCommitment.commitment
|
|
29830
29840
|
};
|
|
29831
29841
|
const message = await this.getStaticDepositSigningPayload(
|
|
29832
29842
|
depositTransactionId,
|
package/dist/debug.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as Bech32mTokenIdentifier, a as Bech32mTokenIdentifierData, D as DecodedSparkAddressData, L as LRC_WALLET_NETWORK, b as LRC_WALLET_NETWORK_TYPE, N as Network, c as NetworkToProto, d as NetworkType, S as SparkAddressData, e as SparkAddressFormat, f as decodeBech32mTokenIdentifier, g as decodeSparkAddress, h as encodeBech32mTokenIdentifier, i as encodeSparkAddress, j as getNetwork, k as getNetworkFromAddress, l as getNetworkFromString, m as isValidPublicKey, n as isValidSparkAddress, p as protoToNetwork, o as SparkWallet, C as ConfigOptions } from './spark-wallet-
|
|
2
|
-
import { B as BroadcastConfig, a as BroadcastResult, D as DEFAULT_FEE_SATS, F as FeeBumpTxChain, b as FeeBumpTxPackage, c as FeeRate, L as LeafInfo, T as TxChain, U as Utxo, d as addPrivateKeys, e as addPublicKeys, f as applyAdaptorToSignature, g as applyAdditiveTweakToPublicKey, h as checkIfSelectedOutputsAreAvailable, i as checkIfValidSequence, j as collectResponses, k as computeTaprootKeyNoScript, l as constructFeeBumpTx, m as constructUnilateralExitFeeBumpPackages, n as constructUnilateralExitTxs, o as createRefundTx, p as createSigningCommitment, q as createSigningNonce, r as decodeBytesToSigningCommitment, s as decodeBytesToSigningNonce, t as encodeSigningCommitmentToBytes, u as encodeSigningNonceToBytes, v as filterTokenBalanceForTokenPublicKey, w as generateAdaptorFromSignature, x as generateSignatureFromExistingAdaptor, y as getCurrentTimelock, z as getEphemeralAnchorOutput, A as getLatestDepositTxId, C as getNextTransactionSequence, E as getP2TRAddressFromPkScript, G as getP2TRAddressFromPublicKey, H as getP2TRScriptFromPublicKey, I as getP2WPKHAddressFromPublicKey, J as getRandomSigningNonce, K as getSigHashFromTx, M as getSigningCommitmentFromNonce, N as getSparkAddressFromTaproot, O as getTransactionSequence, P as getTransferPackageSigningPayload, Q as getTxFromRawTxBytes, R as getTxFromRawTxHex, S as getTxId, V as getTxIdNoReverse, W as isEphemeralAnchorOutput, X as isTxBroadcast, Y as lastKeyWithTarget, Z as maybeApplyFee, _ as proofOfPossessionMessageHashForDepositAddress, $ as subtractPrivateKeys, a0 as subtractPublicKeys, a1 as sumAvailableTokens, a2 as sumOfPrivateKeys, a3 as validateOutboundAdaptorSignature } from './xchain-address-
|
|
3
|
-
import { K as VerifiableSecretShare, M as bigIntToPrivateKey, N as computerLagrangeCoefficients, O as evaluatePolynomial, Q as fieldDiv, W as generatePolynomialForSecretSharing, X as getRandomBigInt, Y as modInverse, Z as recoverSecret, _ as splitSecret, $ as splitSecretWithProofs, a0 as validateShare } from './client-
|
|
1
|
+
import { B as Bech32mTokenIdentifier, a as Bech32mTokenIdentifierData, D as DecodedSparkAddressData, L as LRC_WALLET_NETWORK, b as LRC_WALLET_NETWORK_TYPE, N as Network, c as NetworkToProto, d as NetworkType, S as SparkAddressData, e as SparkAddressFormat, f as decodeBech32mTokenIdentifier, g as decodeSparkAddress, h as encodeBech32mTokenIdentifier, i as encodeSparkAddress, j as getNetwork, k as getNetworkFromAddress, l as getNetworkFromString, m as isValidPublicKey, n as isValidSparkAddress, p as protoToNetwork, o as SparkWallet, C as ConfigOptions } from './spark-wallet-CHwKQYJu.cjs';
|
|
2
|
+
import { B as BroadcastConfig, a as BroadcastResult, D as DEFAULT_FEE_SATS, F as FeeBumpTxChain, b as FeeBumpTxPackage, c as FeeRate, L as LeafInfo, T as TxChain, U as Utxo, d as addPrivateKeys, e as addPublicKeys, f as applyAdaptorToSignature, g as applyAdditiveTweakToPublicKey, h as checkIfSelectedOutputsAreAvailable, i as checkIfValidSequence, j as collectResponses, k as computeTaprootKeyNoScript, l as constructFeeBumpTx, m as constructUnilateralExitFeeBumpPackages, n as constructUnilateralExitTxs, o as createRefundTx, p as createSigningCommitment, q as createSigningNonce, r as decodeBytesToSigningCommitment, s as decodeBytesToSigningNonce, t as encodeSigningCommitmentToBytes, u as encodeSigningNonceToBytes, v as filterTokenBalanceForTokenPublicKey, w as generateAdaptorFromSignature, x as generateSignatureFromExistingAdaptor, y as getCurrentTimelock, z as getEphemeralAnchorOutput, A as getLatestDepositTxId, C as getNextTransactionSequence, E as getP2TRAddressFromPkScript, G as getP2TRAddressFromPublicKey, H as getP2TRScriptFromPublicKey, I as getP2WPKHAddressFromPublicKey, J as getRandomSigningNonce, K as getSigHashFromTx, M as getSigningCommitmentFromNonce, N as getSparkAddressFromTaproot, O as getTransactionSequence, P as getTransferPackageSigningPayload, Q as getTxFromRawTxBytes, R as getTxFromRawTxHex, S as getTxId, V as getTxIdNoReverse, W as isEphemeralAnchorOutput, X as isTxBroadcast, Y as lastKeyWithTarget, Z as maybeApplyFee, _ as proofOfPossessionMessageHashForDepositAddress, $ as subtractPrivateKeys, a0 as subtractPublicKeys, a1 as sumAvailableTokens, a2 as sumOfPrivateKeys, a3 as validateOutboundAdaptorSignature } from './xchain-address-D5MIHCDL.cjs';
|
|
3
|
+
import { K as VerifiableSecretShare, M as bigIntToPrivateKey, N as computerLagrangeCoefficients, O as evaluatePolynomial, Q as fieldDiv, W as generatePolynomialForSecretSharing, X as getRandomBigInt, Y as modInverse, Z as recoverSecret, _ as splitSecret, $ as splitSecretWithProofs, a0 as validateShare } from './client-CcYzmpmj.cjs';
|
|
4
4
|
import './spark-BUOx3U7Q.cjs';
|
|
5
5
|
import '@bufbuild/protobuf/wire';
|
|
6
6
|
import 'nice-grpc-common';
|
package/dist/debug.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as Bech32mTokenIdentifier, a as Bech32mTokenIdentifierData, D as DecodedSparkAddressData, L as LRC_WALLET_NETWORK, b as LRC_WALLET_NETWORK_TYPE, N as Network, c as NetworkToProto, d as NetworkType, S as SparkAddressData, e as SparkAddressFormat, f as decodeBech32mTokenIdentifier, g as decodeSparkAddress, h as encodeBech32mTokenIdentifier, i as encodeSparkAddress, j as getNetwork, k as getNetworkFromAddress, l as getNetworkFromString, m as isValidPublicKey, n as isValidSparkAddress, p as protoToNetwork, o as SparkWallet, C as ConfigOptions } from './spark-wallet-
|
|
2
|
-
import { B as BroadcastConfig, a as BroadcastResult, D as DEFAULT_FEE_SATS, F as FeeBumpTxChain, b as FeeBumpTxPackage, c as FeeRate, L as LeafInfo, T as TxChain, U as Utxo, d as addPrivateKeys, e as addPublicKeys, f as applyAdaptorToSignature, g as applyAdditiveTweakToPublicKey, h as checkIfSelectedOutputsAreAvailable, i as checkIfValidSequence, j as collectResponses, k as computeTaprootKeyNoScript, l as constructFeeBumpTx, m as constructUnilateralExitFeeBumpPackages, n as constructUnilateralExitTxs, o as createRefundTx, p as createSigningCommitment, q as createSigningNonce, r as decodeBytesToSigningCommitment, s as decodeBytesToSigningNonce, t as encodeSigningCommitmentToBytes, u as encodeSigningNonceToBytes, v as filterTokenBalanceForTokenPublicKey, w as generateAdaptorFromSignature, x as generateSignatureFromExistingAdaptor, y as getCurrentTimelock, z as getEphemeralAnchorOutput, A as getLatestDepositTxId, C as getNextTransactionSequence, E as getP2TRAddressFromPkScript, G as getP2TRAddressFromPublicKey, H as getP2TRScriptFromPublicKey, I as getP2WPKHAddressFromPublicKey, J as getRandomSigningNonce, K as getSigHashFromTx, M as getSigningCommitmentFromNonce, N as getSparkAddressFromTaproot, O as getTransactionSequence, P as getTransferPackageSigningPayload, Q as getTxFromRawTxBytes, R as getTxFromRawTxHex, S as getTxId, V as getTxIdNoReverse, W as isEphemeralAnchorOutput, X as isTxBroadcast, Y as lastKeyWithTarget, Z as maybeApplyFee, _ as proofOfPossessionMessageHashForDepositAddress, $ as subtractPrivateKeys, a0 as subtractPublicKeys, a1 as sumAvailableTokens, a2 as sumOfPrivateKeys, a3 as validateOutboundAdaptorSignature } from './xchain-address-
|
|
3
|
-
import { K as VerifiableSecretShare, M as bigIntToPrivateKey, N as computerLagrangeCoefficients, O as evaluatePolynomial, Q as fieldDiv, W as generatePolynomialForSecretSharing, X as getRandomBigInt, Y as modInverse, Z as recoverSecret, _ as splitSecret, $ as splitSecretWithProofs, a0 as validateShare } from './client-
|
|
1
|
+
import { B as Bech32mTokenIdentifier, a as Bech32mTokenIdentifierData, D as DecodedSparkAddressData, L as LRC_WALLET_NETWORK, b as LRC_WALLET_NETWORK_TYPE, N as Network, c as NetworkToProto, d as NetworkType, S as SparkAddressData, e as SparkAddressFormat, f as decodeBech32mTokenIdentifier, g as decodeSparkAddress, h as encodeBech32mTokenIdentifier, i as encodeSparkAddress, j as getNetwork, k as getNetworkFromAddress, l as getNetworkFromString, m as isValidPublicKey, n as isValidSparkAddress, p as protoToNetwork, o as SparkWallet, C as ConfigOptions } from './spark-wallet-B_96y9BS.js';
|
|
2
|
+
import { B as BroadcastConfig, a as BroadcastResult, D as DEFAULT_FEE_SATS, F as FeeBumpTxChain, b as FeeBumpTxPackage, c as FeeRate, L as LeafInfo, T as TxChain, U as Utxo, d as addPrivateKeys, e as addPublicKeys, f as applyAdaptorToSignature, g as applyAdditiveTweakToPublicKey, h as checkIfSelectedOutputsAreAvailable, i as checkIfValidSequence, j as collectResponses, k as computeTaprootKeyNoScript, l as constructFeeBumpTx, m as constructUnilateralExitFeeBumpPackages, n as constructUnilateralExitTxs, o as createRefundTx, p as createSigningCommitment, q as createSigningNonce, r as decodeBytesToSigningCommitment, s as decodeBytesToSigningNonce, t as encodeSigningCommitmentToBytes, u as encodeSigningNonceToBytes, v as filterTokenBalanceForTokenPublicKey, w as generateAdaptorFromSignature, x as generateSignatureFromExistingAdaptor, y as getCurrentTimelock, z as getEphemeralAnchorOutput, A as getLatestDepositTxId, C as getNextTransactionSequence, E as getP2TRAddressFromPkScript, G as getP2TRAddressFromPublicKey, H as getP2TRScriptFromPublicKey, I as getP2WPKHAddressFromPublicKey, J as getRandomSigningNonce, K as getSigHashFromTx, M as getSigningCommitmentFromNonce, N as getSparkAddressFromTaproot, O as getTransactionSequence, P as getTransferPackageSigningPayload, Q as getTxFromRawTxBytes, R as getTxFromRawTxHex, S as getTxId, V as getTxIdNoReverse, W as isEphemeralAnchorOutput, X as isTxBroadcast, Y as lastKeyWithTarget, Z as maybeApplyFee, _ as proofOfPossessionMessageHashForDepositAddress, $ as subtractPrivateKeys, a0 as subtractPublicKeys, a1 as sumAvailableTokens, a2 as sumOfPrivateKeys, a3 as validateOutboundAdaptorSignature } from './xchain-address-DLbW1iDh.js';
|
|
3
|
+
import { K as VerifiableSecretShare, M as bigIntToPrivateKey, N as computerLagrangeCoefficients, O as evaluatePolynomial, Q as fieldDiv, W as generatePolynomialForSecretSharing, X as getRandomBigInt, Y as modInverse, Z as recoverSecret, _ as splitSecret, $ as splitSecretWithProofs, a0 as validateShare } from './client-CGTRS23n.js';
|
|
4
4
|
import './spark-BUOx3U7Q.js';
|
|
5
5
|
import '@bufbuild/protobuf/wire';
|
|
6
6
|
import 'nice-grpc-common';
|
package/dist/debug.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BitcoinNetwork, k as CurrencyAmount, P as PageInfo,
|
|
2
|
-
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 LightningSendFeeEstimateInput, t as LightningSendFeeEstimateOutput, v as LightningSendRequest, w as LightningSendRequestStatus, R as RequestCoopExitInput, x as RequestLeavesSwapInput, y as RequestLightningReceiveInput, z as RequestLightningSendInput, S as SparkCoopExitRequestStatus, A as SparkLeavesSwapRequestStatus, D as SparkTransferToLeavesConnection, F as StaticDepositQuoteInput, H as StaticDepositQuoteOutput, J as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitFeeQuoteQuery, j as getCoopExitRequestQuery, n as getLeavesSwapRequestQuery, p as getLightningReceiveRequestQuery, u as getLightningSendRequestQuery } from '../../client-
|
|
1
|
+
import { B as BitcoinNetwork, k as CurrencyAmount, P as PageInfo, aa as SspClient } from '../../client-CcYzmpmj.cjs';
|
|
2
|
+
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 LightningSendFeeEstimateInput, t as LightningSendFeeEstimateOutput, v as LightningSendRequest, w as LightningSendRequestStatus, R as RequestCoopExitInput, x as RequestLeavesSwapInput, y as RequestLightningReceiveInput, z as RequestLightningSendInput, S as SparkCoopExitRequestStatus, A as SparkLeavesSwapRequestStatus, D as SparkTransferToLeavesConnection, F as StaticDepositQuoteInput, H as StaticDepositQuoteOutput, J as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitFeeQuoteQuery, j as getCoopExitRequestQuery, n as getLeavesSwapRequestQuery, p as getLightningReceiveRequestQuery, u as getLightningSendRequestQuery } from '../../client-CcYzmpmj.cjs';
|
|
3
3
|
import { Query } from '@lightsparkdev/core';
|
|
4
4
|
import '@buildonspark/lrc20-sdk';
|
|
5
5
|
import '@scure/btc-signer';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BitcoinNetwork, k as CurrencyAmount, P as PageInfo,
|
|
2
|
-
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 LightningSendFeeEstimateInput, t as LightningSendFeeEstimateOutput, v as LightningSendRequest, w as LightningSendRequestStatus, R as RequestCoopExitInput, x as RequestLeavesSwapInput, y as RequestLightningReceiveInput, z as RequestLightningSendInput, S as SparkCoopExitRequestStatus, A as SparkLeavesSwapRequestStatus, D as SparkTransferToLeavesConnection, F as StaticDepositQuoteInput, H as StaticDepositQuoteOutput, J as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitFeeQuoteQuery, j as getCoopExitRequestQuery, n as getLeavesSwapRequestQuery, p as getLightningReceiveRequestQuery, u as getLightningSendRequestQuery } from '../../client-
|
|
1
|
+
import { B as BitcoinNetwork, k as CurrencyAmount, P as PageInfo, aa as SspClient } from '../../client-CGTRS23n.js';
|
|
2
|
+
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 LightningSendFeeEstimateInput, t as LightningSendFeeEstimateOutput, v as LightningSendRequest, w as LightningSendRequestStatus, R as RequestCoopExitInput, x as RequestLeavesSwapInput, y as RequestLightningReceiveInput, z as RequestLightningSendInput, S as SparkCoopExitRequestStatus, A as SparkLeavesSwapRequestStatus, D as SparkTransferToLeavesConnection, F as StaticDepositQuoteInput, H as StaticDepositQuoteOutput, J as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitFeeQuoteQuery, j as getCoopExitRequestQuery, n as getLeavesSwapRequestQuery, p as getLightningReceiveRequestQuery, u as getLightningSendRequestQuery } from '../../client-CGTRS23n.js';
|
|
3
3
|
import { Query } from '@lightsparkdev/core';
|
|
4
4
|
import '@buildonspark/lrc20-sdk';
|
|
5
5
|
import '@scure/btc-signer';
|