@lightsparkdev/lightspark-sdk 0.4.8 → 0.4.10

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 (86) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{chunk-YTXDF6SQ.js → chunk-NXUFC5J7.js} +950 -246
  3. package/dist/{index-adeff42d.d.ts → index-3ffe9e7b.d.ts} +194 -56
  4. package/dist/index.cjs +962 -254
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +15 -9
  7. package/dist/objects/index.cjs +952 -246
  8. package/dist/objects/index.d.ts +1 -1
  9. package/dist/objects/index.js +5 -1
  10. package/package.json +1 -2
  11. package/src/client.ts +13 -14
  12. package/src/objects/Account.ts +36 -30
  13. package/src/objects/AccountToApiTokensConnection.ts +11 -6
  14. package/src/objects/AccountToNodesConnection.ts +11 -6
  15. package/src/objects/AccountToPaymentRequestsConnection.ts +20 -15
  16. package/src/objects/AccountToTransactionsConnection.ts +19 -14
  17. package/src/objects/AccountToWalletsConnection.ts +11 -6
  18. package/src/objects/ApiToken.ts +2 -1
  19. package/src/objects/Balances.ts +1 -0
  20. package/src/objects/BitcoinNetwork.ts +2 -1
  21. package/src/objects/BlockchainBalance.ts +1 -1
  22. package/src/objects/Channel.ts +2 -2
  23. package/src/objects/ChannelClosingTransaction.ts +2 -2
  24. package/src/objects/ChannelFees.ts +1 -0
  25. package/src/objects/ChannelOpeningTransaction.ts +2 -2
  26. package/src/objects/ChannelStatus.ts +1 -0
  27. package/src/objects/Connection.ts +387 -0
  28. package/src/objects/CreateInvoiceInput.ts +12 -0
  29. package/src/objects/CreateLnurlInvoiceInput.ts +10 -0
  30. package/src/objects/CreateTestModePaymentoutput.ts +1 -0
  31. package/src/objects/CryptoSanctionsScreeningProvider.ts +14 -0
  32. package/src/objects/CurrencyAmount.ts +1 -1
  33. package/src/objects/CurrencyUnit.ts +1 -0
  34. package/src/objects/Deposit.ts +2 -2
  35. package/src/objects/Entity.ts +1 -1
  36. package/src/objects/FeeEstimate.ts +1 -0
  37. package/src/objects/GraphNode.ts +2 -2
  38. package/src/objects/Hop.ts +2 -2
  39. package/src/objects/HtlcAttemptFailureCode.ts +1 -0
  40. package/src/objects/IncomingPayment.ts +19 -6
  41. package/src/objects/IncomingPaymentAttempt.ts +2 -2
  42. package/src/objects/IncomingPaymentAttemptStatus.ts +1 -1
  43. package/src/objects/IncomingPaymentToAttemptsConnection.ts +21 -1
  44. package/src/objects/Invoice.ts +2 -2
  45. package/src/objects/InvoiceData.ts +1 -1
  46. package/src/objects/InvoiceType.ts +1 -0
  47. package/src/objects/LightningTransaction.ts +2 -2
  48. package/src/objects/LightsparkNode.ts +12 -6
  49. package/src/objects/LightsparkNodeOwner.ts +2 -2
  50. package/src/objects/LightsparkNodePurpose.ts +1 -0
  51. package/src/objects/LightsparkNodeToChannelsConnection.ts +11 -6
  52. package/src/objects/Node.ts +2 -3
  53. package/src/objects/NodeAddress.ts +1 -1
  54. package/src/objects/NodeAddressType.ts +1 -1
  55. package/src/objects/OnChainTransaction.ts +2 -3
  56. package/src/objects/OutgoingPayment.ts +14 -6
  57. package/src/objects/OutgoingPaymentAttempt.ts +14 -6
  58. package/src/objects/OutgoingPaymentAttemptStatus.ts +1 -1
  59. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +21 -1
  60. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +21 -1
  61. package/src/objects/PageInfo.ts +1 -0
  62. package/src/objects/PaymentFailureReason.ts +1 -0
  63. package/src/objects/PaymentRequest.ts +2 -2
  64. package/src/objects/PaymentRequestData.ts +1 -1
  65. package/src/objects/PaymentRequestStatus.ts +1 -0
  66. package/src/objects/Permission.ts +1 -0
  67. package/src/objects/RiskRating.ts +18 -0
  68. package/src/objects/RoutingTransaction.ts +2 -2
  69. package/src/objects/RoutingTransactionFailureReason.ts +1 -0
  70. package/src/objects/ScreenBitcoinAddressesInput.ts +23 -0
  71. package/src/objects/ScreenBitcoinAddressesOutput.ts +25 -0
  72. package/src/objects/Transaction.ts +2 -2
  73. package/src/objects/TransactionFailures.ts +1 -0
  74. package/src/objects/TransactionStatus.ts +1 -0
  75. package/src/objects/TransactionType.ts +1 -0
  76. package/src/objects/Wallet.ts +632 -7
  77. package/src/objects/WalletStatus.ts +1 -0
  78. package/src/objects/WalletToPaymentRequestsConnection.ts +57 -0
  79. package/src/objects/WalletToTransactionsConnection.ts +57 -0
  80. package/src/objects/WebhookEventType.ts +3 -0
  81. package/src/objects/Withdrawal.ts +2 -2
  82. package/src/objects/WithdrawalMode.ts +1 -0
  83. package/src/objects/WithdrawalRequest.ts +2 -1
  84. package/src/objects/WithdrawalRequestStatus.ts +1 -0
  85. package/src/objects/index.ts +7 -0
  86. package/src/objects/.eslintrc.cjs +0 -5
@@ -1,6 +1,6 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import type { Query } from "@lightsparkdev/core";
3
+ import { type Query } from "@lightsparkdev/core";
4
4
  import autoBind from "auto-bind";
5
5
  import type LightsparkClient from "../client.js";
6
6
  import type Balances from "./Balances.js";
@@ -8,8 +8,15 @@ import { BalancesFromJson } from "./Balances.js";
8
8
  import type CurrencyAmount from "./CurrencyAmount.js";
9
9
  import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
10
10
  import type LightsparkNodeOwner from "./LightsparkNodeOwner.js";
11
+ import type TransactionStatus from "./TransactionStatus.js";
12
+ import type TransactionType from "./TransactionType.js";
11
13
  import WalletStatus from "./WalletStatus.js";
14
+ import type WalletToPaymentRequestsConnection from "./WalletToPaymentRequestsConnection.js";
15
+ import { WalletToPaymentRequestsConnectionFromJson } from "./WalletToPaymentRequestsConnection.js";
16
+ import type WalletToTransactionsConnection from "./WalletToTransactionsConnection.js";
17
+ import { WalletToTransactionsConnectionFromJson } from "./WalletToTransactionsConnection.js";
12
18
 
19
+ /** This object represents a Lightspark Wallet, tied to your Lightspark account. Wallets can be used to send or receive funds over the Lightning Network. You can retrieve this object to receive information about a specific wallet tied to your Lightspark account. **/
13
20
  class Wallet implements LightsparkNodeOwner {
14
21
  constructor(
15
22
  public readonly id: string,
@@ -24,6 +31,622 @@ class Wallet implements LightsparkNodeOwner {
24
31
  autoBind(this);
25
32
  }
26
33
 
34
+ public async getTransactions(
35
+ client: LightsparkClient,
36
+ first: number | undefined = undefined,
37
+ after: string | undefined = undefined,
38
+ createdAfterDate: string | undefined = undefined,
39
+ createdBeforeDate: string | undefined = undefined,
40
+ statuses: TransactionStatus[] | undefined = undefined,
41
+ types: TransactionType[] | undefined = undefined
42
+ ): Promise<WalletToTransactionsConnection> {
43
+ return (await client.executeRawQuery({
44
+ queryPayload: `
45
+ query FetchWalletToTransactionsConnection($entity_id: ID!, $first: Int, $after: ID, $created_after_date: DateTime, $created_before_date: DateTime, $statuses: [TransactionStatus!], $types: [TransactionType!]) {
46
+ entity(id: $entity_id) {
47
+ ... on Wallet {
48
+ transactions(, first: $first, after: $after, created_after_date: $created_after_date, created_before_date: $created_before_date, statuses: $statuses, types: $types) {
49
+ __typename
50
+ wallet_to_transactions_connection_count: count
51
+ wallet_to_transactions_connection_page_info: page_info {
52
+ __typename
53
+ page_info_has_next_page: has_next_page
54
+ page_info_has_previous_page: has_previous_page
55
+ page_info_start_cursor: start_cursor
56
+ page_info_end_cursor: end_cursor
57
+ }
58
+ wallet_to_transactions_connection_entities: entities {
59
+ __typename
60
+ ... on ChannelClosingTransaction {
61
+ __typename
62
+ channel_closing_transaction_id: id
63
+ channel_closing_transaction_created_at: created_at
64
+ channel_closing_transaction_updated_at: updated_at
65
+ channel_closing_transaction_status: status
66
+ channel_closing_transaction_resolved_at: resolved_at
67
+ channel_closing_transaction_amount: amount {
68
+ __typename
69
+ currency_amount_original_value: original_value
70
+ currency_amount_original_unit: original_unit
71
+ currency_amount_preferred_currency_unit: preferred_currency_unit
72
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
73
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
74
+ }
75
+ channel_closing_transaction_transaction_hash: transaction_hash
76
+ channel_closing_transaction_fees: fees {
77
+ __typename
78
+ currency_amount_original_value: original_value
79
+ currency_amount_original_unit: original_unit
80
+ currency_amount_preferred_currency_unit: preferred_currency_unit
81
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
82
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
83
+ }
84
+ channel_closing_transaction_block_hash: block_hash
85
+ channel_closing_transaction_block_height: block_height
86
+ channel_closing_transaction_destination_addresses: destination_addresses
87
+ channel_closing_transaction_num_confirmations: num_confirmations
88
+ channel_closing_transaction_channel: channel {
89
+ id
90
+ }
91
+ }
92
+ ... on ChannelOpeningTransaction {
93
+ __typename
94
+ channel_opening_transaction_id: id
95
+ channel_opening_transaction_created_at: created_at
96
+ channel_opening_transaction_updated_at: updated_at
97
+ channel_opening_transaction_status: status
98
+ channel_opening_transaction_resolved_at: resolved_at
99
+ channel_opening_transaction_amount: amount {
100
+ __typename
101
+ currency_amount_original_value: original_value
102
+ currency_amount_original_unit: original_unit
103
+ currency_amount_preferred_currency_unit: preferred_currency_unit
104
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
105
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
106
+ }
107
+ channel_opening_transaction_transaction_hash: transaction_hash
108
+ channel_opening_transaction_fees: fees {
109
+ __typename
110
+ currency_amount_original_value: original_value
111
+ currency_amount_original_unit: original_unit
112
+ currency_amount_preferred_currency_unit: preferred_currency_unit
113
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
114
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
115
+ }
116
+ channel_opening_transaction_block_hash: block_hash
117
+ channel_opening_transaction_block_height: block_height
118
+ channel_opening_transaction_destination_addresses: destination_addresses
119
+ channel_opening_transaction_num_confirmations: num_confirmations
120
+ channel_opening_transaction_channel: channel {
121
+ id
122
+ }
123
+ }
124
+ ... on Deposit {
125
+ __typename
126
+ deposit_id: id
127
+ deposit_created_at: created_at
128
+ deposit_updated_at: updated_at
129
+ deposit_status: status
130
+ deposit_resolved_at: resolved_at
131
+ deposit_amount: amount {
132
+ __typename
133
+ currency_amount_original_value: original_value
134
+ currency_amount_original_unit: original_unit
135
+ currency_amount_preferred_currency_unit: preferred_currency_unit
136
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
137
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
138
+ }
139
+ deposit_transaction_hash: transaction_hash
140
+ deposit_fees: fees {
141
+ __typename
142
+ currency_amount_original_value: original_value
143
+ currency_amount_original_unit: original_unit
144
+ currency_amount_preferred_currency_unit: preferred_currency_unit
145
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
146
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
147
+ }
148
+ deposit_block_hash: block_hash
149
+ deposit_block_height: block_height
150
+ deposit_destination_addresses: destination_addresses
151
+ deposit_num_confirmations: num_confirmations
152
+ deposit_destination: destination {
153
+ id
154
+ }
155
+ }
156
+ ... on IncomingPayment {
157
+ __typename
158
+ incoming_payment_id: id
159
+ incoming_payment_created_at: created_at
160
+ incoming_payment_updated_at: updated_at
161
+ incoming_payment_status: status
162
+ incoming_payment_resolved_at: resolved_at
163
+ incoming_payment_amount: amount {
164
+ __typename
165
+ currency_amount_original_value: original_value
166
+ currency_amount_original_unit: original_unit
167
+ currency_amount_preferred_currency_unit: preferred_currency_unit
168
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
169
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
170
+ }
171
+ incoming_payment_transaction_hash: transaction_hash
172
+ incoming_payment_origin: origin {
173
+ id
174
+ }
175
+ incoming_payment_destination: destination {
176
+ id
177
+ }
178
+ incoming_payment_payment_request: payment_request {
179
+ id
180
+ }
181
+ }
182
+ ... on OutgoingPayment {
183
+ __typename
184
+ outgoing_payment_id: id
185
+ outgoing_payment_created_at: created_at
186
+ outgoing_payment_updated_at: updated_at
187
+ outgoing_payment_status: status
188
+ outgoing_payment_resolved_at: resolved_at
189
+ outgoing_payment_amount: amount {
190
+ __typename
191
+ currency_amount_original_value: original_value
192
+ currency_amount_original_unit: original_unit
193
+ currency_amount_preferred_currency_unit: preferred_currency_unit
194
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
195
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
196
+ }
197
+ outgoing_payment_transaction_hash: transaction_hash
198
+ outgoing_payment_origin: origin {
199
+ id
200
+ }
201
+ outgoing_payment_destination: destination {
202
+ id
203
+ }
204
+ outgoing_payment_fees: fees {
205
+ __typename
206
+ currency_amount_original_value: original_value
207
+ currency_amount_original_unit: original_unit
208
+ currency_amount_preferred_currency_unit: preferred_currency_unit
209
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
210
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
211
+ }
212
+ outgoing_payment_payment_request_data: payment_request_data {
213
+ __typename
214
+ ... on InvoiceData {
215
+ __typename
216
+ invoice_data_encoded_payment_request: encoded_payment_request
217
+ invoice_data_bitcoin_network: bitcoin_network
218
+ invoice_data_payment_hash: payment_hash
219
+ invoice_data_amount: amount {
220
+ __typename
221
+ currency_amount_original_value: original_value
222
+ currency_amount_original_unit: original_unit
223
+ currency_amount_preferred_currency_unit: preferred_currency_unit
224
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
225
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
226
+ }
227
+ invoice_data_created_at: created_at
228
+ invoice_data_expires_at: expires_at
229
+ invoice_data_memo: memo
230
+ invoice_data_destination: destination {
231
+ __typename
232
+ ... on GraphNode {
233
+ __typename
234
+ graph_node_id: id
235
+ graph_node_created_at: created_at
236
+ graph_node_updated_at: updated_at
237
+ graph_node_alias: alias
238
+ graph_node_bitcoin_network: bitcoin_network
239
+ graph_node_color: color
240
+ graph_node_conductivity: conductivity
241
+ graph_node_display_name: display_name
242
+ graph_node_public_key: public_key
243
+ }
244
+ ... on LightsparkNode {
245
+ __typename
246
+ lightspark_node_id: id
247
+ lightspark_node_created_at: created_at
248
+ lightspark_node_updated_at: updated_at
249
+ lightspark_node_alias: alias
250
+ lightspark_node_bitcoin_network: bitcoin_network
251
+ lightspark_node_color: color
252
+ lightspark_node_conductivity: conductivity
253
+ lightspark_node_display_name: display_name
254
+ lightspark_node_public_key: public_key
255
+ lightspark_node_account: account {
256
+ id
257
+ }
258
+ lightspark_node_owner: owner {
259
+ id
260
+ }
261
+ lightspark_node_blockchain_balance: blockchain_balance {
262
+ __typename
263
+ blockchain_balance_total_balance: total_balance {
264
+ __typename
265
+ currency_amount_original_value: original_value
266
+ currency_amount_original_unit: original_unit
267
+ currency_amount_preferred_currency_unit: preferred_currency_unit
268
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
269
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
270
+ }
271
+ blockchain_balance_confirmed_balance: confirmed_balance {
272
+ __typename
273
+ currency_amount_original_value: original_value
274
+ currency_amount_original_unit: original_unit
275
+ currency_amount_preferred_currency_unit: preferred_currency_unit
276
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
277
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
278
+ }
279
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
280
+ __typename
281
+ currency_amount_original_value: original_value
282
+ currency_amount_original_unit: original_unit
283
+ currency_amount_preferred_currency_unit: preferred_currency_unit
284
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
285
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
286
+ }
287
+ blockchain_balance_locked_balance: locked_balance {
288
+ __typename
289
+ currency_amount_original_value: original_value
290
+ currency_amount_original_unit: original_unit
291
+ currency_amount_preferred_currency_unit: preferred_currency_unit
292
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
293
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
294
+ }
295
+ blockchain_balance_required_reserve: required_reserve {
296
+ __typename
297
+ currency_amount_original_value: original_value
298
+ currency_amount_original_unit: original_unit
299
+ currency_amount_preferred_currency_unit: preferred_currency_unit
300
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
301
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
302
+ }
303
+ blockchain_balance_available_balance: available_balance {
304
+ __typename
305
+ currency_amount_original_value: original_value
306
+ currency_amount_original_unit: original_unit
307
+ currency_amount_preferred_currency_unit: preferred_currency_unit
308
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
309
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
310
+ }
311
+ }
312
+ lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
313
+ __typename
314
+ secret_encrypted_value: encrypted_value
315
+ secret_cipher: cipher
316
+ }
317
+ lightspark_node_total_balance: total_balance {
318
+ __typename
319
+ currency_amount_original_value: original_value
320
+ currency_amount_original_unit: original_unit
321
+ currency_amount_preferred_currency_unit: preferred_currency_unit
322
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
323
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
324
+ }
325
+ lightspark_node_total_local_balance: total_local_balance {
326
+ __typename
327
+ currency_amount_original_value: original_value
328
+ currency_amount_original_unit: original_unit
329
+ currency_amount_preferred_currency_unit: preferred_currency_unit
330
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
331
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
332
+ }
333
+ lightspark_node_local_balance: local_balance {
334
+ __typename
335
+ currency_amount_original_value: original_value
336
+ currency_amount_original_unit: original_unit
337
+ currency_amount_preferred_currency_unit: preferred_currency_unit
338
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
339
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
340
+ }
341
+ lightspark_node_purpose: purpose
342
+ lightspark_node_remote_balance: remote_balance {
343
+ __typename
344
+ currency_amount_original_value: original_value
345
+ currency_amount_original_unit: original_unit
346
+ currency_amount_preferred_currency_unit: preferred_currency_unit
347
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
348
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
349
+ }
350
+ lightspark_node_status: status
351
+ }
352
+ }
353
+ }
354
+ }
355
+ outgoing_payment_failure_reason: failure_reason
356
+ outgoing_payment_failure_message: failure_message {
357
+ __typename
358
+ rich_text_text: text
359
+ }
360
+ }
361
+ ... on RoutingTransaction {
362
+ __typename
363
+ routing_transaction_id: id
364
+ routing_transaction_created_at: created_at
365
+ routing_transaction_updated_at: updated_at
366
+ routing_transaction_status: status
367
+ routing_transaction_resolved_at: resolved_at
368
+ routing_transaction_amount: amount {
369
+ __typename
370
+ currency_amount_original_value: original_value
371
+ currency_amount_original_unit: original_unit
372
+ currency_amount_preferred_currency_unit: preferred_currency_unit
373
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
374
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
375
+ }
376
+ routing_transaction_transaction_hash: transaction_hash
377
+ routing_transaction_incoming_channel: incoming_channel {
378
+ id
379
+ }
380
+ routing_transaction_outgoing_channel: outgoing_channel {
381
+ id
382
+ }
383
+ routing_transaction_fees: fees {
384
+ __typename
385
+ currency_amount_original_value: original_value
386
+ currency_amount_original_unit: original_unit
387
+ currency_amount_preferred_currency_unit: preferred_currency_unit
388
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
389
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
390
+ }
391
+ routing_transaction_failure_message: failure_message {
392
+ __typename
393
+ rich_text_text: text
394
+ }
395
+ routing_transaction_failure_reason: failure_reason
396
+ }
397
+ ... on Withdrawal {
398
+ __typename
399
+ withdrawal_id: id
400
+ withdrawal_created_at: created_at
401
+ withdrawal_updated_at: updated_at
402
+ withdrawal_status: status
403
+ withdrawal_resolved_at: resolved_at
404
+ withdrawal_amount: amount {
405
+ __typename
406
+ currency_amount_original_value: original_value
407
+ currency_amount_original_unit: original_unit
408
+ currency_amount_preferred_currency_unit: preferred_currency_unit
409
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
410
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
411
+ }
412
+ withdrawal_transaction_hash: transaction_hash
413
+ withdrawal_fees: fees {
414
+ __typename
415
+ currency_amount_original_value: original_value
416
+ currency_amount_original_unit: original_unit
417
+ currency_amount_preferred_currency_unit: preferred_currency_unit
418
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
419
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
420
+ }
421
+ withdrawal_block_hash: block_hash
422
+ withdrawal_block_height: block_height
423
+ withdrawal_destination_addresses: destination_addresses
424
+ withdrawal_num_confirmations: num_confirmations
425
+ withdrawal_origin: origin {
426
+ id
427
+ }
428
+ }
429
+ }
430
+ }
431
+ }
432
+ }
433
+ }
434
+ `,
435
+ variables: {
436
+ entity_id: this.id,
437
+ first: first,
438
+ after: after,
439
+ created_after_date: createdAfterDate,
440
+ created_before_date: createdBeforeDate,
441
+ statuses: statuses,
442
+ types: types,
443
+ },
444
+ constructObject: (json) => {
445
+ const connection = json["entity"]["transactions"];
446
+ return WalletToTransactionsConnectionFromJson(connection);
447
+ },
448
+ }))!;
449
+ }
450
+
451
+ public async getPaymentRequests(
452
+ client: LightsparkClient,
453
+ first: number | undefined = undefined,
454
+ after: string | undefined = undefined,
455
+ createdAfterDate: string | undefined = undefined,
456
+ createdBeforeDate: string | undefined = undefined
457
+ ): Promise<WalletToPaymentRequestsConnection> {
458
+ return (await client.executeRawQuery({
459
+ queryPayload: `
460
+ query FetchWalletToPaymentRequestsConnection($entity_id: ID!, $first: Int, $after: ID, $created_after_date: DateTime, $created_before_date: DateTime) {
461
+ entity(id: $entity_id) {
462
+ ... on Wallet {
463
+ payment_requests(, first: $first, after: $after, created_after_date: $created_after_date, created_before_date: $created_before_date) {
464
+ __typename
465
+ wallet_to_payment_requests_connection_count: count
466
+ wallet_to_payment_requests_connection_page_info: page_info {
467
+ __typename
468
+ page_info_has_next_page: has_next_page
469
+ page_info_has_previous_page: has_previous_page
470
+ page_info_start_cursor: start_cursor
471
+ page_info_end_cursor: end_cursor
472
+ }
473
+ wallet_to_payment_requests_connection_entities: entities {
474
+ __typename
475
+ ... on Invoice {
476
+ __typename
477
+ invoice_id: id
478
+ invoice_created_at: created_at
479
+ invoice_updated_at: updated_at
480
+ invoice_data: data {
481
+ __typename
482
+ invoice_data_encoded_payment_request: encoded_payment_request
483
+ invoice_data_bitcoin_network: bitcoin_network
484
+ invoice_data_payment_hash: payment_hash
485
+ invoice_data_amount: amount {
486
+ __typename
487
+ currency_amount_original_value: original_value
488
+ currency_amount_original_unit: original_unit
489
+ currency_amount_preferred_currency_unit: preferred_currency_unit
490
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
491
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
492
+ }
493
+ invoice_data_created_at: created_at
494
+ invoice_data_expires_at: expires_at
495
+ invoice_data_memo: memo
496
+ invoice_data_destination: destination {
497
+ __typename
498
+ ... on GraphNode {
499
+ __typename
500
+ graph_node_id: id
501
+ graph_node_created_at: created_at
502
+ graph_node_updated_at: updated_at
503
+ graph_node_alias: alias
504
+ graph_node_bitcoin_network: bitcoin_network
505
+ graph_node_color: color
506
+ graph_node_conductivity: conductivity
507
+ graph_node_display_name: display_name
508
+ graph_node_public_key: public_key
509
+ }
510
+ ... on LightsparkNode {
511
+ __typename
512
+ lightspark_node_id: id
513
+ lightspark_node_created_at: created_at
514
+ lightspark_node_updated_at: updated_at
515
+ lightspark_node_alias: alias
516
+ lightspark_node_bitcoin_network: bitcoin_network
517
+ lightspark_node_color: color
518
+ lightspark_node_conductivity: conductivity
519
+ lightspark_node_display_name: display_name
520
+ lightspark_node_public_key: public_key
521
+ lightspark_node_account: account {
522
+ id
523
+ }
524
+ lightspark_node_owner: owner {
525
+ id
526
+ }
527
+ lightspark_node_blockchain_balance: blockchain_balance {
528
+ __typename
529
+ blockchain_balance_total_balance: total_balance {
530
+ __typename
531
+ currency_amount_original_value: original_value
532
+ currency_amount_original_unit: original_unit
533
+ currency_amount_preferred_currency_unit: preferred_currency_unit
534
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
535
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
536
+ }
537
+ blockchain_balance_confirmed_balance: confirmed_balance {
538
+ __typename
539
+ currency_amount_original_value: original_value
540
+ currency_amount_original_unit: original_unit
541
+ currency_amount_preferred_currency_unit: preferred_currency_unit
542
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
543
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
544
+ }
545
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
546
+ __typename
547
+ currency_amount_original_value: original_value
548
+ currency_amount_original_unit: original_unit
549
+ currency_amount_preferred_currency_unit: preferred_currency_unit
550
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
551
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
552
+ }
553
+ blockchain_balance_locked_balance: locked_balance {
554
+ __typename
555
+ currency_amount_original_value: original_value
556
+ currency_amount_original_unit: original_unit
557
+ currency_amount_preferred_currency_unit: preferred_currency_unit
558
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
559
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
560
+ }
561
+ blockchain_balance_required_reserve: required_reserve {
562
+ __typename
563
+ currency_amount_original_value: original_value
564
+ currency_amount_original_unit: original_unit
565
+ currency_amount_preferred_currency_unit: preferred_currency_unit
566
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
567
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
568
+ }
569
+ blockchain_balance_available_balance: available_balance {
570
+ __typename
571
+ currency_amount_original_value: original_value
572
+ currency_amount_original_unit: original_unit
573
+ currency_amount_preferred_currency_unit: preferred_currency_unit
574
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
575
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
576
+ }
577
+ }
578
+ lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
579
+ __typename
580
+ secret_encrypted_value: encrypted_value
581
+ secret_cipher: cipher
582
+ }
583
+ lightspark_node_total_balance: total_balance {
584
+ __typename
585
+ currency_amount_original_value: original_value
586
+ currency_amount_original_unit: original_unit
587
+ currency_amount_preferred_currency_unit: preferred_currency_unit
588
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
589
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
590
+ }
591
+ lightspark_node_total_local_balance: total_local_balance {
592
+ __typename
593
+ currency_amount_original_value: original_value
594
+ currency_amount_original_unit: original_unit
595
+ currency_amount_preferred_currency_unit: preferred_currency_unit
596
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
597
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
598
+ }
599
+ lightspark_node_local_balance: local_balance {
600
+ __typename
601
+ currency_amount_original_value: original_value
602
+ currency_amount_original_unit: original_unit
603
+ currency_amount_preferred_currency_unit: preferred_currency_unit
604
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
605
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
606
+ }
607
+ lightspark_node_purpose: purpose
608
+ lightspark_node_remote_balance: remote_balance {
609
+ __typename
610
+ currency_amount_original_value: original_value
611
+ currency_amount_original_unit: original_unit
612
+ currency_amount_preferred_currency_unit: preferred_currency_unit
613
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
614
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
615
+ }
616
+ lightspark_node_status: status
617
+ }
618
+ }
619
+ }
620
+ invoice_status: status
621
+ invoice_amount_paid: amount_paid {
622
+ __typename
623
+ currency_amount_original_value: original_value
624
+ currency_amount_original_unit: original_unit
625
+ currency_amount_preferred_currency_unit: preferred_currency_unit
626
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
627
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
628
+ }
629
+ }
630
+ }
631
+ }
632
+ }
633
+ }
634
+ }
635
+ `,
636
+ variables: {
637
+ entity_id: this.id,
638
+ first: first,
639
+ after: after,
640
+ created_after_date: createdAfterDate,
641
+ created_before_date: createdBeforeDate,
642
+ },
643
+ constructObject: (json) => {
644
+ const connection = json["entity"]["payment_requests"];
645
+ return WalletToPaymentRequestsConnectionFromJson(connection);
646
+ },
647
+ }))!;
648
+ }
649
+
27
650
  public async getTotalAmountReceived(
28
651
  client: LightsparkClient,
29
652
  createdAfterDate: string | undefined = undefined,
@@ -31,8 +654,8 @@ class Wallet implements LightsparkNodeOwner {
31
654
  ): Promise<CurrencyAmount> {
32
655
  return (await client.executeRawQuery({
33
656
  queryPayload: `
34
- query FetchWalletTotalAmountReceived($created_after_date: DateTime, $created_before_date: DateTime) {
35
- current_wallet {
657
+ query FetchWalletTotalAmountReceived($entity_id: ID!, $created_after_date: DateTime, $created_before_date: DateTime) {
658
+ entity(id: $entity_id) {
36
659
  ... on Wallet {
37
660
  total_amount_received(, created_after_date: $created_after_date, created_before_date: $created_before_date) {
38
661
  __typename
@@ -47,11 +670,12 @@ query FetchWalletTotalAmountReceived($created_after_date: DateTime, $created_bef
47
670
  }
48
671
  `,
49
672
  variables: {
673
+ entity_id: this.id,
50
674
  created_after_date: createdAfterDate,
51
675
  created_before_date: createdBeforeDate,
52
676
  },
53
677
  constructObject: (json) => {
54
- const connection = json["current_wallet"]["total_amount_received"];
678
+ const connection = json["entity"]["total_amount_received"];
55
679
  return CurrencyAmountFromJson(connection);
56
680
  },
57
681
  }))!;
@@ -64,8 +688,8 @@ query FetchWalletTotalAmountReceived($created_after_date: DateTime, $created_bef
64
688
  ): Promise<CurrencyAmount> {
65
689
  return (await client.executeRawQuery({
66
690
  queryPayload: `
67
- query FetchWalletTotalAmountSent($created_after_date: DateTime, $created_before_date: DateTime) {
68
- current_wallet {
691
+ query FetchWalletTotalAmountSent($entity_id: ID!, $created_after_date: DateTime, $created_before_date: DateTime) {
692
+ entity(id: $entity_id) {
69
693
  ... on Wallet {
70
694
  total_amount_sent(, created_after_date: $created_after_date, created_before_date: $created_before_date) {
71
695
  __typename
@@ -80,11 +704,12 @@ query FetchWalletTotalAmountSent($created_after_date: DateTime, $created_before_
80
704
  }
81
705
  `,
82
706
  variables: {
707
+ entity_id: this.id,
83
708
  created_after_date: createdAfterDate,
84
709
  created_before_date: createdBeforeDate,
85
710
  },
86
711
  constructObject: (json) => {
87
- const connection = json["current_wallet"]["total_amount_sent"];
712
+ const connection = json["entity"]["total_amount_sent"];
88
713
  return CurrencyAmountFromJson(connection);
89
714
  },
90
715
  }))!;