@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
@@ -1,6 +1,7 @@
1
1
  import { Q as QueryTransfersResponse, f as Transfer, d as TreeNode } from '../spark-B_7nZx6T.cjs';
2
- import { o as SparkWallet$1, I as InitWalletResponse, C as ConfigOptions, q as SparkWalletProps } from '../spark-wallet-DJJm19BP.cjs';
3
- import { a1 as SparkSigner, a2 as DefaultSparkSigner } from '../client-CcYzmpmj.cjs';
2
+ import { b as ConfigOptions, w as SparkWalletProps } from '../spark-wallet-DG3x2obf.cjs';
3
+ import { S as SparkSigner, D as DefaultSparkSigner } from '../client-KhNkrXz4.cjs';
4
+ import { S as SparkWallet } from '../spark-wallet.node-CN9LoB_O.cjs';
4
5
  import { Transaction } from '@scure/btc-signer';
5
6
  import { TransactionInput, TransactionOutput } from '@scure/btc-signer/psbt';
6
7
  import '@bufbuild/protobuf/wire';
@@ -16,14 +17,6 @@ import '@lightsparkdev/core';
16
17
  import '@scure/bip32';
17
18
  import '../types-BADxR3bm.cjs';
18
19
 
19
- declare class SparkWallet extends SparkWallet$1 {
20
- private tracer;
21
- protected wrapWithOtelSpan<T>(name: string, fn: (...args: any[]) => Promise<T>): (...args: any[]) => Promise<T>;
22
- protected initializeTracer(tracerName: string): Promise<void>;
23
- private wrapSparkWalletWithTracing;
24
- protected initWallet(mnemonicOrSeed?: Uint8Array | string, accountNumber?: number): Promise<InitWalletResponse | undefined>;
25
- }
26
-
27
20
  interface ISparkWalletTesting extends SparkWallet {
28
21
  getSigner(): SparkSigner;
29
22
  queryPendingTransfers(): Promise<QueryTransfersResponse>;
@@ -75,9 +68,16 @@ declare class BitcoinFaucet {
75
68
  declare function getTestWalletConfig(): ConfigOptions;
76
69
  declare function getTestWalletConfigWithIdentityKey(identityPrivateKey: Uint8Array): ConfigOptions;
77
70
  declare function createNewTree(wallet: SparkWalletTesting, leafId: string, faucet: BitcoinFaucet, amountSats?: bigint): Promise<TreeNode>;
71
+ declare function createNewTreeWithoutDirectTx(wallet: SparkWalletTesting, leafId: string, faucet: BitcoinFaucet, amountSats?: bigint): Promise<TreeNode>;
78
72
  declare const signerTypes: {
79
73
  name: string;
80
74
  Signer: typeof DefaultSparkSigner;
75
+ createTree: typeof createNewTree;
76
+ }[];
77
+ declare const walletTypes: {
78
+ name: string;
79
+ Signer: typeof DefaultSparkSigner;
80
+ createTree: typeof createNewTree;
81
81
  }[];
82
82
 
83
- export { BitcoinFaucet, createNewTree, getTestWalletConfig, getTestWalletConfigWithIdentityKey, signerTypes };
83
+ export { BitcoinFaucet, createNewTree, createNewTreeWithoutDirectTx, getTestWalletConfig, getTestWalletConfigWithIdentityKey, signerTypes, walletTypes };
@@ -1,6 +1,7 @@
1
1
  import { Q as QueryTransfersResponse, f as Transfer, d as TreeNode } from '../spark-B_7nZx6T.js';
2
- import { o as SparkWallet$1, I as InitWalletResponse, C as ConfigOptions, q as SparkWalletProps } from '../spark-wallet-CxcGPXRB.js';
3
- import { a1 as SparkSigner, a2 as DefaultSparkSigner } from '../client-CGTRS23n.js';
2
+ import { b as ConfigOptions, w as SparkWalletProps } from '../spark-wallet-C1Tr_VKI.js';
3
+ import { S as SparkSigner, D as DefaultSparkSigner } from '../client-BF4cn8F4.js';
4
+ import { S as SparkWallet } from '../spark-wallet.node-CGxoeCpH.js';
4
5
  import { Transaction } from '@scure/btc-signer';
5
6
  import { TransactionInput, TransactionOutput } from '@scure/btc-signer/psbt';
6
7
  import '@bufbuild/protobuf/wire';
@@ -16,14 +17,6 @@ import '@lightsparkdev/core';
16
17
  import '@scure/bip32';
17
18
  import '../types-BADxR3bm.js';
18
19
 
19
- declare class SparkWallet extends SparkWallet$1 {
20
- private tracer;
21
- protected wrapWithOtelSpan<T>(name: string, fn: (...args: any[]) => Promise<T>): (...args: any[]) => Promise<T>;
22
- protected initializeTracer(tracerName: string): Promise<void>;
23
- private wrapSparkWalletWithTracing;
24
- protected initWallet(mnemonicOrSeed?: Uint8Array | string, accountNumber?: number): Promise<InitWalletResponse | undefined>;
25
- }
26
-
27
20
  interface ISparkWalletTesting extends SparkWallet {
28
21
  getSigner(): SparkSigner;
29
22
  queryPendingTransfers(): Promise<QueryTransfersResponse>;
@@ -75,9 +68,16 @@ declare class BitcoinFaucet {
75
68
  declare function getTestWalletConfig(): ConfigOptions;
76
69
  declare function getTestWalletConfigWithIdentityKey(identityPrivateKey: Uint8Array): ConfigOptions;
77
70
  declare function createNewTree(wallet: SparkWalletTesting, leafId: string, faucet: BitcoinFaucet, amountSats?: bigint): Promise<TreeNode>;
71
+ declare function createNewTreeWithoutDirectTx(wallet: SparkWalletTesting, leafId: string, faucet: BitcoinFaucet, amountSats?: bigint): Promise<TreeNode>;
78
72
  declare const signerTypes: {
79
73
  name: string;
80
74
  Signer: typeof DefaultSparkSigner;
75
+ createTree: typeof createNewTree;
76
+ }[];
77
+ declare const walletTypes: {
78
+ name: string;
79
+ Signer: typeof DefaultSparkSigner;
80
+ createTree: typeof createNewTree;
81
81
  }[];
82
82
 
83
- export { BitcoinFaucet, createNewTree, getTestWalletConfig, getTestWalletConfigWithIdentityKey, signerTypes };
83
+ export { BitcoinFaucet, createNewTree, createNewTreeWithoutDirectTx, getTestWalletConfig, getTestWalletConfigWithIdentityKey, signerTypes, walletTypes };
@@ -1,4 +1,4 @@
1
- import "../chunk-PTRXJS7Q.js";
1
+ import "../chunk-TVUMSHWA.js";
2
2
  import "../chunk-BYXBJQAS.js";
3
3
  import {
4
4
  BitcoinFaucet,
@@ -11,10 +11,10 @@ import {
11
11
  WalletConfigService,
12
12
  getNetwork,
13
13
  getP2TRAddressFromPublicKey
14
- } from "../chunk-PLLJIZC3.js";
14
+ } from "../chunk-W4ZRBSWM.js";
15
15
  import "../chunk-G4MSZ6DE.js";
16
16
  import "../chunk-3SEOTO43.js";
17
- import "../chunk-CDLETEDT.js";
17
+ import "../chunk-WAQKYSDI.js";
18
18
  import "../chunk-AAZWSPUK.js";
19
19
  import "../chunk-MVRQ5US7.js";
20
20
 
@@ -31,7 +31,7 @@ function getTestWalletConfigWithIdentityKey(identityPrivateKey) {
31
31
  identityPrivateKey
32
32
  };
33
33
  }
34
- async function createNewTree(wallet, leafId, faucet, amountSats = 100000n) {
34
+ async function createDeposit(wallet, leafId, faucet, amountSats = 100000n, includeDirectTx = true) {
35
35
  const faucetCoin = await faucet.fund();
36
36
  const configService = new WalletConfigService(
37
37
  {
@@ -62,15 +62,28 @@ async function createNewTree(wallet, leafId, faucet, amountSats = 100000n) {
62
62
  );
63
63
  const script = OutScript.encode(addr);
64
64
  depositTx.addOutput({ script, amount: amountSats });
65
- const treeResp = await depositService.createTreeRoot({
66
- keyDerivation: {
67
- type: "leaf" /* LEAF */,
68
- path: leafId
69
- },
70
- verifyingKey: depositResp.depositAddress.verifyingKey,
71
- depositTx,
72
- vout: 0
73
- });
65
+ let treeResp;
66
+ if (includeDirectTx) {
67
+ treeResp = await depositService.createTreeRoot({
68
+ keyDerivation: {
69
+ type: "leaf" /* LEAF */,
70
+ path: leafId
71
+ },
72
+ verifyingKey: depositResp.depositAddress.verifyingKey,
73
+ depositTx,
74
+ vout: 0
75
+ });
76
+ } else {
77
+ treeResp = await depositService.createTreeWithoutDirectTx({
78
+ keyDerivation: {
79
+ type: "leaf" /* LEAF */,
80
+ path: leafId
81
+ },
82
+ verifyingKey: depositResp.depositAddress.verifyingKey,
83
+ depositTx,
84
+ vout: 0
85
+ });
86
+ }
74
87
  const signedDepositTx = await faucet.signFaucetCoin(
75
88
  depositTx,
76
89
  faucetCoin.txout,
@@ -87,14 +100,38 @@ async function createNewTree(wallet, leafId, faucet, amountSats = 100000n) {
87
100
  await new Promise((resolve) => setTimeout(resolve, 100));
88
101
  return treeResp.nodes[0];
89
102
  }
103
+ async function createNewTree(wallet, leafId, faucet, amountSats = 100000n) {
104
+ return await createDeposit(wallet, leafId, faucet, amountSats, true);
105
+ }
106
+ async function createNewTreeWithoutDirectTx(wallet, leafId, faucet, amountSats = 100000n) {
107
+ return await createDeposit(wallet, leafId, faucet, amountSats, false);
108
+ }
90
109
  var signerTypes = [
91
- { name: "DefaultSparkSigner", Signer: DefaultSparkSigner },
92
- { name: "UnsafeStatelessSparkSigner", Signer: UnsafeStatelessSparkSigner }
110
+ {
111
+ name: "DefaultSparkSigner",
112
+ Signer: DefaultSparkSigner,
113
+ createTree: createNewTree
114
+ },
115
+ {
116
+ name: "UnsafeStatelessSparkSigner",
117
+ Signer: UnsafeStatelessSparkSigner,
118
+ createTree: createNewTree
119
+ }
120
+ ];
121
+ var walletTypes = [
122
+ ...signerTypes,
123
+ {
124
+ name: "DefaultSparkSignerWithoutDirectTx",
125
+ Signer: UnsafeStatelessSparkSigner,
126
+ createTree: createNewTreeWithoutDirectTx
127
+ }
93
128
  ];
94
129
  export {
95
130
  BitcoinFaucet,
96
131
  createNewTree,
132
+ createNewTreeWithoutDirectTx,
97
133
  getTestWalletConfig,
98
134
  getTestWalletConfigWithIdentityKey,
99
- signerTypes
135
+ signerTypes,
136
+ walletTypes
100
137
  };
@@ -353,7 +353,11 @@ var SwapLeafFromJson = (obj) => {
353
353
  return {
354
354
  leafId: obj["swap_leaf_leaf_id"],
355
355
  rawUnsignedRefundTransaction: obj["swap_leaf_raw_unsigned_refund_transaction"],
356
- adaptorSignedSignature: obj["swap_leaf_adaptor_signed_signature"]
356
+ adaptorSignedSignature: obj["swap_leaf_adaptor_signed_signature"],
357
+ directRawUnsignedRefundTransaction: obj["swap_leaf_direct_raw_unsigned_refund_transaction"],
358
+ directAdaptorSignedSignature: obj["swap_leaf_direct_adaptor_signed_signature"],
359
+ directFromCpfpRawUnsignedRefundTransaction: obj["swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction"],
360
+ directFromCpfpAdaptorSignedSignature: obj["swap_leaf_direct_from_cpfp_adaptor_signed_signature"]
357
361
  };
358
362
  };
359
363
 
@@ -584,6 +588,10 @@ fragment LeavesSwapRequestFragment on LeavesSwapRequest {
584
588
  swap_leaf_leaf_id: leaf_id
585
589
  swap_leaf_raw_unsigned_refund_transaction: raw_unsigned_refund_transaction
586
590
  swap_leaf_adaptor_signed_signature: adaptor_signed_signature
591
+ swap_leaf_direct_raw_unsigned_refund_transaction: direct_raw_unsigned_refund_transaction
592
+ swap_leaf_direct_adaptor_signed_signature: direct_adaptor_signed_signature
593
+ swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction: direct_from_cpfp_raw_unsigned_refund_transaction
594
+ swap_leaf_direct_from_cpfp_adaptor_signed_signature: direct_from_cpfp_adaptor_signed_signature
587
595
  }
588
596
  }`;
589
597
  var getLeavesSwapRequestQuery = (id) => {
@@ -1088,6 +1096,10 @@ fragment UserRequestFragment on UserRequest {
1088
1096
  swap_leaf_leaf_id: leaf_id
1089
1097
  swap_leaf_raw_unsigned_refund_transaction: raw_unsigned_refund_transaction
1090
1098
  swap_leaf_adaptor_signed_signature: adaptor_signed_signature
1099
+ swap_leaf_direct_raw_unsigned_refund_transaction: direct_raw_unsigned_refund_transaction
1100
+ swap_leaf_direct_adaptor_signed_signature: direct_adaptor_signed_signature
1101
+ swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction: direct_from_cpfp_raw_unsigned_refund_transaction
1102
+ swap_leaf_direct_from_cpfp_adaptor_signed_signature: direct_from_cpfp_adaptor_signed_signature
1091
1103
  }
1092
1104
  }
1093
1105
  ... on LightningReceiveRequest {
@@ -1,4 +1,4 @@
1
- export { B as BitcoinNetwork, C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as CoopExitFeeQuote, h as CoopExitFeeQuoteInput, i as CoopExitRequest, k as CurrencyAmount, l as CurrencyUnit, E as ExitSpeed, G as GetChallengeOutput, I as Invoice, L as Leaf, m as LeavesSwapFeeEstimateOutput, o as LeavesSwapRequest, q as LightningReceiveRequest, r as LightningReceiveRequestStatus, s as LightningSendFeeEstimateInput, t as LightningSendFeeEstimateOutput, v as LightningSendRequest, w as LightningSendRequestStatus, P as PageInfo, R as RequestCoopExitInput, x as RequestLeavesSwapInput, y as RequestLightningReceiveInput, z as RequestLightningSendInput, S as SparkCoopExitRequestStatus, A as SparkLeavesSwapRequestStatus, D as SparkTransferToLeavesConnection, F as StaticDepositQuoteInput, H as StaticDepositQuoteOutput, J as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitFeeQuoteQuery, j as getCoopExitRequestQuery, n as getLeavesSwapRequestQuery, p as getLightningReceiveRequestQuery, u as getLightningSendRequestQuery } from '../client-CcYzmpmj.cjs';
1
+ export { B as BitcoinNetwork, C as ClaimStaticDepositOutput, t as CompleteCoopExitInput, u as CompleteLeavesSwapInput, w as CoopExitFeeEstimate, x as CoopExitFeeEstimatesInput, y as CoopExitFeeEstimatesOutput, E as CoopExitFeeQuote, F as CoopExitFeeQuoteInput, G as CoopExitRequest, I as CurrencyAmount, J as CurrencyUnit, L as ExitSpeed, M as GetChallengeOutput, N as Invoice, O as Leaf, P as LeavesSwapFeeEstimateOutput, R as LeavesSwapRequest, X as LightningReceiveRequest, Y as LightningReceiveRequestStatus, Z as LightningSendFeeEstimateInput, _ as LightningSendFeeEstimateOutput, a0 as LightningSendRequest, a1 as LightningSendRequestStatus, a2 as PageInfo, a3 as RequestCoopExitInput, a4 as RequestLeavesSwapInput, a5 as RequestLightningReceiveInput, a6 as RequestLightningSendInput, a7 as SparkCoopExitRequestStatus, a8 as SparkLeavesSwapRequestStatus, a9 as SparkTransferToLeavesConnection, aa as StaticDepositQuoteInput, ab as StaticDepositQuoteOutput, ac as SwapLeaf, ad as Transfer, ae as UserLeafInput, af as VerifyChallengeOutput, z as getCoopExitFeeQuoteQuery, H as getCoopExitRequestQuery, Q as getLeavesSwapRequestQuery, W as getLightningReceiveRequestQuery, $ as getLightningSendRequestQuery } from '../client-KhNkrXz4.cjs';
2
2
  export { ClaimStaticDeposit, ClaimStaticDepositInput, ClaimStaticDepositRequestType, ClaimStaticDepositStatus, CompleteCoopExitOutput, CompleteLeavesSwapOutput, CompleteSeedReleaseInput, CompleteSeedReleaseOutput, Connection, CoopExitFeeQuoteOutput, Entity, GetChallengeInput, LeavesSwapFeeEstimateInput, NotifyReceiverTransferInput, Provider, RequestCoopExitOutput, RequestLeavesSwapOutput, RequestLightningReceiveOutput, RequestLightningSendOutput, SparkUserRequestStatus, SparkUserRequestType, SparkWalletUser, SparkWalletUserToUserRequestsConnection, StartSeedReleaseInput, UserRequest, VerifyChallengeInput, WalletUserIdentityPublicKeyInput, WalletUserIdentityPublicKeyOutput, getClaimStaticDepositQuery, getUserRequestQuery } from '../graphql/objects/index.cjs';
3
3
  export { c as CommonProto, s as SparkProto } from '../spark-B_7nZx6T.cjs';
4
4
  export { T as TransferDirection, W as WalletLeaf, a as WalletTransfer, b as WalletTransferLeaf, c as mapTransferLeafToWalletTransferLeaf, d as mapTransferToWalletTransfer, m as mapTreeNodeToWalletLeaf } from '../sdk-types-CB9HrW5O.cjs';
@@ -1,4 +1,4 @@
1
- export { B as BitcoinNetwork, C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as CoopExitFeeQuote, h as CoopExitFeeQuoteInput, i as CoopExitRequest, k as CurrencyAmount, l as CurrencyUnit, E as ExitSpeed, G as GetChallengeOutput, I as Invoice, L as Leaf, m as LeavesSwapFeeEstimateOutput, o as LeavesSwapRequest, q as LightningReceiveRequest, r as LightningReceiveRequestStatus, s as LightningSendFeeEstimateInput, t as LightningSendFeeEstimateOutput, v as LightningSendRequest, w as LightningSendRequestStatus, P as PageInfo, R as RequestCoopExitInput, x as RequestLeavesSwapInput, y as RequestLightningReceiveInput, z as RequestLightningSendInput, S as SparkCoopExitRequestStatus, A as SparkLeavesSwapRequestStatus, D as SparkTransferToLeavesConnection, F as StaticDepositQuoteInput, H as StaticDepositQuoteOutput, J as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitFeeQuoteQuery, j as getCoopExitRequestQuery, n as getLeavesSwapRequestQuery, p as getLightningReceiveRequestQuery, u as getLightningSendRequestQuery } from '../client-CGTRS23n.js';
1
+ export { B as BitcoinNetwork, C as ClaimStaticDepositOutput, t as CompleteCoopExitInput, u as CompleteLeavesSwapInput, w as CoopExitFeeEstimate, x as CoopExitFeeEstimatesInput, y as CoopExitFeeEstimatesOutput, E as CoopExitFeeQuote, F as CoopExitFeeQuoteInput, G as CoopExitRequest, I as CurrencyAmount, J as CurrencyUnit, L as ExitSpeed, M as GetChallengeOutput, N as Invoice, O as Leaf, P as LeavesSwapFeeEstimateOutput, R as LeavesSwapRequest, X as LightningReceiveRequest, Y as LightningReceiveRequestStatus, Z as LightningSendFeeEstimateInput, _ as LightningSendFeeEstimateOutput, a0 as LightningSendRequest, a1 as LightningSendRequestStatus, a2 as PageInfo, a3 as RequestCoopExitInput, a4 as RequestLeavesSwapInput, a5 as RequestLightningReceiveInput, a6 as RequestLightningSendInput, a7 as SparkCoopExitRequestStatus, a8 as SparkLeavesSwapRequestStatus, a9 as SparkTransferToLeavesConnection, aa as StaticDepositQuoteInput, ab as StaticDepositQuoteOutput, ac as SwapLeaf, ad as Transfer, ae as UserLeafInput, af as VerifyChallengeOutput, z as getCoopExitFeeQuoteQuery, H as getCoopExitRequestQuery, Q as getLeavesSwapRequestQuery, W as getLightningReceiveRequestQuery, $ as getLightningSendRequestQuery } from '../client-BF4cn8F4.js';
2
2
  export { ClaimStaticDeposit, ClaimStaticDepositInput, ClaimStaticDepositRequestType, ClaimStaticDepositStatus, CompleteCoopExitOutput, CompleteLeavesSwapOutput, CompleteSeedReleaseInput, CompleteSeedReleaseOutput, Connection, CoopExitFeeQuoteOutput, Entity, GetChallengeInput, LeavesSwapFeeEstimateInput, NotifyReceiverTransferInput, Provider, RequestCoopExitOutput, RequestLeavesSwapOutput, RequestLightningReceiveOutput, RequestLightningSendOutput, SparkUserRequestStatus, SparkUserRequestType, SparkWalletUser, SparkWalletUserToUserRequestsConnection, StartSeedReleaseInput, UserRequest, VerifyChallengeInput, WalletUserIdentityPublicKeyInput, WalletUserIdentityPublicKeyOutput, getClaimStaticDepositQuery, getUserRequestQuery } from '../graphql/objects/index.js';
3
3
  export { c as CommonProto, s as SparkProto } from '../spark-B_7nZx6T.js';
4
4
  export { T as TransferDirection, W as WalletLeaf, a as WalletTransfer, b as WalletTransferLeaf, c as mapTransferLeafToWalletTransferLeaf, d as mapTransferToWalletTransfer, m as mapTreeNodeToWalletLeaf } from '../sdk-types-CkRNraXT.js';
@@ -24,7 +24,7 @@ import {
24
24
  getLightningReceiveRequestQuery,
25
25
  getLightningSendRequestQuery,
26
26
  getUserRequestQuery
27
- } from "../chunk-CDLETEDT.js";
27
+ } from "../chunk-WAQKYSDI.js";
28
28
  import {
29
29
  common_exports,
30
30
  spark_exports
@@ -1,8 +1,8 @@
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, T as TokenOutputsMap, B as Bech32mTokenIdentifier, r as TokenBalanceMap, e as SparkAddressFormat } from './spark-wallet-CxcGPXRB.js';
5
- import { a8 as SigningNonce, a9 as SigningCommitment } from './client-CGTRS23n.js';
4
+ import { N as Network, u as TokenOutputsMap, B as Bech32mTokenIdentifier, t as TokenBalanceMap, S as SparkAddressFormat } from './spark-wallet-C1Tr_VKI.js';
5
+ import { j as SigningNonce, k as SigningCommitment } from './client-BF4cn8F4.js';
6
6
  import { j as OutputWithPreviousTransactionData, k as TransferPackage, g as SparkServiceClient } from './spark-B_7nZx6T.js';
7
7
 
8
8
  declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
@@ -56,19 +56,66 @@ declare function filterTokenBalanceForTokenPublicKey(tokenBalances: TokenBalance
56
56
 
57
57
  declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
58
58
 
59
+ declare const DIRECT_TIMELOCK_OFFSET = 50;
60
+ declare const INITIAL_SEQUENCE: number;
61
+ declare const INITIAL_DIRECT_SEQUENCE: number;
62
+ declare const TEST_UNILATERAL_SEQUENCE: number;
63
+ declare const TEST_UNILATERAL_DIRECT_SEQUENCE: number;
59
64
  declare const DEFAULT_FEE_SATS: number;
60
65
  /**
61
66
  * Subtracts the default fee from the amount if it's greater than the fee.
62
67
  * Returns the original amount if it's less than or equal to the fee.
63
68
  */
64
69
  declare function maybeApplyFee(amount: bigint): bigint;
65
- declare function createRefundTx(sequence: number, nodeOutPoint: TransactionInput, amountSats: bigint, receivingPubkey: Uint8Array, network: Network): Transaction;
70
+ declare function createRootTx(depositOutPoint: TransactionInput, depositTxOut: TransactionOutput): [Transaction, Transaction];
71
+ declare function createSplitTx(parentOutPoint: TransactionInput, childTxOuts: TransactionOutput[]): [Transaction, Transaction];
72
+ interface CreateNodeTxInput {
73
+ txOut: TransactionOutput;
74
+ parentOutPoint: TransactionInput;
75
+ applyFee?: boolean;
76
+ includeAnchor?: boolean;
77
+ }
78
+ declare function createNodeTx({ txOut, parentOutPoint, applyFee, includeAnchor, }: CreateNodeTxInput): Transaction;
79
+ declare function createNodeTxs(txOut: TransactionOutput, txIn: TransactionInput, directTxIn?: TransactionInput): {
80
+ cpfpNodeTx: Transaction;
81
+ directNodeTx?: Transaction;
82
+ };
83
+ declare function createLeafNodeTx(sequence: number, directSequence: number, parentOutPoint: TransactionInput, txOut: TransactionOutput, shouldCalculateFee: boolean): [Transaction, Transaction];
84
+ interface CreateRefundTxInput {
85
+ sequence: number;
86
+ input: TransactionInput;
87
+ amountSats: bigint;
88
+ receivingPubkey: Uint8Array;
89
+ network: Network;
90
+ shouldCalculateFee: boolean;
91
+ includeAnchor: boolean;
92
+ }
93
+ declare function createRefundTx({ sequence, input, amountSats, receivingPubkey, network, shouldCalculateFee, includeAnchor, }: CreateRefundTxInput): Transaction;
94
+ interface CreateRefundTxsInput {
95
+ sequence: number;
96
+ directSequence?: number;
97
+ input: TransactionInput;
98
+ directInput?: TransactionInput;
99
+ amountSats: bigint;
100
+ receivingPubkey: Uint8Array;
101
+ network: Network;
102
+ }
103
+ declare function createRefundTxs({ sequence, directSequence, input, directInput, amountSats, receivingPubkey, network, }: CreateRefundTxsInput): {
104
+ cpfpRefundTx: Transaction;
105
+ directRefundTx?: Transaction;
106
+ directFromCpfpRefundTx?: Transaction;
107
+ };
108
+ declare function createConnectorRefundTransactions(sequence: number, cpfpNodeOutPoint: TransactionInput, directNodeOutPoint: TransactionInput, connectorOutput: TransactionInput, amountSats: bigint, receiverPubKey: Uint8Array, network: Network, shouldCalculateFee: boolean): [Transaction, Transaction, Transaction];
66
109
  declare function getCurrentTimelock(currSequence?: number): number;
67
- declare function getTransactionSequence(currSequence?: number): number;
110
+ declare function getTransactionSequence(currSequence?: number): {
111
+ nextSequence: number;
112
+ nextDirectSequence: number;
113
+ };
68
114
  declare function checkIfValidSequence(currSequence?: number): void;
69
- declare function getNextTransactionSequence(currSequence?: number, forRefresh?: boolean): {
115
+ declare function doesLeafNeedRefresh(currSequence: number, isNodeTx?: boolean): boolean;
116
+ declare function getNextTransactionSequence(currSequence: number, isNodeTx?: boolean): {
70
117
  nextSequence: number;
71
- needRefresh: boolean;
118
+ nextDirectSequence: number;
72
119
  };
73
120
  declare function getEphemeralAnchorOutput(): TransactionOutput;
74
121
 
@@ -123,4 +170,4 @@ declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRa
123
170
 
124
171
  declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
125
172
 
126
- export { subtractPrivateKeys as $, getLatestDepositTxId as A, type BroadcastConfig as B, getNextTransactionSequence as C, DEFAULT_FEE_SATS as D, getP2TRAddressFromPkScript as E, type FeeBumpTxChain as F, getP2TRAddressFromPublicKey as G, getP2TRScriptFromPublicKey as H, getP2WPKHAddressFromPublicKey as I, getRandomSigningNonce as J, getSigHashFromTx as K, type LeafInfo as L, getSigningCommitmentFromNonce as M, getSparkAddressFromTaproot as N, getTransactionSequence as O, getTransferPackageSigningPayload as P, getTxFromRawTxBytes as Q, getTxFromRawTxHex as R, getTxId as S, type TxChain as T, type Utxo as U, getTxIdNoReverse as V, isEphemeralAnchorOutput as W, isTxBroadcast as X, lastKeyWithTarget as Y, maybeApplyFee as Z, proofOfPossessionMessageHashForDepositAddress as _, type BroadcastResult as a, subtractPublicKeys as a0, sumAvailableTokens as a1, sumOfPrivateKeys as a2, validateOutboundAdaptorSignature as a3, type FeeBumpTxPackage as b, type FeeRate as c, addPrivateKeys as d, addPublicKeys as e, applyAdaptorToSignature as f, applyAdditiveTweakToPublicKey as g, checkIfSelectedOutputsAreAvailable as h, checkIfValidSequence as i, collectResponses as j, computeTaprootKeyNoScript as k, constructFeeBumpTx as l, constructUnilateralExitFeeBumpPackages as m, constructUnilateralExitTxs as n, createRefundTx as o, createSigningCommitment as p, createSigningNonce as q, decodeBytesToSigningCommitment as r, decodeBytesToSigningNonce as s, encodeSigningCommitmentToBytes as t, encodeSigningNonceToBytes as u, filterTokenBalanceForTokenPublicKey as v, generateAdaptorFromSignature as w, generateSignatureFromExistingAdaptor as x, getCurrentTimelock as y, getEphemeralAnchorOutput as z };
173
+ export { getTransactionSequence as $, createSigningNonce as A, getSigningCommitmentFromNonce as B, encodeSigningNonceToBytes as C, decodeBytesToSigningNonce as D, createSigningCommitment as E, encodeSigningCommitmentToBytes as F, decodeBytesToSigningCommitment as G, sumAvailableTokens as H, checkIfSelectedOutputsAreAvailable as I, filterTokenBalanceForTokenPublicKey as J, getTransferPackageSigningPayload as K, DIRECT_TIMELOCK_OFFSET as L, INITIAL_SEQUENCE as M, INITIAL_DIRECT_SEQUENCE as N, TEST_UNILATERAL_DIRECT_SEQUENCE as O, DEFAULT_FEE_SATS as P, maybeApplyFee as Q, createRootTx as R, createSplitTx as S, TEST_UNILATERAL_SEQUENCE as T, createNodeTx as U, createNodeTxs as V, createLeafNodeTx as W, createRefundTx as X, createRefundTxs as Y, createConnectorRefundTransactions as Z, getCurrentTimelock as _, generateAdaptorFromSignature as a, checkIfValidSequence as a0, doesLeafNeedRefresh as a1, getNextTransactionSequence as a2, getEphemeralAnchorOutput as a3, type LeafInfo as a4, type Utxo as a5, type FeeRate as a6, type FeeBumpTxPackage as a7, type FeeBumpTxChain as a8, type TxChain as a9, type BroadcastConfig as aa, type BroadcastResult as ab, isEphemeralAnchorOutput as ac, constructUnilateralExitTxs as ad, constructUnilateralExitFeeBumpPackages as ae, constructFeeBumpTx as af, getSparkAddressFromTaproot as ag, 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, addPublicKeys as n, applyAdditiveTweakToPublicKey as o, addPrivateKeys as p, subtractPrivateKeys as q, sumOfPrivateKeys as r, subtractPublicKeys as s, lastKeyWithTarget as t, getLatestDepositTxId as u, validateOutboundAdaptorSignature as v, isTxBroadcast as w, proofOfPossessionMessageHashForDepositAddress as x, collectResponses as y, getRandomSigningNonce as z };
@@ -1,8 +1,8 @@
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, T as TokenOutputsMap, B as Bech32mTokenIdentifier, r as TokenBalanceMap, e as SparkAddressFormat } from './spark-wallet-DJJm19BP.cjs';
5
- import { a8 as SigningNonce, a9 as SigningCommitment } from './client-CcYzmpmj.cjs';
4
+ import { N as Network, u as TokenOutputsMap, B as Bech32mTokenIdentifier, t as TokenBalanceMap, S as SparkAddressFormat } from './spark-wallet-DG3x2obf.cjs';
5
+ import { j as SigningNonce, k as SigningCommitment } from './client-KhNkrXz4.cjs';
6
6
  import { j as OutputWithPreviousTransactionData, k as TransferPackage, g as SparkServiceClient } from './spark-B_7nZx6T.cjs';
7
7
 
8
8
  declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
@@ -56,19 +56,66 @@ declare function filterTokenBalanceForTokenPublicKey(tokenBalances: TokenBalance
56
56
 
57
57
  declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
58
58
 
59
+ declare const DIRECT_TIMELOCK_OFFSET = 50;
60
+ declare const INITIAL_SEQUENCE: number;
61
+ declare const INITIAL_DIRECT_SEQUENCE: number;
62
+ declare const TEST_UNILATERAL_SEQUENCE: number;
63
+ declare const TEST_UNILATERAL_DIRECT_SEQUENCE: number;
59
64
  declare const DEFAULT_FEE_SATS: number;
60
65
  /**
61
66
  * Subtracts the default fee from the amount if it's greater than the fee.
62
67
  * Returns the original amount if it's less than or equal to the fee.
63
68
  */
64
69
  declare function maybeApplyFee(amount: bigint): bigint;
65
- declare function createRefundTx(sequence: number, nodeOutPoint: TransactionInput, amountSats: bigint, receivingPubkey: Uint8Array, network: Network): Transaction;
70
+ declare function createRootTx(depositOutPoint: TransactionInput, depositTxOut: TransactionOutput): [Transaction, Transaction];
71
+ declare function createSplitTx(parentOutPoint: TransactionInput, childTxOuts: TransactionOutput[]): [Transaction, Transaction];
72
+ interface CreateNodeTxInput {
73
+ txOut: TransactionOutput;
74
+ parentOutPoint: TransactionInput;
75
+ applyFee?: boolean;
76
+ includeAnchor?: boolean;
77
+ }
78
+ declare function createNodeTx({ txOut, parentOutPoint, applyFee, includeAnchor, }: CreateNodeTxInput): Transaction;
79
+ declare function createNodeTxs(txOut: TransactionOutput, txIn: TransactionInput, directTxIn?: TransactionInput): {
80
+ cpfpNodeTx: Transaction;
81
+ directNodeTx?: Transaction;
82
+ };
83
+ declare function createLeafNodeTx(sequence: number, directSequence: number, parentOutPoint: TransactionInput, txOut: TransactionOutput, shouldCalculateFee: boolean): [Transaction, Transaction];
84
+ interface CreateRefundTxInput {
85
+ sequence: number;
86
+ input: TransactionInput;
87
+ amountSats: bigint;
88
+ receivingPubkey: Uint8Array;
89
+ network: Network;
90
+ shouldCalculateFee: boolean;
91
+ includeAnchor: boolean;
92
+ }
93
+ declare function createRefundTx({ sequence, input, amountSats, receivingPubkey, network, shouldCalculateFee, includeAnchor, }: CreateRefundTxInput): Transaction;
94
+ interface CreateRefundTxsInput {
95
+ sequence: number;
96
+ directSequence?: number;
97
+ input: TransactionInput;
98
+ directInput?: TransactionInput;
99
+ amountSats: bigint;
100
+ receivingPubkey: Uint8Array;
101
+ network: Network;
102
+ }
103
+ declare function createRefundTxs({ sequence, directSequence, input, directInput, amountSats, receivingPubkey, network, }: CreateRefundTxsInput): {
104
+ cpfpRefundTx: Transaction;
105
+ directRefundTx?: Transaction;
106
+ directFromCpfpRefundTx?: Transaction;
107
+ };
108
+ declare function createConnectorRefundTransactions(sequence: number, cpfpNodeOutPoint: TransactionInput, directNodeOutPoint: TransactionInput, connectorOutput: TransactionInput, amountSats: bigint, receiverPubKey: Uint8Array, network: Network, shouldCalculateFee: boolean): [Transaction, Transaction, Transaction];
66
109
  declare function getCurrentTimelock(currSequence?: number): number;
67
- declare function getTransactionSequence(currSequence?: number): number;
110
+ declare function getTransactionSequence(currSequence?: number): {
111
+ nextSequence: number;
112
+ nextDirectSequence: number;
113
+ };
68
114
  declare function checkIfValidSequence(currSequence?: number): void;
69
- declare function getNextTransactionSequence(currSequence?: number, forRefresh?: boolean): {
115
+ declare function doesLeafNeedRefresh(currSequence: number, isNodeTx?: boolean): boolean;
116
+ declare function getNextTransactionSequence(currSequence: number, isNodeTx?: boolean): {
70
117
  nextSequence: number;
71
- needRefresh: boolean;
118
+ nextDirectSequence: number;
72
119
  };
73
120
  declare function getEphemeralAnchorOutput(): TransactionOutput;
74
121
 
@@ -123,4 +170,4 @@ declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRa
123
170
 
124
171
  declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
125
172
 
126
- export { subtractPrivateKeys as $, getLatestDepositTxId as A, type BroadcastConfig as B, getNextTransactionSequence as C, DEFAULT_FEE_SATS as D, getP2TRAddressFromPkScript as E, type FeeBumpTxChain as F, getP2TRAddressFromPublicKey as G, getP2TRScriptFromPublicKey as H, getP2WPKHAddressFromPublicKey as I, getRandomSigningNonce as J, getSigHashFromTx as K, type LeafInfo as L, getSigningCommitmentFromNonce as M, getSparkAddressFromTaproot as N, getTransactionSequence as O, getTransferPackageSigningPayload as P, getTxFromRawTxBytes as Q, getTxFromRawTxHex as R, getTxId as S, type TxChain as T, type Utxo as U, getTxIdNoReverse as V, isEphemeralAnchorOutput as W, isTxBroadcast as X, lastKeyWithTarget as Y, maybeApplyFee as Z, proofOfPossessionMessageHashForDepositAddress as _, type BroadcastResult as a, subtractPublicKeys as a0, sumAvailableTokens as a1, sumOfPrivateKeys as a2, validateOutboundAdaptorSignature as a3, type FeeBumpTxPackage as b, type FeeRate as c, addPrivateKeys as d, addPublicKeys as e, applyAdaptorToSignature as f, applyAdditiveTweakToPublicKey as g, checkIfSelectedOutputsAreAvailable as h, checkIfValidSequence as i, collectResponses as j, computeTaprootKeyNoScript as k, constructFeeBumpTx as l, constructUnilateralExitFeeBumpPackages as m, constructUnilateralExitTxs as n, createRefundTx as o, createSigningCommitment as p, createSigningNonce as q, decodeBytesToSigningCommitment as r, decodeBytesToSigningNonce as s, encodeSigningCommitmentToBytes as t, encodeSigningNonceToBytes as u, filterTokenBalanceForTokenPublicKey as v, generateAdaptorFromSignature as w, generateSignatureFromExistingAdaptor as x, getCurrentTimelock as y, getEphemeralAnchorOutput as z };
173
+ export { getTransactionSequence as $, createSigningNonce as A, getSigningCommitmentFromNonce as B, encodeSigningNonceToBytes as C, decodeBytesToSigningNonce as D, createSigningCommitment as E, encodeSigningCommitmentToBytes as F, decodeBytesToSigningCommitment as G, sumAvailableTokens as H, checkIfSelectedOutputsAreAvailable as I, filterTokenBalanceForTokenPublicKey as J, getTransferPackageSigningPayload as K, DIRECT_TIMELOCK_OFFSET as L, INITIAL_SEQUENCE as M, INITIAL_DIRECT_SEQUENCE as N, TEST_UNILATERAL_DIRECT_SEQUENCE as O, DEFAULT_FEE_SATS as P, maybeApplyFee as Q, createRootTx as R, createSplitTx as S, TEST_UNILATERAL_SEQUENCE as T, createNodeTx as U, createNodeTxs as V, createLeafNodeTx as W, createRefundTx as X, createRefundTxs as Y, createConnectorRefundTransactions as Z, getCurrentTimelock as _, generateAdaptorFromSignature as a, checkIfValidSequence as a0, doesLeafNeedRefresh as a1, getNextTransactionSequence as a2, getEphemeralAnchorOutput as a3, type LeafInfo as a4, type Utxo as a5, type FeeRate as a6, type FeeBumpTxPackage as a7, type FeeBumpTxChain as a8, type TxChain as a9, type BroadcastConfig as aa, type BroadcastResult as ab, isEphemeralAnchorOutput as ac, constructUnilateralExitTxs as ad, constructUnilateralExitFeeBumpPackages as ae, constructFeeBumpTx as af, getSparkAddressFromTaproot as ag, 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, addPublicKeys as n, applyAdditiveTweakToPublicKey as o, addPrivateKeys as p, subtractPrivateKeys as q, sumOfPrivateKeys as r, subtractPublicKeys as s, lastKeyWithTarget as t, getLatestDepositTxId as u, validateOutboundAdaptorSignature as v, isTxBroadcast as w, proofOfPossessionMessageHashForDepositAddress as x, collectResponses as y, getRandomSigningNonce as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildonspark/spark-sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "author": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -309,6 +309,8 @@ export default class SspClient {
309
309
 
310
310
  async requestLeaveSwap({
311
311
  adaptorPubkey,
312
+ directAdaptorPubkey,
313
+ directFromCpfpAdaptorPubkey,
312
314
  totalAmountSats,
313
315
  targetAmountSats,
314
316
  feeSats,
@@ -320,6 +322,8 @@ export default class SspClient {
320
322
  queryPayload: RequestSwapLeaves,
321
323
  variables: {
322
324
  adaptor_pubkey: adaptorPubkey,
325
+ direct_adaptor_pubkey: directAdaptorPubkey,
326
+ direct_from_cpfp_adaptor_pubkey: directFromCpfpAdaptorPubkey,
323
327
  total_amount_sats: totalAmountSats,
324
328
  target_amount_sats: targetAmountSats,
325
329
  fee_sats: feeSats,
@@ -340,6 +344,8 @@ export default class SspClient {
340
344
 
341
345
  async completeLeaveSwap({
342
346
  adaptorSecretKey,
347
+ directAdaptorSecretKey,
348
+ directFromCpfpAdaptorSecretKey,
343
349
  userOutboundTransferExternalId,
344
350
  leavesSwapRequestId,
345
351
  }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null> {
@@ -347,6 +353,8 @@ export default class SspClient {
347
353
  queryPayload: CompleteLeavesSwap,
348
354
  variables: {
349
355
  adaptor_secret_key: adaptorSecretKey,
356
+ direct_adaptor_secret_key: directAdaptorSecretKey,
357
+ direct_from_cpfp_adaptor_secret_key: directFromCpfpAdaptorSecretKey,
350
358
  user_outbound_transfer_external_id: userOutboundTransferExternalId,
351
359
  leaves_swap_request_id: leavesSwapRequestId,
352
360
  },
@@ -3,10 +3,18 @@ import { FRAGMENT as LeavesSwapRequestFragment } from "../objects/LeavesSwapRequ
3
3
  export const CompleteLeavesSwap = `
4
4
  mutation CompleteLeavesSwap(
5
5
  $adaptor_secret_key: String!
6
+ $direct_adaptor_secret_key: String!
7
+ $direct_from_cpfp_adaptor_secret_key: String!
6
8
  $user_outbound_transfer_external_id: UUID!
7
9
  $leaves_swap_request_id: ID!
8
10
  ) {
9
- complete_leaves_swap(input: { adaptor_secret_key: $adaptor_secret_key, user_outbound_transfer_external_id: $user_outbound_transfer_external_id, leaves_swap_request_id: $leaves_swap_request_id }) {
11
+ complete_leaves_swap(input: {
12
+ adaptor_secret_key: $adaptor_secret_key,
13
+ direct_adaptor_secret_key: $direct_adaptor_secret_key,
14
+ direct_from_cpfp_adaptor_secret_key: $direct_from_cpfp_adaptor_secret_key,
15
+ user_outbound_transfer_external_id: $user_outbound_transfer_external_id,
16
+ leaves_swap_request_id: $leaves_swap_request_id
17
+ }) {
10
18
  request {
11
19
  ...LeavesSwapRequestFragment
12
20
  }
@@ -3,6 +3,8 @@ import { FRAGMENT as LeavesSwapRequestFragment } from "../objects/LeavesSwapRequ
3
3
  export const RequestSwapLeaves = `
4
4
  mutation RequestSwapLeaves(
5
5
  $adaptor_pubkey: PublicKey!
6
+ $direct_adaptor_pubkey: PublicKey
7
+ $direct_from_cpfp_adaptor_pubkey: PublicKey
6
8
  $total_amount_sats: Long!
7
9
  $target_amount_sats: Long!
8
10
  $fee_sats: Long!
@@ -12,6 +14,8 @@ export const RequestSwapLeaves = `
12
14
  ) {
13
15
  request_leaves_swap(input: {
14
16
  adaptor_pubkey: $adaptor_pubkey
17
+ direct_adaptor_pubkey: $direct_adaptor_pubkey
18
+ direct_from_cpfp_adaptor_pubkey: $direct_from_cpfp_adaptor_pubkey
15
19
  total_amount_sats: $total_amount_sats
16
20
  target_amount_sats: $target_amount_sats
17
21
  fee_sats: $fee_sats
@@ -1,45 +1,45 @@
1
-
2
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
2
 
4
-
5
-
6
-
7
-
8
3
  interface CompleteLeavesSwapInput {
4
+ adaptorSecretKey: string;
9
5
 
6
+ directAdaptorSecretKey: string;
10
7
 
11
- adaptorSecretKey: string;
12
-
13
- userOutboundTransferExternalId: string;
14
-
15
- leavesSwapRequestId: string;
16
-
17
-
8
+ directFromCpfpAdaptorSecretKey: string;
18
9
 
10
+ userOutboundTransferExternalId: string;
19
11
 
12
+ leavesSwapRequestId: string;
20
13
  }
21
14
 
22
- export const CompleteLeavesSwapInputFromJson = (obj: any): CompleteLeavesSwapInput => {
23
- return {
24
- adaptorSecretKey: obj["complete_leaves_swap_input_adaptor_secret_key"],
25
- userOutboundTransferExternalId: obj["complete_leaves_swap_input_user_outbound_transfer_external_id"],
26
- leavesSwapRequestId: obj["complete_leaves_swap_input_leaves_swap_request_id"],
27
-
28
- } as CompleteLeavesSwapInput;
29
-
30
- }
31
- export const CompleteLeavesSwapInputToJson = (obj: CompleteLeavesSwapInput): any => {
32
- return {
33
- complete_leaves_swap_input_adaptor_secret_key: obj.adaptorSecretKey,
34
- complete_leaves_swap_input_user_outbound_transfer_external_id: obj.userOutboundTransferExternalId,
35
- complete_leaves_swap_input_leaves_swap_request_id: obj.leavesSwapRequestId,
36
-
37
- }
38
-
39
- }
40
-
41
-
42
-
43
-
15
+ export const CompleteLeavesSwapInputFromJson = (
16
+ obj: any,
17
+ ): CompleteLeavesSwapInput => {
18
+ return {
19
+ adaptorSecretKey: obj["complete_leaves_swap_input_adaptor_secret_key"],
20
+ directAdaptorSecretKey:
21
+ obj["complete_leaves_swap_input_direct_adaptor_secret_key"],
22
+ directFromCpfpAdaptorSecretKey:
23
+ obj["complete_leaves_swap_input_direct_from_cpfp_adaptor_secret_key"],
24
+ userOutboundTransferExternalId:
25
+ obj["complete_leaves_swap_input_user_outbound_transfer_external_id"],
26
+ leavesSwapRequestId:
27
+ obj["complete_leaves_swap_input_leaves_swap_request_id"],
28
+ } as CompleteLeavesSwapInput;
29
+ };
30
+ export const CompleteLeavesSwapInputToJson = (
31
+ obj: CompleteLeavesSwapInput,
32
+ ): any => {
33
+ return {
34
+ complete_leaves_swap_input_adaptor_secret_key: obj.adaptorSecretKey,
35
+ complete_leaves_swap_input_direct_adaptor_secret_key:
36
+ obj.directAdaptorSecretKey,
37
+ complete_leaves_swap_input_direct_from_cpfp_adaptor_secret_key:
38
+ obj.directFromCpfpAdaptorSecretKey,
39
+ complete_leaves_swap_input_user_outbound_transfer_external_id:
40
+ obj.userOutboundTransferExternalId,
41
+ complete_leaves_swap_input_leaves_swap_request_id: obj.leavesSwapRequestId,
42
+ };
43
+ };
44
44
 
45
45
  export default CompleteLeavesSwapInput;
@@ -175,6 +175,10 @@ fragment LeavesSwapRequestFragment on LeavesSwapRequest {
175
175
  swap_leaf_leaf_id: leaf_id
176
176
  swap_leaf_raw_unsigned_refund_transaction: raw_unsigned_refund_transaction
177
177
  swap_leaf_adaptor_signed_signature: adaptor_signed_signature
178
+ swap_leaf_direct_raw_unsigned_refund_transaction: direct_raw_unsigned_refund_transaction
179
+ swap_leaf_direct_adaptor_signed_signature: direct_adaptor_signed_signature
180
+ swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction: direct_from_cpfp_raw_unsigned_refund_transaction
181
+ swap_leaf_direct_from_cpfp_adaptor_signed_signature: direct_from_cpfp_adaptor_signed_signature
178
182
  }
179
183
  }`;
180
184