@buildonspark/spark-sdk 0.2.4 → 0.2.5

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 (60) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{chunk-3SEOTO43.js → chunk-3SPMJMUX.js} +3 -2
  3. package/dist/{chunk-WAQKYSDI.js → chunk-CQY5ML2A.js} +3 -2
  4. package/dist/{chunk-TVUMSHWA.js → chunk-LQZL2D3Y.js} +1 -1
  5. package/dist/{chunk-W4ZRBSWM.js → chunk-U7LRIWTF.js} +174 -45
  6. package/dist/{client-KhNkrXz4.d.cts → client-C88GCTPB.d.cts} +199 -104
  7. package/dist/{client-BF4cn8F4.d.ts → client-Dg6vS_2I.d.ts} +199 -104
  8. package/dist/debug.cjs +231 -71
  9. package/dist/debug.d.cts +6 -6
  10. package/dist/debug.d.ts +6 -6
  11. package/dist/debug.js +3 -3
  12. package/dist/graphql/objects/index.d.cts +6 -51
  13. package/dist/graphql/objects/index.d.ts +6 -51
  14. package/dist/graphql/objects/index.js +1 -1
  15. package/dist/index.cjs +208 -45
  16. package/dist/index.d.cts +5 -6
  17. package/dist/index.d.ts +5 -6
  18. package/dist/index.js +6 -4
  19. package/dist/index.node.cjs +208 -45
  20. package/dist/index.node.d.cts +5 -6
  21. package/dist/index.node.d.ts +5 -6
  22. package/dist/index.node.js +5 -3
  23. package/dist/native/index.cjs +208 -45
  24. package/dist/native/index.d.cts +217 -147
  25. package/dist/native/index.d.ts +217 -147
  26. package/dist/native/index.js +209 -45
  27. package/dist/proto/lrc20.d.cts +1 -1
  28. package/dist/proto/lrc20.d.ts +1 -1
  29. package/dist/proto/spark.d.cts +1 -1
  30. package/dist/proto/spark.d.ts +1 -1
  31. package/dist/proto/spark_token.d.cts +1 -1
  32. package/dist/proto/spark_token.d.ts +1 -1
  33. package/dist/{spark-B_7nZx6T.d.cts → spark-ESAfZARg.d.cts} +1 -1
  34. package/dist/{spark-B_7nZx6T.d.ts → spark-ESAfZARg.d.ts} +1 -1
  35. package/dist/{spark-wallet-C1Tr_VKI.d.ts → spark-wallet-B2WwKN8W.d.ts} +27 -11
  36. package/dist/{spark-wallet-DG3x2obf.d.cts → spark-wallet-Di65w0Us.d.cts} +27 -11
  37. package/dist/{spark-wallet.node-CN9LoB_O.d.cts → spark-wallet.node-7R0Rxyj9.d.cts} +1 -1
  38. package/dist/{spark-wallet.node-CGxoeCpH.d.ts → spark-wallet.node-CSPWOWRu.d.ts} +1 -1
  39. package/dist/tests/test-utils.cjs +9 -5
  40. package/dist/tests/test-utils.d.cts +4 -5
  41. package/dist/tests/test-utils.d.ts +4 -5
  42. package/dist/tests/test-utils.js +4 -4
  43. package/dist/types/index.cjs +3 -2
  44. package/dist/types/index.d.cts +3 -4
  45. package/dist/types/index.d.ts +3 -4
  46. package/dist/types/index.js +2 -2
  47. package/dist/{xchain-address-BHu6CpZC.d.ts → xchain-address-BsveIy5l.d.ts} +5 -4
  48. package/dist/{xchain-address-HBr6isnc.d.cts → xchain-address-CqRu3F21.d.cts} +5 -4
  49. package/package.json +1 -1
  50. package/src/graphql/client.ts +49 -8
  51. package/src/graphql/objects/SparkWalletUser.ts +1 -1
  52. package/src/graphql/queries/Transfers.ts +15 -0
  53. package/src/spark-wallet/spark-wallet.ts +156 -39
  54. package/src/tests/integration/ssp/static_deposit.test.ts +83 -1
  55. package/src/tests/integration/ssp/transfers.test.ts +97 -0
  56. package/src/types/sdk-types.ts +15 -0
  57. package/src/utils/bitcoin.ts +13 -0
  58. package/dist/sdk-types-CB9HrW5O.d.cts +0 -44
  59. package/dist/sdk-types-CkRNraXT.d.ts +0 -44
  60. package/src/graphql/queries/Transfer.ts +0 -10
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { W as WalletConfigService, C as ConnectionManager, u as TokenOutputsMap, B as Bech32mTokenIdentifier } from './spark-wallet-C1Tr_VKI.js';
2
- export { n as Bech32mTokenIdentifierData, b as ConfigOptions, r as CreateLightningInvoiceParams, D as DecodedSparkAddressData, s as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, k as LRC_WALLET_NETWORK_TYPE, N as Network, h as NetworkToProto, g as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, c as SparkAddressData, S as SparkAddressFormat, y as SparkWallet, x as SparkWalletEvents, w as SparkWalletProps, t as TokenBalanceMap, v as TokenMetadataMap, T as TransferParams, U as UserTokenMetadata, a as WalletConfig, q as decodeBech32mTokenIdentifier, d as decodeSparkAddress, o as encodeBech32mTokenIdentifier, e as encodeSparkAddress, j as getNetwork, l as getNetworkFromAddress, m as getNetworkFromString, f as isValidPublicKey, i as isValidSparkAddress, p as protoToNetwork } from './spark-wallet-C1Tr_VKI.js';
3
- export { aa as BroadcastConfig, ab as BroadcastResult, P as DEFAULT_FEE_SATS, L as DIRECT_TIMELOCK_OFFSET, a8 as FeeBumpTxChain, a7 as FeeBumpTxPackage, a6 as FeeRate, N as INITIAL_DIRECT_SEQUENCE, M as INITIAL_SEQUENCE, a4 as LeafInfo, O as TEST_UNILATERAL_DIRECT_SEQUENCE, T as TEST_UNILATERAL_SEQUENCE, a9 as TxChain, a5 as Utxo, p as addPrivateKeys, n as addPublicKeys, b as applyAdaptorToSignature, o as applyAdditiveTweakToPublicKey, I as checkIfSelectedOutputsAreAvailable, a0 as checkIfValidSequence, y as collectResponses, c as computeTaprootKeyNoScript, af as constructFeeBumpTx, ae as constructUnilateralExitFeeBumpPackages, ad as constructUnilateralExitTxs, Z as createConnectorRefundTransactions, W as createLeafNodeTx, U as createNodeTx, V as createNodeTxs, X as createRefundTx, Y as createRefundTxs, R as createRootTx, E as createSigningCommitment, A as createSigningNonce, S as createSplitTx, G as decodeBytesToSigningCommitment, D as decodeBytesToSigningNonce, a1 as doesLeafNeedRefresh, F as encodeSigningCommitmentToBytes, C as encodeSigningNonceToBytes, J as filterTokenBalanceForTokenPublicKey, a as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, _ as getCurrentTimelock, a3 as getEphemeralAnchorOutput, u as getLatestDepositTxId, a2 as getNextTransactionSequence, f as getP2TRAddressFromPkScript, e as getP2TRAddressFromPublicKey, d as getP2TRScriptFromPublicKey, h as getP2WPKHAddressFromPublicKey, z as getRandomSigningNonce, k as getSigHashFromTx, B as getSigningCommitmentFromNonce, ag as getSparkAddressFromTaproot, $ as getTransactionSequence, K as getTransferPackageSigningPayload, j as getTxFromRawTxBytes, i as getTxFromRawTxHex, l as getTxId, m as getTxIdNoReverse, ac as isEphemeralAnchorOutput, w as isTxBroadcast, t as lastKeyWithTarget, Q as maybeApplyFee, x as proofOfPossessionMessageHashForDepositAddress, q as subtractPrivateKeys, s as subtractPublicKeys, H as sumAvailableTokens, r as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from './xchain-address-BHu6CpZC.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-BF4cn8F4.js';
5
- import { j as OutputWithPreviousTransactionData, T as TokenTransaction, l as TokenTransactionWithStatus } from './spark-B_7nZx6T.js';
1
+ import { W as WalletConfigService, C as ConnectionManager, u as TokenOutputsMap, B as Bech32mTokenIdentifier } from './spark-wallet-B2WwKN8W.js';
2
+ export { n as Bech32mTokenIdentifierData, b as ConfigOptions, r as CreateLightningInvoiceParams, D as DecodedSparkAddressData, s as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, k as LRC_WALLET_NETWORK_TYPE, N as Network, h as NetworkToProto, g as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, c as SparkAddressData, S as SparkAddressFormat, y as SparkWallet, x as SparkWalletEvents, w as SparkWalletProps, t as TokenBalanceMap, v as TokenMetadataMap, T as TransferParams, U as UserTokenMetadata, a as WalletConfig, q as decodeBech32mTokenIdentifier, d as decodeSparkAddress, o as encodeBech32mTokenIdentifier, e as encodeSparkAddress, j as getNetwork, l as getNetworkFromAddress, m as getNetworkFromString, f as isValidPublicKey, i as isValidSparkAddress, p as protoToNetwork } from './spark-wallet-B2WwKN8W.js';
3
+ export { ab as BroadcastConfig, ac as BroadcastResult, Q as DEFAULT_FEE_SATS, M as DIRECT_TIMELOCK_OFFSET, a9 as FeeBumpTxChain, a8 as FeeBumpTxPackage, a7 as FeeRate, O as INITIAL_DIRECT_SEQUENCE, N as INITIAL_SEQUENCE, a5 as LeafInfo, P as TEST_UNILATERAL_DIRECT_SEQUENCE, T as TEST_UNILATERAL_SEQUENCE, aa as TxChain, a6 as Utxo, q as addPrivateKeys, o as addPublicKeys, b as applyAdaptorToSignature, p as applyAdditiveTweakToPublicKey, J as checkIfSelectedOutputsAreAvailable, a1 as checkIfValidSequence, z as collectResponses, c as computeTaprootKeyNoScript, ag as constructFeeBumpTx, af as constructUnilateralExitFeeBumpPackages, ae as constructUnilateralExitTxs, _ as createConnectorRefundTransactions, X as createLeafNodeTx, V as createNodeTx, W as createNodeTxs, Y as createRefundTx, Z as createRefundTxs, S as createRootTx, F as createSigningCommitment, B as createSigningNonce, U as createSplitTx, H as decodeBytesToSigningCommitment, E as decodeBytesToSigningNonce, a2 as doesLeafNeedRefresh, G as encodeSigningCommitmentToBytes, D as encodeSigningNonceToBytes, K as filterTokenBalanceForTokenPublicKey, a as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, $ as getCurrentTimelock, a4 as getEphemeralAnchorOutput, w as getLatestDepositTxId, a3 as getNextTransactionSequence, f as getP2TRAddressFromPkScript, e as getP2TRAddressFromPublicKey, d as getP2TRScriptFromPublicKey, h as getP2WPKHAddressFromPublicKey, A as getRandomSigningNonce, k as getSigHashFromTx, C as getSigningCommitmentFromNonce, ah as getSparkAddressFromTaproot, a0 as getTransactionSequence, L as getTransferPackageSigningPayload, n as getTxEstimatedVbytesSizeByNumberOfInputsOutputs, j as getTxFromRawTxBytes, i as getTxFromRawTxHex, l as getTxId, m as getTxIdNoReverse, ad as isEphemeralAnchorOutput, x as isTxBroadcast, u as lastKeyWithTarget, R as maybeApplyFee, y as proofOfPossessionMessageHashForDepositAddress, r as subtractPrivateKeys, s as subtractPublicKeys, I as sumAvailableTokens, t as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from './xchain-address-BsveIy5l.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-Dg6vS_2I.js';
5
+ import { f as OutputWithPreviousTransactionData, T as TokenTransaction, k as TokenTransactionWithStatus } from './spark-ESAfZARg.js';
6
6
  import { TokenTransaction as TokenTransaction$1, TokenTransactionWithStatus as TokenTransactionWithStatus$1 } from './proto/spark_token.js';
7
7
  export { TokenSigner } from '@buildonspark/lrc20-sdk';
8
8
  export { MultisigReceiptInput } from '@buildonspark/lrc20-sdk/lrc/types';
@@ -13,7 +13,6 @@ import 'nice-grpc-web';
13
13
  import '@bufbuild/protobuf/wire';
14
14
  import 'nice-grpc-common';
15
15
  import 'eventemitter3';
16
- import './sdk-types-CkRNraXT.js';
17
16
  import '@scure/btc-signer/psbt';
18
17
  import '@lightsparkdev/core';
19
18
  import '@scure/bip32';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./chunk-TVUMSHWA.js";
1
+ import "./chunk-LQZL2D3Y.js";
2
2
  import "./chunk-BYXBJQAS.js";
3
3
  import {
4
4
  AuthenticationError,
@@ -84,6 +84,7 @@ import {
84
84
  getSparkAddressFromTaproot,
85
85
  getTransactionSequence,
86
86
  getTransferPackageSigningPayload,
87
+ getTxEstimatedVbytesSizeByNumberOfInputsOutputs,
87
88
  getTxFromRawTxBytes,
88
89
  getTxFromRawTxHex,
89
90
  getTxId,
@@ -106,10 +107,10 @@ import {
106
107
  sumOfPrivateKeys,
107
108
  validateOutboundAdaptorSignature,
108
109
  validateShare
109
- } from "./chunk-W4ZRBSWM.js";
110
+ } from "./chunk-U7LRIWTF.js";
110
111
  import "./chunk-G4MSZ6DE.js";
111
- import "./chunk-3SEOTO43.js";
112
- import "./chunk-WAQKYSDI.js";
112
+ import "./chunk-3SPMJMUX.js";
113
+ import "./chunk-CQY5ML2A.js";
113
114
  import "./chunk-AAZWSPUK.js";
114
115
  import "./chunk-MVRQ5US7.js";
115
116
  export {
@@ -196,6 +197,7 @@ export {
196
197
  getSparkAddressFromTaproot,
197
198
  getTransactionSequence,
198
199
  getTransferPackageSigningPayload,
200
+ getTxEstimatedVbytesSizeByNumberOfInputsOutputs,
199
201
  getTxFromRawTxBytes,
200
202
  getTxFromRawTxHex,
201
203
  getTxId,
@@ -1370,6 +1370,7 @@ __export(index_node_exports, {
1370
1370
  getSparkAddressFromTaproot: () => getSparkAddressFromTaproot,
1371
1371
  getTransactionSequence: () => getTransactionSequence,
1372
1372
  getTransferPackageSigningPayload: () => getTransferPackageSigningPayload,
1373
+ getTxEstimatedVbytesSizeByNumberOfInputsOutputs: () => getTxEstimatedVbytesSizeByNumberOfInputsOutputs,
1373
1374
  getTxFromRawTxBytes: () => getTxFromRawTxBytes,
1374
1375
  getTxFromRawTxHex: () => getTxFromRawTxHex,
1375
1376
  getTxId: () => getTxId,
@@ -16557,6 +16558,12 @@ function getTxId(tx) {
16557
16558
  function getTxIdNoReverse(tx) {
16558
16559
  return (0, import_utils5.bytesToHex)((0, import_sha2.sha256)((0, import_sha2.sha256)(tx.toBytes(true))));
16559
16560
  }
16561
+ function getTxEstimatedVbytesSizeByNumberOfInputsOutputs(numInputs, numOutputs) {
16562
+ const TX_OVERHEAD = 10;
16563
+ const IN_VBYTES = 150;
16564
+ const OUT_VBYTES = 34;
16565
+ return TX_OVERHEAD + numInputs * IN_VBYTES + numOutputs * OUT_VBYTES;
16566
+ }
16560
16567
 
16561
16568
  // src/utils/keys.ts
16562
16569
  init_buffer();
@@ -16939,6 +16946,20 @@ var import_core = require("@lightsparkdev/core");
16939
16946
 
16940
16947
  // src/graphql/objects/ClaimStaticDepositStatus.ts
16941
16948
  init_buffer();
16949
+ var ClaimStaticDepositStatus = /* @__PURE__ */ ((ClaimStaticDepositStatus2) => {
16950
+ ClaimStaticDepositStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
16951
+ ClaimStaticDepositStatus2["CREATED"] = "CREATED";
16952
+ ClaimStaticDepositStatus2["TRANSFER_CREATED"] = "TRANSFER_CREATED";
16953
+ ClaimStaticDepositStatus2["TRANSFER_CREATION_FAILED"] = "TRANSFER_CREATION_FAILED";
16954
+ ClaimStaticDepositStatus2["REFUND_SIGNING_COMMITMENTS_QUERYING_FAILED"] = "REFUND_SIGNING_COMMITMENTS_QUERYING_FAILED";
16955
+ ClaimStaticDepositStatus2["REFUND_SIGNING_FAILED"] = "REFUND_SIGNING_FAILED";
16956
+ ClaimStaticDepositStatus2["UTXO_SWAPPING_FAILED"] = "UTXO_SWAPPING_FAILED";
16957
+ ClaimStaticDepositStatus2["TRANSFER_COMPLETED"] = "TRANSFER_COMPLETED";
16958
+ ClaimStaticDepositStatus2["SPEND_TX_CREATED"] = "SPEND_TX_CREATED";
16959
+ ClaimStaticDepositStatus2["SPEND_TX_BROADCAST"] = "SPEND_TX_BROADCAST";
16960
+ return ClaimStaticDepositStatus2;
16961
+ })(ClaimStaticDepositStatus || {});
16962
+ var ClaimStaticDepositStatus_default = ClaimStaticDepositStatus;
16942
16963
 
16943
16964
  // src/graphql/objects/CurrencyAmount.ts
16944
16965
  init_buffer();
@@ -16981,6 +17002,26 @@ var CurrencyAmountToJson = (obj) => {
16981
17002
  };
16982
17003
  };
16983
17004
 
17005
+ // src/graphql/objects/ClaimStaticDeposit.ts
17006
+ var ClaimStaticDepositFromJson = (obj) => {
17007
+ return {
17008
+ id: obj["claim_static_deposit_id"],
17009
+ createdAt: obj["claim_static_deposit_created_at"],
17010
+ updatedAt: obj["claim_static_deposit_updated_at"],
17011
+ network: BitcoinNetwork_default[obj["claim_static_deposit_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
17012
+ creditAmount: CurrencyAmountFromJson(
17013
+ obj["claim_static_deposit_credit_amount"]
17014
+ ),
17015
+ maxFee: CurrencyAmountFromJson(obj["claim_static_deposit_max_fee"]),
17016
+ status: ClaimStaticDepositStatus_default[obj["claim_static_deposit_status"]] ?? ClaimStaticDepositStatus_default.FUTURE_VALUE,
17017
+ transactionId: obj["claim_static_deposit_transaction_id"],
17018
+ outputIndex: obj["claim_static_deposit_output_index"],
17019
+ bitcoinNetwork: BitcoinNetwork_default[obj["claim_static_deposit_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
17020
+ typename: "ClaimStaticDeposit",
17021
+ transferSparkId: obj["claim_static_deposit_transfer_spark_id"]
17022
+ };
17023
+ };
17024
+
16984
17025
  // src/graphql/objects/ClaimStaticDepositRequestType.ts
16985
17026
  init_buffer();
16986
17027
  var ClaimStaticDepositRequestType = /* @__PURE__ */ ((ClaimStaticDepositRequestType2) => {
@@ -17848,7 +17889,7 @@ function mapTransferLeafToWalletTransferLeaf(proto) {
17848
17889
  intermediateRefundTx: (0, import_utils7.bytesToHex)(proto.intermediateRefundTx)
17849
17890
  };
17850
17891
  }
17851
- function mapTransferToWalletTransfer(proto, identityPublicKey) {
17892
+ function mapTransferToWalletTransfer(proto, identityPublicKey, userRequest) {
17852
17893
  const receiverIdentityPublicKey = (0, import_utils7.bytesToHex)(proto.receiverIdentityPublicKey);
17853
17894
  const senderIdentityPublicKey = (0, import_utils7.bytesToHex)(proto.senderIdentityPublicKey);
17854
17895
  return {
@@ -17862,7 +17903,8 @@ function mapTransferToWalletTransfer(proto, identityPublicKey) {
17862
17903
  createdTime: proto.createdTime ? new Date(proto.createdTime) : void 0,
17863
17904
  updatedTime: proto.updatedTime ? new Date(proto.updatedTime) : void 0,
17864
17905
  type: TransferType[proto.type],
17865
- transferDirection: receiverIdentityPublicKey === identityPublicKey ? "INCOMING" /* INCOMING */ : "OUTGOING" /* OUTGOING */
17906
+ transferDirection: receiverIdentityPublicKey === identityPublicKey ? "INCOMING" /* INCOMING */ : "OUTGOING" /* OUTGOING */,
17907
+ userRequest
17866
17908
  };
17867
17909
  }
17868
17910
 
@@ -19247,7 +19289,7 @@ init_buffer();
19247
19289
  var import_core8 = require("@lightsparkdev/core");
19248
19290
  var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
19249
19291
  var isBun = globalThis.Bun !== void 0;
19250
- var packageVersion = true ? "0.2.4" : "unknown";
19292
+ var packageVersion = true ? "0.2.5" : "unknown";
19251
19293
  var baseEnvStr = "unknown";
19252
19294
  if (isBun) {
19253
19295
  const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
@@ -20410,15 +20452,19 @@ var LightningSendFeeEstimate = `
20410
20452
  ${FRAGMENT13}
20411
20453
  `;
20412
20454
 
20413
- // src/graphql/queries/Transfer.ts
20455
+ // src/graphql/queries/Transfers.ts
20414
20456
  init_buffer();
20415
- var GetTransfer = `
20416
- query Transfer($transfer_spark_id: UUID!) {
20417
- transfer(transfer_spark_id: $transfer_spark_id) {
20457
+ var GetTransfers = `
20458
+ query Transfers($transfer_spark_ids: [UUID!]!) {
20459
+ transfers(transfer_spark_ids: $transfer_spark_ids) {
20418
20460
  ...TransferFragment
20461
+ transfer_user_request: user_request {
20462
+ ...UserRequestFragment
20463
+ }
20419
20464
  }
20420
20465
  }
20421
20466
  ${FRAGMENT2}
20467
+ ${FRAGMENT6}
20422
20468
  `;
20423
20469
 
20424
20470
  // src/graphql/queries/UserRequest.ts
@@ -20775,14 +20821,47 @@ var SspClient = class {
20775
20821
  }
20776
20822
  });
20777
20823
  }
20778
- async getTransfer(id) {
20824
+ async getTransfers(ids) {
20779
20825
  return await this.executeRawQuery({
20780
- queryPayload: GetTransfer,
20826
+ queryPayload: GetTransfers,
20781
20827
  variables: {
20782
- transfer_spark_id: id
20828
+ transfer_spark_ids: ids
20783
20829
  },
20784
20830
  constructObject: (response) => {
20785
- return TransferFromJson(response.transfer);
20831
+ return response.transfers.map((transfer) => {
20832
+ const transferObj = TransferFromJson(
20833
+ transfer
20834
+ );
20835
+ switch (transfer.transfer_user_request.__typename) {
20836
+ case "ClaimStaticDeposit":
20837
+ transferObj.userRequest = ClaimStaticDepositFromJson(
20838
+ transfer.transfer_user_request
20839
+ );
20840
+ break;
20841
+ case "CoopExitRequest":
20842
+ transferObj.userRequest = CoopExitRequestFromJson(
20843
+ transfer.transfer_user_request
20844
+ );
20845
+ break;
20846
+ case "LeavesSwapRequest":
20847
+ transferObj.userRequest = LeavesSwapRequestFromJson(
20848
+ transfer.transfer_user_request
20849
+ );
20850
+ break;
20851
+ case "LightningReceiveRequest":
20852
+ transferObj.userRequest = LightningReceiveRequestFromJson(
20853
+ transfer.transfer_user_request
20854
+ );
20855
+ break;
20856
+ case "LightningSendRequest":
20857
+ transferObj.userRequest = LightningSendRequestFromJson(
20858
+ transfer.transfer_user_request
20859
+ );
20860
+ break;
20861
+ }
20862
+ const { userRequestId, ...rest } = transferObj;
20863
+ return rest;
20864
+ });
20786
20865
  }
20787
20866
  });
20788
20867
  }
@@ -32220,9 +32299,22 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
32220
32299
  const identityPublicKey = (0, import_utils24.bytesToHex)(
32221
32300
  await this.config.signer.getIdentityPublicKey()
32222
32301
  );
32302
+ const userRequests = await this.sspClient?.getTransfers(
32303
+ transfers.transfers.map((transfer) => transfer.id)
32304
+ );
32305
+ const userRequestsMap = /* @__PURE__ */ new Map();
32306
+ for (const userRequest of userRequests || []) {
32307
+ if (userRequest && userRequest.sparkId && userRequest.userRequest) {
32308
+ userRequestsMap.set(userRequest.sparkId, userRequest.userRequest);
32309
+ }
32310
+ }
32223
32311
  return {
32224
32312
  transfers: transfers.transfers.map(
32225
- (transfer) => mapTransferToWalletTransfer(transfer, identityPublicKey)
32313
+ (transfer) => mapTransferToWalletTransfer(
32314
+ transfer,
32315
+ identityPublicKey,
32316
+ userRequestsMap.get(transfer.id)
32317
+ )
32226
32318
  ),
32227
32319
  offset: transfers.offset
32228
32320
  };
@@ -32405,7 +32497,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
32405
32497
  network = BitcoinNetwork_default.REGTEST;
32406
32498
  }
32407
32499
  if (outputIndex === void 0) {
32408
- outputIndex = await this.getDepositTransactionVout(transactionId);
32500
+ outputIndex = await this.getDepositTransactionVout({
32501
+ txid: transactionId
32502
+ });
32409
32503
  }
32410
32504
  const quote = await sspClient.getClaimDepositQuote({
32411
32505
  transactionId,
@@ -32436,7 +32530,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
32436
32530
  throw new Error("SSP client not initialized");
32437
32531
  }
32438
32532
  if (outputIndex === void 0) {
32439
- outputIndex = await this.getDepositTransactionVout(transactionId);
32533
+ outputIndex = await this.getDepositTransactionVout({
32534
+ txid: transactionId
32535
+ });
32440
32536
  }
32441
32537
  let network = this.config.getSspNetwork();
32442
32538
  if (network === BitcoinNetwork_default.FUTURE_VALUE) {
@@ -32470,25 +32566,94 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
32470
32566
  }
32471
32567
  return response;
32472
32568
  }
32569
+ /**
32570
+ * Get a quote on how much credit you can claim for a deposit from the SSP. If the quote charges less fees than the max fee, claim the deposit.
32571
+ *
32572
+ * @param {Object} params - The parameters object
32573
+ * @param {string} params.transactionId - The ID of the transaction
32574
+ * @param {number} params.maxFee - The maximum fee to claim the deposit for
32575
+ * @param {number} [params.outputIndex] - The index of the output
32576
+ * @returns {Promise<StaticDepositQuoteOutput>} Quote for claiming a deposit to a static deposit address
32577
+ */
32578
+ async claimStaticDepositWithMaxFee({
32579
+ transactionId,
32580
+ maxFee,
32581
+ outputIndex
32582
+ }) {
32583
+ const sspClient = this.getSspClient();
32584
+ let network = this.config.getSspNetwork();
32585
+ if (network === BitcoinNetwork_default.FUTURE_VALUE) {
32586
+ network = BitcoinNetwork_default.REGTEST;
32587
+ }
32588
+ const depositTx = await this.getDepositTransaction(transactionId);
32589
+ if (outputIndex === void 0) {
32590
+ outputIndex = await this.getDepositTransactionVout({
32591
+ txid: transactionId,
32592
+ depositTx
32593
+ });
32594
+ }
32595
+ const depositAmount = Number(depositTx.getOutput(outputIndex).amount);
32596
+ const quote = await sspClient.getClaimDepositQuote({
32597
+ transactionId,
32598
+ outputIndex,
32599
+ network
32600
+ });
32601
+ if (!quote) {
32602
+ throw new Error("Failed to get claim deposit quote");
32603
+ }
32604
+ const { creditAmountSats, signature: sspSignature } = quote;
32605
+ const feeCharged = depositAmount - creditAmountSats;
32606
+ if (feeCharged > maxFee) {
32607
+ throw new ValidationError("Fee larger than max fee", {
32608
+ field: "feeCharged",
32609
+ value: feeCharged
32610
+ });
32611
+ }
32612
+ const response = await this.claimStaticDeposit({
32613
+ transactionId,
32614
+ creditAmountSats,
32615
+ sspSignature,
32616
+ outputIndex
32617
+ });
32618
+ if (!response) {
32619
+ throw new Error("Failed to claim static deposit");
32620
+ }
32621
+ return response;
32622
+ }
32473
32623
  /**
32474
32624
  * Refunds a static deposit to a destination address.
32475
32625
  *
32476
- * @param {string} depositTransactionId - The ID of the transaction
32477
- * @param {number} [outputIndex] - The index of the output
32478
- * @param {string} destinationAddress - The destination address
32479
- * @param {number} fee - The fee to refund
32626
+ * @param {Object} params - The refund parameters
32627
+ * @param {string} params.depositTransactionId - The ID of the transaction
32628
+ * @param {number} [params.outputIndex] - The index of the output
32629
+ * @param {string} params.destinationAddress - The destination address
32630
+ * @param {number} [params.fee] - **@deprecated** The fee to refund
32631
+ * @param {number} [params.satsPerVbyteFee] - The fee per vbyte to refund
32480
32632
  * @returns {Promise<string>} The hex of the refund transaction
32481
32633
  */
32482
32634
  async refundStaticDeposit({
32483
32635
  depositTransactionId,
32484
32636
  outputIndex,
32485
32637
  destinationAddress,
32486
- fee
32638
+ fee,
32639
+ satsPerVbyteFee
32487
32640
  }) {
32488
- if (fee <= 300) {
32641
+ if (fee !== void 0) {
32642
+ console.warn(
32643
+ `refundStaticDeposit(): \`fee\` parameter is deprecated and will be removed; please switch to \`satsPerVbyteFee\`.`
32644
+ );
32645
+ }
32646
+ if (fee === void 0 && satsPerVbyteFee === void 0) {
32647
+ throw new ValidationError("Fee or satsPerVbyteFee must be provided");
32648
+ }
32649
+ if (satsPerVbyteFee && satsPerVbyteFee > 150) {
32650
+ throw new ValidationError("satsPerVbyteFee must be less than 150");
32651
+ }
32652
+ const finalFee = satsPerVbyteFee ? satsPerVbyteFee * getTxEstimatedVbytesSizeByNumberOfInputsOutputs(1, 1) : fee;
32653
+ if (finalFee <= 200) {
32489
32654
  throw new ValidationError("Fee must be greater than 300", {
32490
32655
  field: "fee",
32491
- value: fee
32656
+ value: finalFee
32492
32657
  });
32493
32658
  }
32494
32659
  let network = this.config.getNetwork();
@@ -32496,10 +32661,13 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
32496
32661
  const networkJSON = networkToJSON(networkType);
32497
32662
  const depositTx = await this.getDepositTransaction(depositTransactionId);
32498
32663
  if (outputIndex === void 0) {
32499
- outputIndex = await this.getDepositTransactionVout(depositTransactionId);
32664
+ outputIndex = await this.getDepositTransactionVout({
32665
+ txid: depositTransactionId,
32666
+ depositTx
32667
+ });
32500
32668
  }
32501
32669
  const totalAmount = depositTx.getOutput(outputIndex).amount;
32502
- const creditAmountSats = Number(totalAmount) - fee;
32670
+ const creditAmountSats = Number(totalAmount) - finalFee;
32503
32671
  if (creditAmountSats <= 0) {
32504
32672
  throw new ValidationError(
32505
32673
  "Fee too large. Credit amount must be greater than 0",
@@ -32547,26 +32715,14 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
32547
32715
  const sparkClient = await this.connectionManager.createSparkClient(
32548
32716
  this.config.getCoordinatorAddress()
32549
32717
  );
32550
- const transferId = (0, import_uuidv75.uuidv7)();
32551
- const swapResponse = await sparkClient.initiate_utxo_swap({
32718
+ const swapResponse = await sparkClient.initiate_static_deposit_utxo_refund({
32552
32719
  onChainUtxo: {
32553
32720
  txid: (0, import_utils24.hexToBytes)(depositTransactionId),
32554
32721
  vout: outputIndex,
32555
32722
  network: networkType
32556
32723
  },
32557
- requestType: 2 /* Refund */,
32558
- amount: {
32559
- creditAmountSats: 0,
32560
- $case: "creditAmountSats"
32561
- },
32562
32724
  userSignature: swapResponseUserSignature,
32563
- sspSignature: new Uint8Array(),
32564
- transfer: {
32565
- transferId,
32566
- ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
32567
- receiverIdentityPublicKey: await this.config.signer.getIdentityPublicKey()
32568
- },
32569
- spendTxSigningJob: signingJob
32725
+ refundTxSigningJob: signingJob
32570
32726
  });
32571
32727
  if (!swapResponse) {
32572
32728
  throw new Error("Failed to initiate utxo swap");
@@ -32579,15 +32735,15 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
32579
32735
  path: 0
32580
32736
  },
32581
32737
  selfCommitment: signingNonceCommitment,
32582
- statechainCommitments: swapResponse.spendTxSigningResult.signingNonceCommitments,
32738
+ statechainCommitments: swapResponse.refundTxSigningResult.signingNonceCommitments,
32583
32739
  verifyingKey: swapResponse.depositAddress.verifyingPublicKey
32584
32740
  });
32585
32741
  const signatureResult = await this.config.signer.aggregateFrost({
32586
32742
  message: spendTxSighash,
32587
- statechainSignatures: swapResponse.spendTxSigningResult.signatureShares,
32588
- statechainPublicKeys: swapResponse.spendTxSigningResult.publicKeys,
32743
+ statechainSignatures: swapResponse.refundTxSigningResult.signatureShares,
32744
+ statechainPublicKeys: swapResponse.refundTxSigningResult.publicKeys,
32589
32745
  verifyingKey: swapResponse.depositAddress.verifyingPublicKey,
32590
- statechainCommitments: swapResponse.spendTxSigningResult.signingNonceCommitments,
32746
+ statechainCommitments: swapResponse.refundTxSigningResult.signingNonceCommitments,
32591
32747
  selfCommitment: signingNonceCommitment,
32592
32748
  publicKey: await this.config.signer.getStaticDepositSigningKey(0),
32593
32749
  selfSignature: userSignature
@@ -32640,8 +32796,13 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
32640
32796
  }
32641
32797
  return payload;
32642
32798
  }
32643
- async getDepositTransactionVout(txid) {
32644
- const depositTx = await this.getDepositTransaction(txid);
32799
+ async getDepositTransactionVout({
32800
+ txid,
32801
+ depositTx
32802
+ }) {
32803
+ if (!depositTx) {
32804
+ depositTx = await this.getDepositTransaction(txid);
32805
+ }
32645
32806
  const staticDepositAddresses = new Set(
32646
32807
  await this.queryStaticDepositAddresses()
32647
32808
  );
@@ -33856,11 +34017,12 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
33856
34017
  * Gets a transfer that has been sent by the SSP to the wallet.
33857
34018
  *
33858
34019
  * @param {string} id - The ID of the transfer
33859
- * @returns {Promise<GraphQLTransferObj | null>} The transfer
34020
+ * @returns {Promise<TransferWithUserRequest | undefined>} The transfer
33860
34021
  */
33861
34022
  async getTransferFromSsp(id) {
33862
34023
  const sspClient = this.getSspClient();
33863
- return await sspClient.getTransfer(id);
34024
+ const transfers = await sspClient.getTransfers([id]);
34025
+ return transfers?.[0];
33864
34026
  }
33865
34027
  /**
33866
34028
  * Gets a transfer, that the wallet is a participant of, in the Spark network.
@@ -34647,6 +34809,7 @@ setCrypto(cryptoImpl2);
34647
34809
  getSparkAddressFromTaproot,
34648
34810
  getTransactionSequence,
34649
34811
  getTransferPackageSigningPayload,
34812
+ getTxEstimatedVbytesSizeByNumberOfInputsOutputs,
34650
34813
  getTxFromRawTxBytes,
34651
34814
  getTxFromRawTxHex,
34652
34815
  getTxId,
@@ -1,11 +1,11 @@
1
1
  export { AuthenticationError, ConfigurationError, InternalValidationError, NetworkError, NotImplementedError, RPCError, SparkSDKError, TokenTransactionService, ValidationError } from './index.cjs';
2
- export { B as Bech32mTokenIdentifier, n as Bech32mTokenIdentifierData, b as ConfigOptions, C as ConnectionManager, r as CreateLightningInvoiceParams, D as DecodedSparkAddressData, s as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, k as LRC_WALLET_NETWORK_TYPE, N as Network, h as NetworkToProto, g as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, c as SparkAddressData, S as SparkAddressFormat, x as SparkWalletEvents, w as SparkWalletProps, t as TokenBalanceMap, v as TokenMetadataMap, u as TokenOutputsMap, T as TransferParams, U as UserTokenMetadata, a as WalletConfig, W as WalletConfigService, q as decodeBech32mTokenIdentifier, d as decodeSparkAddress, o as encodeBech32mTokenIdentifier, e as encodeSparkAddress, j as getNetwork, l as getNetworkFromAddress, m as getNetworkFromString, f as isValidPublicKey, i as isValidSparkAddress, p as protoToNetwork } from './spark-wallet-DG3x2obf.cjs';
3
- export { aa as BroadcastConfig, ab as BroadcastResult, P as DEFAULT_FEE_SATS, L as DIRECT_TIMELOCK_OFFSET, a8 as FeeBumpTxChain, a7 as FeeBumpTxPackage, a6 as FeeRate, N as INITIAL_DIRECT_SEQUENCE, M as INITIAL_SEQUENCE, a4 as LeafInfo, O as TEST_UNILATERAL_DIRECT_SEQUENCE, T as TEST_UNILATERAL_SEQUENCE, a9 as TxChain, a5 as Utxo, p as addPrivateKeys, n as addPublicKeys, b as applyAdaptorToSignature, o as applyAdditiveTweakToPublicKey, I as checkIfSelectedOutputsAreAvailable, a0 as checkIfValidSequence, y as collectResponses, c as computeTaprootKeyNoScript, af as constructFeeBumpTx, ae as constructUnilateralExitFeeBumpPackages, ad as constructUnilateralExitTxs, Z as createConnectorRefundTransactions, W as createLeafNodeTx, U as createNodeTx, V as createNodeTxs, X as createRefundTx, Y as createRefundTxs, R as createRootTx, E as createSigningCommitment, A as createSigningNonce, S as createSplitTx, G as decodeBytesToSigningCommitment, D as decodeBytesToSigningNonce, a1 as doesLeafNeedRefresh, F as encodeSigningCommitmentToBytes, C as encodeSigningNonceToBytes, J as filterTokenBalanceForTokenPublicKey, a as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, _ as getCurrentTimelock, a3 as getEphemeralAnchorOutput, u as getLatestDepositTxId, a2 as getNextTransactionSequence, f as getP2TRAddressFromPkScript, e as getP2TRAddressFromPublicKey, d as getP2TRScriptFromPublicKey, h as getP2WPKHAddressFromPublicKey, z as getRandomSigningNonce, k as getSigHashFromTx, B as getSigningCommitmentFromNonce, ag as getSparkAddressFromTaproot, $ as getTransactionSequence, K as getTransferPackageSigningPayload, j as getTxFromRawTxBytes, i as getTxFromRawTxHex, l as getTxId, m as getTxIdNoReverse, ac as isEphemeralAnchorOutput, w as isTxBroadcast, t as lastKeyWithTarget, Q as maybeApplyFee, x as proofOfPossessionMessageHashForDepositAddress, q as subtractPrivateKeys, s as subtractPublicKeys, H as sumAvailableTokens, r as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from './xchain-address-HBr6isnc.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-KhNkrXz4.cjs';
5
- export { S as SparkWallet } from './spark-wallet.node-CN9LoB_O.cjs';
2
+ export { B as Bech32mTokenIdentifier, n as Bech32mTokenIdentifierData, b as ConfigOptions, C as ConnectionManager, r as CreateLightningInvoiceParams, D as DecodedSparkAddressData, s as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, k as LRC_WALLET_NETWORK_TYPE, N as Network, h as NetworkToProto, g as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, c as SparkAddressData, S as SparkAddressFormat, x as SparkWalletEvents, w as SparkWalletProps, t as TokenBalanceMap, v as TokenMetadataMap, u as TokenOutputsMap, T as TransferParams, U as UserTokenMetadata, a as WalletConfig, W as WalletConfigService, q as decodeBech32mTokenIdentifier, d as decodeSparkAddress, o as encodeBech32mTokenIdentifier, e as encodeSparkAddress, j as getNetwork, l as getNetworkFromAddress, m as getNetworkFromString, f as isValidPublicKey, i as isValidSparkAddress, p as protoToNetwork } from './spark-wallet-Di65w0Us.cjs';
3
+ export { ab as BroadcastConfig, ac as BroadcastResult, Q as DEFAULT_FEE_SATS, M as DIRECT_TIMELOCK_OFFSET, a9 as FeeBumpTxChain, a8 as FeeBumpTxPackage, a7 as FeeRate, O as INITIAL_DIRECT_SEQUENCE, N as INITIAL_SEQUENCE, a5 as LeafInfo, P as TEST_UNILATERAL_DIRECT_SEQUENCE, T as TEST_UNILATERAL_SEQUENCE, aa as TxChain, a6 as Utxo, q as addPrivateKeys, o as addPublicKeys, b as applyAdaptorToSignature, p as applyAdditiveTweakToPublicKey, J as checkIfSelectedOutputsAreAvailable, a1 as checkIfValidSequence, z as collectResponses, c as computeTaprootKeyNoScript, ag as constructFeeBumpTx, af as constructUnilateralExitFeeBumpPackages, ae as constructUnilateralExitTxs, _ as createConnectorRefundTransactions, X as createLeafNodeTx, V as createNodeTx, W as createNodeTxs, Y as createRefundTx, Z as createRefundTxs, S as createRootTx, F as createSigningCommitment, B as createSigningNonce, U as createSplitTx, H as decodeBytesToSigningCommitment, E as decodeBytesToSigningNonce, a2 as doesLeafNeedRefresh, G as encodeSigningCommitmentToBytes, D as encodeSigningNonceToBytes, K as filterTokenBalanceForTokenPublicKey, a as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, $ as getCurrentTimelock, a4 as getEphemeralAnchorOutput, w as getLatestDepositTxId, a3 as getNextTransactionSequence, f as getP2TRAddressFromPkScript, e as getP2TRAddressFromPublicKey, d as getP2TRScriptFromPublicKey, h as getP2WPKHAddressFromPublicKey, A as getRandomSigningNonce, k as getSigHashFromTx, C as getSigningCommitmentFromNonce, ah as getSparkAddressFromTaproot, a0 as getTransactionSequence, L as getTransferPackageSigningPayload, n as getTxEstimatedVbytesSizeByNumberOfInputsOutputs, j as getTxFromRawTxBytes, i as getTxFromRawTxHex, l as getTxId, m as getTxIdNoReverse, ad as isEphemeralAnchorOutput, x as isTxBroadcast, u as lastKeyWithTarget, R as maybeApplyFee, y as proofOfPossessionMessageHashForDepositAddress, r as subtractPrivateKeys, s as subtractPublicKeys, I as sumAvailableTokens, t as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from './xchain-address-CqRu3F21.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-C88GCTPB.cjs';
5
+ export { S as SparkWallet } from './spark-wallet.node-7R0Rxyj9.cjs';
6
6
  export { TokenSigner } from '@buildonspark/lrc20-sdk';
7
7
  export { MultisigReceiptInput } from '@buildonspark/lrc20-sdk/lrc/types';
8
- import './spark-B_7nZx6T.cjs';
8
+ import './spark-ESAfZARg.cjs';
9
9
  import '@bufbuild/protobuf/wire';
10
10
  import 'nice-grpc-common';
11
11
  import './proto/spark_token.cjs';
@@ -14,7 +14,6 @@ import 'bitcoinjs-lib';
14
14
  import 'nice-grpc';
15
15
  import 'nice-grpc-web';
16
16
  import 'eventemitter3';
17
- import './sdk-types-CB9HrW5O.cjs';
18
17
  import '@scure/btc-signer/psbt';
19
18
  import '@lightsparkdev/core';
20
19
  import '@scure/bip32';
@@ -1,11 +1,11 @@
1
1
  export { AuthenticationError, ConfigurationError, InternalValidationError, NetworkError, NotImplementedError, RPCError, SparkSDKError, TokenTransactionService, ValidationError } from './index.js';
2
- export { B as Bech32mTokenIdentifier, n as Bech32mTokenIdentifierData, b as ConfigOptions, C as ConnectionManager, r as CreateLightningInvoiceParams, D as DecodedSparkAddressData, s as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, k as LRC_WALLET_NETWORK_TYPE, N as Network, h as NetworkToProto, g as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, c as SparkAddressData, S as SparkAddressFormat, x as SparkWalletEvents, w as SparkWalletProps, t as TokenBalanceMap, v as TokenMetadataMap, u as TokenOutputsMap, T as TransferParams, U as UserTokenMetadata, a as WalletConfig, W as WalletConfigService, q as decodeBech32mTokenIdentifier, d as decodeSparkAddress, o as encodeBech32mTokenIdentifier, e as encodeSparkAddress, j as getNetwork, l as getNetworkFromAddress, m as getNetworkFromString, f as isValidPublicKey, i as isValidSparkAddress, p as protoToNetwork } from './spark-wallet-C1Tr_VKI.js';
3
- export { aa as BroadcastConfig, ab as BroadcastResult, P as DEFAULT_FEE_SATS, L as DIRECT_TIMELOCK_OFFSET, a8 as FeeBumpTxChain, a7 as FeeBumpTxPackage, a6 as FeeRate, N as INITIAL_DIRECT_SEQUENCE, M as INITIAL_SEQUENCE, a4 as LeafInfo, O as TEST_UNILATERAL_DIRECT_SEQUENCE, T as TEST_UNILATERAL_SEQUENCE, a9 as TxChain, a5 as Utxo, p as addPrivateKeys, n as addPublicKeys, b as applyAdaptorToSignature, o as applyAdditiveTweakToPublicKey, I as checkIfSelectedOutputsAreAvailable, a0 as checkIfValidSequence, y as collectResponses, c as computeTaprootKeyNoScript, af as constructFeeBumpTx, ae as constructUnilateralExitFeeBumpPackages, ad as constructUnilateralExitTxs, Z as createConnectorRefundTransactions, W as createLeafNodeTx, U as createNodeTx, V as createNodeTxs, X as createRefundTx, Y as createRefundTxs, R as createRootTx, E as createSigningCommitment, A as createSigningNonce, S as createSplitTx, G as decodeBytesToSigningCommitment, D as decodeBytesToSigningNonce, a1 as doesLeafNeedRefresh, F as encodeSigningCommitmentToBytes, C as encodeSigningNonceToBytes, J as filterTokenBalanceForTokenPublicKey, a as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, _ as getCurrentTimelock, a3 as getEphemeralAnchorOutput, u as getLatestDepositTxId, a2 as getNextTransactionSequence, f as getP2TRAddressFromPkScript, e as getP2TRAddressFromPublicKey, d as getP2TRScriptFromPublicKey, h as getP2WPKHAddressFromPublicKey, z as getRandomSigningNonce, k as getSigHashFromTx, B as getSigningCommitmentFromNonce, ag as getSparkAddressFromTaproot, $ as getTransactionSequence, K as getTransferPackageSigningPayload, j as getTxFromRawTxBytes, i as getTxFromRawTxHex, l as getTxId, m as getTxIdNoReverse, ac as isEphemeralAnchorOutput, w as isTxBroadcast, t as lastKeyWithTarget, Q as maybeApplyFee, x as proofOfPossessionMessageHashForDepositAddress, q as subtractPrivateKeys, s as subtractPublicKeys, H as sumAvailableTokens, r as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from './xchain-address-BHu6CpZC.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-BF4cn8F4.js';
5
- export { S as SparkWallet } from './spark-wallet.node-CGxoeCpH.js';
2
+ export { B as Bech32mTokenIdentifier, n as Bech32mTokenIdentifierData, b as ConfigOptions, C as ConnectionManager, r as CreateLightningInvoiceParams, D as DecodedSparkAddressData, s as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, k as LRC_WALLET_NETWORK_TYPE, N as Network, h as NetworkToProto, g as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, c as SparkAddressData, S as SparkAddressFormat, x as SparkWalletEvents, w as SparkWalletProps, t as TokenBalanceMap, v as TokenMetadataMap, u as TokenOutputsMap, T as TransferParams, U as UserTokenMetadata, a as WalletConfig, W as WalletConfigService, q as decodeBech32mTokenIdentifier, d as decodeSparkAddress, o as encodeBech32mTokenIdentifier, e as encodeSparkAddress, j as getNetwork, l as getNetworkFromAddress, m as getNetworkFromString, f as isValidPublicKey, i as isValidSparkAddress, p as protoToNetwork } from './spark-wallet-B2WwKN8W.js';
3
+ export { ab as BroadcastConfig, ac as BroadcastResult, Q as DEFAULT_FEE_SATS, M as DIRECT_TIMELOCK_OFFSET, a9 as FeeBumpTxChain, a8 as FeeBumpTxPackage, a7 as FeeRate, O as INITIAL_DIRECT_SEQUENCE, N as INITIAL_SEQUENCE, a5 as LeafInfo, P as TEST_UNILATERAL_DIRECT_SEQUENCE, T as TEST_UNILATERAL_SEQUENCE, aa as TxChain, a6 as Utxo, q as addPrivateKeys, o as addPublicKeys, b as applyAdaptorToSignature, p as applyAdditiveTweakToPublicKey, J as checkIfSelectedOutputsAreAvailable, a1 as checkIfValidSequence, z as collectResponses, c as computeTaprootKeyNoScript, ag as constructFeeBumpTx, af as constructUnilateralExitFeeBumpPackages, ae as constructUnilateralExitTxs, _ as createConnectorRefundTransactions, X as createLeafNodeTx, V as createNodeTx, W as createNodeTxs, Y as createRefundTx, Z as createRefundTxs, S as createRootTx, F as createSigningCommitment, B as createSigningNonce, U as createSplitTx, H as decodeBytesToSigningCommitment, E as decodeBytesToSigningNonce, a2 as doesLeafNeedRefresh, G as encodeSigningCommitmentToBytes, D as encodeSigningNonceToBytes, K as filterTokenBalanceForTokenPublicKey, a as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, $ as getCurrentTimelock, a4 as getEphemeralAnchorOutput, w as getLatestDepositTxId, a3 as getNextTransactionSequence, f as getP2TRAddressFromPkScript, e as getP2TRAddressFromPublicKey, d as getP2TRScriptFromPublicKey, h as getP2WPKHAddressFromPublicKey, A as getRandomSigningNonce, k as getSigHashFromTx, C as getSigningCommitmentFromNonce, ah as getSparkAddressFromTaproot, a0 as getTransactionSequence, L as getTransferPackageSigningPayload, n as getTxEstimatedVbytesSizeByNumberOfInputsOutputs, j as getTxFromRawTxBytes, i as getTxFromRawTxHex, l as getTxId, m as getTxIdNoReverse, ad as isEphemeralAnchorOutput, x as isTxBroadcast, u as lastKeyWithTarget, R as maybeApplyFee, y as proofOfPossessionMessageHashForDepositAddress, r as subtractPrivateKeys, s as subtractPublicKeys, I as sumAvailableTokens, t as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from './xchain-address-BsveIy5l.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-Dg6vS_2I.js';
5
+ export { S as SparkWallet } from './spark-wallet.node-CSPWOWRu.js';
6
6
  export { TokenSigner } from '@buildonspark/lrc20-sdk';
7
7
  export { MultisigReceiptInput } from '@buildonspark/lrc20-sdk/lrc/types';
8
- import './spark-B_7nZx6T.js';
8
+ import './spark-ESAfZARg.js';
9
9
  import '@bufbuild/protobuf/wire';
10
10
  import 'nice-grpc-common';
11
11
  import './proto/spark_token.js';
@@ -14,7 +14,6 @@ import 'bitcoinjs-lib';
14
14
  import 'nice-grpc';
15
15
  import 'nice-grpc-web';
16
16
  import 'eventemitter3';
17
- import './sdk-types-CkRNraXT.js';
18
17
  import '@scure/btc-signer/psbt';
19
18
  import '@lightsparkdev/core';
20
19
  import '@scure/bip32';
@@ -83,6 +83,7 @@ import {
83
83
  getSparkAddressFromTaproot,
84
84
  getTransactionSequence,
85
85
  getTransferPackageSigningPayload,
86
+ getTxEstimatedVbytesSizeByNumberOfInputsOutputs,
86
87
  getTxFromRawTxBytes,
87
88
  getTxFromRawTxHex,
88
89
  getTxId,
@@ -106,10 +107,10 @@ import {
106
107
  sumOfPrivateKeys,
107
108
  validateOutboundAdaptorSignature,
108
109
  validateShare
109
- } from "./chunk-W4ZRBSWM.js";
110
+ } from "./chunk-U7LRIWTF.js";
110
111
  import "./chunk-G4MSZ6DE.js";
111
- import "./chunk-3SEOTO43.js";
112
- import "./chunk-WAQKYSDI.js";
112
+ import "./chunk-3SPMJMUX.js";
113
+ import "./chunk-CQY5ML2A.js";
113
114
  import "./chunk-AAZWSPUK.js";
114
115
  import "./chunk-MVRQ5US7.js";
115
116
 
@@ -303,6 +304,7 @@ export {
303
304
  getSparkAddressFromTaproot,
304
305
  getTransactionSequence,
305
306
  getTransferPackageSigningPayload,
307
+ getTxEstimatedVbytesSizeByNumberOfInputsOutputs,
306
308
  getTxFromRawTxBytes,
307
309
  getTxFromRawTxHex,
308
310
  getTxId,