@buildonspark/spark-sdk 0.0.19 → 0.0.20

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 (123) hide show
  1. package/dist/graphql/client.d.ts +2 -1
  2. package/dist/graphql/client.js +13 -0
  3. package/dist/graphql/client.js.map +1 -1
  4. package/dist/graphql/mutations/CompleteCoopExit.d.ts +1 -1
  5. package/dist/graphql/mutations/CompleteLeavesSwap.d.ts +1 -1
  6. package/dist/graphql/mutations/RequestCoopExit.d.ts +1 -1
  7. package/dist/graphql/mutations/RequestLightningReceive.d.ts +1 -1
  8. package/dist/graphql/mutations/RequestLightningSend.d.ts +1 -1
  9. package/dist/graphql/mutations/RequestSwapLeaves.d.ts +1 -1
  10. package/dist/graphql/objects/Connection.js +1 -1
  11. package/dist/graphql/objects/Connection.js.map +1 -1
  12. package/dist/graphql/objects/CoopExitFeeEstimateOutput.js.map +1 -1
  13. package/dist/graphql/objects/CoopExitRequest.d.ts +5 -2
  14. package/dist/graphql/objects/CoopExitRequest.js +5 -1
  15. package/dist/graphql/objects/CoopExitRequest.js.map +1 -1
  16. package/dist/graphql/objects/CurrencyUnit.d.ts +2 -0
  17. package/dist/graphql/objects/CurrencyUnit.js +2 -0
  18. package/dist/graphql/objects/CurrencyUnit.js.map +1 -1
  19. package/dist/graphql/objects/Entity.d.ts +1 -1
  20. package/dist/graphql/objects/Entity.js +4 -0
  21. package/dist/graphql/objects/Entity.js.map +1 -1
  22. package/dist/graphql/objects/Invoice.d.ts +1 -1
  23. package/dist/graphql/objects/Invoice.js +2 -2
  24. package/dist/graphql/objects/Invoice.js.map +1 -1
  25. package/dist/graphql/objects/Leaf.js.map +1 -1
  26. package/dist/graphql/objects/LeavesSwapFeeEstimateOutput.js.map +1 -1
  27. package/dist/graphql/objects/LeavesSwapRequest.d.ts +12 -9
  28. package/dist/graphql/objects/LeavesSwapRequest.js +16 -21
  29. package/dist/graphql/objects/LeavesSwapRequest.js.map +1 -1
  30. package/dist/graphql/objects/LightningReceiveFeeEstimateOutput.js.map +1 -1
  31. package/dist/graphql/objects/LightningReceiveRequest.d.ts +5 -2
  32. package/dist/graphql/objects/LightningReceiveRequest.js +5 -1
  33. package/dist/graphql/objects/LightningReceiveRequest.js.map +1 -1
  34. package/dist/graphql/objects/LightningSendFeeEstimateOutput.js.map +1 -1
  35. package/dist/graphql/objects/LightningSendRequest.d.ts +6 -3
  36. package/dist/graphql/objects/LightningSendRequest.js +5 -1
  37. package/dist/graphql/objects/LightningSendRequest.js.map +1 -1
  38. package/dist/graphql/objects/RequestLeavesSwapInput.js +1 -1
  39. package/dist/graphql/objects/RequestLeavesSwapInput.js.map +1 -1
  40. package/dist/graphql/objects/SparkCoopExitRequestStatus.d.ts +5 -2
  41. package/dist/graphql/objects/SparkCoopExitRequestStatus.js +4 -1
  42. package/dist/graphql/objects/SparkCoopExitRequestStatus.js.map +1 -1
  43. package/dist/graphql/objects/SparkLeavesSwapRequestStatus.d.ts +5 -2
  44. package/dist/graphql/objects/SparkLeavesSwapRequestStatus.js +4 -1
  45. package/dist/graphql/objects/SparkLeavesSwapRequestStatus.js.map +1 -1
  46. package/dist/graphql/objects/SparkTransferToLeavesConnection.d.ts +5 -5
  47. package/dist/graphql/objects/SparkTransferToLeavesConnection.js +5 -6
  48. package/dist/graphql/objects/SparkTransferToLeavesConnection.js.map +1 -1
  49. package/dist/graphql/objects/Transfer.d.ts +1 -1
  50. package/dist/graphql/objects/UserRequest.d.ts +22 -0
  51. package/dist/graphql/objects/UserRequest.js +310 -0
  52. package/dist/graphql/objects/UserRequest.js.map +1 -0
  53. package/dist/graphql/objects/VerifyChallengeInput.js.map +1 -1
  54. package/dist/graphql/objects/index.d.ts +1 -0
  55. package/dist/graphql/objects/index.js +1 -0
  56. package/dist/graphql/objects/index.js.map +1 -1
  57. package/dist/graphql/queries/LeavesSwapFeeEstimate.d.ts +1 -0
  58. package/dist/graphql/queries/LeavesSwapFeeEstimate.js +16 -0
  59. package/dist/graphql/queries/LeavesSwapFeeEstimate.js.map +1 -0
  60. package/dist/services/coop-exit.js +2 -2
  61. package/dist/services/coop-exit.js.map +1 -1
  62. package/dist/services/lightning.js +1 -1
  63. package/dist/services/lightning.js.map +1 -1
  64. package/dist/services/transfer.js +3 -3
  65. package/dist/services/transfer.js.map +1 -1
  66. package/dist/spark-sdk.d.ts +18 -3
  67. package/dist/spark-sdk.js +88 -16
  68. package/dist/spark-sdk.js.map +1 -1
  69. package/dist/tests/adaptor-signature.test.js +1 -1
  70. package/dist/tests/adaptor-signature.test.js.map +1 -1
  71. package/dist/tests/coop-exit.test.js +2 -2
  72. package/dist/tests/coop-exit.test.js.map +1 -1
  73. package/dist/tests/deposit.test.js +2 -2
  74. package/dist/tests/deposit.test.js.map +1 -1
  75. package/dist/tests/lightning.test.js +2 -2
  76. package/dist/tests/lightning.test.js.map +1 -1
  77. package/dist/tests/swap.test.js +2 -2
  78. package/dist/tests/swap.test.js.map +1 -1
  79. package/dist/tests/transfer.test.js +7 -7
  80. package/dist/tests/transfer.test.js.map +1 -1
  81. package/dist/tests/utils/spark-testing-wallet.d.ts +1 -1
  82. package/dist/tests/utils/spark-testing-wallet.js +1 -1
  83. package/dist/tests/utils/spark-testing-wallet.js.map +1 -1
  84. package/dist/utils/transaction.d.ts +4 -1
  85. package/dist/utils/transaction.js +6 -2
  86. package/dist/utils/transaction.js.map +1 -1
  87. package/package.json +2 -2
  88. package/src/examples/example.ts +1 -1
  89. package/src/graphql/client.ts +19 -0
  90. package/src/graphql/objects/Connection.ts +3 -3
  91. package/src/graphql/objects/CoopExitFeeEstimateOutput.ts +1 -1
  92. package/src/graphql/objects/CoopExitRequest.ts +9 -1
  93. package/src/graphql/objects/CurrencyUnit.ts +2 -0
  94. package/src/graphql/objects/Entity.ts +4 -0
  95. package/src/graphql/objects/Invoice.ts +2 -2
  96. package/src/graphql/objects/Leaf.ts +1 -1
  97. package/src/graphql/objects/LeavesSwapFeeEstimateOutput.ts +1 -1
  98. package/src/graphql/objects/LeavesSwapRequest.ts +99 -98
  99. package/src/graphql/objects/LightningReceiveFeeEstimateOutput.ts +1 -1
  100. package/src/graphql/objects/LightningReceiveRequest.ts +11 -3
  101. package/src/graphql/objects/LightningSendFeeEstimateOutput.ts +1 -1
  102. package/src/graphql/objects/LightningSendRequest.ts +10 -2
  103. package/src/graphql/objects/RequestLeavesSwapInput.ts +1 -1
  104. package/src/graphql/objects/SparkCoopExitRequestStatus.ts +7 -1
  105. package/src/graphql/objects/SparkLeavesSwapRequestStatus.ts +7 -1
  106. package/src/graphql/objects/SparkTransferToLeavesConnection.ts +50 -45
  107. package/src/graphql/objects/Transfer.ts +1 -1
  108. package/src/graphql/objects/UserRequest.ts +359 -0
  109. package/src/graphql/objects/VerifyChallengeInput.ts +1 -1
  110. package/src/graphql/objects/index.ts +1 -0
  111. package/src/graphql/queries/LeavesSwapFeeEstimate.ts +16 -0
  112. package/src/services/coop-exit.ts +2 -2
  113. package/src/services/lightning.ts +1 -1
  114. package/src/services/transfer.ts +4 -3
  115. package/src/spark-sdk.ts +132 -20
  116. package/src/tests/adaptor-signature.test.ts +1 -1
  117. package/src/tests/coop-exit.test.ts +2 -2
  118. package/src/tests/deposit.test.ts +2 -2
  119. package/src/tests/lightning.test.ts +2 -2
  120. package/src/tests/swap.test.ts +2 -2
  121. package/src/tests/transfer.test.ts +7 -7
  122. package/src/tests/utils/spark-testing-wallet.ts +1 -1
  123. package/src/utils/transaction.ts +11 -3
@@ -1,113 +1,116 @@
1
+
1
2
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
3
 
3
- import Entity from "./Entity.js";
4
- import SparkLeavesSwapRequestStatus from "./SparkLeavesSwapRequestStatus.js";
5
- import { CurrencyAmountToJson } from "./CurrencyAmount.js";
6
- import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
7
- import { TransferFromJson } from "./Transfer.js";
8
- import { SwapLeafToJson } from "./SwapLeaf.js";
9
- import SwapLeaf from "./SwapLeaf.js";
10
- import CurrencyAmount from "./CurrencyAmount.js";
11
- import { Query, isObject } from "@lightsparkdev/core";
12
- import Transfer from "./Transfer.js";
13
- import { SwapLeafFromJson } from "./SwapLeaf.js";
4
+ import UserRequest from './UserRequest.js';
5
+ import Entity from './Entity.js';
6
+ import BitcoinNetwork from './BitcoinNetwork.js';
7
+ import SwapLeaf from './SwapLeaf.js';
8
+ import {SwapLeafToJson} from './SwapLeaf.js';
9
+ import {CurrencyAmountToJson} from './CurrencyAmount.js';
10
+ import {CurrencyAmountFromJson} from './CurrencyAmount.js';
11
+ import {TransferFromJson} from './Transfer.js';
12
+ import CurrencyAmount from './CurrencyAmount.js';
13
+ import Transfer from './Transfer.js';
14
+ import { Query, isObject } from '@lightsparkdev/core';
15
+ import SparkLeavesSwapRequestStatus from './SparkLeavesSwapRequestStatus.js';
16
+ import {SwapLeafFromJson} from './SwapLeaf.js';
17
+
14
18
 
15
19
  interface LeavesSwapRequest {
16
- /**
17
- * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
18
- * string.
19
- **/
20
- id: string;
21
20
 
22
- /** The date and time when the entity was first created. **/
23
- createdAt: string;
24
21
 
25
- /** The date and time when the entity was last updated. **/
26
- updatedAt: string;
22
+ /**
23
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
24
+ * string.
25
+ **/
26
+ id: string;
27
+
28
+ /** The date and time when the entity was first created. **/
29
+ createdAt: string;
30
+
31
+ /** The date and time when the entity was last updated. **/
32
+ updatedAt: string;
33
+
34
+ /** The network the lightning send request is on. **/
35
+ network: BitcoinNetwork;
36
+
37
+ /** The status of the request. **/
38
+ status: SparkLeavesSwapRequestStatus;
27
39
 
28
- /** The status of the request. **/
29
- status: SparkLeavesSwapRequestStatus;
40
+ /** The total amount of leaves user sent for swap. **/
41
+ totalAmount: CurrencyAmount;
30
42
 
31
- /** The total amount of leaves user sent for swap. **/
32
- totalAmount: CurrencyAmount;
43
+ /** The target amount of leaves user wanted to get from the swap. **/
44
+ targetAmount: CurrencyAmount;
33
45
 
34
- /** The target amount of leaves user wanted to get from the swap. **/
35
- targetAmount: CurrencyAmount;
46
+ /** The fee user needs to pay for swap. **/
47
+ fee: CurrencyAmount;
36
48
 
37
- /** The fee user needs to pay for swap. **/
38
- fee: CurrencyAmount;
49
+ /** The leaves transfer to user. **/
50
+ inboundTransfer: Transfer;
39
51
 
40
- /** The leaves transfer to user. **/
41
- inboundTransfer: Transfer;
52
+ /** The time when the leaves swap request expires. **/
53
+ expiresAt: string;
54
+
55
+ /** The swap leaves returned to the user **/
56
+ swapLeaves: SwapLeaf[];
57
+
58
+ /** The typename of the object **/
59
+ typename: string;
60
+
61
+ /** The leaves transfer out from user. **/
62
+ outboundTransfer?: Transfer | undefined;
42
63
 
43
- /** The time when the leaves swap request expires. **/
44
- expiresAt: string;
45
64
 
46
- /** The swap leaves returned to the user **/
47
- swapLeaves: SwapLeaf[];
48
65
 
49
- /** The typename of the object **/
50
- typename: string;
51
66
 
52
- /** The leaves transfer out from user. **/
53
- outboundTransfer?: Transfer | undefined;
54
67
  }
55
68
 
56
69
  export const LeavesSwapRequestFromJson = (obj: any): LeavesSwapRequest => {
57
- return {
58
- id: obj["leaves_swap_request_id"],
59
- createdAt: obj["leaves_swap_request_created_at"],
60
- updatedAt: obj["leaves_swap_request_updated_at"],
61
- status:
62
- SparkLeavesSwapRequestStatus[obj["leaves_swap_request_status"]] ??
63
- SparkLeavesSwapRequestStatus.FUTURE_VALUE,
64
- totalAmount: CurrencyAmountFromJson(
65
- obj["leaves_swap_request_total_amount"],
66
- ),
67
- targetAmount: CurrencyAmountFromJson(
68
- obj["leaves_swap_request_target_amount"],
69
- ),
70
- fee: CurrencyAmountFromJson(obj["leaves_swap_request_fee"]),
71
- inboundTransfer: TransferFromJson(
72
- obj["leaves_swap_request_inbound_transfer"],
73
- ),
74
- expiresAt: obj["leaves_swap_request_expires_at"],
75
- swapLeaves: obj["leaves_swap_request_swap_leaves"].map((e) =>
76
- SwapLeafFromJson(e),
77
- ),
78
- typename: "LeavesSwapRequest",
79
- outboundTransfer: !!obj["leaves_swap_request_outbound_transfer"]
80
- ? TransferFromJson(obj["leaves_swap_request_outbound_transfer"])
81
- : undefined,
82
- } as LeavesSwapRequest;
83
- };
70
+ return {
71
+ id: obj["leaves_swap_request_id"],
72
+ createdAt: obj["leaves_swap_request_created_at"],
73
+ updatedAt: obj["leaves_swap_request_updated_at"],
74
+ network: BitcoinNetwork[obj["leaves_swap_request_network"]] ?? BitcoinNetwork.FUTURE_VALUE,
75
+ status: SparkLeavesSwapRequestStatus[obj["leaves_swap_request_status"]] ?? SparkLeavesSwapRequestStatus.FUTURE_VALUE,
76
+ totalAmount: CurrencyAmountFromJson(obj["leaves_swap_request_total_amount"]),
77
+ targetAmount: CurrencyAmountFromJson(obj["leaves_swap_request_target_amount"]),
78
+ fee: CurrencyAmountFromJson(obj["leaves_swap_request_fee"]),
79
+ inboundTransfer: TransferFromJson(obj["leaves_swap_request_inbound_transfer"]),
80
+ expiresAt: obj["leaves_swap_request_expires_at"],
81
+ swapLeaves: obj["leaves_swap_request_swap_leaves"].map((e) => SwapLeafFromJson(e)),
82
+ typename: "LeavesSwapRequest", outboundTransfer: (!!obj["leaves_swap_request_outbound_transfer"] ? TransferFromJson(obj["leaves_swap_request_outbound_transfer"]) : undefined),
83
+
84
+ } as LeavesSwapRequest;
85
+
86
+ }
84
87
  export const LeavesSwapRequestToJson = (obj: LeavesSwapRequest): any => {
85
- return {
86
- __typename: "LeavesSwapRequest",
87
- leaves_swap_request_id: obj.id,
88
- leaves_swap_request_created_at: obj.createdAt,
89
- leaves_swap_request_updated_at: obj.updatedAt,
90
- leaves_swap_request_status: obj.status,
91
- leaves_swap_request_total_amount: CurrencyAmountToJson(obj.totalAmount),
92
- leaves_swap_request_target_amount: CurrencyAmountToJson(obj.targetAmount),
93
- leaves_swap_request_fee: CurrencyAmountToJson(obj.fee),
94
- leaves_swap_request_inbound_transfer: obj.inboundTransfer.toJson(),
95
- leaves_swap_request_outbound_transfer: obj.outboundTransfer
96
- ? obj.outboundTransfer.toJson()
97
- : undefined,
98
- leaves_swap_request_expires_at: obj.expiresAt,
99
- leaves_swap_request_swap_leaves: obj.swapLeaves.map((e) =>
100
- SwapLeafToJson(e),
101
- ),
102
- };
103
- };
104
-
105
- export const FRAGMENT = `
88
+ return {
89
+ __typename: "LeavesSwapRequest",leaves_swap_request_id: obj.id,
90
+ leaves_swap_request_created_at: obj.createdAt,
91
+ leaves_swap_request_updated_at: obj.updatedAt,
92
+ leaves_swap_request_network: obj.network,
93
+ leaves_swap_request_status: obj.status,
94
+ leaves_swap_request_total_amount: CurrencyAmountToJson(obj.totalAmount),
95
+ leaves_swap_request_target_amount: CurrencyAmountToJson(obj.targetAmount),
96
+ leaves_swap_request_fee: CurrencyAmountToJson(obj.fee),
97
+ leaves_swap_request_inbound_transfer: obj.inboundTransfer.toJson(),
98
+ leaves_swap_request_outbound_transfer: (obj.outboundTransfer ? obj.outboundTransfer.toJson() : undefined),
99
+ leaves_swap_request_expires_at: obj.expiresAt,
100
+ leaves_swap_request_swap_leaves: obj.swapLeaves.map((e) => SwapLeafToJson(e)),
101
+
102
+ }
103
+
104
+ }
105
+
106
+
107
+ export const FRAGMENT = `
106
108
  fragment LeavesSwapRequestFragment on LeavesSwapRequest {
107
109
  __typename
108
110
  leaves_swap_request_id: id
109
111
  leaves_swap_request_created_at: created_at
110
112
  leaves_swap_request_updated_at: updated_at
113
+ leaves_swap_request_network: network
111
114
  leaves_swap_request_status: status
112
115
  leaves_swap_request_total_amount: total_amount {
113
116
  __typename
@@ -166,11 +169,11 @@ fragment LeavesSwapRequestFragment on LeavesSwapRequest {
166
169
  }
167
170
  }`;
168
171
 
169
- export const getLeavesSwapRequestQuery = (
170
- id: string,
171
- ): Query<LeavesSwapRequest> => {
172
- return {
173
- queryPayload: `
172
+
173
+
174
+ export const getLeavesSwapRequestQuery = (id: string): Query<LeavesSwapRequest> => {
175
+ return {
176
+ queryPayload: `
174
177
  query GetLeavesSwapRequest($id: ID!) {
175
178
  entity(id: $id) {
176
179
  ... on LeavesSwapRequest {
@@ -181,12 +184,10 @@ query GetLeavesSwapRequest($id: ID!) {
181
184
 
182
185
  ${FRAGMENT}
183
186
  `,
184
- variables: { id },
185
- constructObject: (data: unknown) =>
186
- isObject(data) && "entity" in data && isObject(data.entity)
187
- ? LeavesSwapRequestFromJson(data.entity)
188
- : null,
189
- };
190
- };
187
+ variables: {id},
188
+ constructObject: (data: unknown) => isObject(data) && "entity" in data && isObject(data.entity) ? LeavesSwapRequestFromJson(data.entity) : null,
189
+ }
190
+ }
191
+
191
192
 
192
193
  export default LeavesSwapRequest;
@@ -2,9 +2,9 @@
2
2
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
3
 
4
4
 
5
+ import CurrencyAmount from './CurrencyAmount.js';
5
6
  import {CurrencyAmountToJson} from './CurrencyAmount.js';
6
7
  import {CurrencyAmountFromJson} from './CurrencyAmount.js';
7
- import CurrencyAmount from './CurrencyAmount.js';
8
8
 
9
9
 
10
10
  interface LightningReceiveFeeEstimateOutput {
@@ -1,16 +1,18 @@
1
1
 
2
2
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
3
 
4
+ import UserRequest from './UserRequest.js';
4
5
  import Entity from './Entity.js';
6
+ import BitcoinNetwork from './BitcoinNetwork.js';
7
+ import {InvoiceFromJson} from './Invoice.js';
5
8
  import {CurrencyAmountToJson} from './CurrencyAmount.js';
6
9
  import {CurrencyAmountFromJson} from './CurrencyAmount.js';
7
- import Invoice from './Invoice.js';
8
- import {InvoiceFromJson} from './Invoice.js';
9
10
  import {TransferFromJson} from './Transfer.js';
11
+ import Invoice from './Invoice.js';
10
12
  import LightningReceiveRequestStatus from './LightningReceiveRequestStatus.js';
11
13
  import CurrencyAmount from './CurrencyAmount.js';
12
- import { Query, isObject } from '@lightsparkdev/core';
13
14
  import Transfer from './Transfer.js';
15
+ import { Query, isObject } from '@lightsparkdev/core';
14
16
  import {InvoiceToJson} from './Invoice.js';
15
17
 
16
18
 
@@ -29,6 +31,9 @@ createdAt: string;
29
31
  /** The date and time when the entity was last updated. **/
30
32
  updatedAt: string;
31
33
 
34
+ /** The network the lightning send request is on. **/
35
+ network: BitcoinNetwork;
36
+
32
37
  /** The lightning invoice generated to receive lightning payment. **/
33
38
  invoice: Invoice;
34
39
 
@@ -54,6 +59,7 @@ export const LightningReceiveRequestFromJson = (obj: any): LightningReceiveReque
54
59
  id: obj["lightning_receive_request_id"],
55
60
  createdAt: obj["lightning_receive_request_created_at"],
56
61
  updatedAt: obj["lightning_receive_request_updated_at"],
62
+ network: BitcoinNetwork[obj["lightning_receive_request_network"]] ?? BitcoinNetwork.FUTURE_VALUE,
57
63
  invoice: InvoiceFromJson(obj["lightning_receive_request_invoice"]),
58
64
  fee: CurrencyAmountFromJson(obj["lightning_receive_request_fee"]),
59
65
  status: LightningReceiveRequestStatus[obj["lightning_receive_request_status"]] ?? LightningReceiveRequestStatus.FUTURE_VALUE,
@@ -67,6 +73,7 @@ return {
67
73
  __typename: "LightningReceiveRequest",lightning_receive_request_id: obj.id,
68
74
  lightning_receive_request_created_at: obj.createdAt,
69
75
  lightning_receive_request_updated_at: obj.updatedAt,
76
+ lightning_receive_request_network: obj.network,
70
77
  lightning_receive_request_invoice: InvoiceToJson(obj.invoice),
71
78
  lightning_receive_request_fee: CurrencyAmountToJson(obj.fee),
72
79
  lightning_receive_request_status: obj.status,
@@ -83,6 +90,7 @@ fragment LightningReceiveRequestFragment on LightningReceiveRequest {
83
90
  lightning_receive_request_id: id
84
91
  lightning_receive_request_created_at: created_at
85
92
  lightning_receive_request_updated_at: updated_at
93
+ lightning_receive_request_network: network
86
94
  lightning_receive_request_invoice: invoice {
87
95
  __typename
88
96
  invoice_encoded_envoice: encoded_envoice
@@ -2,9 +2,9 @@
2
2
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
3
 
4
4
 
5
+ import CurrencyAmount from './CurrencyAmount.js';
5
6
  import {CurrencyAmountToJson} from './CurrencyAmount.js';
6
7
  import {CurrencyAmountFromJson} from './CurrencyAmount.js';
7
- import CurrencyAmount from './CurrencyAmount.js';
8
8
 
9
9
 
10
10
  interface LightningSendFeeEstimateOutput {
@@ -1,14 +1,16 @@
1
1
 
2
2
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
3
 
4
+ import UserRequest from './UserRequest.js';
4
5
  import Entity from './Entity.js';
6
+ import BitcoinNetwork from './BitcoinNetwork.js';
5
7
  import {CurrencyAmountToJson} from './CurrencyAmount.js';
6
8
  import {CurrencyAmountFromJson} from './CurrencyAmount.js';
7
- import LightningSendRequestStatus from './LightningSendRequestStatus.js';
8
9
  import {TransferFromJson} from './Transfer.js';
9
10
  import CurrencyAmount from './CurrencyAmount.js';
10
- import { Query, isObject } from '@lightsparkdev/core';
11
11
  import Transfer from './Transfer.js';
12
+ import { Query, isObject } from '@lightsparkdev/core';
13
+ import LightningSendRequestStatus from './LightningSendRequestStatus.js';
12
14
 
13
15
 
14
16
  interface LightningSendRequest {
@@ -26,6 +28,9 @@ createdAt: string;
26
28
  /** The date and time when the entity was last updated. **/
27
29
  updatedAt: string;
28
30
 
31
+ /** The network the lightning send request is on. **/
32
+ network: BitcoinNetwork;
33
+
29
34
  /** The lightning invoice user requested to pay. **/
30
35
  encodedInvoice: string;
31
36
 
@@ -54,6 +59,7 @@ export const LightningSendRequestFromJson = (obj: any): LightningSendRequest =>
54
59
  id: obj["lightning_send_request_id"],
55
60
  createdAt: obj["lightning_send_request_created_at"],
56
61
  updatedAt: obj["lightning_send_request_updated_at"],
62
+ network: BitcoinNetwork[obj["lightning_send_request_network"]] ?? BitcoinNetwork.FUTURE_VALUE,
57
63
  encodedInvoice: obj["lightning_send_request_encoded_invoice"],
58
64
  fee: CurrencyAmountFromJson(obj["lightning_send_request_fee"]),
59
65
  idempotencyKey: obj["lightning_send_request_idempotency_key"],
@@ -68,6 +74,7 @@ return {
68
74
  __typename: "LightningSendRequest",lightning_send_request_id: obj.id,
69
75
  lightning_send_request_created_at: obj.createdAt,
70
76
  lightning_send_request_updated_at: obj.updatedAt,
77
+ lightning_send_request_network: obj.network,
71
78
  lightning_send_request_encoded_invoice: obj.encodedInvoice,
72
79
  lightning_send_request_fee: CurrencyAmountToJson(obj.fee),
73
80
  lightning_send_request_idempotency_key: obj.idempotencyKey,
@@ -85,6 +92,7 @@ fragment LightningSendRequestFragment on LightningSendRequest {
85
92
  lightning_send_request_id: id
86
93
  lightning_send_request_created_at: created_at
87
94
  lightning_send_request_updated_at: updated_at
95
+ lightning_send_request_network: network
88
96
  lightning_send_request_encoded_invoice: encoded_invoice
89
97
  lightning_send_request_fee: fee {
90
98
  __typename
@@ -2,9 +2,9 @@
2
2
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
3
 
4
4
 
5
- import {UserLeafInputFromJson} from './UserLeafInput.js';
6
5
  import UserLeafInput from './UserLeafInput.js';
7
6
  import {UserLeafInputToJson} from './UserLeafInput.js';
7
+ import {UserLeafInputFromJson} from './UserLeafInput.js';
8
8
 
9
9
 
10
10
  interface RequestLeavesSwapInput {
@@ -11,10 +11,16 @@ export enum SparkCoopExitRequestStatus {
11
11
 
12
12
  INITIATED = "INITIATED",
13
13
 
14
- FAILED = "FAILED",
14
+ TX_SIGNED = "TX_SIGNED",
15
+
16
+ TX_BROADCASTED = "TX_BROADCASTED",
15
17
 
16
18
  SUCCEEDED = "SUCCEEDED",
17
19
 
20
+ EXPIRED = "EXPIRED",
21
+
22
+ FAILED = "FAILED",
23
+
18
24
  }
19
25
 
20
26
  export default SparkCoopExitRequestStatus;
@@ -11,10 +11,16 @@ export enum SparkLeavesSwapRequestStatus {
11
11
 
12
12
  INITIATED = "INITIATED",
13
13
 
14
- FAILED = "FAILED",
14
+ REFUND_TX_ADAPTOR_SIGNED = "REFUND_TX_ADAPTOR_SIGNED",
15
+
16
+ INBOUND_TRANSFER_CLAIMED = "INBOUND_TRANSFER_CLAIMED",
15
17
 
16
18
  SUCCEEDED = "SUCCEEDED",
17
19
 
20
+ EXPIRED = "EXPIRED",
21
+
22
+ FAILED = "FAILED",
23
+
18
24
  }
19
25
 
20
26
  export default SparkLeavesSwapRequestStatus;
@@ -1,57 +1,59 @@
1
+
1
2
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
3
 
3
- import Leaf from "./Leaf.js";
4
- import { PageInfoToJson } from "./PageInfo.js";
5
- import { LeafToJson } from "./Leaf.js";
6
- import { PageInfoFromJson } from "./PageInfo.js";
7
- import { LeafFromJson } from "./Leaf.js";
8
- import PageInfo from "./PageInfo.js";
4
+ import Connection from './Connection.js';
5
+ import {PageInfoToJson} from './PageInfo.js';
6
+ import {PageInfoFromJson} from './PageInfo.js';
7
+ import PageInfo from './PageInfo.js';
8
+ import {LeafFromJson} from './Leaf.js';
9
+ import {LeafToJson} from './Leaf.js';
10
+ import Leaf from './Leaf.js';
11
+
9
12
 
10
13
  interface SparkTransferToLeavesConnection {
11
- /**
12
- * The total count of objects in this connection, using the current filters. It is different from the
13
- * number of objects returned in the current page (in the `entities` field).
14
- **/
15
- count: number;
16
14
 
17
- /** An object that holds pagination information about the objects in this connection. **/
18
- pageInfo: PageInfo;
19
15
 
20
- /** The leaves for the current page of this connection. **/
21
- entities: Leaf[];
16
+ /**
17
+ * The total count of objects in this connection, using the current filters. It is different from the
18
+ * number of objects returned in the current page (in the `entities` field).
19
+ **/
20
+ count: number;
21
+
22
+ /** An object that holds pagination information about the objects in this connection. **/
23
+ pageInfo: PageInfo;
24
+
25
+ /** The leaves for the current page of this connection. **/
26
+ entities: Leaf[];
27
+
28
+ /** The typename of the object **/
29
+ typename: string;
30
+
31
+
32
+
22
33
 
23
- /** The typename of the object **/
24
- typename: string;
25
34
  }
26
35
 
27
- export const SparkTransferToLeavesConnectionFromJson = (
28
- obj: any,
29
- ): SparkTransferToLeavesConnection => {
30
- return {
31
- count: obj["spark_transfer_to_leaves_connection_count"],
32
- pageInfo: PageInfoFromJson(
33
- obj["spark_transfer_to_leaves_connection_page_info"],
34
- ),
35
- entities: obj["spark_transfer_to_leaves_connection_entities"].map((e) =>
36
- LeafFromJson(e),
37
- ),
38
- typename: "SparkTransferToLeavesConnection",
39
- } as SparkTransferToLeavesConnection;
40
- };
41
- export const SparkTransferToLeavesConnectionToJson = (
42
- obj: SparkTransferToLeavesConnection,
43
- ): any => {
44
- return {
45
- __typename: "SparkTransferToLeavesConnection",
46
- spark_transfer_to_leaves_connection_count: obj.count,
47
- spark_transfer_to_leaves_connection_page_info: PageInfoToJson(obj.pageInfo),
48
- spark_transfer_to_leaves_connection_entities: obj.entities.map((e) =>
49
- LeafToJson(e),
50
- ),
51
- };
52
- };
53
-
54
- export const FRAGMENT = `
36
+ export const SparkTransferToLeavesConnectionFromJson = (obj: any): SparkTransferToLeavesConnection => {
37
+ return {
38
+ count: obj["spark_transfer_to_leaves_connection_count"],
39
+ pageInfo: PageInfoFromJson(obj["spark_transfer_to_leaves_connection_page_info"]),
40
+ entities: obj["spark_transfer_to_leaves_connection_entities"].map((e) => LeafFromJson(e)),
41
+ typename: "SparkTransferToLeavesConnection",
42
+ } as SparkTransferToLeavesConnection;
43
+
44
+ }
45
+ export const SparkTransferToLeavesConnectionToJson = (obj: SparkTransferToLeavesConnection): any => {
46
+ return {
47
+ __typename: "SparkTransferToLeavesConnection",spark_transfer_to_leaves_connection_count: obj.count,
48
+ spark_transfer_to_leaves_connection_page_info: PageInfoToJson(obj.pageInfo),
49
+ spark_transfer_to_leaves_connection_entities: obj.entities.map((e) => LeafToJson(e)),
50
+
51
+ }
52
+
53
+ }
54
+
55
+
56
+ export const FRAGMENT = `
55
57
  fragment SparkTransferToLeavesConnectionFragment on SparkTransferToLeavesConnection {
56
58
  __typename
57
59
  spark_transfer_to_leaves_connection_count: count
@@ -76,4 +78,7 @@ fragment SparkTransferToLeavesConnectionFragment on SparkTransferToLeavesConnect
76
78
  }
77
79
  }`;
78
80
 
81
+
82
+
83
+
79
84
  export default SparkTransferToLeavesConnection;
@@ -1,7 +1,7 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
3
  import autoBind from "auto-bind";
4
- import type LightsparkClient from "../client.js";
4
+ import LightsparkClient from "../client.js";
5
5
  import CurrencyAmount, {
6
6
  CurrencyAmountFromJson,
7
7
  CurrencyAmountToJson,