@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,3 +1,3 @@
1
- export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as ApiToken, B as Balances, i as BitcoinNetwork, j as BlockchainBalance, C as Channel, k as ChannelClosingTransaction, m as ChannelFees, n as ChannelOpeningTransaction, p as ChannelStatus, q as ChannelToTransactionsConnection, r as CreateApiTokenInput, s as CreateApiTokenOutput, t as CreateInvoiceInput, u as CreateInvoiceOutput, v as CreateLnurlInvoiceInput, w as CreateNodeWalletAddressInput, x as CreateNodeWalletAddressOutput, y as CreateTestModeInvoiceInput, z as CreateTestModeInvoiceOutput, D as CreateTestModePaymentInput, E as CreateTestModePaymentoutput, F as CurrencyAmount, G as CurrencyUnit, H as DeleteApiTokenInput, I as DeleteApiTokenOutput, J as Deposit, M as Entity, N as FeeEstimate, O as FundNodeInput, P as FundNodeOutput, Q as GraphNode, R as Hop, T as HtlcAttemptFailureCode, U as IncomingPayment, V as IncomingPaymentAttempt, Y as IncomingPaymentAttemptStatus, Z as IncomingPaymentToAttemptsConnection, _ as Invoice, a0 as InvoiceData, a1 as InvoiceType, a2 as LightningFeeEstimateForInvoiceInput, a3 as LightningFeeEstimateForNodeInput, a4 as LightningFeeEstimateOutput, a5 as LightningTransaction, a7 as LightsparkNode, a8 as LightsparkNodeOwner, aa as LightsparkNodePurpose, ab as LightsparkNodeStatus, ac as LightsparkNodeToChannelsConnection, ad as Node, ae as NodeAddress, af as NodeAddressType, ag as NodeToAddressesConnection, ah as OnChainTransaction, aj as OutgoingPayment, ak as OutgoingPaymentAttempt, al as OutgoingPaymentAttemptStatus, am as OutgoingPaymentAttemptToHopsConnection, an as OutgoingPaymentToAttemptsConnection, ao as PageInfo, ap as PayInvoiceInput, aq as PayInvoiceOutput, ar as PaymentFailureReason, as as PaymentRequest, au as PaymentRequestData, av as PaymentRequestStatus, aw as Permission, ax as RequestWithdrawalInput, ay as RequestWithdrawalOutput, az as RichText, aA as RoutingTransaction, aC as RoutingTransactionFailureReason, aD as Secret, aE as SendPaymentInput, aF as SendPaymentOutput, aG as SingleNodeDashboard, aH as Transaction, aJ as TransactionFailures, aK as TransactionStatus, aL as TransactionType, aM as TransactionUpdate, aN as Wallet, aO as WalletStatus, W as WebhookEventType, aP as Withdrawal, aR as WithdrawalMode, aS as WithdrawalRequest, aT as WithdrawalRequestStatus, aU as WithdrawalRequestToChannelClosingTransactionsConnection, aV as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, l as getChannelClosingTransactionQuery, o as getChannelOpeningTransactionQuery, K as getDepositQuery, S as getHopQuery, X as getIncomingPaymentAttemptQuery, $ as getInvoiceQuery, a6 as getLightningTransactionQuery, a9 as getLightsparkNodeOwnerQuery, ai as getOnChainTransactionQuery, at as getPaymentRequestQuery, aB as getRoutingTransactionQuery, aI as getTransactionQuery, aQ as getWithdrawalQuery } from '../index-adeff42d.js';
1
+ export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as ApiToken, B as Balances, i as BitcoinNetwork, j as BlockchainBalance, C as Channel, k as ChannelClosingTransaction, m as ChannelFees, n as ChannelOpeningTransaction, p as ChannelStatus, q as ChannelToTransactionsConnection, r as Connection, s as CreateApiTokenInput, t as CreateApiTokenOutput, u as CreateInvoiceInput, v as CreateInvoiceOutput, w as CreateLnurlInvoiceInput, x as CreateNodeWalletAddressInput, y as CreateNodeWalletAddressOutput, z as CreateTestModeInvoiceInput, D as CreateTestModeInvoiceOutput, E as CreateTestModePaymentInput, F as CreateTestModePaymentoutput, G as CryptoSanctionsScreeningProvider, H as CurrencyAmount, I as CurrencyUnit, J as DeleteApiTokenInput, K as DeleteApiTokenOutput, M as Deposit, O as Entity, P as FeeEstimate, Q as FundNodeInput, R as FundNodeOutput, S as GraphNode, T as Hop, V as HtlcAttemptFailureCode, X as IncomingPayment, Y as IncomingPaymentAttempt, _ as IncomingPaymentAttemptStatus, $ as IncomingPaymentToAttemptsConnection, a0 as Invoice, a2 as InvoiceData, a3 as InvoiceType, a4 as LightningFeeEstimateForInvoiceInput, a5 as LightningFeeEstimateForNodeInput, a6 as LightningFeeEstimateOutput, a7 as LightningTransaction, a9 as LightsparkNode, aa as LightsparkNodeOwner, ac as LightsparkNodePurpose, ad as LightsparkNodeStatus, ae as LightsparkNodeToChannelsConnection, af as Node, ag as NodeAddress, ah as NodeAddressType, ai as NodeToAddressesConnection, aj as OnChainTransaction, al as OutgoingPayment, am as OutgoingPaymentAttempt, an as OutgoingPaymentAttemptStatus, ao as OutgoingPaymentAttemptToHopsConnection, ap as OutgoingPaymentToAttemptsConnection, aq as PageInfo, ar as PayInvoiceInput, as as PayInvoiceOutput, at as PaymentFailureReason, au as PaymentRequest, aw as PaymentRequestData, ax as PaymentRequestStatus, ay as Permission, az as RequestWithdrawalInput, aA as RequestWithdrawalOutput, aB as RichText, aC as RiskRating, aD as RoutingTransaction, aF as RoutingTransactionFailureReason, aG as ScreenBitcoinAddressesInput, aH as ScreenBitcoinAddressesOutput, aI as Secret, aJ as SendPaymentInput, aK as SendPaymentOutput, aL as SingleNodeDashboard, aM as Transaction, aO as TransactionFailures, aP as TransactionStatus, aQ as TransactionType, aR as TransactionUpdate, aS as Wallet, aT as WalletStatus, aU as WalletToPaymentRequestsConnection, aV as WalletToTransactionsConnection, W as WebhookEventType, aW as Withdrawal, aY as WithdrawalMode, aZ as WithdrawalRequest, a_ as WithdrawalRequestStatus, a$ as WithdrawalRequestToChannelClosingTransactionsConnection, b0 as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, l as getChannelClosingTransactionQuery, o as getChannelOpeningTransactionQuery, N as getDepositQuery, U as getHopQuery, Z as getIncomingPaymentAttemptQuery, a1 as getInvoiceQuery, a8 as getLightningTransactionQuery, ab as getLightsparkNodeOwnerQuery, ak as getOnChainTransactionQuery, av as getPaymentRequestQuery, aE as getRoutingTransactionQuery, aN as getTransactionQuery, aX as getWithdrawalQuery } from '../index-3ffe9e7b.js';
2
2
  import '@lightsparkdev/core';
3
3
  import 'zen-observable';
@@ -4,6 +4,7 @@ import {
4
4
  BitcoinNetwork_default,
5
5
  ChannelStatus_default,
6
6
  Channel_default,
7
+ CryptoSanctionsScreeningProvider_default,
7
8
  CurrencyUnit_default,
8
9
  GraphNode_default,
9
10
  HtlcAttemptFailureCode_default,
@@ -21,6 +22,7 @@ import {
21
22
  PaymentFailureReason_default,
22
23
  PaymentRequestStatus_default,
23
24
  Permission_default,
25
+ RiskRating_default,
24
26
  RoutingTransactionFailureReason_default,
25
27
  TransactionStatus_default,
26
28
  TransactionType_default,
@@ -44,7 +46,7 @@ import {
44
46
  getRoutingTransactionQuery,
45
47
  getTransactionQuery,
46
48
  getWithdrawalQuery
47
- } from "../chunk-YTXDF6SQ.js";
49
+ } from "../chunk-NXUFC5J7.js";
48
50
  import "../chunk-NIMBE7W3.js";
49
51
  export {
50
52
  Account_default as Account,
@@ -52,6 +54,7 @@ export {
52
54
  BitcoinNetwork_default as BitcoinNetwork,
53
55
  Channel_default as Channel,
54
56
  ChannelStatus_default as ChannelStatus,
57
+ CryptoSanctionsScreeningProvider_default as CryptoSanctionsScreeningProvider,
55
58
  CurrencyUnit_default as CurrencyUnit,
56
59
  GraphNode_default as GraphNode,
57
60
  HtlcAttemptFailureCode_default as HtlcAttemptFailureCode,
@@ -69,6 +72,7 @@ export {
69
72
  PaymentFailureReason_default as PaymentFailureReason,
70
73
  PaymentRequestStatus_default as PaymentRequestStatus,
71
74
  Permission_default as Permission,
75
+ RiskRating_default as RiskRating,
72
76
  RoutingTransactionFailureReason_default as RoutingTransactionFailureReason,
73
77
  TransactionStatus_default as TransactionStatus,
74
78
  TransactionType_default as TransactionType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightsparkdev/lightspark-sdk",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "description": "Lightspark JS SDK",
5
5
  "author": "Lightspark Inc.",
6
6
  "keywords": [
@@ -84,7 +84,6 @@
84
84
  },
85
85
  "devDependencies": {
86
86
  "@lightsparkdev/eslint-config": "*",
87
- "@lightsparkdev/gql": "0.0.2",
88
87
  "@lightsparkdev/tsconfig": "0.0.0",
89
88
  "@types/crypto-js": "^4.1.1",
90
89
  "@types/jest": "^29.5.2",
package/src/client.ts CHANGED
@@ -21,10 +21,6 @@ import {
21
21
  Requester,
22
22
  StubAuthProvider,
23
23
  } from "@lightsparkdev/core";
24
- import {
25
- type OutgoingPayment as GQLOutgoingPayment,
26
- type Subscription as GQLSubscription,
27
- } from "@lightsparkdev/gql/generated/graphql.js";
28
24
  import { createHash } from "crypto";
29
25
  import packageJson from "../package.json";
30
26
  import { BitcoinFeeEstimate as BitcoinFeeEstimateQuery } from "./graphql/BitcoinFeeEstimate.js";
@@ -200,15 +196,16 @@ class LightsparkClient {
200
196
  public listenToTransactions(
201
197
  nodeIds: string[]
202
198
  ): Observable<TransactionUpdate | undefined> {
203
- const response = this.requester.subscribe<
204
- Pick<GQLSubscription, "transactions">
205
- >(TransactionSubscription, {
206
- nodeIds,
207
- });
199
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
200
+ const response = this.requester.subscribe<{ transactions: any }>(
201
+ TransactionSubscription,
202
+ {
203
+ nodeIds,
204
+ }
205
+ );
208
206
  return response.map(
209
207
  (response) =>
210
- response &&
211
- response.data.transactions &&
208
+ response?.data?.transactions &&
212
209
  TransactionUpdateFromJson(response.data.transactions)
213
210
  );
214
211
  }
@@ -500,7 +497,8 @@ class LightsparkClient {
500
497
  }
501
498
  );
502
499
  return CurrencyAmountFromJson(
503
- response.lightning_fee_estimate_for_invoice.fee_estimate
500
+ response.lightning_fee_estimate_for_invoice
501
+ .lightning_fee_estimate_output_fee_estimate
504
502
  );
505
503
  }
506
504
 
@@ -526,7 +524,8 @@ class LightsparkClient {
526
524
  }
527
525
  );
528
526
  return CurrencyAmountFromJson(
529
- response.lightning_fee_estimate_for_node.fee_estimate
527
+ response.lightning_fee_estimate_for_node
528
+ .lightning_fee_estimate_output_fee_estimate
530
529
  );
531
530
  }
532
531
 
@@ -872,7 +871,7 @@ class LightsparkClient {
872
871
  },
873
872
  constructObject: (responseJson: {
874
873
  create_test_mode_payment: {
875
- payment: GQLOutgoingPayment;
874
+ payment: any; // eslint-disable-line @typescript-eslint/no-explicit-any
876
875
  } | null;
877
876
  }) => {
878
877
  return OutgoingPaymentFromJson(
@@ -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 AccountToApiTokensConnection from "./AccountToApiTokensConnection.js";
@@ -25,6 +25,7 @@ import type TransactionFailures from "./TransactionFailures.js";
25
25
  import type TransactionStatus from "./TransactionStatus.js";
26
26
  import type TransactionType from "./TransactionType.js";
27
27
 
28
+ /** This is an object representing the connected Lightspark account. You can retrieve this object to see your account information and objects tied to your account. **/
28
29
  class Account implements LightsparkNodeOwner {
29
30
  constructor(
30
31
  public readonly id: string,
@@ -38,15 +39,17 @@ class Account implements LightsparkNodeOwner {
38
39
 
39
40
  public async getApiTokens(
40
41
  client: LightsparkClient,
41
- first: number | undefined = undefined
42
+ first: number | undefined = undefined,
43
+ after: string | undefined = undefined
42
44
  ): Promise<AccountToApiTokensConnection> {
43
45
  return (await client.executeRawQuery({
44
46
  queryPayload: `
45
- query FetchAccountToApiTokensConnection($first: Int) {
47
+ query FetchAccountToApiTokensConnection($first: Int, $after: String) {
46
48
  current_account {
47
49
  ... on Account {
48
- api_tokens(, first: $first) {
50
+ api_tokens(, first: $first, after: $after) {
49
51
  __typename
52
+ account_to_api_tokens_connection_count: count
50
53
  account_to_api_tokens_connection_page_info: page_info {
51
54
  __typename
52
55
  page_info_has_next_page: has_next_page
@@ -54,7 +57,6 @@ query FetchAccountToApiTokensConnection($first: Int) {
54
57
  page_info_start_cursor: start_cursor
55
58
  page_info_end_cursor: end_cursor
56
59
  }
57
- account_to_api_tokens_connection_count: count
58
60
  account_to_api_tokens_connection_entities: entities {
59
61
  __typename
60
62
  api_token_id: id
@@ -69,7 +71,7 @@ query FetchAccountToApiTokensConnection($first: Int) {
69
71
  }
70
72
  }
71
73
  `,
72
- variables: { first: first },
74
+ variables: { first: first, after: after },
73
75
  constructObject: (json) => {
74
76
  const connection = json["current_account"]["api_tokens"];
75
77
  return AccountToApiTokensConnectionFromJson(connection);
@@ -207,15 +209,17 @@ query FetchAccountLocalBalance($bitcoin_networks: [BitcoinNetwork!], $node_ids:
207
209
  client: LightsparkClient,
208
210
  first: number | undefined = undefined,
209
211
  bitcoinNetworks: BitcoinNetwork[] | undefined = undefined,
210
- nodeIds: string[] | undefined = undefined
212
+ nodeIds: string[] | undefined = undefined,
213
+ after: string | undefined = undefined
211
214
  ): Promise<AccountToNodesConnection> {
212
215
  return (await client.executeRawQuery({
213
216
  queryPayload: `
214
- query FetchAccountToNodesConnection($first: Int, $bitcoin_networks: [BitcoinNetwork!], $node_ids: [ID!]) {
217
+ query FetchAccountToNodesConnection($first: Int, $bitcoin_networks: [BitcoinNetwork!], $node_ids: [ID!], $after: String) {
215
218
  current_account {
216
219
  ... on Account {
217
- nodes(, first: $first, bitcoin_networks: $bitcoin_networks, node_ids: $node_ids) {
220
+ nodes(, first: $first, bitcoin_networks: $bitcoin_networks, node_ids: $node_ids, after: $after) {
218
221
  __typename
222
+ account_to_nodes_connection_count: count
219
223
  account_to_nodes_connection_page_info: page_info {
220
224
  __typename
221
225
  page_info_has_next_page: has_next_page
@@ -223,7 +227,6 @@ query FetchAccountToNodesConnection($first: Int, $bitcoin_networks: [BitcoinNetw
223
227
  page_info_start_cursor: start_cursor
224
228
  page_info_end_cursor: end_cursor
225
229
  }
226
- account_to_nodes_connection_count: count
227
230
  account_to_nodes_connection_purpose: purpose
228
231
  account_to_nodes_connection_entities: entities {
229
232
  __typename
@@ -342,6 +345,7 @@ query FetchAccountToNodesConnection($first: Int, $bitcoin_networks: [BitcoinNetw
342
345
  first: first,
343
346
  bitcoin_networks: bitcoinNetworks,
344
347
  node_ids: nodeIds,
348
+ after: after,
345
349
  },
346
350
  constructObject: (json) => {
347
351
  const connection = json["current_account"]["nodes"];
@@ -558,6 +562,14 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types:
558
562
  ... on Account {
559
563
  transactions(, first: $first, after: $after, types: $types, after_date: $after_date, before_date: $before_date, bitcoin_network: $bitcoin_network, lightning_node_id: $lightning_node_id, statuses: $statuses, exclude_failures: $exclude_failures) {
560
564
  __typename
565
+ account_to_transactions_connection_count: count
566
+ account_to_transactions_connection_page_info: page_info {
567
+ __typename
568
+ page_info_has_next_page: has_next_page
569
+ page_info_has_previous_page: has_previous_page
570
+ page_info_start_cursor: start_cursor
571
+ page_info_end_cursor: end_cursor
572
+ }
561
573
  account_to_transactions_connection_profit_loss: profit_loss {
562
574
  __typename
563
575
  currency_amount_original_value: original_value
@@ -574,7 +586,6 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types:
574
586
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
575
587
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
576
588
  }
577
- account_to_transactions_connection_count: count
578
589
  account_to_transactions_connection_total_amount_transacted: total_amount_transacted {
579
590
  __typename
580
591
  currency_amount_original_value: original_value
@@ -955,13 +966,6 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types:
955
966
  }
956
967
  }
957
968
  }
958
- account_to_transactions_connection_page_info: page_info {
959
- __typename
960
- page_info_has_next_page: has_next_page
961
- page_info_has_previous_page: has_previous_page
962
- page_info_start_cursor: start_cursor
963
- page_info_end_cursor: end_cursor
964
- }
965
969
  }
966
970
  }
967
971
  }
@@ -1002,6 +1006,13 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
1002
1006
  payment_requests(, first: $first, after: $after, after_date: $after_date, before_date: $before_date, bitcoin_network: $bitcoin_network, lightning_node_id: $lightning_node_id) {
1003
1007
  __typename
1004
1008
  account_to_payment_requests_connection_count: count
1009
+ account_to_payment_requests_connection_page_info: page_info {
1010
+ __typename
1011
+ page_info_has_next_page: has_next_page
1012
+ page_info_has_previous_page: has_previous_page
1013
+ page_info_start_cursor: start_cursor
1014
+ page_info_end_cursor: end_cursor
1015
+ }
1005
1016
  account_to_payment_requests_connection_entities: entities {
1006
1017
  __typename
1007
1018
  ... on Invoice {
@@ -1160,13 +1171,6 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
1160
1171
  }
1161
1172
  }
1162
1173
  }
1163
- account_to_payment_requests_connection_page_info: page_info {
1164
- __typename
1165
- page_info_has_next_page: has_next_page
1166
- page_info_has_previous_page: has_previous_page
1167
- page_info_start_cursor: start_cursor
1168
- page_info_end_cursor: end_cursor
1169
- }
1170
1174
  }
1171
1175
  }
1172
1176
  }
@@ -1189,15 +1193,18 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
1189
1193
 
1190
1194
  public async getWallets(
1191
1195
  client: LightsparkClient,
1192
- first: number | undefined = undefined
1196
+ first: number | undefined = undefined,
1197
+ after: string | undefined = undefined,
1198
+ thirdPartyIds: string[] | undefined = undefined
1193
1199
  ): Promise<AccountToWalletsConnection> {
1194
1200
  return (await client.executeRawQuery({
1195
1201
  queryPayload: `
1196
- query FetchAccountToWalletsConnection($first: Int) {
1202
+ query FetchAccountToWalletsConnection($first: Int, $after: String, $third_party_ids: [String!]) {
1197
1203
  current_account {
1198
1204
  ... on Account {
1199
- wallets(, first: $first) {
1205
+ wallets(, first: $first, after: $after, third_party_ids: $third_party_ids) {
1200
1206
  __typename
1207
+ account_to_wallets_connection_count: count
1201
1208
  account_to_wallets_connection_page_info: page_info {
1202
1209
  __typename
1203
1210
  page_info_has_next_page: has_next_page
@@ -1205,7 +1212,6 @@ query FetchAccountToWalletsConnection($first: Int) {
1205
1212
  page_info_start_cursor: start_cursor
1206
1213
  page_info_end_cursor: end_cursor
1207
1214
  }
1208
- account_to_wallets_connection_count: count
1209
1215
  account_to_wallets_connection_entities: entities {
1210
1216
  __typename
1211
1217
  wallet_id: id
@@ -1247,7 +1253,7 @@ query FetchAccountToWalletsConnection($first: Int) {
1247
1253
  }
1248
1254
  }
1249
1255
  `,
1250
- variables: { first: first },
1256
+ variables: { first: first, after: after, third_party_ids: thirdPartyIds },
1251
1257
  constructObject: (json) => {
1252
1258
  const connection = json["current_account"]["wallets"];
1253
1259
  return AccountToWalletsConnectionFromJson(connection);
@@ -2,40 +2,46 @@
2
2
 
3
3
  import type ApiToken from "./ApiToken.js";
4
4
  import { ApiTokenFromJson } from "./ApiToken.js";
5
+ import type Connection from "./Connection.js";
5
6
  import type PageInfo from "./PageInfo.js";
6
7
  import { PageInfoFromJson } from "./PageInfo.js";
7
8
 
8
- type AccountToApiTokensConnection = {
9
- /** An object that holds pagination information about the objects in this connection. **/
10
- pageInfo: PageInfo;
11
-
9
+ type AccountToApiTokensConnection = Connection & {
12
10
  /**
13
11
  * The total count of objects in this connection, using the current filters. It is different from the
14
12
  * number of objects returned in the current page (in the `entities` field).
15
13
  **/
16
14
  count: number;
17
15
 
16
+ /** An object that holds pagination information about the objects in this connection. **/
17
+ pageInfo: PageInfo;
18
+
18
19
  /** The API tokens for the current page of this connection. **/
19
20
  entities: ApiToken[];
21
+
22
+ /** The typename of the object **/
23
+ typename: string;
20
24
  };
21
25
 
22
26
  export const AccountToApiTokensConnectionFromJson = (
23
27
  obj: any
24
28
  ): AccountToApiTokensConnection => {
25
29
  return {
30
+ count: obj["account_to_api_tokens_connection_count"],
26
31
  pageInfo: PageInfoFromJson(
27
32
  obj["account_to_api_tokens_connection_page_info"]
28
33
  ),
29
- count: obj["account_to_api_tokens_connection_count"],
30
34
  entities: obj["account_to_api_tokens_connection_entities"].map((e) =>
31
35
  ApiTokenFromJson(e)
32
36
  ),
37
+ typename: "AccountToApiTokensConnection",
33
38
  } as AccountToApiTokensConnection;
34
39
  };
35
40
 
36
41
  export const FRAGMENT = `
37
42
  fragment AccountToApiTokensConnectionFragment on AccountToApiTokensConnection {
38
43
  __typename
44
+ account_to_api_tokens_connection_count: count
39
45
  account_to_api_tokens_connection_page_info: page_info {
40
46
  __typename
41
47
  page_info_has_next_page: has_next_page
@@ -43,7 +49,6 @@ fragment AccountToApiTokensConnectionFragment on AccountToApiTokensConnection {
43
49
  page_info_start_cursor: start_cursor
44
50
  page_info_end_cursor: end_cursor
45
51
  }
46
- account_to_api_tokens_connection_count: count
47
52
  account_to_api_tokens_connection_entities: entities {
48
53
  id
49
54
  }
@@ -1,5 +1,6 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
+ import type Connection from "./Connection.js";
3
4
  import type LightsparkNode from "./LightsparkNode.js";
4
5
  import { LightsparkNodeFromJson } from "./LightsparkNode.js";
5
6
  import LightsparkNodePurpose from "./LightsparkNodePurpose.js";
@@ -7,19 +8,22 @@ import type PageInfo from "./PageInfo.js";
7
8
  import { PageInfoFromJson } from "./PageInfo.js";
8
9
 
9
10
  /** A connection between an account and the nodes it manages. **/
10
- type AccountToNodesConnection = {
11
- /** An object that holds pagination information about the objects in this connection. **/
12
- pageInfo: PageInfo;
13
-
11
+ type AccountToNodesConnection = Connection & {
14
12
  /**
15
13
  * The total count of objects in this connection, using the current filters. It is different from the
16
14
  * number of objects returned in the current page (in the `entities` field).
17
15
  **/
18
16
  count: number;
19
17
 
18
+ /** An object that holds pagination information about the objects in this connection. **/
19
+ pageInfo: PageInfo;
20
+
20
21
  /** The nodes for the current page of this connection. **/
21
22
  entities: LightsparkNode[];
22
23
 
24
+ /** The typename of the object **/
25
+ typename: string;
26
+
23
27
  /**
24
28
  * The main purpose for the selected set of nodes. It is automatically determined from the nodes that
25
29
  * are selected in this connection and is used for optimization purposes, as well as to determine the
@@ -32,11 +36,12 @@ export const AccountToNodesConnectionFromJson = (
32
36
  obj: any
33
37
  ): AccountToNodesConnection => {
34
38
  return {
35
- pageInfo: PageInfoFromJson(obj["account_to_nodes_connection_page_info"]),
36
39
  count: obj["account_to_nodes_connection_count"],
40
+ pageInfo: PageInfoFromJson(obj["account_to_nodes_connection_page_info"]),
37
41
  entities: obj["account_to_nodes_connection_entities"].map((e) =>
38
42
  LightsparkNodeFromJson(e)
39
43
  ),
44
+ typename: "AccountToNodesConnection",
40
45
  purpose: !!obj["account_to_nodes_connection_purpose"]
41
46
  ? LightsparkNodePurpose[obj["account_to_nodes_connection_purpose"]] ??
42
47
  LightsparkNodePurpose.FUTURE_VALUE
@@ -47,6 +52,7 @@ export const AccountToNodesConnectionFromJson = (
47
52
  export const FRAGMENT = `
48
53
  fragment AccountToNodesConnectionFragment on AccountToNodesConnection {
49
54
  __typename
55
+ account_to_nodes_connection_count: count
50
56
  account_to_nodes_connection_page_info: page_info {
51
57
  __typename
52
58
  page_info_has_next_page: has_next_page
@@ -54,7 +60,6 @@ fragment AccountToNodesConnectionFragment on AccountToNodesConnection {
54
60
  page_info_start_cursor: start_cursor
55
61
  page_info_end_cursor: end_cursor
56
62
  }
57
- account_to_nodes_connection_count: count
58
63
  account_to_nodes_connection_purpose: purpose
59
64
  account_to_nodes_connection_entities: entities {
60
65
  id
@@ -1,35 +1,40 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
+ import type Connection from "./Connection.js";
3
4
  import type PageInfo from "./PageInfo.js";
4
5
  import { PageInfoFromJson } from "./PageInfo.js";
5
6
  import type PaymentRequest from "./PaymentRequest.js";
6
7
  import { PaymentRequestFromJson } from "./PaymentRequest.js";
7
8
 
8
- type AccountToPaymentRequestsConnection = {
9
- /** The payment requests for the current page of this connection. **/
10
- entities: PaymentRequest[];
11
-
12
- /** An object that holds pagination information about the objects in this connection. **/
13
- pageInfo: PageInfo;
14
-
9
+ type AccountToPaymentRequestsConnection = Connection & {
15
10
  /**
16
11
  * The total count of objects in this connection, using the current filters. It is different from the
17
12
  * number of objects returned in the current page (in the `entities` field).
18
13
  **/
19
- count?: number;
14
+ count: number;
15
+
16
+ /** An object that holds pagination information about the objects in this connection. **/
17
+ pageInfo: PageInfo;
18
+
19
+ /** The payment requests for the current page of this connection. **/
20
+ entities: PaymentRequest[];
21
+
22
+ /** The typename of the object **/
23
+ typename: string;
20
24
  };
21
25
 
22
26
  export const AccountToPaymentRequestsConnectionFromJson = (
23
27
  obj: any
24
28
  ): AccountToPaymentRequestsConnection => {
25
29
  return {
26
- entities: obj["account_to_payment_requests_connection_entities"].map((e) =>
27
- PaymentRequestFromJson(e)
28
- ),
30
+ count: obj["account_to_payment_requests_connection_count"],
29
31
  pageInfo: PageInfoFromJson(
30
32
  obj["account_to_payment_requests_connection_page_info"]
31
33
  ),
32
- count: obj["account_to_payment_requests_connection_count"],
34
+ entities: obj["account_to_payment_requests_connection_entities"].map((e) =>
35
+ PaymentRequestFromJson(e)
36
+ ),
37
+ typename: "AccountToPaymentRequestsConnection",
33
38
  } as AccountToPaymentRequestsConnection;
34
39
  };
35
40
 
@@ -37,9 +42,6 @@ export const FRAGMENT = `
37
42
  fragment AccountToPaymentRequestsConnectionFragment on AccountToPaymentRequestsConnection {
38
43
  __typename
39
44
  account_to_payment_requests_connection_count: count
40
- account_to_payment_requests_connection_entities: entities {
41
- id
42
- }
43
45
  account_to_payment_requests_connection_page_info: page_info {
44
46
  __typename
45
47
  page_info_has_next_page: has_next_page
@@ -47,6 +49,9 @@ fragment AccountToPaymentRequestsConnectionFragment on AccountToPaymentRequestsC
47
49
  page_info_start_cursor: start_cursor
48
50
  page_info_end_cursor: end_cursor
49
51
  }
52
+ account_to_payment_requests_connection_entities: entities {
53
+ id
54
+ }
50
55
  }`;
51
56
 
52
57
  export default AccountToPaymentRequestsConnection;
@@ -1,5 +1,6 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
+ import type Connection from "./Connection.js";
3
4
  import type CurrencyAmount from "./CurrencyAmount.js";
4
5
  import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
5
6
  import type PageInfo from "./PageInfo.js";
@@ -7,18 +8,21 @@ import { PageInfoFromJson } from "./PageInfo.js";
7
8
  import type Transaction from "./Transaction.js";
8
9
  import { TransactionFromJson } from "./Transaction.js";
9
10
 
10
- type AccountToTransactionsConnection = {
11
+ type AccountToTransactionsConnection = Connection & {
11
12
  /**
12
13
  * The total count of objects in this connection, using the current filters. It is different from the
13
14
  * number of objects returned in the current page (in the `entities` field).
14
15
  **/
15
16
  count: number;
16
17
 
18
+ /** An object that holds pagination information about the objects in this connection. **/
19
+ pageInfo: PageInfo;
20
+
17
21
  /** The transactions for the current page of this connection. **/
18
22
  entities: Transaction[];
19
23
 
20
- /** An object that holds pagination information about the objects in this connection. **/
21
- pageInfo: PageInfo;
24
+ /** The typename of the object **/
25
+ typename: string;
22
26
 
23
27
  /**
24
28
  * Profit (or loss) generated by the transactions in this connection, with the set of filters and
@@ -44,12 +48,13 @@ export const AccountToTransactionsConnectionFromJson = (
44
48
  ): AccountToTransactionsConnection => {
45
49
  return {
46
50
  count: obj["account_to_transactions_connection_count"],
47
- entities: obj["account_to_transactions_connection_entities"].map((e) =>
48
- TransactionFromJson(e)
49
- ),
50
51
  pageInfo: PageInfoFromJson(
51
52
  obj["account_to_transactions_connection_page_info"]
52
53
  ),
54
+ entities: obj["account_to_transactions_connection_entities"].map((e) =>
55
+ TransactionFromJson(e)
56
+ ),
57
+ typename: "AccountToTransactionsConnection",
53
58
  profitLoss: !!obj["account_to_transactions_connection_profit_loss"]
54
59
  ? CurrencyAmountFromJson(
55
60
  obj["account_to_transactions_connection_profit_loss"]
@@ -75,6 +80,14 @@ export const AccountToTransactionsConnectionFromJson = (
75
80
  export const FRAGMENT = `
76
81
  fragment AccountToTransactionsConnectionFragment on AccountToTransactionsConnection {
77
82
  __typename
83
+ account_to_transactions_connection_count: count
84
+ account_to_transactions_connection_page_info: page_info {
85
+ __typename
86
+ page_info_has_next_page: has_next_page
87
+ page_info_has_previous_page: has_previous_page
88
+ page_info_start_cursor: start_cursor
89
+ page_info_end_cursor: end_cursor
90
+ }
78
91
  account_to_transactions_connection_profit_loss: profit_loss {
79
92
  __typename
80
93
  currency_amount_original_value: original_value
@@ -91,7 +104,6 @@ fragment AccountToTransactionsConnectionFragment on AccountToTransactionsConnect
91
104
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
92
105
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
93
106
  }
94
- account_to_transactions_connection_count: count
95
107
  account_to_transactions_connection_total_amount_transacted: total_amount_transacted {
96
108
  __typename
97
109
  currency_amount_original_value: original_value
@@ -103,13 +115,6 @@ fragment AccountToTransactionsConnectionFragment on AccountToTransactionsConnect
103
115
  account_to_transactions_connection_entities: entities {
104
116
  id
105
117
  }
106
- account_to_transactions_connection_page_info: page_info {
107
- __typename
108
- page_info_has_next_page: has_next_page
109
- page_info_has_previous_page: has_previous_page
110
- page_info_start_cursor: start_cursor
111
- page_info_end_cursor: end_cursor
112
- }
113
118
  }`;
114
119
 
115
120
  export default AccountToTransactionsConnection;
@@ -1,39 +1,45 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
+ import type Connection from "./Connection.js";
3
4
  import type PageInfo from "./PageInfo.js";
4
5
  import { PageInfoFromJson } from "./PageInfo.js";
5
6
  import type Wallet from "./Wallet.js";
6
7
  import { WalletFromJson } from "./Wallet.js";
7
8
 
8
- type AccountToWalletsConnection = {
9
- /** An object that holds pagination information about the objects in this connection. **/
10
- pageInfo: PageInfo;
11
-
9
+ type AccountToWalletsConnection = Connection & {
12
10
  /**
13
11
  * The total count of objects in this connection, using the current filters. It is different from the
14
12
  * number of objects returned in the current page (in the `entities` field).
15
13
  **/
16
14
  count: number;
17
15
 
16
+ /** An object that holds pagination information about the objects in this connection. **/
17
+ pageInfo: PageInfo;
18
+
18
19
  /** The wallets for the current page of this connection. **/
19
20
  entities: Wallet[];
21
+
22
+ /** The typename of the object **/
23
+ typename: string;
20
24
  };
21
25
 
22
26
  export const AccountToWalletsConnectionFromJson = (
23
27
  obj: any
24
28
  ): AccountToWalletsConnection => {
25
29
  return {
26
- pageInfo: PageInfoFromJson(obj["account_to_wallets_connection_page_info"]),
27
30
  count: obj["account_to_wallets_connection_count"],
31
+ pageInfo: PageInfoFromJson(obj["account_to_wallets_connection_page_info"]),
28
32
  entities: obj["account_to_wallets_connection_entities"].map((e) =>
29
33
  WalletFromJson(e)
30
34
  ),
35
+ typename: "AccountToWalletsConnection",
31
36
  } as AccountToWalletsConnection;
32
37
  };
33
38
 
34
39
  export const FRAGMENT = `
35
40
  fragment AccountToWalletsConnectionFragment on AccountToWalletsConnection {
36
41
  __typename
42
+ account_to_wallets_connection_count: count
37
43
  account_to_wallets_connection_page_info: page_info {
38
44
  __typename
39
45
  page_info_has_next_page: has_next_page
@@ -41,7 +47,6 @@ fragment AccountToWalletsConnectionFragment on AccountToWalletsConnection {
41
47
  page_info_start_cursor: start_cursor
42
48
  page_info_end_cursor: end_cursor
43
49
  }
44
- account_to_wallets_connection_count: count
45
50
  account_to_wallets_connection_entities: entities {
46
51
  id
47
52
  }