@buildonspark/spark-sdk 0.2.3 → 0.2.4

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 (73) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{chunk-PTRXJS7Q.js → chunk-TVUMSHWA.js} +1 -1
  3. package/dist/{chunk-PLLJIZC3.js → chunk-W4ZRBSWM.js} +2298 -778
  4. package/dist/{chunk-CDLETEDT.js → chunk-WAQKYSDI.js} +13 -1
  5. package/dist/{client-CGTRS23n.d.ts → client-BF4cn8F4.d.ts} +15 -3
  6. package/dist/{client-CcYzmpmj.d.cts → client-KhNkrXz4.d.cts} +15 -3
  7. package/dist/debug.cjs +2282 -762
  8. package/dist/debug.d.cts +17 -4
  9. package/dist/debug.d.ts +17 -4
  10. package/dist/debug.js +2 -2
  11. package/dist/graphql/objects/index.cjs +13 -1
  12. package/dist/graphql/objects/index.d.cts +2 -2
  13. package/dist/graphql/objects/index.d.ts +2 -2
  14. package/dist/graphql/objects/index.js +1 -1
  15. package/dist/index.cjs +2283 -752
  16. package/dist/index.d.cts +189 -8
  17. package/dist/index.d.ts +189 -8
  18. package/dist/index.js +29 -3
  19. package/dist/index.node.cjs +2387 -753
  20. package/dist/index.node.d.cts +9 -189
  21. package/dist/index.node.d.ts +9 -189
  22. package/dist/index.node.js +131 -3
  23. package/dist/native/index.cjs +2283 -752
  24. package/dist/native/index.d.cts +95 -30
  25. package/dist/native/index.d.ts +95 -30
  26. package/dist/native/index.js +2284 -767
  27. package/dist/{spark-wallet-CxcGPXRB.d.ts → spark-wallet-C1Tr_VKI.d.ts} +31 -25
  28. package/dist/{spark-wallet-DJJm19BP.d.cts → spark-wallet-DG3x2obf.d.cts} +31 -25
  29. package/dist/spark-wallet.node-CGxoeCpH.d.ts +13 -0
  30. package/dist/spark-wallet.node-CN9LoB_O.d.cts +13 -0
  31. package/dist/tests/test-utils.cjs +570 -73
  32. package/dist/tests/test-utils.d.cts +11 -11
  33. package/dist/tests/test-utils.d.ts +11 -11
  34. package/dist/tests/test-utils.js +53 -16
  35. package/dist/types/index.cjs +13 -1
  36. package/dist/types/index.d.cts +1 -1
  37. package/dist/types/index.d.ts +1 -1
  38. package/dist/types/index.js +1 -1
  39. package/dist/{xchain-address-Bh9w1SeC.d.ts → xchain-address-BHu6CpZC.d.ts} +54 -7
  40. package/dist/{xchain-address-SZ7dkVUE.d.cts → xchain-address-HBr6isnc.d.cts} +54 -7
  41. package/package.json +1 -1
  42. package/src/graphql/client.ts +8 -0
  43. package/src/graphql/mutations/CompleteLeavesSwap.ts +9 -1
  44. package/src/graphql/mutations/RequestSwapLeaves.ts +4 -0
  45. package/src/graphql/objects/CompleteLeavesSwapInput.ts +34 -34
  46. package/src/graphql/objects/LeavesSwapRequest.ts +4 -0
  47. package/src/graphql/objects/RequestLeavesSwapInput.ts +48 -47
  48. package/src/graphql/objects/SwapLeaf.ts +40 -32
  49. package/src/graphql/objects/UserLeafInput.ts +24 -0
  50. package/src/graphql/objects/UserRequest.ts +4 -0
  51. package/src/index.node.ts +1 -1
  52. package/src/native/index.ts +4 -5
  53. package/src/services/coop-exit.ts +171 -36
  54. package/src/services/deposit.ts +471 -74
  55. package/src/services/lightning.ts +18 -5
  56. package/src/services/signing.ts +162 -50
  57. package/src/services/transfer.ts +950 -384
  58. package/src/services/tree-creation.ts +342 -121
  59. package/src/spark-wallet/spark-wallet.node.ts +71 -66
  60. package/src/spark-wallet/spark-wallet.ts +405 -153
  61. package/src/tests/integration/coop-exit.test.ts +3 -8
  62. package/src/tests/integration/deposit.test.ts +3 -3
  63. package/src/tests/integration/lightning.test.ts +521 -466
  64. package/src/tests/integration/swap.test.ts +559 -307
  65. package/src/tests/integration/transfer.test.ts +625 -623
  66. package/src/tests/integration/wallet.test.ts +2 -2
  67. package/src/tests/integration/watchtower.test.ts +211 -0
  68. package/src/tests/test-utils.ts +63 -14
  69. package/src/tests/utils/test-faucet.ts +4 -2
  70. package/src/utils/adaptor-signature.ts +15 -5
  71. package/src/utils/fetch.ts +75 -0
  72. package/src/utils/mempool.ts +9 -4
  73. package/src/utils/transaction.ts +388 -26
@@ -19,13 +19,13 @@ import {
19
19
  getTxIdNoReverse,
20
20
  } from "../../utils/bitcoin.js";
21
21
  import { getNetwork, Network } from "../../utils/network.js";
22
- import { createNewTree, signerTypes } from "../test-utils.js";
22
+ import { walletTypes } from "../test-utils.js";
23
23
  import { SparkWalletTesting } from "../utils/spark-testing-wallet.js";
24
24
  import { BitcoinFaucet } from "../utils/test-faucet.js";
25
25
 
26
26
  import { KeyDerivation, KeyDerivationType } from "../../index.js";
27
27
  import { TransferStatus } from "../../proto/spark.js";
28
- describe.each(signerTypes)("coop exit", ({ name, Signer }) => {
28
+ describe.each(walletTypes)("coop exit", ({ name, Signer, createTree }) => {
29
29
  it(`${name} - test coop exit`, async () => {
30
30
  const faucet = BitcoinFaucet.getInstance();
31
31
 
@@ -56,12 +56,7 @@ describe.each(signerTypes)("coop exit", ({ name, Signer }) => {
56
56
  );
57
57
 
58
58
  const leafId = uuidv7();
59
- const rootNode = await createNewTree(
60
- userWallet,
61
- leafId,
62
- faucet,
63
- amountSats,
64
- );
59
+ const rootNode = await createTree(userWallet, leafId, faucet, amountSats);
65
60
 
66
61
  // Setup ssp
67
62
  const { wallet: sspWallet } = await SparkWalletTesting.initialize({
@@ -3,11 +3,11 @@ import { Address, OutScript, Transaction } from "@scure/btc-signer";
3
3
  import { RPCError } from "../../errors/types.js";
4
4
  import { getTxId } from "../../utils/bitcoin.js";
5
5
  import { getNetwork, Network } from "../../utils/network.js";
6
- import { signerTypes } from "../test-utils.js";
6
+ import { walletTypes } from "../test-utils.js";
7
7
  import { SparkWalletTesting } from "../utils/spark-testing-wallet.js";
8
8
  import { BitcoinFaucet } from "../utils/test-faucet.js";
9
9
 
10
- describe.each(signerTypes)("deposit", ({ name, Signer }) => {
10
+ describe.each(walletTypes)("deposit", ({ name, Signer, createTree }) => {
11
11
  it(`${name} - should generate a deposit address`, async () => {
12
12
  const { wallet: sdk } = await SparkWalletTesting.initialize({
13
13
  options: {
@@ -241,7 +241,7 @@ describe.each(signerTypes)("deposit", ({ name, Signer }) => {
241
241
  }, 30000);
242
242
  });
243
243
 
244
- describe.each(signerTypes)("refund static deposit", ({ name, Signer }) => {
244
+ describe.each(walletTypes)("refund static deposit", ({ name, Signer }) => {
245
245
  it(`${name} - should refund a static deposit`, async () => {
246
246
  const faucet = BitcoinFaucet.getInstance();
247
247