@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/dist/index.cjs
CHANGED
|
@@ -1306,6 +1306,7 @@ __export(index_exports, {
|
|
|
1306
1306
|
TaprootOutputKeysGenerator: () => TaprootOutputKeysGenerator,
|
|
1307
1307
|
TaprootSparkSigner: () => TaprootSparkSigner,
|
|
1308
1308
|
TokenTransactionService: () => TokenTransactionService,
|
|
1309
|
+
UnsafeStatelessSparkSigner: () => UnsafeStatelessSparkSigner,
|
|
1309
1310
|
ValidationError: () => ValidationError,
|
|
1310
1311
|
WalletConfig: () => WalletConfig,
|
|
1311
1312
|
addPrivateKeys: () => addPrivateKeys,
|
|
@@ -18854,7 +18855,7 @@ init_buffer();
|
|
|
18854
18855
|
var import_core8 = require("@lightsparkdev/core");
|
|
18855
18856
|
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
18856
18857
|
var isBun = globalThis.Bun !== void 0;
|
|
18857
|
-
var packageVersion = true ? "0.2.
|
|
18858
|
+
var packageVersion = true ? "0.2.2" : "unknown";
|
|
18858
18859
|
var baseEnvStr = "unknown";
|
|
18859
18860
|
if (isBun) {
|
|
18860
18861
|
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
@@ -19186,7 +19187,8 @@ var DefaultSparkSigner = class {
|
|
|
19186
19187
|
field: "privateKey"
|
|
19187
19188
|
});
|
|
19188
19189
|
}
|
|
19189
|
-
const
|
|
19190
|
+
const commitment = selfCommitment.commitment;
|
|
19191
|
+
const nonce = this.commitmentToNonceMap.get(commitment);
|
|
19190
19192
|
if (!nonce) {
|
|
19191
19193
|
throw new ValidationError("Nonce not found for commitment", {
|
|
19192
19194
|
field: "nonce"
|
|
@@ -19201,7 +19203,7 @@ var DefaultSparkSigner = class {
|
|
|
19201
19203
|
message,
|
|
19202
19204
|
keyPackage,
|
|
19203
19205
|
nonce,
|
|
19204
|
-
selfCommitment,
|
|
19206
|
+
selfCommitment: commitment,
|
|
19205
19207
|
statechainCommitments,
|
|
19206
19208
|
adaptorPubKey
|
|
19207
19209
|
});
|
|
@@ -19229,7 +19231,7 @@ var DefaultSparkSigner = class {
|
|
|
19229
19231
|
statechainPublicKeys,
|
|
19230
19232
|
verifyingKey,
|
|
19231
19233
|
statechainCommitments,
|
|
19232
|
-
selfCommitment,
|
|
19234
|
+
selfCommitment: selfCommitment.commitment,
|
|
19233
19235
|
selfPublicKey: publicKey,
|
|
19234
19236
|
selfSignature,
|
|
19235
19237
|
adaptorPubKey
|
|
@@ -19280,7 +19282,9 @@ var DefaultSparkSigner = class {
|
|
|
19280
19282
|
const nonce = getRandomSigningNonce();
|
|
19281
19283
|
const commitment = getSigningCommitmentFromNonce(nonce);
|
|
19282
19284
|
this.commitmentToNonceMap.set(commitment, nonce);
|
|
19283
|
-
return
|
|
19285
|
+
return {
|
|
19286
|
+
commitment
|
|
19287
|
+
};
|
|
19284
19288
|
}
|
|
19285
19289
|
async validateMessageWithIdentityKey(message, signature) {
|
|
19286
19290
|
if (!this.identityKey?.publicKey) {
|
|
@@ -19334,6 +19338,64 @@ var DefaultSparkSigner = class {
|
|
|
19334
19338
|
tx.signIdx(privateKey, index);
|
|
19335
19339
|
}
|
|
19336
19340
|
};
|
|
19341
|
+
var UnsafeStatelessSparkSigner = class extends DefaultSparkSigner {
|
|
19342
|
+
constructor({
|
|
19343
|
+
sparkKeysGenerator
|
|
19344
|
+
} = {}) {
|
|
19345
|
+
super({
|
|
19346
|
+
sparkKeysGenerator
|
|
19347
|
+
});
|
|
19348
|
+
}
|
|
19349
|
+
async getRandomSigningCommitment() {
|
|
19350
|
+
const nonce = getRandomSigningNonce();
|
|
19351
|
+
const commitment = getSigningCommitmentFromNonce(nonce);
|
|
19352
|
+
return {
|
|
19353
|
+
commitment,
|
|
19354
|
+
nonce
|
|
19355
|
+
};
|
|
19356
|
+
}
|
|
19357
|
+
async signFrost({
|
|
19358
|
+
message,
|
|
19359
|
+
keyDerivation,
|
|
19360
|
+
publicKey,
|
|
19361
|
+
verifyingKey,
|
|
19362
|
+
selfCommitment,
|
|
19363
|
+
statechainCommitments,
|
|
19364
|
+
adaptorPubKey
|
|
19365
|
+
}) {
|
|
19366
|
+
const SparkFrost = await getSparkFrostModule();
|
|
19367
|
+
if (!SparkFrost) {
|
|
19368
|
+
throw new ValidationError("SparkFrost module not found", {
|
|
19369
|
+
field: "SparkFrost"
|
|
19370
|
+
});
|
|
19371
|
+
}
|
|
19372
|
+
const signingPrivateKey = await this.getSigningPrivateKeyFromDerivation(keyDerivation);
|
|
19373
|
+
if (!signingPrivateKey) {
|
|
19374
|
+
throw new ValidationError("Private key not found for public key", {
|
|
19375
|
+
field: "privateKey"
|
|
19376
|
+
});
|
|
19377
|
+
}
|
|
19378
|
+
const { commitment, nonce } = selfCommitment;
|
|
19379
|
+
if (!nonce) {
|
|
19380
|
+
throw new ValidationError("Nonce not found for commitment", {
|
|
19381
|
+
field: "nonce"
|
|
19382
|
+
});
|
|
19383
|
+
}
|
|
19384
|
+
const keyPackage = {
|
|
19385
|
+
secretKey: signingPrivateKey,
|
|
19386
|
+
publicKey,
|
|
19387
|
+
verifyingKey
|
|
19388
|
+
};
|
|
19389
|
+
return SparkFrost.signFrost({
|
|
19390
|
+
message,
|
|
19391
|
+
keyPackage,
|
|
19392
|
+
nonce,
|
|
19393
|
+
selfCommitment: commitment,
|
|
19394
|
+
statechainCommitments,
|
|
19395
|
+
adaptorPubKey
|
|
19396
|
+
});
|
|
19397
|
+
}
|
|
19398
|
+
};
|
|
19337
19399
|
var TaprootSparkSigner = class extends DefaultSparkSigner {
|
|
19338
19400
|
constructor(useAddressIndex = false) {
|
|
19339
19401
|
super({
|
|
@@ -24065,6 +24127,13 @@ var DEFAULT_EXPIRY_TIME = 10 * 60 * 1e3;
|
|
|
24065
24127
|
function initialSequence() {
|
|
24066
24128
|
return 1 << 30 | INITIAL_TIME_LOCK;
|
|
24067
24129
|
}
|
|
24130
|
+
function getSigningJobProto(signingJob) {
|
|
24131
|
+
return {
|
|
24132
|
+
signingPublicKey: signingJob.signingPublicKey,
|
|
24133
|
+
rawTx: signingJob.rawTx,
|
|
24134
|
+
signingNonceCommitment: signingJob.signingNonceCommitment.commitment
|
|
24135
|
+
};
|
|
24136
|
+
}
|
|
24068
24137
|
var BaseTransferService = class {
|
|
24069
24138
|
config;
|
|
24070
24139
|
connectionManager;
|
|
@@ -24691,7 +24760,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
24691
24760
|
refundSigningData.keyDerivation
|
|
24692
24761
|
),
|
|
24693
24762
|
rawTx: refundTx.toBytes(),
|
|
24694
|
-
signingNonceCommitment: refundNonceCommitmentProto
|
|
24763
|
+
signingNonceCommitment: refundNonceCommitmentProto.commitment
|
|
24695
24764
|
},
|
|
24696
24765
|
// TODO: Add direct refund signature
|
|
24697
24766
|
directRefundTxSigningJob: void 0,
|
|
@@ -25003,7 +25072,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
25003
25072
|
const response = await sparkClient.refresh_timelock({
|
|
25004
25073
|
leafId: leaf.id,
|
|
25005
25074
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
25006
|
-
signingJobs
|
|
25075
|
+
signingJobs: signingJobs.map(getSigningJobProto)
|
|
25007
25076
|
});
|
|
25008
25077
|
if (signingJobs.length !== response.signingResults.length) {
|
|
25009
25078
|
throw Error(
|
|
@@ -25169,8 +25238,8 @@ var TransferService = class extends BaseTransferService {
|
|
|
25169
25238
|
const response = await sparkClient.extend_leaf({
|
|
25170
25239
|
leafId: node.id,
|
|
25171
25240
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
25172
|
-
nodeTxSigningJob: newNodeSigningJob,
|
|
25173
|
-
refundTxSigningJob: newRefundSigningJob
|
|
25241
|
+
nodeTxSigningJob: getSigningJobProto(newNodeSigningJob),
|
|
25242
|
+
refundTxSigningJob: getSigningJobProto(newRefundSigningJob)
|
|
25174
25243
|
});
|
|
25175
25244
|
if (!response.nodeTxSigningResult || !response.refundTxSigningResult) {
|
|
25176
25245
|
throw new Error("Signing result does not exist");
|
|
@@ -25278,7 +25347,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
25278
25347
|
const response = await sparkClient.refresh_timelock({
|
|
25279
25348
|
leafId: node.id,
|
|
25280
25349
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
25281
|
-
signingJobs: [refundSigningJob]
|
|
25350
|
+
signingJobs: [getSigningJobProto(refundSigningJob)]
|
|
25282
25351
|
});
|
|
25283
25352
|
if (response.signingResults.length !== 1) {
|
|
25284
25353
|
throw Error(
|
|
@@ -25430,7 +25499,7 @@ var CoopExitService = class extends BaseTransferService {
|
|
|
25430
25499
|
leaf.keyDerivation
|
|
25431
25500
|
),
|
|
25432
25501
|
rawTx: refundTx.toBytes(),
|
|
25433
|
-
signingNonceCommitment
|
|
25502
|
+
signingNonceCommitment: signingNonceCommitment.commitment
|
|
25434
25503
|
},
|
|
25435
25504
|
// TODO: Add direct refund signature
|
|
25436
25505
|
directRefundTxSigningJob: void 0,
|
|
@@ -25685,12 +25754,12 @@ var DepositService = class {
|
|
|
25685
25754
|
rootTxSigningJob: {
|
|
25686
25755
|
rawTx: rootTx.toBytes(),
|
|
25687
25756
|
signingPublicKey: signingPubKey,
|
|
25688
|
-
signingNonceCommitment: rootNonceCommitment
|
|
25757
|
+
signingNonceCommitment: rootNonceCommitment.commitment
|
|
25689
25758
|
},
|
|
25690
25759
|
refundTxSigningJob: {
|
|
25691
25760
|
rawTx: refundTx.toBytes(),
|
|
25692
25761
|
signingPublicKey: signingPubKey,
|
|
25693
|
-
signingNonceCommitment: refundNonceCommitment
|
|
25762
|
+
signingNonceCommitment: refundNonceCommitment.commitment
|
|
25694
25763
|
}
|
|
25695
25764
|
});
|
|
25696
25765
|
} catch (error) {
|
|
@@ -28762,7 +28831,7 @@ var TreeCreationService = class {
|
|
|
28762
28831
|
const signingJob = {
|
|
28763
28832
|
signingPublicKey: node.signingPublicKey,
|
|
28764
28833
|
rawTx: tx.toBytes(),
|
|
28765
|
-
signingNonceCommitment
|
|
28834
|
+
signingNonceCommitment: signingNonceCommitment.commitment
|
|
28766
28835
|
};
|
|
28767
28836
|
internalCreationNode.nodeTxSigningCommitment = signingNonceCommitment;
|
|
28768
28837
|
internalCreationNode.nodeTxSigningJob = signingJob;
|
|
@@ -28791,7 +28860,7 @@ var TreeCreationService = class {
|
|
|
28791
28860
|
const childSigningJob = {
|
|
28792
28861
|
signingPublicKey: node.signingPublicKey,
|
|
28793
28862
|
rawTx: childTx.toBytes(),
|
|
28794
|
-
signingNonceCommitment: childSigningNonceCommitment
|
|
28863
|
+
signingNonceCommitment: childSigningNonceCommitment.commitment
|
|
28795
28864
|
};
|
|
28796
28865
|
childCreationNode.nodeTxSigningCommitment = childSigningNonceCommitment;
|
|
28797
28866
|
childCreationNode.nodeTxSigningJob = childSigningJob;
|
|
@@ -28818,7 +28887,7 @@ var TreeCreationService = class {
|
|
|
28818
28887
|
const refundSigningJob = {
|
|
28819
28888
|
signingPublicKey: node.signingPublicKey,
|
|
28820
28889
|
rawTx: refundTx.toBytes(),
|
|
28821
|
-
signingNonceCommitment: refundSigningNonceCommitment
|
|
28890
|
+
signingNonceCommitment: refundSigningNonceCommitment.commitment
|
|
28822
28891
|
};
|
|
28823
28892
|
childCreationNode.refundTxSigningCommitment = refundSigningNonceCommitment;
|
|
28824
28893
|
childCreationNode.refundTxSigningJob = refundSigningJob;
|
|
@@ -28853,7 +28922,7 @@ var TreeCreationService = class {
|
|
|
28853
28922
|
const rootNodeSigningJob = {
|
|
28854
28923
|
signingPublicKey: root.signingPublicKey,
|
|
28855
28924
|
rawTx: rootNodeTx.toBytes(),
|
|
28856
|
-
signingNonceCommitment: rootNodeSigningCommitment
|
|
28925
|
+
signingNonceCommitment: rootNodeSigningCommitment.commitment
|
|
28857
28926
|
};
|
|
28858
28927
|
const rootCreationNode = {
|
|
28859
28928
|
nodeTxSigningJob: rootNodeSigningJob,
|
|
@@ -29086,7 +29155,7 @@ var SigningService = class {
|
|
|
29086
29155
|
leaf.keyDerivation
|
|
29087
29156
|
),
|
|
29088
29157
|
rawTx: refundTx.toBytes(),
|
|
29089
|
-
signingNonceCommitment: signingCommitment,
|
|
29158
|
+
signingNonceCommitment: signingCommitment.commitment,
|
|
29090
29159
|
userSignature: signingResult,
|
|
29091
29160
|
signingCommitments: {
|
|
29092
29161
|
signingCommitments: signingNonceCommitments
|
|
@@ -30534,7 +30603,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30534
30603
|
const signingJob = {
|
|
30535
30604
|
rawTx: tx.toBytes(),
|
|
30536
30605
|
signingPublicKey: await this.config.signer.getStaticDepositSigningKey(0),
|
|
30537
|
-
signingNonceCommitment
|
|
30606
|
+
signingNonceCommitment: signingNonceCommitment.commitment
|
|
30538
30607
|
};
|
|
30539
30608
|
const message = await this.getStaticDepositSigningPayload(
|
|
30540
30609
|
depositTransactionId,
|
|
@@ -32487,6 +32556,7 @@ setCrypto(cryptoImpl2);
|
|
|
32487
32556
|
TaprootOutputKeysGenerator,
|
|
32488
32557
|
TaprootSparkSigner,
|
|
32489
32558
|
TokenTransactionService,
|
|
32559
|
+
UnsafeStatelessSparkSigner,
|
|
32490
32560
|
ValidationError,
|
|
32491
32561
|
WalletConfig,
|
|
32492
32562
|
addPrivateKeys,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AuthenticationError, ConfigurationError, InternalValidationError, NetworkError, NotImplementedError, RPCError, SparkSDKError, TokenTransactionService, ValidationError } from './index.node.cjs';
|
|
2
|
-
export { B as Bech32mTokenIdentifier, a as Bech32mTokenIdentifierData, C as ConfigOptions, s as ConnectionManager, u as CreateLightningInvoiceParams, D as DecodedSparkAddressData, w as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, b as LRC_WALLET_NETWORK_TYPE, N as Network, c as NetworkToProto, d as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, S as SparkAddressData, e as SparkAddressFormat, o as SparkWallet, y as SparkWalletEvents, q as SparkWalletProps, r as TokenBalanceMap, x as TokenMetadataMap, T as TokenOutputsMap, v as TransferParams, U as UserTokenMetadata, t as WalletConfig, W as WalletConfigService, 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 } from './spark-wallet-
|
|
3
|
-
export { 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-
|
|
4
|
-
export {
|
|
2
|
+
export { B as Bech32mTokenIdentifier, a as Bech32mTokenIdentifierData, C as ConfigOptions, s as ConnectionManager, u as CreateLightningInvoiceParams, D as DecodedSparkAddressData, w as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, b as LRC_WALLET_NETWORK_TYPE, N as Network, c as NetworkToProto, d as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, S as SparkAddressData, e as SparkAddressFormat, o as SparkWallet, y as SparkWalletEvents, q as SparkWalletProps, r as TokenBalanceMap, x as TokenMetadataMap, T as TokenOutputsMap, v as TransferParams, U as UserTokenMetadata, t as WalletConfig, W as WalletConfigService, 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 } from './spark-wallet-CHwKQYJu.cjs';
|
|
3
|
+
export { 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';
|
|
4
|
+
export { ag as AggregateFrostParams, a2 as DefaultSparkSigner, ai as DerivedHDKey, a6 as KeyDerivation, ae as KeyDerivationType, aj as KeyPair, af as SignFrostParams, a9 as SigningCommitment, a7 as SigningCommitmentWithOptionalNonce, a8 as SigningNonce, a1 as SparkSigner, ah as SplitSecretWithProofsParams, ab as TaprootOutputKeysGenerator, ac as TaprootSparkSigner, ad as UnsafeStatelessSparkSigner, 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';
|
|
5
5
|
export { TokenSigner } from '@buildonspark/lrc20-sdk';
|
|
6
6
|
export { MultisigReceiptInput } from '@buildonspark/lrc20-sdk/lrc/types';
|
|
7
7
|
import './spark-BUOx3U7Q.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AuthenticationError, ConfigurationError, InternalValidationError, NetworkError, NotImplementedError, RPCError, SparkSDKError, TokenTransactionService, ValidationError } from './index.node.js';
|
|
2
|
-
export { B as Bech32mTokenIdentifier, a as Bech32mTokenIdentifierData, C as ConfigOptions, s as ConnectionManager, u as CreateLightningInvoiceParams, D as DecodedSparkAddressData, w as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, b as LRC_WALLET_NETWORK_TYPE, N as Network, c as NetworkToProto, d as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, S as SparkAddressData, e as SparkAddressFormat, o as SparkWallet, y as SparkWalletEvents, q as SparkWalletProps, r as TokenBalanceMap, x as TokenMetadataMap, T as TokenOutputsMap, v as TransferParams, U as UserTokenMetadata, t as WalletConfig, W as WalletConfigService, 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 } from './spark-wallet-
|
|
3
|
-
export { 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-
|
|
4
|
-
export {
|
|
2
|
+
export { B as Bech32mTokenIdentifier, a as Bech32mTokenIdentifierData, C as ConfigOptions, s as ConnectionManager, u as CreateLightningInvoiceParams, D as DecodedSparkAddressData, w as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, b as LRC_WALLET_NETWORK_TYPE, N as Network, c as NetworkToProto, d as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, S as SparkAddressData, e as SparkAddressFormat, o as SparkWallet, y as SparkWalletEvents, q as SparkWalletProps, r as TokenBalanceMap, x as TokenMetadataMap, T as TokenOutputsMap, v as TransferParams, U as UserTokenMetadata, t as WalletConfig, W as WalletConfigService, 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 } from './spark-wallet-B_96y9BS.js';
|
|
3
|
+
export { 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';
|
|
4
|
+
export { ag as AggregateFrostParams, a2 as DefaultSparkSigner, ai as DerivedHDKey, a6 as KeyDerivation, ae as KeyDerivationType, aj as KeyPair, af as SignFrostParams, a9 as SigningCommitment, a7 as SigningCommitmentWithOptionalNonce, a8 as SigningNonce, a1 as SparkSigner, ah as SplitSecretWithProofsParams, ab as TaprootOutputKeysGenerator, ac as TaprootSparkSigner, ad as UnsafeStatelessSparkSigner, 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';
|
|
5
5
|
export { TokenSigner } from '@buildonspark/lrc20-sdk';
|
|
6
6
|
export { MultisigReceiptInput } from '@buildonspark/lrc20-sdk/lrc/types';
|
|
7
7
|
import './spark-BUOx3U7Q.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-S2AL73MZ.js";
|
|
2
2
|
import "./chunk-BYXBJQAS.js";
|
|
3
3
|
import {
|
|
4
4
|
AuthenticationError,
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
TaprootOutputKeysGenerator,
|
|
21
21
|
TaprootSparkSigner,
|
|
22
22
|
TokenTransactionService,
|
|
23
|
+
UnsafeStatelessSparkSigner,
|
|
23
24
|
ValidationError,
|
|
24
25
|
WalletConfig,
|
|
25
26
|
addPrivateKeys,
|
|
@@ -92,7 +93,7 @@ import {
|
|
|
92
93
|
sumOfPrivateKeys,
|
|
93
94
|
validateOutboundAdaptorSignature,
|
|
94
95
|
validateShare
|
|
95
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-2TUM3R6C.js";
|
|
96
97
|
import "./chunk-4JD4HIAN.js";
|
|
97
98
|
import "./chunk-TM6CHQXC.js";
|
|
98
99
|
import "./chunk-CDLETEDT.js";
|
|
@@ -118,6 +119,7 @@ export {
|
|
|
118
119
|
TaprootOutputKeysGenerator,
|
|
119
120
|
TaprootSparkSigner,
|
|
120
121
|
TokenTransactionService,
|
|
122
|
+
UnsafeStatelessSparkSigner,
|
|
121
123
|
ValidationError,
|
|
122
124
|
WalletConfig,
|
|
123
125
|
addPrivateKeys,
|
package/dist/index.node.cjs
CHANGED
|
@@ -1306,6 +1306,7 @@ __export(index_node_exports, {
|
|
|
1306
1306
|
TaprootOutputKeysGenerator: () => TaprootOutputKeysGenerator,
|
|
1307
1307
|
TaprootSparkSigner: () => TaprootSparkSigner,
|
|
1308
1308
|
TokenTransactionService: () => TokenTransactionService,
|
|
1309
|
+
UnsafeStatelessSparkSigner: () => UnsafeStatelessSparkSigner,
|
|
1309
1310
|
ValidationError: () => ValidationError,
|
|
1310
1311
|
WalletConfig: () => WalletConfig,
|
|
1311
1312
|
addPrivateKeys: () => addPrivateKeys,
|
|
@@ -1381,6 +1382,7 @@ __export(index_node_exports, {
|
|
|
1381
1382
|
});
|
|
1382
1383
|
module.exports = __toCommonJS(index_node_exports);
|
|
1383
1384
|
init_buffer();
|
|
1385
|
+
var import_crypto3 = __toESM(require("crypto"), 1);
|
|
1384
1386
|
|
|
1385
1387
|
// src/utils/crypto.ts
|
|
1386
1388
|
init_buffer();
|
|
@@ -1397,9 +1399,6 @@ var setCrypto = (cryptoImplParam) => {
|
|
|
1397
1399
|
cryptoImpl = cryptoImplParam;
|
|
1398
1400
|
};
|
|
1399
1401
|
|
|
1400
|
-
// src/index.node.ts
|
|
1401
|
-
var import_crypto4 = __toESM(require("crypto"), 1);
|
|
1402
|
-
|
|
1403
1402
|
// src/errors/index.ts
|
|
1404
1403
|
init_buffer();
|
|
1405
1404
|
|
|
@@ -18857,7 +18856,7 @@ init_buffer();
|
|
|
18857
18856
|
var import_core8 = require("@lightsparkdev/core");
|
|
18858
18857
|
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
18859
18858
|
var isBun = globalThis.Bun !== void 0;
|
|
18860
|
-
var packageVersion = true ? "0.2.
|
|
18859
|
+
var packageVersion = true ? "0.2.2" : "unknown";
|
|
18861
18860
|
var baseEnvStr = "unknown";
|
|
18862
18861
|
if (isBun) {
|
|
18863
18862
|
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
@@ -19189,7 +19188,8 @@ var DefaultSparkSigner = class {
|
|
|
19189
19188
|
field: "privateKey"
|
|
19190
19189
|
});
|
|
19191
19190
|
}
|
|
19192
|
-
const
|
|
19191
|
+
const commitment = selfCommitment.commitment;
|
|
19192
|
+
const nonce = this.commitmentToNonceMap.get(commitment);
|
|
19193
19193
|
if (!nonce) {
|
|
19194
19194
|
throw new ValidationError("Nonce not found for commitment", {
|
|
19195
19195
|
field: "nonce"
|
|
@@ -19204,7 +19204,7 @@ var DefaultSparkSigner = class {
|
|
|
19204
19204
|
message,
|
|
19205
19205
|
keyPackage,
|
|
19206
19206
|
nonce,
|
|
19207
|
-
selfCommitment,
|
|
19207
|
+
selfCommitment: commitment,
|
|
19208
19208
|
statechainCommitments,
|
|
19209
19209
|
adaptorPubKey
|
|
19210
19210
|
});
|
|
@@ -19232,7 +19232,7 @@ var DefaultSparkSigner = class {
|
|
|
19232
19232
|
statechainPublicKeys,
|
|
19233
19233
|
verifyingKey,
|
|
19234
19234
|
statechainCommitments,
|
|
19235
|
-
selfCommitment,
|
|
19235
|
+
selfCommitment: selfCommitment.commitment,
|
|
19236
19236
|
selfPublicKey: publicKey,
|
|
19237
19237
|
selfSignature,
|
|
19238
19238
|
adaptorPubKey
|
|
@@ -19283,7 +19283,9 @@ var DefaultSparkSigner = class {
|
|
|
19283
19283
|
const nonce = getRandomSigningNonce();
|
|
19284
19284
|
const commitment = getSigningCommitmentFromNonce(nonce);
|
|
19285
19285
|
this.commitmentToNonceMap.set(commitment, nonce);
|
|
19286
|
-
return
|
|
19286
|
+
return {
|
|
19287
|
+
commitment
|
|
19288
|
+
};
|
|
19287
19289
|
}
|
|
19288
19290
|
async validateMessageWithIdentityKey(message, signature) {
|
|
19289
19291
|
if (!this.identityKey?.publicKey) {
|
|
@@ -19337,6 +19339,64 @@ var DefaultSparkSigner = class {
|
|
|
19337
19339
|
tx.signIdx(privateKey, index);
|
|
19338
19340
|
}
|
|
19339
19341
|
};
|
|
19342
|
+
var UnsafeStatelessSparkSigner = class extends DefaultSparkSigner {
|
|
19343
|
+
constructor({
|
|
19344
|
+
sparkKeysGenerator
|
|
19345
|
+
} = {}) {
|
|
19346
|
+
super({
|
|
19347
|
+
sparkKeysGenerator
|
|
19348
|
+
});
|
|
19349
|
+
}
|
|
19350
|
+
async getRandomSigningCommitment() {
|
|
19351
|
+
const nonce = getRandomSigningNonce();
|
|
19352
|
+
const commitment = getSigningCommitmentFromNonce(nonce);
|
|
19353
|
+
return {
|
|
19354
|
+
commitment,
|
|
19355
|
+
nonce
|
|
19356
|
+
};
|
|
19357
|
+
}
|
|
19358
|
+
async signFrost({
|
|
19359
|
+
message,
|
|
19360
|
+
keyDerivation,
|
|
19361
|
+
publicKey,
|
|
19362
|
+
verifyingKey,
|
|
19363
|
+
selfCommitment,
|
|
19364
|
+
statechainCommitments,
|
|
19365
|
+
adaptorPubKey
|
|
19366
|
+
}) {
|
|
19367
|
+
const SparkFrost = await getSparkFrostModule();
|
|
19368
|
+
if (!SparkFrost) {
|
|
19369
|
+
throw new ValidationError("SparkFrost module not found", {
|
|
19370
|
+
field: "SparkFrost"
|
|
19371
|
+
});
|
|
19372
|
+
}
|
|
19373
|
+
const signingPrivateKey = await this.getSigningPrivateKeyFromDerivation(keyDerivation);
|
|
19374
|
+
if (!signingPrivateKey) {
|
|
19375
|
+
throw new ValidationError("Private key not found for public key", {
|
|
19376
|
+
field: "privateKey"
|
|
19377
|
+
});
|
|
19378
|
+
}
|
|
19379
|
+
const { commitment, nonce } = selfCommitment;
|
|
19380
|
+
if (!nonce) {
|
|
19381
|
+
throw new ValidationError("Nonce not found for commitment", {
|
|
19382
|
+
field: "nonce"
|
|
19383
|
+
});
|
|
19384
|
+
}
|
|
19385
|
+
const keyPackage = {
|
|
19386
|
+
secretKey: signingPrivateKey,
|
|
19387
|
+
publicKey,
|
|
19388
|
+
verifyingKey
|
|
19389
|
+
};
|
|
19390
|
+
return SparkFrost.signFrost({
|
|
19391
|
+
message,
|
|
19392
|
+
keyPackage,
|
|
19393
|
+
nonce,
|
|
19394
|
+
selfCommitment: commitment,
|
|
19395
|
+
statechainCommitments,
|
|
19396
|
+
adaptorPubKey
|
|
19397
|
+
});
|
|
19398
|
+
}
|
|
19399
|
+
};
|
|
19340
19400
|
var TaprootSparkSigner = class extends DefaultSparkSigner {
|
|
19341
19401
|
constructor(useAddressIndex = false) {
|
|
19342
19402
|
super({
|
|
@@ -24068,6 +24128,13 @@ var DEFAULT_EXPIRY_TIME = 10 * 60 * 1e3;
|
|
|
24068
24128
|
function initialSequence() {
|
|
24069
24129
|
return 1 << 30 | INITIAL_TIME_LOCK;
|
|
24070
24130
|
}
|
|
24131
|
+
function getSigningJobProto(signingJob) {
|
|
24132
|
+
return {
|
|
24133
|
+
signingPublicKey: signingJob.signingPublicKey,
|
|
24134
|
+
rawTx: signingJob.rawTx,
|
|
24135
|
+
signingNonceCommitment: signingJob.signingNonceCommitment.commitment
|
|
24136
|
+
};
|
|
24137
|
+
}
|
|
24071
24138
|
var BaseTransferService = class {
|
|
24072
24139
|
config;
|
|
24073
24140
|
connectionManager;
|
|
@@ -24694,7 +24761,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
24694
24761
|
refundSigningData.keyDerivation
|
|
24695
24762
|
),
|
|
24696
24763
|
rawTx: refundTx.toBytes(),
|
|
24697
|
-
signingNonceCommitment: refundNonceCommitmentProto
|
|
24764
|
+
signingNonceCommitment: refundNonceCommitmentProto.commitment
|
|
24698
24765
|
},
|
|
24699
24766
|
// TODO: Add direct refund signature
|
|
24700
24767
|
directRefundTxSigningJob: void 0,
|
|
@@ -25006,7 +25073,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
25006
25073
|
const response = await sparkClient.refresh_timelock({
|
|
25007
25074
|
leafId: leaf.id,
|
|
25008
25075
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
25009
|
-
signingJobs
|
|
25076
|
+
signingJobs: signingJobs.map(getSigningJobProto)
|
|
25010
25077
|
});
|
|
25011
25078
|
if (signingJobs.length !== response.signingResults.length) {
|
|
25012
25079
|
throw Error(
|
|
@@ -25172,8 +25239,8 @@ var TransferService = class extends BaseTransferService {
|
|
|
25172
25239
|
const response = await sparkClient.extend_leaf({
|
|
25173
25240
|
leafId: node.id,
|
|
25174
25241
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
25175
|
-
nodeTxSigningJob: newNodeSigningJob,
|
|
25176
|
-
refundTxSigningJob: newRefundSigningJob
|
|
25242
|
+
nodeTxSigningJob: getSigningJobProto(newNodeSigningJob),
|
|
25243
|
+
refundTxSigningJob: getSigningJobProto(newRefundSigningJob)
|
|
25177
25244
|
});
|
|
25178
25245
|
if (!response.nodeTxSigningResult || !response.refundTxSigningResult) {
|
|
25179
25246
|
throw new Error("Signing result does not exist");
|
|
@@ -25281,7 +25348,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
25281
25348
|
const response = await sparkClient.refresh_timelock({
|
|
25282
25349
|
leafId: node.id,
|
|
25283
25350
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
25284
|
-
signingJobs: [refundSigningJob]
|
|
25351
|
+
signingJobs: [getSigningJobProto(refundSigningJob)]
|
|
25285
25352
|
});
|
|
25286
25353
|
if (response.signingResults.length !== 1) {
|
|
25287
25354
|
throw Error(
|
|
@@ -25433,7 +25500,7 @@ var CoopExitService = class extends BaseTransferService {
|
|
|
25433
25500
|
leaf.keyDerivation
|
|
25434
25501
|
),
|
|
25435
25502
|
rawTx: refundTx.toBytes(),
|
|
25436
|
-
signingNonceCommitment
|
|
25503
|
+
signingNonceCommitment: signingNonceCommitment.commitment
|
|
25437
25504
|
},
|
|
25438
25505
|
// TODO: Add direct refund signature
|
|
25439
25506
|
directRefundTxSigningJob: void 0,
|
|
@@ -25688,12 +25755,12 @@ var DepositService = class {
|
|
|
25688
25755
|
rootTxSigningJob: {
|
|
25689
25756
|
rawTx: rootTx.toBytes(),
|
|
25690
25757
|
signingPublicKey: signingPubKey,
|
|
25691
|
-
signingNonceCommitment: rootNonceCommitment
|
|
25758
|
+
signingNonceCommitment: rootNonceCommitment.commitment
|
|
25692
25759
|
},
|
|
25693
25760
|
refundTxSigningJob: {
|
|
25694
25761
|
rawTx: refundTx.toBytes(),
|
|
25695
25762
|
signingPublicKey: signingPubKey,
|
|
25696
|
-
signingNonceCommitment: refundNonceCommitment
|
|
25763
|
+
signingNonceCommitment: refundNonceCommitment.commitment
|
|
25697
25764
|
}
|
|
25698
25765
|
});
|
|
25699
25766
|
} catch (error) {
|
|
@@ -28765,7 +28832,7 @@ var TreeCreationService = class {
|
|
|
28765
28832
|
const signingJob = {
|
|
28766
28833
|
signingPublicKey: node.signingPublicKey,
|
|
28767
28834
|
rawTx: tx.toBytes(),
|
|
28768
|
-
signingNonceCommitment
|
|
28835
|
+
signingNonceCommitment: signingNonceCommitment.commitment
|
|
28769
28836
|
};
|
|
28770
28837
|
internalCreationNode.nodeTxSigningCommitment = signingNonceCommitment;
|
|
28771
28838
|
internalCreationNode.nodeTxSigningJob = signingJob;
|
|
@@ -28794,7 +28861,7 @@ var TreeCreationService = class {
|
|
|
28794
28861
|
const childSigningJob = {
|
|
28795
28862
|
signingPublicKey: node.signingPublicKey,
|
|
28796
28863
|
rawTx: childTx.toBytes(),
|
|
28797
|
-
signingNonceCommitment: childSigningNonceCommitment
|
|
28864
|
+
signingNonceCommitment: childSigningNonceCommitment.commitment
|
|
28798
28865
|
};
|
|
28799
28866
|
childCreationNode.nodeTxSigningCommitment = childSigningNonceCommitment;
|
|
28800
28867
|
childCreationNode.nodeTxSigningJob = childSigningJob;
|
|
@@ -28821,7 +28888,7 @@ var TreeCreationService = class {
|
|
|
28821
28888
|
const refundSigningJob = {
|
|
28822
28889
|
signingPublicKey: node.signingPublicKey,
|
|
28823
28890
|
rawTx: refundTx.toBytes(),
|
|
28824
|
-
signingNonceCommitment: refundSigningNonceCommitment
|
|
28891
|
+
signingNonceCommitment: refundSigningNonceCommitment.commitment
|
|
28825
28892
|
};
|
|
28826
28893
|
childCreationNode.refundTxSigningCommitment = refundSigningNonceCommitment;
|
|
28827
28894
|
childCreationNode.refundTxSigningJob = refundSigningJob;
|
|
@@ -28856,7 +28923,7 @@ var TreeCreationService = class {
|
|
|
28856
28923
|
const rootNodeSigningJob = {
|
|
28857
28924
|
signingPublicKey: root.signingPublicKey,
|
|
28858
28925
|
rawTx: rootNodeTx.toBytes(),
|
|
28859
|
-
signingNonceCommitment: rootNodeSigningCommitment
|
|
28926
|
+
signingNonceCommitment: rootNodeSigningCommitment.commitment
|
|
28860
28927
|
};
|
|
28861
28928
|
const rootCreationNode = {
|
|
28862
28929
|
nodeTxSigningJob: rootNodeSigningJob,
|
|
@@ -29089,7 +29156,7 @@ var SigningService = class {
|
|
|
29089
29156
|
leaf.keyDerivation
|
|
29090
29157
|
),
|
|
29091
29158
|
rawTx: refundTx.toBytes(),
|
|
29092
|
-
signingNonceCommitment: signingCommitment,
|
|
29159
|
+
signingNonceCommitment: signingCommitment.commitment,
|
|
29093
29160
|
userSignature: signingResult,
|
|
29094
29161
|
signingCommitments: {
|
|
29095
29162
|
signingCommitments: signingNonceCommitments
|
|
@@ -30537,7 +30604,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30537
30604
|
const signingJob = {
|
|
30538
30605
|
rawTx: tx.toBytes(),
|
|
30539
30606
|
signingPublicKey: await this.config.signer.getStaticDepositSigningKey(0),
|
|
30540
|
-
signingNonceCommitment
|
|
30607
|
+
signingNonceCommitment: signingNonceCommitment.commitment
|
|
30541
30608
|
};
|
|
30542
30609
|
const message = await this.getStaticDepositSigningPayload(
|
|
30543
30610
|
depositTransactionId,
|
|
@@ -32467,7 +32534,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32467
32534
|
init_buffer();
|
|
32468
32535
|
|
|
32469
32536
|
// src/index.node.ts
|
|
32470
|
-
var cryptoImpl2 = typeof global !== "undefined" && global.crypto ? global.crypto :
|
|
32537
|
+
var cryptoImpl2 = typeof global !== "undefined" && global.crypto ? global.crypto : import_crypto3.default;
|
|
32471
32538
|
setCrypto(cryptoImpl2);
|
|
32472
32539
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32473
32540
|
0 && (module.exports = {
|
|
@@ -32490,6 +32557,7 @@ setCrypto(cryptoImpl2);
|
|
|
32490
32557
|
TaprootOutputKeysGenerator,
|
|
32491
32558
|
TaprootSparkSigner,
|
|
32492
32559
|
TokenTransactionService,
|
|
32560
|
+
UnsafeStatelessSparkSigner,
|
|
32493
32561
|
ValidationError,
|
|
32494
32562
|
WalletConfig,
|
|
32495
32563
|
addPrivateKeys,
|
package/dist/index.node.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as WalletConfigService, s as ConnectionManager, T as TokenOutputsMap, B as Bech32mTokenIdentifier } from './spark-wallet-
|
|
2
|
-
export { a as Bech32mTokenIdentifierData, C as ConfigOptions, u as CreateLightningInvoiceParams, D as DecodedSparkAddressData, w as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, b as LRC_WALLET_NETWORK_TYPE, N as Network, c as NetworkToProto, d as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, S as SparkAddressData, e as SparkAddressFormat, o as SparkWallet, y as SparkWalletEvents, q as SparkWalletProps, r as TokenBalanceMap, x as TokenMetadataMap, v as TransferParams, U as UserTokenMetadata, t as WalletConfig, 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 } from './spark-wallet-
|
|
3
|
-
export { 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-
|
|
4
|
-
export {
|
|
1
|
+
import { W as WalletConfigService, s as ConnectionManager, T as TokenOutputsMap, B as Bech32mTokenIdentifier } from './spark-wallet-CHwKQYJu.cjs';
|
|
2
|
+
export { a as Bech32mTokenIdentifierData, C as ConfigOptions, u as CreateLightningInvoiceParams, D as DecodedSparkAddressData, w as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, b as LRC_WALLET_NETWORK_TYPE, N as Network, c as NetworkToProto, d as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, S as SparkAddressData, e as SparkAddressFormat, o as SparkWallet, y as SparkWalletEvents, q as SparkWalletProps, r as TokenBalanceMap, x as TokenMetadataMap, v as TransferParams, U as UserTokenMetadata, t as WalletConfig, 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 } from './spark-wallet-CHwKQYJu.cjs';
|
|
3
|
+
export { 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';
|
|
4
|
+
export { ag as AggregateFrostParams, a2 as DefaultSparkSigner, ai as DerivedHDKey, a6 as KeyDerivation, ae as KeyDerivationType, aj as KeyPair, af as SignFrostParams, a9 as SigningCommitment, a7 as SigningCommitmentWithOptionalNonce, a8 as SigningNonce, a1 as SparkSigner, ah as SplitSecretWithProofsParams, ab as TaprootOutputKeysGenerator, ac as TaprootSparkSigner, ad as UnsafeStatelessSparkSigner, 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';
|
|
5
5
|
export { TokenSigner } from '@buildonspark/lrc20-sdk';
|
|
6
6
|
export { MultisigReceiptInput } from '@buildonspark/lrc20-sdk/lrc/types';
|
|
7
7
|
import { j as OutputWithPreviousTransactionData, T as TokenTransaction, l as TokenTransactionWithStatus } from './spark-BUOx3U7Q.cjs';
|
package/dist/index.node.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as WalletConfigService, s as ConnectionManager, T as TokenOutputsMap, B as Bech32mTokenIdentifier } from './spark-wallet-
|
|
2
|
-
export { a as Bech32mTokenIdentifierData, C as ConfigOptions, u as CreateLightningInvoiceParams, D as DecodedSparkAddressData, w as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, b as LRC_WALLET_NETWORK_TYPE, N as Network, c as NetworkToProto, d as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, S as SparkAddressData, e as SparkAddressFormat, o as SparkWallet, y as SparkWalletEvents, q as SparkWalletProps, r as TokenBalanceMap, x as TokenMetadataMap, v as TransferParams, U as UserTokenMetadata, t as WalletConfig, 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 } from './spark-wallet-
|
|
3
|
-
export { 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-
|
|
4
|
-
export {
|
|
1
|
+
import { W as WalletConfigService, s as ConnectionManager, T as TokenOutputsMap, B as Bech32mTokenIdentifier } from './spark-wallet-B_96y9BS.js';
|
|
2
|
+
export { a as Bech32mTokenIdentifierData, C as ConfigOptions, u as CreateLightningInvoiceParams, D as DecodedSparkAddressData, w as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, b as LRC_WALLET_NETWORK_TYPE, N as Network, c as NetworkToProto, d as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, S as SparkAddressData, e as SparkAddressFormat, o as SparkWallet, y as SparkWalletEvents, q as SparkWalletProps, r as TokenBalanceMap, x as TokenMetadataMap, v as TransferParams, U as UserTokenMetadata, t as WalletConfig, 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 } from './spark-wallet-B_96y9BS.js';
|
|
3
|
+
export { 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';
|
|
4
|
+
export { ag as AggregateFrostParams, a2 as DefaultSparkSigner, ai as DerivedHDKey, a6 as KeyDerivation, ae as KeyDerivationType, aj as KeyPair, af as SignFrostParams, a9 as SigningCommitment, a7 as SigningCommitmentWithOptionalNonce, a8 as SigningNonce, a1 as SparkSigner, ah as SplitSecretWithProofsParams, ab as TaprootOutputKeysGenerator, ac as TaprootSparkSigner, ad as UnsafeStatelessSparkSigner, 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';
|
|
5
5
|
export { TokenSigner } from '@buildonspark/lrc20-sdk';
|
|
6
6
|
export { MultisigReceiptInput } from '@buildonspark/lrc20-sdk/lrc/types';
|
|
7
7
|
import { j as OutputWithPreviousTransactionData, T as TokenTransaction, l as TokenTransactionWithStatus } from './spark-BUOx3U7Q.js';
|