@buildonspark/spark-sdk 0.3.8 → 0.4.0
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 +18 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/uniffi/uniffi/spark_frost/spark_frost.kt +1361 -1367
- package/android/src/main/jniLibs/arm64-v8a/libuniffi_spark_frost.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libuniffi_spark_frost.so +0 -0
- package/android/src/main/jniLibs/x86/libuniffi_spark_frost.so +0 -0
- package/android/src/main/jniLibs/x86_64/libuniffi_spark_frost.so +0 -0
- package/dist/bare/index.cjs +1342 -1346
- package/dist/bare/index.d.cts +114 -68
- package/dist/bare/index.d.ts +114 -68
- package/dist/bare/index.js +1266 -1279
- package/dist/{chunk-FXIESWE6.js → chunk-27ILUWDJ.js} +1 -1
- package/dist/{chunk-5ASXVNTM.js → chunk-4YFT7DAE.js} +1 -1
- package/dist/{chunk-FP2CRVQH.js → chunk-G3LHXHF3.js} +1045 -1308
- package/dist/{chunk-XI6FCNYG.js → chunk-JLF6WJ7K.js} +1 -1
- package/dist/{chunk-3LPEQGVJ.js → chunk-LOXWCMZL.js} +1 -1
- package/dist/{chunk-5HU5W56H.js → chunk-WICAF6BS.js} +2 -2
- package/dist/{chunk-VFN34EOX.js → chunk-YEBEN7XD.js} +258 -0
- package/dist/{client-pNpGP15j.d.cts → client-BIqiUNy4.d.cts} +1 -1
- package/dist/{client-By-N7oJS.d.ts → client-BaQf-5gD.d.ts} +1 -1
- package/dist/debug.cjs +1330 -1336
- package/dist/debug.d.cts +20 -16
- package/dist/debug.d.ts +20 -16
- package/dist/debug.js +5 -5
- package/dist/graphql/objects/index.d.cts +3 -3
- package/dist/graphql/objects/index.d.ts +3 -3
- package/dist/index.cjs +1363 -1365
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +32 -24
- package/dist/index.node.cjs +1363 -1365
- package/dist/index.node.d.cts +7 -7
- package/dist/index.node.d.ts +7 -7
- package/dist/index.node.js +31 -23
- package/dist/{logging-DMFVY384.d.ts → logging-BNGm6dBp.d.ts} +42 -37
- package/dist/{logging-DxLp34Xm.d.cts → logging-D3IfXfHG.d.cts} +42 -37
- package/dist/native/index.react-native.cjs +1505 -1366
- package/dist/native/index.react-native.d.cts +112 -58
- package/dist/native/index.react-native.d.ts +112 -58
- package/dist/native/index.react-native.js +1415 -1289
- package/dist/proto/spark.cjs +258 -0
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +5 -1
- package/dist/proto/spark_token.d.cts +1 -1
- package/dist/proto/spark_token.d.ts +1 -1
- package/dist/proto/spark_token.js +2 -2
- package/dist/{spark-By6yHsrk.d.cts → spark-DOpheE8_.d.cts} +39 -2
- package/dist/{spark-By6yHsrk.d.ts → spark-DOpheE8_.d.ts} +39 -2
- package/dist/{spark-wallet.browser-C1dQknVj.d.ts → spark-wallet.browser-B2rGwjuM.d.ts} +2 -2
- package/dist/{spark-wallet.browser-CNMo3IvO.d.cts → spark-wallet.browser-Ck9No4Ks.d.cts} +2 -2
- package/dist/{spark-wallet.node-Og6__NMh.d.ts → spark-wallet.node-BqmKsGPs.d.ts} +2 -2
- package/dist/{spark-wallet.node-BZJhJZKq.d.cts → spark-wallet.node-C2TIkyt4.d.cts} +2 -2
- package/dist/tests/test-utils.cjs +1304 -1236
- package/dist/tests/test-utils.d.cts +18 -4
- package/dist/tests/test-utils.d.ts +18 -4
- package/dist/tests/test-utils.js +7 -7
- package/dist/{token-transactions-CLR3rnYi.d.cts → token-transactions-Db8mkjnU.d.cts} +2 -2
- package/dist/{token-transactions-C7yefB2S.d.ts → token-transactions-DoMcrxXQ.d.ts} +2 -2
- package/dist/types/index.cjs +256 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +2 -2
- package/dist/{wallet-config-BoyMVa6n.d.ts → wallet-config-Bg3kWltL.d.ts} +42 -35
- package/dist/{wallet-config-xom-9UFF.d.cts → wallet-config-CuZKNo9S.d.cts} +42 -35
- package/ios/spark_frostFFI.xcframework/ios-arm64/SparkFrost +0 -0
- package/ios/spark_frostFFI.xcframework/ios-arm64/spark_frostFFI.framework/spark_frostFFI +0 -0
- package/ios/spark_frostFFI.xcframework/ios-arm64_x86_64-simulator/SparkFrost +0 -0
- package/ios/spark_frostFFI.xcframework/ios-arm64_x86_64-simulator/spark_frostFFI.framework/spark_frostFFI +0 -0
- package/ios/spark_frostFFI.xcframework/macos-arm64_x86_64/spark_frostFFI.framework/spark_frostFFI +0 -0
- package/package.json +1 -1
- package/src/index.react-native.ts +8 -2
- package/src/proto/spark.ts +348 -4
- package/src/services/config.ts +5 -0
- package/src/services/coop-exit.ts +26 -107
- package/src/services/deposit.ts +12 -48
- package/src/services/signing.ts +62 -49
- package/src/services/transfer.ts +437 -722
- package/src/services/wallet-config.ts +10 -0
- package/src/services/xhr-transport.ts +13 -3
- package/src/signer/signer.react-native.ts +73 -1
- package/src/spark-wallet/proto-descriptors.ts +1 -1
- package/src/spark-wallet/spark-wallet.ts +162 -315
- package/src/spark-wallet/types.ts +2 -2
- package/src/spark_descriptors.pb +0 -0
- package/src/tests/integration/lightning.test.ts +1 -27
- package/src/tests/integration/static_deposit.test.ts +6 -9
- package/src/tests/integration/unilateral-exit.test.ts +117 -0
- package/src/tests/optimize.test.ts +31 -1
- package/src/tests/utils/signing.ts +33 -0
- package/src/tests/utils/test-faucet.ts +61 -0
- package/src/utils/optimize.ts +42 -0
- package/src/utils/transaction.ts +250 -249
- package/src/utils/unilateral-exit.ts +1 -40
package/dist/index.node.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { A as AuthenticationError, C as ConfigurationError, I as InternalValidationError, N as NetworkError, a as NotImplementedError, R as RPCError, S as SparkSDKError, T as TokenTransactionService, V as ValidationError } from './token-transactions-
|
|
2
|
-
export { C as BaseConnectionManager, B as Bech32mTokenIdentifier, w as Bech32mTokenIdentifierData, b as ConfigOptions, A as CreateLightningInvoiceParams, D as DecodedSparkAddressData, K as DepositParams, G as FulfillSparkInvoiceResponse, J as GroupSparkInvoicesResult, V as InitWalletResponse, I as InvalidInvoice, L as LegacySparkAddressFormat, N as Network, p as NetworkToProto, o as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, c as SparkAddressData, S as SparkAddressFormat, Y as SparkWalletEvent, Z as SparkWalletEventType, _ as SparkWalletEvents, X as SparkWalletProps, M as TokenBalanceMap, H as TokenInvoice, Q as TokenMetadataMap, O as TokenOutputsMap, T as TransferParams, F as TransferWithInvoiceOutcome, E as TransferWithInvoiceParams, U as UserTokenMetadata, a as WalletConfig, W as WalletConfigService, l as assertBech32, m as bech32mDecode, y as decodeBech32mTokenIdentifier, f as decodeSparkAddress, x as encodeBech32mTokenIdentifier, e as encodeSparkAddress, d as encodeSparkAddressWithSignature, r as getNetwork, s as getNetworkFromAddress, z as getNetworkFromBech32mTokenIdentifier, g as getNetworkFromSparkAddress, u as getNetworkFromString, i as isLegacySparkAddress, n as isSafeForNumber, j as isValidPublicKey, h as isValidSparkAddress, q as protoToNetwork, t as toProtoTimestamp, v as validateSparkInvoiceFields, k as validateSparkInvoiceSignature } from './wallet-config-
|
|
3
|
-
export {
|
|
4
|
-
export { A as AggregateFrostParams, D as DefaultSparkSigner, p as DerivedHDKey, l as KeyDerivation, K as KeyDerivationType, q as KeyPair, n as SignFrostParams, k as SigningCommitment, i as SigningCommitmentWithOptionalNonce, j as SigningNonce, S as SparkSigner, o as SplitSecretWithProofsParams, T as TaprootOutputKeysGenerator, a as TaprootSparkSigner, U as UnsafeStatelessSparkSigner, V as VerifiableSecretShare, h as bigIntToPrivateKey, c as computerLagrangeCoefficients, e as evaluatePolynomial, f as fieldDiv, b as generatePolynomialForSecretSharing, g as getRandomBigInt, m as modInverse, r as recoverSecret, s as splitSecret, d as splitSecretWithProofs, v as validateShare } from './client-
|
|
1
|
+
export { A as AuthenticationError, C as ConfigurationError, I as InternalValidationError, N as NetworkError, a as NotImplementedError, R as RPCError, S as SparkSDKError, T as TokenTransactionService, V as ValidationError } from './token-transactions-Db8mkjnU.cjs';
|
|
2
|
+
export { C as BaseConnectionManager, B as Bech32mTokenIdentifier, w as Bech32mTokenIdentifierData, b as ConfigOptions, A as CreateLightningInvoiceParams, D as DecodedSparkAddressData, K as DepositParams, G as FulfillSparkInvoiceResponse, J as GroupSparkInvoicesResult, V as InitWalletResponse, I as InvalidInvoice, L as LegacySparkAddressFormat, N as Network, p as NetworkToProto, o as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, c as SparkAddressData, S as SparkAddressFormat, Y as SparkWalletEvent, Z as SparkWalletEventType, _ as SparkWalletEvents, X as SparkWalletProps, M as TokenBalanceMap, H as TokenInvoice, Q as TokenMetadataMap, O as TokenOutputsMap, T as TransferParams, F as TransferWithInvoiceOutcome, E as TransferWithInvoiceParams, U as UserTokenMetadata, a as WalletConfig, W as WalletConfigService, l as assertBech32, m as bech32mDecode, y as decodeBech32mTokenIdentifier, f as decodeSparkAddress, x as encodeBech32mTokenIdentifier, e as encodeSparkAddress, d as encodeSparkAddressWithSignature, r as getNetwork, s as getNetworkFromAddress, z as getNetworkFromBech32mTokenIdentifier, g as getNetworkFromSparkAddress, u as getNetworkFromString, i as isLegacySparkAddress, n as isSafeForNumber, j as isValidPublicKey, h as isValidSparkAddress, q as protoToNetwork, t as toProtoTimestamp, v as validateSparkInvoiceFields, k as validateSparkInvoiceSignature } from './wallet-config-CuZKNo9S.cjs';
|
|
3
|
+
export { ah as BroadcastConfig, ai as BroadcastResult, R as DEFAULT_FEE_SATS, O as DIRECT_HTLC_TIMELOCK_OFFSET, M as DIRECT_TIMELOCK_OFFSET, af as FeeBumpTxChain, ae as FeeBumpTxPackage, ad as FeeRate, N as HTLC_TIMELOCK_OFFSET, P as INITIAL_SEQUENCE, ap as LOGGER_NAMES, ab as LeafInfo, aq as LoggerName, ar as SparkSdkLogger, Q as TEST_UNILATERAL_DIRECT_SEQUENCE, T as TEST_UNILATERAL_SEQUENCE, ag as TxChain, ac as Utxo, q as addPrivateKeys, o as addPublicKeys, b as applyAdaptorToSignature, p as applyAdditiveTweakToPublicKey, J as checkIfSelectedOutputsAreAvailable, a5 as checkIfValidSequence, z as collectResponses, c as computeTaprootKeyNoScript, an as constructFeeBumpTx, al as constructUnilateralExitFeeBumpPackages, ak as constructUnilateralExitTxs, a2 as createConnectorRefundTxs, a0 as createCurrentTimelockRefundTxs, X as createDecrementedTimelockNodeTx, $ as createDecrementedTimelockRefundTxs, W as createInitialTimelockNodeTx, _ as createInitialTimelockRefundTxs, U as createRootNodeTx, F as createSigningCommitment, B as createSigningNonce, a1 as createTestUnilateralRefundTxs, Y as createTestUnilateralTimelockNodeTx, V as createZeroTimelockNodeTx, H as decodeBytesToSigningCommitment, E as decodeBytesToSigningNonce, a8 as doesLeafNeedRefresh, a7 as doesTxnNeedRenewed, G as encodeSigningCommitmentToBytes, D as encodeSigningNonceToBytes, K as filterTokenBalanceForTokenIdentifier, a as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, a3 as getCurrentTimelock, aa as getEphemeralAnchorOutput, w as getLatestDepositTxId, Z as getNextHTLCTransactionSequence, a9 as getNextTransactionSequence, f as getP2TRAddressFromPkScript, e as getP2TRAddressFromPublicKey, d as getP2TRScriptFromPublicKey, h as getP2WPKHAddressFromPublicKey, A as getRandomSigningNonce, k as getSigHashFromTx, C as getSigningCommitmentFromNonce, ao as getSparkAddressFromTaproot, a4 as getTransactionSequence, L as getTransferPackageSigningPayload, n as getTxEstimatedVbytesSizeByNumberOfInputsOutputs, j as getTxFromRawTxBytes, i as getTxFromRawTxHex, l as getTxId, m as getTxIdNoReverse, am as hash160, aj as isEphemeralAnchorOutput, x as isTxBroadcast, a6 as isZeroTimelock, u as lastKeyWithTarget, S as maybeApplyFee, y as proofOfPossessionMessageHashForDepositAddress, r as subtractPrivateKeys, s as subtractPublicKeys, I as sumAvailableTokens, t as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from './logging-D3IfXfHG.cjs';
|
|
4
|
+
export { A as AggregateFrostParams, D as DefaultSparkSigner, p as DerivedHDKey, l as KeyDerivation, K as KeyDerivationType, q as KeyPair, n as SignFrostParams, k as SigningCommitment, i as SigningCommitmentWithOptionalNonce, j as SigningNonce, S as SparkSigner, o as SplitSecretWithProofsParams, T as TaprootOutputKeysGenerator, a as TaprootSparkSigner, U as UnsafeStatelessSparkSigner, V as VerifiableSecretShare, h as bigIntToPrivateKey, c as computerLagrangeCoefficients, e as evaluatePolynomial, f as fieldDiv, b as generatePolynomialForSecretSharing, g as getRandomBigInt, m as modInverse, r as recoverSecret, s as splitSecret, d as splitSecretWithProofs, v as validateShare } from './client-BIqiUNy4.cjs';
|
|
5
5
|
export { I as IKeyPackage } from './types-B3hMoTYO.cjs';
|
|
6
|
-
export { C as ConnectionManager, S as SparkWallet, i as initializeTracerEnv } from './spark-wallet.node-
|
|
7
|
-
import './spark-
|
|
6
|
+
export { C as ConnectionManager, S as SparkWallet, i as initializeTracerEnv } from './spark-wallet.node-C2TIkyt4.cjs';
|
|
7
|
+
import './spark-DOpheE8_.cjs';
|
|
8
8
|
import '@bufbuild/protobuf/wire';
|
|
9
9
|
import 'nice-grpc-common';
|
|
10
10
|
import './proto/spark_token.cjs';
|
|
@@ -13,8 +13,8 @@ import '@scure/base';
|
|
|
13
13
|
import 'nice-grpc';
|
|
14
14
|
import 'nice-grpc-web';
|
|
15
15
|
import 'nice-grpc-client-middleware-retry';
|
|
16
|
+
import '@scure/btc-signer/psbt';
|
|
16
17
|
import '@opentelemetry/sdk-trace-base';
|
|
17
18
|
import 'eventemitter3';
|
|
18
|
-
import '@scure/btc-signer/psbt';
|
|
19
19
|
import '@lightsparkdev/core';
|
|
20
20
|
import '@scure/bip32';
|
package/dist/index.node.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { A as AuthenticationError, C as ConfigurationError, I as InternalValidationError, N as NetworkError, a as NotImplementedError, R as RPCError, S as SparkSDKError, T as TokenTransactionService, V as ValidationError } from './token-transactions-
|
|
2
|
-
export { C as BaseConnectionManager, B as Bech32mTokenIdentifier, w as Bech32mTokenIdentifierData, b as ConfigOptions, A as CreateLightningInvoiceParams, D as DecodedSparkAddressData, K as DepositParams, G as FulfillSparkInvoiceResponse, J as GroupSparkInvoicesResult, V as InitWalletResponse, I as InvalidInvoice, L as LegacySparkAddressFormat, N as Network, p as NetworkToProto, o as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, c as SparkAddressData, S as SparkAddressFormat, Y as SparkWalletEvent, Z as SparkWalletEventType, _ as SparkWalletEvents, X as SparkWalletProps, M as TokenBalanceMap, H as TokenInvoice, Q as TokenMetadataMap, O as TokenOutputsMap, T as TransferParams, F as TransferWithInvoiceOutcome, E as TransferWithInvoiceParams, U as UserTokenMetadata, a as WalletConfig, W as WalletConfigService, l as assertBech32, m as bech32mDecode, y as decodeBech32mTokenIdentifier, f as decodeSparkAddress, x as encodeBech32mTokenIdentifier, e as encodeSparkAddress, d as encodeSparkAddressWithSignature, r as getNetwork, s as getNetworkFromAddress, z as getNetworkFromBech32mTokenIdentifier, g as getNetworkFromSparkAddress, u as getNetworkFromString, i as isLegacySparkAddress, n as isSafeForNumber, j as isValidPublicKey, h as isValidSparkAddress, q as protoToNetwork, t as toProtoTimestamp, v as validateSparkInvoiceFields, k as validateSparkInvoiceSignature } from './wallet-config-
|
|
3
|
-
export {
|
|
4
|
-
export { A as AggregateFrostParams, D as DefaultSparkSigner, p as DerivedHDKey, l as KeyDerivation, K as KeyDerivationType, q as KeyPair, n as SignFrostParams, k as SigningCommitment, i as SigningCommitmentWithOptionalNonce, j as SigningNonce, S as SparkSigner, o as SplitSecretWithProofsParams, T as TaprootOutputKeysGenerator, a as TaprootSparkSigner, U as UnsafeStatelessSparkSigner, V as VerifiableSecretShare, h as bigIntToPrivateKey, c as computerLagrangeCoefficients, e as evaluatePolynomial, f as fieldDiv, b as generatePolynomialForSecretSharing, g as getRandomBigInt, m as modInverse, r as recoverSecret, s as splitSecret, d as splitSecretWithProofs, v as validateShare } from './client-
|
|
1
|
+
export { A as AuthenticationError, C as ConfigurationError, I as InternalValidationError, N as NetworkError, a as NotImplementedError, R as RPCError, S as SparkSDKError, T as TokenTransactionService, V as ValidationError } from './token-transactions-DoMcrxXQ.js';
|
|
2
|
+
export { C as BaseConnectionManager, B as Bech32mTokenIdentifier, w as Bech32mTokenIdentifierData, b as ConfigOptions, A as CreateLightningInvoiceParams, D as DecodedSparkAddressData, K as DepositParams, G as FulfillSparkInvoiceResponse, J as GroupSparkInvoicesResult, V as InitWalletResponse, I as InvalidInvoice, L as LegacySparkAddressFormat, N as Network, p as NetworkToProto, o as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, c as SparkAddressData, S as SparkAddressFormat, Y as SparkWalletEvent, Z as SparkWalletEventType, _ as SparkWalletEvents, X as SparkWalletProps, M as TokenBalanceMap, H as TokenInvoice, Q as TokenMetadataMap, O as TokenOutputsMap, T as TransferParams, F as TransferWithInvoiceOutcome, E as TransferWithInvoiceParams, U as UserTokenMetadata, a as WalletConfig, W as WalletConfigService, l as assertBech32, m as bech32mDecode, y as decodeBech32mTokenIdentifier, f as decodeSparkAddress, x as encodeBech32mTokenIdentifier, e as encodeSparkAddress, d as encodeSparkAddressWithSignature, r as getNetwork, s as getNetworkFromAddress, z as getNetworkFromBech32mTokenIdentifier, g as getNetworkFromSparkAddress, u as getNetworkFromString, i as isLegacySparkAddress, n as isSafeForNumber, j as isValidPublicKey, h as isValidSparkAddress, q as protoToNetwork, t as toProtoTimestamp, v as validateSparkInvoiceFields, k as validateSparkInvoiceSignature } from './wallet-config-Bg3kWltL.js';
|
|
3
|
+
export { ah as BroadcastConfig, ai as BroadcastResult, R as DEFAULT_FEE_SATS, O as DIRECT_HTLC_TIMELOCK_OFFSET, M as DIRECT_TIMELOCK_OFFSET, af as FeeBumpTxChain, ae as FeeBumpTxPackage, ad as FeeRate, N as HTLC_TIMELOCK_OFFSET, P as INITIAL_SEQUENCE, ap as LOGGER_NAMES, ab as LeafInfo, aq as LoggerName, ar as SparkSdkLogger, Q as TEST_UNILATERAL_DIRECT_SEQUENCE, T as TEST_UNILATERAL_SEQUENCE, ag as TxChain, ac as Utxo, q as addPrivateKeys, o as addPublicKeys, b as applyAdaptorToSignature, p as applyAdditiveTweakToPublicKey, J as checkIfSelectedOutputsAreAvailable, a5 as checkIfValidSequence, z as collectResponses, c as computeTaprootKeyNoScript, an as constructFeeBumpTx, al as constructUnilateralExitFeeBumpPackages, ak as constructUnilateralExitTxs, a2 as createConnectorRefundTxs, a0 as createCurrentTimelockRefundTxs, X as createDecrementedTimelockNodeTx, $ as createDecrementedTimelockRefundTxs, W as createInitialTimelockNodeTx, _ as createInitialTimelockRefundTxs, U as createRootNodeTx, F as createSigningCommitment, B as createSigningNonce, a1 as createTestUnilateralRefundTxs, Y as createTestUnilateralTimelockNodeTx, V as createZeroTimelockNodeTx, H as decodeBytesToSigningCommitment, E as decodeBytesToSigningNonce, a8 as doesLeafNeedRefresh, a7 as doesTxnNeedRenewed, G as encodeSigningCommitmentToBytes, D as encodeSigningNonceToBytes, K as filterTokenBalanceForTokenIdentifier, a as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, a3 as getCurrentTimelock, aa as getEphemeralAnchorOutput, w as getLatestDepositTxId, Z as getNextHTLCTransactionSequence, a9 as getNextTransactionSequence, f as getP2TRAddressFromPkScript, e as getP2TRAddressFromPublicKey, d as getP2TRScriptFromPublicKey, h as getP2WPKHAddressFromPublicKey, A as getRandomSigningNonce, k as getSigHashFromTx, C as getSigningCommitmentFromNonce, ao as getSparkAddressFromTaproot, a4 as getTransactionSequence, L as getTransferPackageSigningPayload, n as getTxEstimatedVbytesSizeByNumberOfInputsOutputs, j as getTxFromRawTxBytes, i as getTxFromRawTxHex, l as getTxId, m as getTxIdNoReverse, am as hash160, aj as isEphemeralAnchorOutput, x as isTxBroadcast, a6 as isZeroTimelock, u as lastKeyWithTarget, S as maybeApplyFee, y as proofOfPossessionMessageHashForDepositAddress, r as subtractPrivateKeys, s as subtractPublicKeys, I as sumAvailableTokens, t as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from './logging-BNGm6dBp.js';
|
|
4
|
+
export { A as AggregateFrostParams, D as DefaultSparkSigner, p as DerivedHDKey, l as KeyDerivation, K as KeyDerivationType, q as KeyPair, n as SignFrostParams, k as SigningCommitment, i as SigningCommitmentWithOptionalNonce, j as SigningNonce, S as SparkSigner, o as SplitSecretWithProofsParams, T as TaprootOutputKeysGenerator, a as TaprootSparkSigner, U as UnsafeStatelessSparkSigner, V as VerifiableSecretShare, h as bigIntToPrivateKey, c as computerLagrangeCoefficients, e as evaluatePolynomial, f as fieldDiv, b as generatePolynomialForSecretSharing, g as getRandomBigInt, m as modInverse, r as recoverSecret, s as splitSecret, d as splitSecretWithProofs, v as validateShare } from './client-BaQf-5gD.js';
|
|
5
5
|
export { I as IKeyPackage } from './types-B3hMoTYO.js';
|
|
6
|
-
export { C as ConnectionManager, S as SparkWallet, i as initializeTracerEnv } from './spark-wallet.node-
|
|
7
|
-
import './spark-
|
|
6
|
+
export { C as ConnectionManager, S as SparkWallet, i as initializeTracerEnv } from './spark-wallet.node-BqmKsGPs.js';
|
|
7
|
+
import './spark-DOpheE8_.js';
|
|
8
8
|
import '@bufbuild/protobuf/wire';
|
|
9
9
|
import 'nice-grpc-common';
|
|
10
10
|
import './proto/spark_token.js';
|
|
@@ -13,8 +13,8 @@ import '@scure/base';
|
|
|
13
13
|
import 'nice-grpc';
|
|
14
14
|
import 'nice-grpc-web';
|
|
15
15
|
import 'nice-grpc-client-middleware-retry';
|
|
16
|
+
import '@scure/btc-signer/psbt';
|
|
16
17
|
import '@opentelemetry/sdk-trace-base';
|
|
17
18
|
import 'eventemitter3';
|
|
18
|
-
import '@scure/btc-signer/psbt';
|
|
19
19
|
import '@lightsparkdev/core';
|
|
20
20
|
import '@scure/bip32';
|
package/dist/index.node.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ConnectionManagerNodeJS,
|
|
3
3
|
SparkWalletNodeJS,
|
|
4
4
|
initializeTracerEnvNodeJS
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WICAF6BS.js";
|
|
6
6
|
import {
|
|
7
7
|
AuthenticationError,
|
|
8
8
|
ConfigurationError,
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
DIRECT_TIMELOCK_OFFSET,
|
|
12
12
|
DefaultSparkSigner,
|
|
13
13
|
HTLC_TIMELOCK_OFFSET,
|
|
14
|
-
INITIAL_DIRECT_SEQUENCE,
|
|
15
14
|
INITIAL_SEQUENCE,
|
|
16
15
|
InternalValidationError,
|
|
17
16
|
KeyDerivationType,
|
|
@@ -45,21 +44,24 @@ import {
|
|
|
45
44
|
constructFeeBumpTx,
|
|
46
45
|
constructUnilateralExitFeeBumpPackages,
|
|
47
46
|
constructUnilateralExitTxs,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
createConnectorRefundTxs,
|
|
48
|
+
createCurrentTimelockRefundTxs,
|
|
49
|
+
createDecrementedTimelockNodeTx,
|
|
50
|
+
createDecrementedTimelockRefundTxs,
|
|
51
|
+
createInitialTimelockNodeTx,
|
|
52
|
+
createInitialTimelockRefundTxs,
|
|
53
|
+
createRootNodeTx,
|
|
55
54
|
createSigningCommitment,
|
|
56
55
|
createSigningNonce,
|
|
57
|
-
|
|
56
|
+
createTestUnilateralRefundTxs,
|
|
57
|
+
createTestUnilateralTimelockNodeTx,
|
|
58
|
+
createZeroTimelockNodeTx,
|
|
58
59
|
decodeBech32mTokenIdentifier,
|
|
59
60
|
decodeBytesToSigningCommitment,
|
|
60
61
|
decodeBytesToSigningNonce,
|
|
61
62
|
decodeSparkAddress,
|
|
62
63
|
doesLeafNeedRefresh,
|
|
64
|
+
doesTxnNeedRenewed,
|
|
63
65
|
encodeBech32mTokenIdentifier,
|
|
64
66
|
encodeSigningCommitmentToBytes,
|
|
65
67
|
encodeSigningNonceToBytes,
|
|
@@ -97,12 +99,14 @@ import {
|
|
|
97
99
|
getTxFromRawTxHex,
|
|
98
100
|
getTxId,
|
|
99
101
|
getTxIdNoReverse,
|
|
102
|
+
hash160,
|
|
100
103
|
isEphemeralAnchorOutput,
|
|
101
104
|
isLegacySparkAddress,
|
|
102
105
|
isSafeForNumber,
|
|
103
106
|
isTxBroadcast,
|
|
104
107
|
isValidPublicKey,
|
|
105
108
|
isValidSparkAddress,
|
|
109
|
+
isZeroTimelock,
|
|
106
110
|
lastKeyWithTarget,
|
|
107
111
|
maybeApplyFee,
|
|
108
112
|
modInverse,
|
|
@@ -121,14 +125,14 @@ import {
|
|
|
121
125
|
validateShare,
|
|
122
126
|
validateSparkInvoiceFields,
|
|
123
127
|
validateSparkInvoiceSignature
|
|
124
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-G3LHXHF3.js";
|
|
125
129
|
import {
|
|
126
130
|
LOGGER_NAMES,
|
|
127
131
|
SparkSdkLogger
|
|
128
132
|
} from "./chunk-NX5KPN5F.js";
|
|
129
|
-
import "./chunk-
|
|
130
|
-
import "./chunk-
|
|
131
|
-
import "./chunk-
|
|
133
|
+
import "./chunk-JLF6WJ7K.js";
|
|
134
|
+
import "./chunk-4YFT7DAE.js";
|
|
135
|
+
import "./chunk-YEBEN7XD.js";
|
|
132
136
|
import "./chunk-CQY5ML2A.js";
|
|
133
137
|
import "./chunk-MVRQ5US7.js";
|
|
134
138
|
|
|
@@ -145,7 +149,6 @@ export {
|
|
|
145
149
|
DIRECT_TIMELOCK_OFFSET,
|
|
146
150
|
DefaultSparkSigner,
|
|
147
151
|
HTLC_TIMELOCK_OFFSET,
|
|
148
|
-
INITIAL_DIRECT_SEQUENCE,
|
|
149
152
|
INITIAL_SEQUENCE,
|
|
150
153
|
InternalValidationError,
|
|
151
154
|
KeyDerivationType,
|
|
@@ -182,21 +185,24 @@ export {
|
|
|
182
185
|
constructFeeBumpTx,
|
|
183
186
|
constructUnilateralExitFeeBumpPackages,
|
|
184
187
|
constructUnilateralExitTxs,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
createConnectorRefundTxs,
|
|
189
|
+
createCurrentTimelockRefundTxs,
|
|
190
|
+
createDecrementedTimelockNodeTx,
|
|
191
|
+
createDecrementedTimelockRefundTxs,
|
|
192
|
+
createInitialTimelockNodeTx,
|
|
193
|
+
createInitialTimelockRefundTxs,
|
|
194
|
+
createRootNodeTx,
|
|
192
195
|
createSigningCommitment,
|
|
193
196
|
createSigningNonce,
|
|
194
|
-
|
|
197
|
+
createTestUnilateralRefundTxs,
|
|
198
|
+
createTestUnilateralTimelockNodeTx,
|
|
199
|
+
createZeroTimelockNodeTx,
|
|
195
200
|
decodeBech32mTokenIdentifier,
|
|
196
201
|
decodeBytesToSigningCommitment,
|
|
197
202
|
decodeBytesToSigningNonce,
|
|
198
203
|
decodeSparkAddress,
|
|
199
204
|
doesLeafNeedRefresh,
|
|
205
|
+
doesTxnNeedRenewed,
|
|
200
206
|
encodeBech32mTokenIdentifier,
|
|
201
207
|
encodeSigningCommitmentToBytes,
|
|
202
208
|
encodeSigningNonceToBytes,
|
|
@@ -234,6 +240,7 @@ export {
|
|
|
234
240
|
getTxFromRawTxHex,
|
|
235
241
|
getTxId,
|
|
236
242
|
getTxIdNoReverse,
|
|
243
|
+
hash160,
|
|
237
244
|
initializeTracerEnvNodeJS as initializeTracerEnv,
|
|
238
245
|
isEphemeralAnchorOutput,
|
|
239
246
|
isLegacySparkAddress,
|
|
@@ -241,6 +248,7 @@ export {
|
|
|
241
248
|
isTxBroadcast,
|
|
242
249
|
isValidPublicKey,
|
|
243
250
|
isValidSparkAddress,
|
|
251
|
+
isZeroTimelock,
|
|
244
252
|
lastKeyWithTarget,
|
|
245
253
|
maybeApplyFee,
|
|
246
254
|
modInverse,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as btc from '@scure/btc-signer';
|
|
2
2
|
import { Transaction } from '@scure/btc-signer';
|
|
3
3
|
import { TransactionOutput, TransactionInput } from '@scure/btc-signer/psbt';
|
|
4
|
-
import { N as Network, O as TokenOutputsMap, B as Bech32mTokenIdentifier, M as TokenBalanceMap, S as SparkAddressFormat } from './wallet-config-
|
|
5
|
-
import { j as SigningNonce, k as SigningCommitment } from './client-
|
|
6
|
-
import { O as OutputWithPreviousTransactionData, j as TransferPackage, f as SparkServiceClient } from './spark-
|
|
4
|
+
import { N as Network, O as TokenOutputsMap, B as Bech32mTokenIdentifier, M as TokenBalanceMap, S as SparkAddressFormat } from './wallet-config-Bg3kWltL.js';
|
|
5
|
+
import { j as SigningNonce, k as SigningCommitment } from './client-BaQf-5gD.js';
|
|
6
|
+
import { O as OutputWithPreviousTransactionData, j as TransferPackage, f as SparkServiceClient } from './spark-DOpheE8_.js';
|
|
7
7
|
import { Logger, LoggingLevel } from '@lightsparkdev/core';
|
|
8
8
|
|
|
9
9
|
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
@@ -68,7 +68,6 @@ declare const DIRECT_TIMELOCK_OFFSET = 50;
|
|
|
68
68
|
declare const HTLC_TIMELOCK_OFFSET = 70;
|
|
69
69
|
declare const DIRECT_HTLC_TIMELOCK_OFFSET = 85;
|
|
70
70
|
declare const INITIAL_SEQUENCE: number;
|
|
71
|
-
declare const INITIAL_DIRECT_SEQUENCE: number;
|
|
72
71
|
declare const TEST_UNILATERAL_SEQUENCE: number;
|
|
73
72
|
declare const TEST_UNILATERAL_DIRECT_SEQUENCE: number;
|
|
74
73
|
declare const DEFAULT_FEE_SATS: number;
|
|
@@ -77,55 +76,60 @@ declare const DEFAULT_FEE_SATS: number;
|
|
|
77
76
|
* Returns the original amount if it's less than or equal to the fee.
|
|
78
77
|
*/
|
|
79
78
|
declare function maybeApplyFee(amount: bigint): bigint;
|
|
80
|
-
declare function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
declare function
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
declare function createRootNodeTx(parentTx: Transaction, vout: number): {
|
|
80
|
+
nodeTx: Transaction;
|
|
81
|
+
directNodeTx: Transaction;
|
|
82
|
+
};
|
|
83
|
+
declare function createZeroTimelockNodeTx(parentTx: Transaction): {
|
|
84
|
+
nodeTx: Transaction;
|
|
85
|
+
directNodeTx: Transaction;
|
|
86
|
+
};
|
|
87
|
+
declare function createInitialTimelockNodeTx(parentTx: Transaction): {
|
|
88
|
+
nodeTx: Transaction;
|
|
89
|
+
directNodeTx: Transaction;
|
|
90
|
+
};
|
|
91
|
+
declare function createDecrementedTimelockNodeTx(parentTx: Transaction, currentTx: Transaction): {
|
|
92
|
+
nodeTx: Transaction;
|
|
93
|
+
directNodeTx: Transaction;
|
|
94
|
+
};
|
|
95
|
+
declare function createTestUnilateralTimelockNodeTx(parentTx: Transaction, nodeTx: Transaction): {
|
|
96
|
+
nodeTx: Transaction;
|
|
97
|
+
directNodeTx: Transaction;
|
|
92
98
|
};
|
|
93
|
-
declare function createLeafNodeTx(sequence: number, directSequence: number, parentOutPoint: TransactionInput, txOut: TransactionOutput, shouldCalculateFee: boolean): [Transaction, Transaction];
|
|
94
|
-
interface CreateRefundTxInput {
|
|
95
|
-
sequence: number;
|
|
96
|
-
input: TransactionInput;
|
|
97
|
-
amountSats: bigint;
|
|
98
|
-
receivingPubkey: Uint8Array;
|
|
99
|
-
network: Network;
|
|
100
|
-
shouldCalculateFee: boolean;
|
|
101
|
-
includeAnchor: boolean;
|
|
102
|
-
}
|
|
103
|
-
declare function createRefundTx({ sequence, input, amountSats, receivingPubkey, network, shouldCalculateFee, includeAnchor, }: CreateRefundTxInput): Transaction;
|
|
104
99
|
declare function getNextHTLCTransactionSequence(currSequence: number, isNodeTx?: boolean): {
|
|
105
100
|
nextSequence: number;
|
|
106
101
|
nextDirectSequence: number;
|
|
107
102
|
};
|
|
108
|
-
interface
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
input: TransactionInput;
|
|
112
|
-
directInput?: TransactionInput;
|
|
113
|
-
amountSats: bigint;
|
|
103
|
+
interface RefundTxParams {
|
|
104
|
+
nodeTx: Transaction;
|
|
105
|
+
directNodeTx?: Transaction;
|
|
114
106
|
receivingPubkey: Uint8Array;
|
|
115
107
|
network: Network;
|
|
116
108
|
}
|
|
117
|
-
|
|
109
|
+
interface RefundTxWithSequenceParams extends RefundTxParams {
|
|
110
|
+
sequence: number;
|
|
111
|
+
}
|
|
112
|
+
interface RefundTxWithSequenceAndConnectorOutputParams extends RefundTxWithSequenceParams {
|
|
113
|
+
connectorOutput: TransactionInput;
|
|
114
|
+
}
|
|
115
|
+
interface RefundTxs {
|
|
118
116
|
cpfpRefundTx: Transaction;
|
|
119
117
|
directRefundTx?: Transaction;
|
|
120
118
|
directFromCpfpRefundTx?: Transaction;
|
|
121
|
-
}
|
|
122
|
-
declare function
|
|
119
|
+
}
|
|
120
|
+
declare function createInitialTimelockRefundTxs(params: RefundTxParams): RefundTxs;
|
|
121
|
+
declare function createDecrementedTimelockRefundTxs(params: RefundTxWithSequenceParams): RefundTxs;
|
|
122
|
+
declare function createCurrentTimelockRefundTxs(params: RefundTxWithSequenceParams): RefundTxs;
|
|
123
|
+
declare function createTestUnilateralRefundTxs(params: RefundTxParams): RefundTxs;
|
|
124
|
+
declare function createConnectorRefundTxs(params: RefundTxWithSequenceAndConnectorOutputParams): RefundTxs;
|
|
123
125
|
declare function getCurrentTimelock(currSequence?: number): number;
|
|
124
126
|
declare function getTransactionSequence(currSequence?: number): {
|
|
125
127
|
nextSequence: number;
|
|
126
128
|
nextDirectSequence: number;
|
|
127
129
|
};
|
|
128
130
|
declare function checkIfValidSequence(currSequence?: number): void;
|
|
131
|
+
declare function isZeroTimelock(currSequence: number): boolean;
|
|
132
|
+
declare function doesTxnNeedRenewed(currSequence: number): boolean;
|
|
129
133
|
declare function doesLeafNeedRefresh(currSequence: number, isNodeTx?: boolean): boolean;
|
|
130
134
|
declare function getNextTransactionSequence(currSequence: number, isNodeTx?: boolean): {
|
|
131
135
|
nextSequence: number;
|
|
@@ -176,6 +180,7 @@ interface BroadcastResult {
|
|
|
176
180
|
declare function isEphemeralAnchorOutput(script?: Uint8Array, amount?: bigint): boolean;
|
|
177
181
|
declare function constructUnilateralExitTxs(nodeHexStrings: string[], sparkClient?: SparkServiceClient, network?: any): Promise<TxChain[]>;
|
|
178
182
|
declare function constructUnilateralExitFeeBumpPackages(nodeHexStrings: string[], utxos: Utxo[], feeRate: FeeRate, electrsUrl: string, sparkClient?: SparkServiceClient, network?: any): Promise<FeeBumpTxChain[]>;
|
|
183
|
+
declare function hash160(data: Uint8Array): Uint8Array;
|
|
179
184
|
declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRate, previousFeeBumpTx?: string): {
|
|
180
185
|
feeBumpPsbt: string;
|
|
181
186
|
usedUtxos: Utxo[];
|
|
@@ -197,4 +202,4 @@ declare class SparkSdkLogger {
|
|
|
197
202
|
static setAllEnabled(enabled: boolean): void;
|
|
198
203
|
}
|
|
199
204
|
|
|
200
|
-
export {
|
|
205
|
+
export { createDecrementedTimelockRefundTxs as $, getRandomSigningNonce as A, createSigningNonce as B, getSigningCommitmentFromNonce as C, encodeSigningNonceToBytes as D, decodeBytesToSigningNonce as E, createSigningCommitment as F, encodeSigningCommitmentToBytes as G, decodeBytesToSigningCommitment as H, sumAvailableTokens as I, checkIfSelectedOutputsAreAvailable as J, filterTokenBalanceForTokenIdentifier as K, getTransferPackageSigningPayload as L, DIRECT_TIMELOCK_OFFSET as M, HTLC_TIMELOCK_OFFSET as N, DIRECT_HTLC_TIMELOCK_OFFSET as O, INITIAL_SEQUENCE as P, TEST_UNILATERAL_DIRECT_SEQUENCE as Q, DEFAULT_FEE_SATS as R, maybeApplyFee as S, TEST_UNILATERAL_SEQUENCE as T, createRootNodeTx as U, createZeroTimelockNodeTx as V, createInitialTimelockNodeTx as W, createDecrementedTimelockNodeTx as X, createTestUnilateralTimelockNodeTx as Y, getNextHTLCTransactionSequence as Z, createInitialTimelockRefundTxs as _, generateAdaptorFromSignature as a, createCurrentTimelockRefundTxs as a0, createTestUnilateralRefundTxs as a1, createConnectorRefundTxs as a2, getCurrentTimelock as a3, getTransactionSequence as a4, checkIfValidSequence as a5, isZeroTimelock as a6, doesTxnNeedRenewed as a7, doesLeafNeedRefresh as a8, getNextTransactionSequence as a9, getEphemeralAnchorOutput as aa, type LeafInfo as ab, type Utxo as ac, type FeeRate as ad, type FeeBumpTxPackage as ae, type FeeBumpTxChain as af, type TxChain as ag, type BroadcastConfig as ah, type BroadcastResult as ai, isEphemeralAnchorOutput as aj, constructUnilateralExitTxs as ak, constructUnilateralExitFeeBumpPackages as al, hash160 as am, constructFeeBumpTx as an, getSparkAddressFromTaproot as ao, LOGGER_NAMES as ap, type LoggerName as aq, SparkSdkLogger as ar, applyAdaptorToSignature as b, computeTaprootKeyNoScript as c, getP2TRScriptFromPublicKey as d, getP2TRAddressFromPublicKey as e, getP2TRAddressFromPkScript as f, generateSignatureFromExistingAdaptor as g, getP2WPKHAddressFromPublicKey as h, getTxFromRawTxHex as i, getTxFromRawTxBytes as j, getSigHashFromTx as k, getTxId as l, getTxIdNoReverse as m, getTxEstimatedVbytesSizeByNumberOfInputsOutputs as n, addPublicKeys as o, applyAdditiveTweakToPublicKey as p, addPrivateKeys as q, subtractPrivateKeys as r, subtractPublicKeys as s, sumOfPrivateKeys as t, lastKeyWithTarget as u, validateOutboundAdaptorSignature as v, getLatestDepositTxId as w, isTxBroadcast as x, proofOfPossessionMessageHashForDepositAddress as y, collectResponses as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as btc from '@scure/btc-signer';
|
|
2
2
|
import { Transaction } from '@scure/btc-signer';
|
|
3
3
|
import { TransactionOutput, TransactionInput } from '@scure/btc-signer/psbt';
|
|
4
|
-
import { N as Network, O as TokenOutputsMap, B as Bech32mTokenIdentifier, M as TokenBalanceMap, S as SparkAddressFormat } from './wallet-config-
|
|
5
|
-
import { j as SigningNonce, k as SigningCommitment } from './client-
|
|
6
|
-
import { O as OutputWithPreviousTransactionData, j as TransferPackage, f as SparkServiceClient } from './spark-
|
|
4
|
+
import { N as Network, O as TokenOutputsMap, B as Bech32mTokenIdentifier, M as TokenBalanceMap, S as SparkAddressFormat } from './wallet-config-CuZKNo9S.cjs';
|
|
5
|
+
import { j as SigningNonce, k as SigningCommitment } from './client-BIqiUNy4.cjs';
|
|
6
|
+
import { O as OutputWithPreviousTransactionData, j as TransferPackage, f as SparkServiceClient } from './spark-DOpheE8_.cjs';
|
|
7
7
|
import { Logger, LoggingLevel } from '@lightsparkdev/core';
|
|
8
8
|
|
|
9
9
|
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
@@ -68,7 +68,6 @@ declare const DIRECT_TIMELOCK_OFFSET = 50;
|
|
|
68
68
|
declare const HTLC_TIMELOCK_OFFSET = 70;
|
|
69
69
|
declare const DIRECT_HTLC_TIMELOCK_OFFSET = 85;
|
|
70
70
|
declare const INITIAL_SEQUENCE: number;
|
|
71
|
-
declare const INITIAL_DIRECT_SEQUENCE: number;
|
|
72
71
|
declare const TEST_UNILATERAL_SEQUENCE: number;
|
|
73
72
|
declare const TEST_UNILATERAL_DIRECT_SEQUENCE: number;
|
|
74
73
|
declare const DEFAULT_FEE_SATS: number;
|
|
@@ -77,55 +76,60 @@ declare const DEFAULT_FEE_SATS: number;
|
|
|
77
76
|
* Returns the original amount if it's less than or equal to the fee.
|
|
78
77
|
*/
|
|
79
78
|
declare function maybeApplyFee(amount: bigint): bigint;
|
|
80
|
-
declare function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
declare function
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
declare function createRootNodeTx(parentTx: Transaction, vout: number): {
|
|
80
|
+
nodeTx: Transaction;
|
|
81
|
+
directNodeTx: Transaction;
|
|
82
|
+
};
|
|
83
|
+
declare function createZeroTimelockNodeTx(parentTx: Transaction): {
|
|
84
|
+
nodeTx: Transaction;
|
|
85
|
+
directNodeTx: Transaction;
|
|
86
|
+
};
|
|
87
|
+
declare function createInitialTimelockNodeTx(parentTx: Transaction): {
|
|
88
|
+
nodeTx: Transaction;
|
|
89
|
+
directNodeTx: Transaction;
|
|
90
|
+
};
|
|
91
|
+
declare function createDecrementedTimelockNodeTx(parentTx: Transaction, currentTx: Transaction): {
|
|
92
|
+
nodeTx: Transaction;
|
|
93
|
+
directNodeTx: Transaction;
|
|
94
|
+
};
|
|
95
|
+
declare function createTestUnilateralTimelockNodeTx(parentTx: Transaction, nodeTx: Transaction): {
|
|
96
|
+
nodeTx: Transaction;
|
|
97
|
+
directNodeTx: Transaction;
|
|
92
98
|
};
|
|
93
|
-
declare function createLeafNodeTx(sequence: number, directSequence: number, parentOutPoint: TransactionInput, txOut: TransactionOutput, shouldCalculateFee: boolean): [Transaction, Transaction];
|
|
94
|
-
interface CreateRefundTxInput {
|
|
95
|
-
sequence: number;
|
|
96
|
-
input: TransactionInput;
|
|
97
|
-
amountSats: bigint;
|
|
98
|
-
receivingPubkey: Uint8Array;
|
|
99
|
-
network: Network;
|
|
100
|
-
shouldCalculateFee: boolean;
|
|
101
|
-
includeAnchor: boolean;
|
|
102
|
-
}
|
|
103
|
-
declare function createRefundTx({ sequence, input, amountSats, receivingPubkey, network, shouldCalculateFee, includeAnchor, }: CreateRefundTxInput): Transaction;
|
|
104
99
|
declare function getNextHTLCTransactionSequence(currSequence: number, isNodeTx?: boolean): {
|
|
105
100
|
nextSequence: number;
|
|
106
101
|
nextDirectSequence: number;
|
|
107
102
|
};
|
|
108
|
-
interface
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
input: TransactionInput;
|
|
112
|
-
directInput?: TransactionInput;
|
|
113
|
-
amountSats: bigint;
|
|
103
|
+
interface RefundTxParams {
|
|
104
|
+
nodeTx: Transaction;
|
|
105
|
+
directNodeTx?: Transaction;
|
|
114
106
|
receivingPubkey: Uint8Array;
|
|
115
107
|
network: Network;
|
|
116
108
|
}
|
|
117
|
-
|
|
109
|
+
interface RefundTxWithSequenceParams extends RefundTxParams {
|
|
110
|
+
sequence: number;
|
|
111
|
+
}
|
|
112
|
+
interface RefundTxWithSequenceAndConnectorOutputParams extends RefundTxWithSequenceParams {
|
|
113
|
+
connectorOutput: TransactionInput;
|
|
114
|
+
}
|
|
115
|
+
interface RefundTxs {
|
|
118
116
|
cpfpRefundTx: Transaction;
|
|
119
117
|
directRefundTx?: Transaction;
|
|
120
118
|
directFromCpfpRefundTx?: Transaction;
|
|
121
|
-
}
|
|
122
|
-
declare function
|
|
119
|
+
}
|
|
120
|
+
declare function createInitialTimelockRefundTxs(params: RefundTxParams): RefundTxs;
|
|
121
|
+
declare function createDecrementedTimelockRefundTxs(params: RefundTxWithSequenceParams): RefundTxs;
|
|
122
|
+
declare function createCurrentTimelockRefundTxs(params: RefundTxWithSequenceParams): RefundTxs;
|
|
123
|
+
declare function createTestUnilateralRefundTxs(params: RefundTxParams): RefundTxs;
|
|
124
|
+
declare function createConnectorRefundTxs(params: RefundTxWithSequenceAndConnectorOutputParams): RefundTxs;
|
|
123
125
|
declare function getCurrentTimelock(currSequence?: number): number;
|
|
124
126
|
declare function getTransactionSequence(currSequence?: number): {
|
|
125
127
|
nextSequence: number;
|
|
126
128
|
nextDirectSequence: number;
|
|
127
129
|
};
|
|
128
130
|
declare function checkIfValidSequence(currSequence?: number): void;
|
|
131
|
+
declare function isZeroTimelock(currSequence: number): boolean;
|
|
132
|
+
declare function doesTxnNeedRenewed(currSequence: number): boolean;
|
|
129
133
|
declare function doesLeafNeedRefresh(currSequence: number, isNodeTx?: boolean): boolean;
|
|
130
134
|
declare function getNextTransactionSequence(currSequence: number, isNodeTx?: boolean): {
|
|
131
135
|
nextSequence: number;
|
|
@@ -176,6 +180,7 @@ interface BroadcastResult {
|
|
|
176
180
|
declare function isEphemeralAnchorOutput(script?: Uint8Array, amount?: bigint): boolean;
|
|
177
181
|
declare function constructUnilateralExitTxs(nodeHexStrings: string[], sparkClient?: SparkServiceClient, network?: any): Promise<TxChain[]>;
|
|
178
182
|
declare function constructUnilateralExitFeeBumpPackages(nodeHexStrings: string[], utxos: Utxo[], feeRate: FeeRate, electrsUrl: string, sparkClient?: SparkServiceClient, network?: any): Promise<FeeBumpTxChain[]>;
|
|
183
|
+
declare function hash160(data: Uint8Array): Uint8Array;
|
|
179
184
|
declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRate, previousFeeBumpTx?: string): {
|
|
180
185
|
feeBumpPsbt: string;
|
|
181
186
|
usedUtxos: Utxo[];
|
|
@@ -197,4 +202,4 @@ declare class SparkSdkLogger {
|
|
|
197
202
|
static setAllEnabled(enabled: boolean): void;
|
|
198
203
|
}
|
|
199
204
|
|
|
200
|
-
export {
|
|
205
|
+
export { createDecrementedTimelockRefundTxs as $, getRandomSigningNonce as A, createSigningNonce as B, getSigningCommitmentFromNonce as C, encodeSigningNonceToBytes as D, decodeBytesToSigningNonce as E, createSigningCommitment as F, encodeSigningCommitmentToBytes as G, decodeBytesToSigningCommitment as H, sumAvailableTokens as I, checkIfSelectedOutputsAreAvailable as J, filterTokenBalanceForTokenIdentifier as K, getTransferPackageSigningPayload as L, DIRECT_TIMELOCK_OFFSET as M, HTLC_TIMELOCK_OFFSET as N, DIRECT_HTLC_TIMELOCK_OFFSET as O, INITIAL_SEQUENCE as P, TEST_UNILATERAL_DIRECT_SEQUENCE as Q, DEFAULT_FEE_SATS as R, maybeApplyFee as S, TEST_UNILATERAL_SEQUENCE as T, createRootNodeTx as U, createZeroTimelockNodeTx as V, createInitialTimelockNodeTx as W, createDecrementedTimelockNodeTx as X, createTestUnilateralTimelockNodeTx as Y, getNextHTLCTransactionSequence as Z, createInitialTimelockRefundTxs as _, generateAdaptorFromSignature as a, createCurrentTimelockRefundTxs as a0, createTestUnilateralRefundTxs as a1, createConnectorRefundTxs as a2, getCurrentTimelock as a3, getTransactionSequence as a4, checkIfValidSequence as a5, isZeroTimelock as a6, doesTxnNeedRenewed as a7, doesLeafNeedRefresh as a8, getNextTransactionSequence as a9, getEphemeralAnchorOutput as aa, type LeafInfo as ab, type Utxo as ac, type FeeRate as ad, type FeeBumpTxPackage as ae, type FeeBumpTxChain as af, type TxChain as ag, type BroadcastConfig as ah, type BroadcastResult as ai, isEphemeralAnchorOutput as aj, constructUnilateralExitTxs as ak, constructUnilateralExitFeeBumpPackages as al, hash160 as am, constructFeeBumpTx as an, getSparkAddressFromTaproot as ao, LOGGER_NAMES as ap, type LoggerName as aq, SparkSdkLogger as ar, applyAdaptorToSignature as b, computeTaprootKeyNoScript as c, getP2TRScriptFromPublicKey as d, getP2TRAddressFromPublicKey as e, getP2TRAddressFromPkScript as f, generateSignatureFromExistingAdaptor as g, getP2WPKHAddressFromPublicKey as h, getTxFromRawTxHex as i, getTxFromRawTxBytes as j, getSigHashFromTx as k, getTxId as l, getTxIdNoReverse as m, getTxEstimatedVbytesSizeByNumberOfInputsOutputs as n, addPublicKeys as o, applyAdditiveTweakToPublicKey as p, addPrivateKeys as q, subtractPrivateKeys as r, subtractPublicKeys as s, sumOfPrivateKeys as t, lastKeyWithTarget as u, validateOutboundAdaptorSignature as v, getLatestDepositTxId as w, isTxBroadcast as x, proofOfPossessionMessageHashForDepositAddress as y, collectResponses as z };
|