@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.
Files changed (94) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/uniffi/uniffi/spark_frost/spark_frost.kt +1361 -1367
  4. package/android/src/main/jniLibs/arm64-v8a/libuniffi_spark_frost.so +0 -0
  5. package/android/src/main/jniLibs/armeabi-v7a/libuniffi_spark_frost.so +0 -0
  6. package/android/src/main/jniLibs/x86/libuniffi_spark_frost.so +0 -0
  7. package/android/src/main/jniLibs/x86_64/libuniffi_spark_frost.so +0 -0
  8. package/dist/bare/index.cjs +1342 -1346
  9. package/dist/bare/index.d.cts +114 -68
  10. package/dist/bare/index.d.ts +114 -68
  11. package/dist/bare/index.js +1266 -1279
  12. package/dist/{chunk-FXIESWE6.js → chunk-27ILUWDJ.js} +1 -1
  13. package/dist/{chunk-5ASXVNTM.js → chunk-4YFT7DAE.js} +1 -1
  14. package/dist/{chunk-FP2CRVQH.js → chunk-G3LHXHF3.js} +1045 -1308
  15. package/dist/{chunk-XI6FCNYG.js → chunk-JLF6WJ7K.js} +1 -1
  16. package/dist/{chunk-3LPEQGVJ.js → chunk-LOXWCMZL.js} +1 -1
  17. package/dist/{chunk-5HU5W56H.js → chunk-WICAF6BS.js} +2 -2
  18. package/dist/{chunk-VFN34EOX.js → chunk-YEBEN7XD.js} +258 -0
  19. package/dist/{client-pNpGP15j.d.cts → client-BIqiUNy4.d.cts} +1 -1
  20. package/dist/{client-By-N7oJS.d.ts → client-BaQf-5gD.d.ts} +1 -1
  21. package/dist/debug.cjs +1330 -1336
  22. package/dist/debug.d.cts +20 -16
  23. package/dist/debug.d.ts +20 -16
  24. package/dist/debug.js +5 -5
  25. package/dist/graphql/objects/index.d.cts +3 -3
  26. package/dist/graphql/objects/index.d.ts +3 -3
  27. package/dist/index.cjs +1363 -1365
  28. package/dist/index.d.cts +7 -7
  29. package/dist/index.d.ts +7 -7
  30. package/dist/index.js +32 -24
  31. package/dist/index.node.cjs +1363 -1365
  32. package/dist/index.node.d.cts +7 -7
  33. package/dist/index.node.d.ts +7 -7
  34. package/dist/index.node.js +31 -23
  35. package/dist/{logging-DMFVY384.d.ts → logging-BNGm6dBp.d.ts} +42 -37
  36. package/dist/{logging-DxLp34Xm.d.cts → logging-D3IfXfHG.d.cts} +42 -37
  37. package/dist/native/index.react-native.cjs +1505 -1366
  38. package/dist/native/index.react-native.d.cts +112 -58
  39. package/dist/native/index.react-native.d.ts +112 -58
  40. package/dist/native/index.react-native.js +1415 -1289
  41. package/dist/proto/spark.cjs +258 -0
  42. package/dist/proto/spark.d.cts +1 -1
  43. package/dist/proto/spark.d.ts +1 -1
  44. package/dist/proto/spark.js +5 -1
  45. package/dist/proto/spark_token.d.cts +1 -1
  46. package/dist/proto/spark_token.d.ts +1 -1
  47. package/dist/proto/spark_token.js +2 -2
  48. package/dist/{spark-By6yHsrk.d.cts → spark-DOpheE8_.d.cts} +39 -2
  49. package/dist/{spark-By6yHsrk.d.ts → spark-DOpheE8_.d.ts} +39 -2
  50. package/dist/{spark-wallet.browser-C1dQknVj.d.ts → spark-wallet.browser-B2rGwjuM.d.ts} +2 -2
  51. package/dist/{spark-wallet.browser-CNMo3IvO.d.cts → spark-wallet.browser-Ck9No4Ks.d.cts} +2 -2
  52. package/dist/{spark-wallet.node-Og6__NMh.d.ts → spark-wallet.node-BqmKsGPs.d.ts} +2 -2
  53. package/dist/{spark-wallet.node-BZJhJZKq.d.cts → spark-wallet.node-C2TIkyt4.d.cts} +2 -2
  54. package/dist/tests/test-utils.cjs +1304 -1236
  55. package/dist/tests/test-utils.d.cts +18 -4
  56. package/dist/tests/test-utils.d.ts +18 -4
  57. package/dist/tests/test-utils.js +7 -7
  58. package/dist/{token-transactions-CLR3rnYi.d.cts → token-transactions-Db8mkjnU.d.cts} +2 -2
  59. package/dist/{token-transactions-C7yefB2S.d.ts → token-transactions-DoMcrxXQ.d.ts} +2 -2
  60. package/dist/types/index.cjs +256 -0
  61. package/dist/types/index.d.cts +2 -2
  62. package/dist/types/index.d.ts +2 -2
  63. package/dist/types/index.js +2 -2
  64. package/dist/{wallet-config-BoyMVa6n.d.ts → wallet-config-Bg3kWltL.d.ts} +42 -35
  65. package/dist/{wallet-config-xom-9UFF.d.cts → wallet-config-CuZKNo9S.d.cts} +42 -35
  66. package/ios/spark_frostFFI.xcframework/ios-arm64/SparkFrost +0 -0
  67. package/ios/spark_frostFFI.xcframework/ios-arm64/spark_frostFFI.framework/spark_frostFFI +0 -0
  68. package/ios/spark_frostFFI.xcframework/ios-arm64_x86_64-simulator/SparkFrost +0 -0
  69. package/ios/spark_frostFFI.xcframework/ios-arm64_x86_64-simulator/spark_frostFFI.framework/spark_frostFFI +0 -0
  70. package/ios/spark_frostFFI.xcframework/macos-arm64_x86_64/spark_frostFFI.framework/spark_frostFFI +0 -0
  71. package/package.json +1 -1
  72. package/src/index.react-native.ts +8 -2
  73. package/src/proto/spark.ts +348 -4
  74. package/src/services/config.ts +5 -0
  75. package/src/services/coop-exit.ts +26 -107
  76. package/src/services/deposit.ts +12 -48
  77. package/src/services/signing.ts +62 -49
  78. package/src/services/transfer.ts +437 -722
  79. package/src/services/wallet-config.ts +10 -0
  80. package/src/services/xhr-transport.ts +13 -3
  81. package/src/signer/signer.react-native.ts +73 -1
  82. package/src/spark-wallet/proto-descriptors.ts +1 -1
  83. package/src/spark-wallet/spark-wallet.ts +162 -315
  84. package/src/spark-wallet/types.ts +2 -2
  85. package/src/spark_descriptors.pb +0 -0
  86. package/src/tests/integration/lightning.test.ts +1 -27
  87. package/src/tests/integration/static_deposit.test.ts +6 -9
  88. package/src/tests/integration/unilateral-exit.test.ts +117 -0
  89. package/src/tests/optimize.test.ts +31 -1
  90. package/src/tests/utils/signing.ts +33 -0
  91. package/src/tests/utils/test-faucet.ts +61 -0
  92. package/src/utils/optimize.ts +42 -0
  93. package/src/utils/transaction.ts +250 -249
  94. package/src/utils/unilateral-exit.ts +1 -40
@@ -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-CLR3rnYi.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-xom-9UFF.cjs';
3
- export { ae as BroadcastConfig, af as BroadcastResult, S as DEFAULT_FEE_SATS, O as DIRECT_HTLC_TIMELOCK_OFFSET, M as DIRECT_TIMELOCK_OFFSET, ac as FeeBumpTxChain, ab as FeeBumpTxPackage, aa as FeeRate, N as HTLC_TIMELOCK_OFFSET, Q as INITIAL_DIRECT_SEQUENCE, P as INITIAL_SEQUENCE, al as LOGGER_NAMES, a8 as LeafInfo, am as LoggerName, an as SparkSdkLogger, R as TEST_UNILATERAL_DIRECT_SEQUENCE, T as TEST_UNILATERAL_SEQUENCE, ad as TxChain, a9 as Utxo, q as addPrivateKeys, o as addPublicKeys, b as applyAdaptorToSignature, p as applyAdditiveTweakToPublicKey, J as checkIfSelectedOutputsAreAvailable, a4 as checkIfValidSequence, z as collectResponses, c as computeTaprootKeyNoScript, aj as constructFeeBumpTx, ai as constructUnilateralExitFeeBumpPackages, ah as constructUnilateralExitTxs, a1 as createConnectorRefundTransactions, Z as createLeafNodeTx, X as createNodeTx, Y as createNodeTxs, _ as createRefundTx, a0 as createRefundTxs, V as createRootTx, F as createSigningCommitment, B as createSigningNonce, W as createSplitTx, H as decodeBytesToSigningCommitment, E as decodeBytesToSigningNonce, a5 as doesLeafNeedRefresh, G as encodeSigningCommitmentToBytes, D as encodeSigningNonceToBytes, K as filterTokenBalanceForTokenIdentifier, a as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, a2 as getCurrentTimelock, a7 as getEphemeralAnchorOutput, w as getLatestDepositTxId, $ as getNextHTLCTransactionSequence, a6 as getNextTransactionSequence, f as getP2TRAddressFromPkScript, e as getP2TRAddressFromPublicKey, d as getP2TRScriptFromPublicKey, h as getP2WPKHAddressFromPublicKey, A as getRandomSigningNonce, k as getSigHashFromTx, C as getSigningCommitmentFromNonce, ak as getSparkAddressFromTaproot, a3 as getTransactionSequence, L as getTransferPackageSigningPayload, n as getTxEstimatedVbytesSizeByNumberOfInputsOutputs, j as getTxFromRawTxBytes, i as getTxFromRawTxHex, l as getTxId, m as getTxIdNoReverse, ag as isEphemeralAnchorOutput, x as isTxBroadcast, u as lastKeyWithTarget, U as maybeApplyFee, y as proofOfPossessionMessageHashForDepositAddress, r as subtractPrivateKeys, s as subtractPublicKeys, I as sumAvailableTokens, t as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from './logging-DxLp34Xm.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-pNpGP15j.cjs';
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-BZJhJZKq.cjs';
7
- import './spark-By6yHsrk.cjs';
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';
@@ -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-C7yefB2S.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-BoyMVa6n.js';
3
- export { ae as BroadcastConfig, af as BroadcastResult, S as DEFAULT_FEE_SATS, O as DIRECT_HTLC_TIMELOCK_OFFSET, M as DIRECT_TIMELOCK_OFFSET, ac as FeeBumpTxChain, ab as FeeBumpTxPackage, aa as FeeRate, N as HTLC_TIMELOCK_OFFSET, Q as INITIAL_DIRECT_SEQUENCE, P as INITIAL_SEQUENCE, al as LOGGER_NAMES, a8 as LeafInfo, am as LoggerName, an as SparkSdkLogger, R as TEST_UNILATERAL_DIRECT_SEQUENCE, T as TEST_UNILATERAL_SEQUENCE, ad as TxChain, a9 as Utxo, q as addPrivateKeys, o as addPublicKeys, b as applyAdaptorToSignature, p as applyAdditiveTweakToPublicKey, J as checkIfSelectedOutputsAreAvailable, a4 as checkIfValidSequence, z as collectResponses, c as computeTaprootKeyNoScript, aj as constructFeeBumpTx, ai as constructUnilateralExitFeeBumpPackages, ah as constructUnilateralExitTxs, a1 as createConnectorRefundTransactions, Z as createLeafNodeTx, X as createNodeTx, Y as createNodeTxs, _ as createRefundTx, a0 as createRefundTxs, V as createRootTx, F as createSigningCommitment, B as createSigningNonce, W as createSplitTx, H as decodeBytesToSigningCommitment, E as decodeBytesToSigningNonce, a5 as doesLeafNeedRefresh, G as encodeSigningCommitmentToBytes, D as encodeSigningNonceToBytes, K as filterTokenBalanceForTokenIdentifier, a as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, a2 as getCurrentTimelock, a7 as getEphemeralAnchorOutput, w as getLatestDepositTxId, $ as getNextHTLCTransactionSequence, a6 as getNextTransactionSequence, f as getP2TRAddressFromPkScript, e as getP2TRAddressFromPublicKey, d as getP2TRScriptFromPublicKey, h as getP2WPKHAddressFromPublicKey, A as getRandomSigningNonce, k as getSigHashFromTx, C as getSigningCommitmentFromNonce, ak as getSparkAddressFromTaproot, a3 as getTransactionSequence, L as getTransferPackageSigningPayload, n as getTxEstimatedVbytesSizeByNumberOfInputsOutputs, j as getTxFromRawTxBytes, i as getTxFromRawTxHex, l as getTxId, m as getTxIdNoReverse, ag as isEphemeralAnchorOutput, x as isTxBroadcast, u as lastKeyWithTarget, U as maybeApplyFee, y as proofOfPossessionMessageHashForDepositAddress, r as subtractPrivateKeys, s as subtractPublicKeys, I as sumAvailableTokens, t as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from './logging-DMFVY384.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-By-N7oJS.js';
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-Og6__NMh.js';
7
- import './spark-By6yHsrk.js';
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';
@@ -2,7 +2,7 @@ import {
2
2
  ConnectionManagerNodeJS,
3
3
  SparkWalletNodeJS,
4
4
  initializeTracerEnvNodeJS
5
- } from "./chunk-5HU5W56H.js";
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
- createConnectorRefundTransactions,
49
- createLeafNodeTx,
50
- createNodeTx,
51
- createNodeTxs,
52
- createRefundTx,
53
- createRefundTxs,
54
- createRootTx,
47
+ createConnectorRefundTxs,
48
+ createCurrentTimelockRefundTxs,
49
+ createDecrementedTimelockNodeTx,
50
+ createDecrementedTimelockRefundTxs,
51
+ createInitialTimelockNodeTx,
52
+ createInitialTimelockRefundTxs,
53
+ createRootNodeTx,
55
54
  createSigningCommitment,
56
55
  createSigningNonce,
57
- createSplitTx,
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-FP2CRVQH.js";
128
+ } from "./chunk-G3LHXHF3.js";
125
129
  import {
126
130
  LOGGER_NAMES,
127
131
  SparkSdkLogger
128
132
  } from "./chunk-NX5KPN5F.js";
129
- import "./chunk-XI6FCNYG.js";
130
- import "./chunk-5ASXVNTM.js";
131
- import "./chunk-VFN34EOX.js";
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
- createConnectorRefundTransactions,
186
- createLeafNodeTx,
187
- createNodeTx,
188
- createNodeTxs,
189
- createRefundTx,
190
- createRefundTxs,
191
- createRootTx,
188
+ createConnectorRefundTxs,
189
+ createCurrentTimelockRefundTxs,
190
+ createDecrementedTimelockNodeTx,
191
+ createDecrementedTimelockRefundTxs,
192
+ createInitialTimelockNodeTx,
193
+ createInitialTimelockRefundTxs,
194
+ createRootNodeTx,
192
195
  createSigningCommitment,
193
196
  createSigningNonce,
194
- createSplitTx,
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-BoyMVa6n.js';
5
- import { j as SigningNonce, k as SigningCommitment } from './client-By-N7oJS.js';
6
- import { O as OutputWithPreviousTransactionData, j as TransferPackage, f as SparkServiceClient } from './spark-By6yHsrk.js';
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 createRootTx(depositOutPoint: TransactionInput, depositTxOut: TransactionOutput): [Transaction, Transaction];
81
- declare function createSplitTx(parentOutPoint: TransactionInput, childTxOuts: TransactionOutput[]): [Transaction, Transaction];
82
- interface CreateNodeTxInput {
83
- txOut: TransactionOutput;
84
- parentOutPoint: TransactionInput;
85
- applyFee?: boolean;
86
- includeAnchor?: boolean;
87
- }
88
- declare function createNodeTx({ txOut, parentOutPoint, applyFee, includeAnchor, }: CreateNodeTxInput): Transaction;
89
- declare function createNodeTxs(txOut: TransactionOutput, txIn: TransactionInput, directTxIn?: TransactionInput): {
90
- cpfpNodeTx: Transaction;
91
- directNodeTx?: Transaction;
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 CreateRefundTxsInput {
109
- sequence: number;
110
- directSequence?: number;
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
- declare function createRefundTxs({ sequence, directSequence, input, directInput, amountSats, receivingPubkey, network, }: CreateRefundTxsInput): {
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 createConnectorRefundTransactions(sequence: number, cpfpNodeOutPoint: TransactionInput, directNodeOutPoint: TransactionInput, connectorOutput: TransactionInput, amountSats: bigint, receiverPubKey: Uint8Array, network: Network, shouldCalculateFee: boolean): [Transaction, Transaction, Transaction];
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 { getNextHTLCTransactionSequence 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, INITIAL_DIRECT_SEQUENCE as Q, TEST_UNILATERAL_DIRECT_SEQUENCE as R, DEFAULT_FEE_SATS as S, TEST_UNILATERAL_SEQUENCE as T, maybeApplyFee as U, createRootTx as V, createSplitTx as W, createNodeTx as X, createNodeTxs as Y, createLeafNodeTx as Z, createRefundTx as _, generateAdaptorFromSignature as a, createRefundTxs as a0, createConnectorRefundTransactions as a1, getCurrentTimelock as a2, getTransactionSequence as a3, checkIfValidSequence as a4, doesLeafNeedRefresh as a5, getNextTransactionSequence as a6, getEphemeralAnchorOutput as a7, type LeafInfo as a8, type Utxo as a9, type FeeRate as aa, type FeeBumpTxPackage as ab, type FeeBumpTxChain as ac, type TxChain as ad, type BroadcastConfig as ae, type BroadcastResult as af, isEphemeralAnchorOutput as ag, constructUnilateralExitTxs as ah, constructUnilateralExitFeeBumpPackages as ai, constructFeeBumpTx as aj, getSparkAddressFromTaproot as ak, LOGGER_NAMES as al, type LoggerName as am, SparkSdkLogger as an, 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 };
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-xom-9UFF.cjs';
5
- import { j as SigningNonce, k as SigningCommitment } from './client-pNpGP15j.cjs';
6
- import { O as OutputWithPreviousTransactionData, j as TransferPackage, f as SparkServiceClient } from './spark-By6yHsrk.cjs';
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 createRootTx(depositOutPoint: TransactionInput, depositTxOut: TransactionOutput): [Transaction, Transaction];
81
- declare function createSplitTx(parentOutPoint: TransactionInput, childTxOuts: TransactionOutput[]): [Transaction, Transaction];
82
- interface CreateNodeTxInput {
83
- txOut: TransactionOutput;
84
- parentOutPoint: TransactionInput;
85
- applyFee?: boolean;
86
- includeAnchor?: boolean;
87
- }
88
- declare function createNodeTx({ txOut, parentOutPoint, applyFee, includeAnchor, }: CreateNodeTxInput): Transaction;
89
- declare function createNodeTxs(txOut: TransactionOutput, txIn: TransactionInput, directTxIn?: TransactionInput): {
90
- cpfpNodeTx: Transaction;
91
- directNodeTx?: Transaction;
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 CreateRefundTxsInput {
109
- sequence: number;
110
- directSequence?: number;
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
- declare function createRefundTxs({ sequence, directSequence, input, directInput, amountSats, receivingPubkey, network, }: CreateRefundTxsInput): {
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 createConnectorRefundTransactions(sequence: number, cpfpNodeOutPoint: TransactionInput, directNodeOutPoint: TransactionInput, connectorOutput: TransactionInput, amountSats: bigint, receiverPubKey: Uint8Array, network: Network, shouldCalculateFee: boolean): [Transaction, Transaction, Transaction];
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 { getNextHTLCTransactionSequence 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, INITIAL_DIRECT_SEQUENCE as Q, TEST_UNILATERAL_DIRECT_SEQUENCE as R, DEFAULT_FEE_SATS as S, TEST_UNILATERAL_SEQUENCE as T, maybeApplyFee as U, createRootTx as V, createSplitTx as W, createNodeTx as X, createNodeTxs as Y, createLeafNodeTx as Z, createRefundTx as _, generateAdaptorFromSignature as a, createRefundTxs as a0, createConnectorRefundTransactions as a1, getCurrentTimelock as a2, getTransactionSequence as a3, checkIfValidSequence as a4, doesLeafNeedRefresh as a5, getNextTransactionSequence as a6, getEphemeralAnchorOutput as a7, type LeafInfo as a8, type Utxo as a9, type FeeRate as aa, type FeeBumpTxPackage as ab, type FeeBumpTxChain as ac, type TxChain as ad, type BroadcastConfig as ae, type BroadcastResult as af, isEphemeralAnchorOutput as ag, constructUnilateralExitTxs as ah, constructUnilateralExitFeeBumpPackages as ai, constructFeeBumpTx as aj, getSparkAddressFromTaproot as ak, LOGGER_NAMES as al, type LoggerName as am, SparkSdkLogger as an, 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 };
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 };