@lightsparkdev/lightspark-sdk 0.4.6 → 0.4.8

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 (58) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/index.cjs +107 -104
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.js +108 -107
  5. package/package.json +13 -5
  6. package/src/auth/AccountTokenAuthProvider.ts +8 -3
  7. package/src/client.ts +51 -36
  8. package/src/graphql/MultiNodeDashboard.ts +6 -7
  9. package/src/objects/.eslintrc.cjs +5 -0
  10. package/src/objects/Account.ts +23 -29
  11. package/src/objects/AccountToApiTokensConnection.ts +4 -2
  12. package/src/objects/AccountToChannelsConnection.ts +2 -1
  13. package/src/objects/AccountToNodesConnection.ts +4 -2
  14. package/src/objects/AccountToPaymentRequestsConnection.ts +4 -2
  15. package/src/objects/AccountToTransactionsConnection.ts +6 -3
  16. package/src/objects/AccountToWalletsConnection.ts +4 -2
  17. package/src/objects/ApiToken.ts +2 -2
  18. package/src/objects/Balances.ts +2 -1
  19. package/src/objects/BlockchainBalance.ts +2 -1
  20. package/src/objects/Channel.ts +10 -9
  21. package/src/objects/ChannelClosingTransaction.ts +6 -5
  22. package/src/objects/ChannelFees.ts +2 -1
  23. package/src/objects/ChannelOpeningTransaction.ts +6 -5
  24. package/src/objects/ChannelToTransactionsConnection.ts +2 -1
  25. package/src/objects/CreateApiTokenOutput.ts +2 -1
  26. package/src/objects/Deposit.ts +6 -5
  27. package/src/objects/FeeEstimate.ts +2 -1
  28. package/src/objects/FundNodeOutput.ts +2 -1
  29. package/src/objects/GraphNode.ts +6 -7
  30. package/src/objects/Hop.ts +4 -3
  31. package/src/objects/IncomingPayment.ts +8 -8
  32. package/src/objects/IncomingPaymentAttempt.ts +4 -3
  33. package/src/objects/IncomingPaymentToAttemptsConnection.ts +2 -3
  34. package/src/objects/Invoice.ts +7 -5
  35. package/src/objects/InvoiceData.ts +5 -3
  36. package/src/objects/LightningFeeEstimateOutput.ts +2 -1
  37. package/src/objects/LightningTransaction.ts +7 -5
  38. package/src/objects/LightsparkNode.ts +15 -16
  39. package/src/objects/LightsparkNodeOwner.ts +3 -2
  40. package/src/objects/LightsparkNodeToChannelsConnection.ts +4 -2
  41. package/src/objects/Node.ts +7 -7
  42. package/src/objects/NodeToAddressesConnection.ts +2 -1
  43. package/src/objects/OnChainTransaction.ts +10 -8
  44. package/src/objects/OutgoingPayment.ts +11 -11
  45. package/src/objects/OutgoingPaymentAttempt.ts +7 -7
  46. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +2 -1
  47. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +2 -3
  48. package/src/objects/PaymentRequest.ts +5 -4
  49. package/src/objects/PaymentRequestData.ts +1 -1
  50. package/src/objects/RoutingTransaction.ts +8 -6
  51. package/src/objects/SingleNodeDashboard.ts +6 -6
  52. package/src/objects/Transaction.ts +10 -8
  53. package/src/objects/TransactionUpdate.ts +2 -1
  54. package/src/objects/Wallet.ts +7 -5
  55. package/src/objects/Withdrawal.ts +6 -5
  56. package/src/objects/WithdrawalRequest.ts +9 -10
  57. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +4 -4
  58. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +4 -4
package/src/client.ts CHANGED
@@ -1,25 +1,32 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
3
  import autoBind from "auto-bind";
4
- import Observable from "zen-observable";
4
+ import type Observable from "zen-observable";
5
5
 
6
- import {
6
+ import type {
7
7
  AuthProvider,
8
- b64encode,
9
8
  CryptoInterface,
9
+ KeyOrAliasType,
10
+ Maybe,
11
+ Query,
12
+ } from "@lightsparkdev/core";
13
+ import {
14
+ b64encode,
10
15
  DefaultCrypto,
11
16
  KeyOrAlias,
12
- KeyOrAliasType,
13
17
  LightsparkAuthException,
14
18
  LightsparkException,
15
19
  LightsparkSigningException,
16
- Maybe,
17
20
  NodeKeyCache,
18
- Query,
19
21
  Requester,
20
22
  StubAuthProvider,
21
23
  } from "@lightsparkdev/core";
24
+ import {
25
+ type OutgoingPayment as GQLOutgoingPayment,
26
+ type Subscription as GQLSubscription,
27
+ } from "@lightsparkdev/gql/generated/graphql.js";
22
28
  import { createHash } from "crypto";
29
+ import packageJson from "../package.json";
23
30
  import { BitcoinFeeEstimate as BitcoinFeeEstimateQuery } from "./graphql/BitcoinFeeEstimate.js";
24
31
  import { CreateApiToken } from "./graphql/CreateApiToken.js";
25
32
  import { CreateInvoice } from "./graphql/CreateInvoice.js";
@@ -32,10 +39,8 @@ import { DeleteApiToken } from "./graphql/DeleteApiToken.js";
32
39
  import { FundNode } from "./graphql/FundNode.js";
33
40
  import { LightningFeeEstimateForInvoice } from "./graphql/LightningFeeEstimateForInvoice.js";
34
41
  import { LightningFeeEstimateForNode } from "./graphql/LightningFeeEstimateForNode.js";
35
- import {
36
- AccountDashboard,
37
- MultiNodeDashboard,
38
- } from "./graphql/MultiNodeDashboard.js";
42
+ import type { AccountDashboard } from "./graphql/MultiNodeDashboard.js";
43
+ import { MultiNodeDashboard } from "./graphql/MultiNodeDashboard.js";
39
44
  import { PayInvoice } from "./graphql/PayInvoice.js";
40
45
  import { RecoverNodeSigningKey } from "./graphql/RecoverNodeSigningKey.js";
41
46
  import { RequestWithdrawal } from "./graphql/RequestWithdrawal.js";
@@ -46,27 +51,29 @@ import { TransactionSubscription } from "./graphql/TransactionSubscription.js";
46
51
  import Account from "./objects/Account.js";
47
52
  import { ApiTokenFromJson } from "./objects/ApiToken.js";
48
53
  import BitcoinNetwork from "./objects/BitcoinNetwork.js";
49
- import CreateApiTokenOutput from "./objects/CreateApiTokenOutput.js";
50
- import CurrencyAmount, {
51
- CurrencyAmountFromJson,
52
- } from "./objects/CurrencyAmount.js";
53
- import FeeEstimate, { FeeEstimateFromJson } from "./objects/FeeEstimate.js";
54
- import Invoice, { InvoiceFromJson } from "./objects/Invoice.js";
55
- import InvoiceData, { InvoiceDataFromJson } from "./objects/InvoiceData.js";
54
+ import type CreateApiTokenOutput from "./objects/CreateApiTokenOutput.js";
55
+ import type CurrencyAmount from "./objects/CurrencyAmount.js";
56
+ import { CurrencyAmountFromJson } from "./objects/CurrencyAmount.js";
57
+ import type FeeEstimate from "./objects/FeeEstimate.js";
58
+ import { FeeEstimateFromJson } from "./objects/FeeEstimate.js";
59
+ import type Invoice from "./objects/Invoice.js";
60
+ import { InvoiceFromJson } from "./objects/Invoice.js";
61
+ import type InvoiceData from "./objects/InvoiceData.js";
62
+ import { InvoiceDataFromJson } from "./objects/InvoiceData.js";
56
63
  import InvoiceType from "./objects/InvoiceType.js";
57
- import OutgoingPayment, {
58
- OutgoingPaymentFromJson,
59
- } from "./objects/OutgoingPayment.js";
64
+ import type OutgoingPayment from "./objects/OutgoingPayment.js";
65
+ import { OutgoingPaymentFromJson } from "./objects/OutgoingPayment.js";
60
66
  import Permission from "./objects/Permission.js";
61
- import SingleNodeDashboard from "./objects/SingleNodeDashboard.js";
62
- import Transaction, { TransactionFromJson } from "./objects/Transaction.js";
63
- import TransactionUpdate, {
64
- TransactionUpdateFromJson,
65
- } from "./objects/TransactionUpdate.js";
66
- import WithdrawalMode from "./objects/WithdrawalMode.js";
67
- import WithdrawalRequest, {
68
- WithdrawalRequestFromJson,
69
- } from "./objects/WithdrawalRequest.js";
67
+ import type SingleNodeDashboard from "./objects/SingleNodeDashboard.js";
68
+ import type Transaction from "./objects/Transaction.js";
69
+ import { TransactionFromJson } from "./objects/Transaction.js";
70
+ import type TransactionUpdate from "./objects/TransactionUpdate.js";
71
+ import { TransactionUpdateFromJson } from "./objects/TransactionUpdate.js";
72
+ import type WithdrawalMode from "./objects/WithdrawalMode.js";
73
+ import type WithdrawalRequest from "./objects/WithdrawalRequest.js";
74
+ import { WithdrawalRequestFromJson } from "./objects/WithdrawalRequest.js";
75
+
76
+ const sdkVersion = packageJson.version;
70
77
 
71
78
  /**
72
79
  * The LightsparkClient is the main entrypoint for interacting with the Lightspark API.
@@ -109,7 +116,6 @@ class LightsparkClient {
109
116
  private readonly serverUrl: string = "api.lightspark.com",
110
117
  private readonly cryptoImpl: CryptoInterface = DefaultCrypto
111
118
  ) {
112
- const sdkVersion = require("../package.json").version;
113
119
  this.nodeKeyCache = new NodeKeyCache(this.cryptoImpl);
114
120
  this.requester = new Requester(
115
121
  this.nodeKeyCache,
@@ -130,7 +136,6 @@ class LightsparkClient {
130
136
  * @param authProvider
131
137
  */
132
138
  public async setAuthProvider(authProvider: AuthProvider) {
133
- const sdkVersion = require("../package.json").version;
134
139
  this.requester = new Requester(
135
140
  this.nodeKeyCache,
136
141
  LIGHTSPARK_SDK_ENDPOINT,
@@ -195,7 +200,9 @@ class LightsparkClient {
195
200
  public listenToTransactions(
196
201
  nodeIds: string[]
197
202
  ): Observable<TransactionUpdate | undefined> {
198
- const response = this.requester.subscribe(TransactionSubscription, {
203
+ const response = this.requester.subscribe<
204
+ Pick<GQLSubscription, "transactions">
205
+ >(TransactionSubscription, {
199
206
  nodeIds,
200
207
  });
201
208
  return response.map(
@@ -619,7 +626,7 @@ class LightsparkClient {
619
626
  if (!this.nodeKeyCache.hasKey(payerNodeId)) {
620
627
  throw new LightsparkSigningException("Paying node is not unlocked");
621
628
  }
622
- const variables: any = {
629
+ const variables: Record<string, string | number> = {
623
630
  node_id: payerNodeId,
624
631
  encoded_invoice: encodedInvoice,
625
632
  timeout_secs: timeoutSecs,
@@ -824,7 +831,11 @@ class LightsparkClient {
824
831
  memo,
825
832
  invoice_type: invoiceType,
826
833
  },
827
- constructObject: (responseJson: any) => {
834
+ constructObject: (responseJson: {
835
+ create_test_mode_invoice: {
836
+ encoded_payment_request: string;
837
+ } | null;
838
+ }) => {
828
839
  const encodedPaymentRequest =
829
840
  responseJson.create_test_mode_invoice?.encoded_payment_request;
830
841
  if (!encodedPaymentRequest) {
@@ -833,7 +844,7 @@ class LightsparkClient {
833
844
  "Unable to create test mode invoice"
834
845
  );
835
846
  }
836
- return encodedPaymentRequest as string;
847
+ return encodedPaymentRequest;
837
848
  },
838
849
  });
839
850
  }
@@ -859,7 +870,11 @@ class LightsparkClient {
859
870
  encoded_invoice: encodedInvoice,
860
871
  amount_msats: amountMsats,
861
872
  },
862
- constructObject: (responseJson: any) => {
873
+ constructObject: (responseJson: {
874
+ create_test_mode_payment: {
875
+ payment: GQLOutgoingPayment;
876
+ } | null;
877
+ }) => {
863
878
  return OutgoingPaymentFromJson(
864
879
  responseJson.create_test_mode_payment?.payment
865
880
  );
@@ -1,12 +1,11 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import { Maybe } from "@lightsparkdev/core";
4
- import CurrencyAmount, {
5
- FRAGMENT as CurrencyAmountFragment,
6
- } from "../objects/CurrencyAmount.js";
7
- import LightsparkNodePurpose from "../objects/LightsparkNodePurpose.js";
8
- import LightsparkNodeStatus from "../objects/LightsparkNodeStatus.js";
9
- import NodeAddressType from "../objects/NodeAddressType.js";
3
+ import type { Maybe } from "@lightsparkdev/core";
4
+ import type CurrencyAmount from "../objects/CurrencyAmount.js";
5
+ import { FRAGMENT as CurrencyAmountFragment } from "../objects/CurrencyAmount.js";
6
+ import type LightsparkNodePurpose from "../objects/LightsparkNodePurpose.js";
7
+ import type LightsparkNodeStatus from "../objects/LightsparkNodeStatus.js";
8
+ import type NodeAddressType from "../objects/NodeAddressType.js";
10
9
 
11
10
  export type AccountDashboard = {
12
11
  id: string;
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ rules: {
3
+ "@typescript-eslint/no-explicit-any": "off",
4
+ },
5
+ };
@@ -1,35 +1,29 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import { Query } from "@lightsparkdev/core";
3
+ import type { Query } from "@lightsparkdev/core";
4
4
  import autoBind from "auto-bind";
5
- import LightsparkClient from "../client.js";
6
- import AccountToApiTokensConnection, {
7
- AccountToApiTokensConnectionFromJson,
8
- } from "./AccountToApiTokensConnection.js";
9
- import AccountToChannelsConnection, {
10
- AccountToChannelsConnectionFromJson,
11
- } from "./AccountToChannelsConnection.js";
12
- import AccountToNodesConnection, {
13
- AccountToNodesConnectionFromJson,
14
- } from "./AccountToNodesConnection.js";
15
- import AccountToPaymentRequestsConnection, {
16
- AccountToPaymentRequestsConnectionFromJson,
17
- } from "./AccountToPaymentRequestsConnection.js";
18
- import AccountToTransactionsConnection, {
19
- AccountToTransactionsConnectionFromJson,
20
- } from "./AccountToTransactionsConnection.js";
21
- import AccountToWalletsConnection, {
22
- AccountToWalletsConnectionFromJson,
23
- } from "./AccountToWalletsConnection.js";
24
- import BitcoinNetwork from "./BitcoinNetwork.js";
25
- import BlockchainBalance, {
26
- BlockchainBalanceFromJson,
27
- } from "./BlockchainBalance.js";
28
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
29
- import LightsparkNodeOwner from "./LightsparkNodeOwner.js";
30
- import TransactionFailures from "./TransactionFailures.js";
31
- import TransactionStatus from "./TransactionStatus.js";
32
- import TransactionType from "./TransactionType.js";
5
+ import type LightsparkClient from "../client.js";
6
+ import type AccountToApiTokensConnection from "./AccountToApiTokensConnection.js";
7
+ import { AccountToApiTokensConnectionFromJson } from "./AccountToApiTokensConnection.js";
8
+ import type AccountToChannelsConnection from "./AccountToChannelsConnection.js";
9
+ import { AccountToChannelsConnectionFromJson } from "./AccountToChannelsConnection.js";
10
+ import type AccountToNodesConnection from "./AccountToNodesConnection.js";
11
+ import { AccountToNodesConnectionFromJson } from "./AccountToNodesConnection.js";
12
+ import type AccountToPaymentRequestsConnection from "./AccountToPaymentRequestsConnection.js";
13
+ import { AccountToPaymentRequestsConnectionFromJson } from "./AccountToPaymentRequestsConnection.js";
14
+ import type AccountToTransactionsConnection from "./AccountToTransactionsConnection.js";
15
+ import { AccountToTransactionsConnectionFromJson } from "./AccountToTransactionsConnection.js";
16
+ import type AccountToWalletsConnection from "./AccountToWalletsConnection.js";
17
+ import { AccountToWalletsConnectionFromJson } from "./AccountToWalletsConnection.js";
18
+ import type BitcoinNetwork from "./BitcoinNetwork.js";
19
+ import type BlockchainBalance from "./BlockchainBalance.js";
20
+ import { BlockchainBalanceFromJson } from "./BlockchainBalance.js";
21
+ import type CurrencyAmount from "./CurrencyAmount.js";
22
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
23
+ import type LightsparkNodeOwner from "./LightsparkNodeOwner.js";
24
+ import type TransactionFailures from "./TransactionFailures.js";
25
+ import type TransactionStatus from "./TransactionStatus.js";
26
+ import type TransactionType from "./TransactionType.js";
33
27
 
34
28
  class Account implements LightsparkNodeOwner {
35
29
  constructor(
@@ -1,7 +1,9 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import ApiToken, { ApiTokenFromJson } from "./ApiToken.js";
4
- import PageInfo, { PageInfoFromJson } from "./PageInfo.js";
3
+ import type ApiToken from "./ApiToken.js";
4
+ import { ApiTokenFromJson } from "./ApiToken.js";
5
+ import type PageInfo from "./PageInfo.js";
6
+ import { PageInfoFromJson } from "./PageInfo.js";
5
7
 
6
8
  type AccountToApiTokensConnection = {
7
9
  /** An object that holds pagination information about the objects in this connection. **/
@@ -1,7 +1,8 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
3
  import autoBind from "auto-bind";
4
- import Channel, { ChannelFromJson } from "./Channel.js";
4
+ import type Channel from "./Channel.js";
5
+ import { ChannelFromJson } from "./Channel.js";
5
6
 
6
7
  class AccountToChannelsConnection {
7
8
  constructor(
@@ -1,8 +1,10 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import LightsparkNode, { LightsparkNodeFromJson } from "./LightsparkNode.js";
3
+ import type LightsparkNode from "./LightsparkNode.js";
4
+ import { LightsparkNodeFromJson } from "./LightsparkNode.js";
4
5
  import LightsparkNodePurpose from "./LightsparkNodePurpose.js";
5
- import PageInfo, { PageInfoFromJson } from "./PageInfo.js";
6
+ import type PageInfo from "./PageInfo.js";
7
+ import { PageInfoFromJson } from "./PageInfo.js";
6
8
 
7
9
  /** A connection between an account and the nodes it manages. **/
8
10
  type AccountToNodesConnection = {
@@ -1,7 +1,9 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import PageInfo, { PageInfoFromJson } from "./PageInfo.js";
4
- import PaymentRequest, { PaymentRequestFromJson } from "./PaymentRequest.js";
3
+ import type PageInfo from "./PageInfo.js";
4
+ import { PageInfoFromJson } from "./PageInfo.js";
5
+ import type PaymentRequest from "./PaymentRequest.js";
6
+ import { PaymentRequestFromJson } from "./PaymentRequest.js";
5
7
 
6
8
  type AccountToPaymentRequestsConnection = {
7
9
  /** The payment requests for the current page of this connection. **/
@@ -1,8 +1,11 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
4
- import PageInfo, { PageInfoFromJson } from "./PageInfo.js";
5
- import Transaction, { TransactionFromJson } from "./Transaction.js";
3
+ import type CurrencyAmount from "./CurrencyAmount.js";
4
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
5
+ import type PageInfo from "./PageInfo.js";
6
+ import { PageInfoFromJson } from "./PageInfo.js";
7
+ import type Transaction from "./Transaction.js";
8
+ import { TransactionFromJson } from "./Transaction.js";
6
9
 
7
10
  type AccountToTransactionsConnection = {
8
11
  /**
@@ -1,7 +1,9 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import PageInfo, { PageInfoFromJson } from "./PageInfo.js";
4
- import Wallet, { WalletFromJson } from "./Wallet.js";
3
+ import type PageInfo from "./PageInfo.js";
4
+ import { PageInfoFromJson } from "./PageInfo.js";
5
+ import type Wallet from "./Wallet.js";
6
+ import { WalletFromJson } from "./Wallet.js";
5
7
 
6
8
  type AccountToWalletsConnection = {
7
9
  /** An object that holds pagination information about the objects in this connection. **/
@@ -1,7 +1,7 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import { Query } from "@lightsparkdev/core";
4
- import Entity from "./Entity.js";
3
+ import type { Query } from "@lightsparkdev/core";
4
+ import type Entity from "./Entity.js";
5
5
  import Permission from "./Permission.js";
6
6
 
7
7
  type ApiToken = Entity & {
@@ -1,6 +1,7 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
3
+ import type CurrencyAmount from "./CurrencyAmount.js";
4
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
4
5
 
5
6
  type Balances = {
6
7
  /**
@@ -1,6 +1,7 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
3
+ import type CurrencyAmount from "./CurrencyAmount.js";
4
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
4
5
 
5
6
  /** This object provides a detailed breakdown of a `LightsparkNode`'s current balance on the Bitcoin Network. **/
6
7
  type BlockchainBalance = {
@@ -1,16 +1,17 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import { Query } from "@lightsparkdev/core";
3
+ import type { Query } from "@lightsparkdev/core";
4
4
  import autoBind from "auto-bind";
5
- import LightsparkClient from "../client.js";
6
- import ChannelFees, { ChannelFeesFromJson } from "./ChannelFees.js";
5
+ import type LightsparkClient from "../client.js";
6
+ import type ChannelFees from "./ChannelFees.js";
7
+ import { ChannelFeesFromJson } from "./ChannelFees.js";
7
8
  import ChannelStatus from "./ChannelStatus.js";
8
- import ChannelToTransactionsConnection, {
9
- ChannelToTransactionsConnectionFromJson,
10
- } from "./ChannelToTransactionsConnection.js";
11
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
12
- import Entity from "./Entity.js";
13
- import TransactionType from "./TransactionType.js";
9
+ import type ChannelToTransactionsConnection from "./ChannelToTransactionsConnection.js";
10
+ import { ChannelToTransactionsConnectionFromJson } from "./ChannelToTransactionsConnection.js";
11
+ import type CurrencyAmount from "./CurrencyAmount.js";
12
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
13
+ import type Entity from "./Entity.js";
14
+ import type TransactionType from "./TransactionType.js";
14
15
 
15
16
  /** An object that represents a payment channel between two nodes in the Lightning Network. **/
16
17
  class Channel implements Entity {
@@ -1,10 +1,11 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import { Query } from "@lightsparkdev/core";
4
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
5
- import Entity from "./Entity.js";
6
- import OnChainTransaction from "./OnChainTransaction.js";
7
- import Transaction from "./Transaction.js";
3
+ import type { Query } from "@lightsparkdev/core";
4
+ import type CurrencyAmount from "./CurrencyAmount.js";
5
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
6
+ import type Entity from "./Entity.js";
7
+ import type OnChainTransaction from "./OnChainTransaction.js";
8
+ import type Transaction from "./Transaction.js";
8
9
  import TransactionStatus from "./TransactionStatus.js";
9
10
 
10
11
  /** The transaction on Bitcoin blockchain to close a channel on Lightning Network where the balances are allocated back to local and remote nodes. **/
@@ -1,6 +1,7 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
3
+ import type CurrencyAmount from "./CurrencyAmount.js";
4
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
4
5
 
5
6
  type ChannelFees = {
6
7
  baseFee?: CurrencyAmount;
@@ -1,10 +1,11 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import { Query } from "@lightsparkdev/core";
4
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
5
- import Entity from "./Entity.js";
6
- import OnChainTransaction from "./OnChainTransaction.js";
7
- import Transaction from "./Transaction.js";
3
+ import type { Query } from "@lightsparkdev/core";
4
+ import type CurrencyAmount from "./CurrencyAmount.js";
5
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
6
+ import type Entity from "./Entity.js";
7
+ import type OnChainTransaction from "./OnChainTransaction.js";
8
+ import type Transaction from "./Transaction.js";
8
9
  import TransactionStatus from "./TransactionStatus.js";
9
10
 
10
11
  /** The transaction on Bitcoin blockchain to open a channel on Lightning Network funded by the local Lightspark node. **/
@@ -1,6 +1,7 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
3
+ import type CurrencyAmount from "./CurrencyAmount.js";
4
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
4
5
 
5
6
  type ChannelToTransactionsConnection = {
6
7
  /**
@@ -1,6 +1,7 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import ApiToken, { ApiTokenFromJson } from "./ApiToken.js";
3
+ import type ApiToken from "./ApiToken.js";
4
+ import { ApiTokenFromJson } from "./ApiToken.js";
4
5
 
5
6
  type CreateApiTokenOutput = {
6
7
  /** The API Token that has been created. **/
@@ -1,10 +1,11 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import { Query } from "@lightsparkdev/core";
4
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
5
- import Entity from "./Entity.js";
6
- import OnChainTransaction from "./OnChainTransaction.js";
7
- import Transaction from "./Transaction.js";
3
+ import type { Query } from "@lightsparkdev/core";
4
+ import type CurrencyAmount from "./CurrencyAmount.js";
5
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
6
+ import type Entity from "./Entity.js";
7
+ import type OnChainTransaction from "./OnChainTransaction.js";
8
+ import type Transaction from "./Transaction.js";
8
9
  import TransactionStatus from "./TransactionStatus.js";
9
10
 
10
11
  /** The transaction on Bitcoin blockchain to fund the Lightspark node's wallet. **/
@@ -1,6 +1,7 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
3
+ import type CurrencyAmount from "./CurrencyAmount.js";
4
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
4
5
 
5
6
  type FeeEstimate = {
6
7
  feeFast: CurrencyAmount;
@@ -1,6 +1,7 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
3
+ import type CurrencyAmount from "./CurrencyAmount.js";
4
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
4
5
 
5
6
  type FundNodeOutput = {
6
7
  amount: CurrencyAmount;
@@ -1,14 +1,13 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import { Query } from "@lightsparkdev/core";
3
+ import type { Query } from "@lightsparkdev/core";
4
4
  import autoBind from "auto-bind";
5
- import LightsparkClient from "../client.js";
5
+ import type LightsparkClient from "../client.js";
6
6
  import BitcoinNetwork from "./BitcoinNetwork.js";
7
- import Node from "./Node.js";
8
- import NodeAddressType from "./NodeAddressType.js";
9
- import NodeToAddressesConnection, {
10
- NodeToAddressesConnectionFromJson,
11
- } from "./NodeToAddressesConnection.js";
7
+ import type Node from "./Node.js";
8
+ import type NodeAddressType from "./NodeAddressType.js";
9
+ import type NodeToAddressesConnection from "./NodeToAddressesConnection.js";
10
+ import { NodeToAddressesConnectionFromJson } from "./NodeToAddressesConnection.js";
12
11
 
13
12
  /** This is a node on the Lightning Network, managed by a third party. The information about this node is public data that has been obtained by observing the Lightning Network. **/
14
13
  class GraphNode implements Node {
@@ -1,8 +1,9 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import { Query } from "@lightsparkdev/core";
4
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
5
- import Entity from "./Entity.js";
3
+ import type { Query } from "@lightsparkdev/core";
4
+ import type CurrencyAmount from "./CurrencyAmount.js";
5
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
6
+ import type Entity from "./Entity.js";
6
7
 
7
8
  /** One hop signifies a payment moving one node ahead on a payment route; a list of sequential hops defines the path from sender node to recipient node for a payment attempt. **/
8
9
  type Hop = Entity & {
@@ -1,14 +1,14 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import { Query } from "@lightsparkdev/core";
3
+ import type { Query } from "@lightsparkdev/core";
4
4
  import autoBind from "auto-bind";
5
- import LightsparkClient from "../client.js";
6
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
7
- import IncomingPaymentAttemptStatus from "./IncomingPaymentAttemptStatus.js";
8
- import IncomingPaymentToAttemptsConnection, {
9
- IncomingPaymentToAttemptsConnectionFromJson,
10
- } from "./IncomingPaymentToAttemptsConnection.js";
11
- import LightningTransaction from "./LightningTransaction.js";
5
+ import type LightsparkClient from "../client.js";
6
+ import type CurrencyAmount from "./CurrencyAmount.js";
7
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
8
+ import type IncomingPaymentAttemptStatus from "./IncomingPaymentAttemptStatus.js";
9
+ import type IncomingPaymentToAttemptsConnection from "./IncomingPaymentToAttemptsConnection.js";
10
+ import { IncomingPaymentToAttemptsConnectionFromJson } from "./IncomingPaymentToAttemptsConnection.js";
11
+ import type LightningTransaction from "./LightningTransaction.js";
12
12
  import TransactionStatus from "./TransactionStatus.js";
13
13
 
14
14
  /** A transaction that was sent to a Lightspark node on the Lightning Network. **/
@@ -1,8 +1,9 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import { Query } from "@lightsparkdev/core";
4
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
5
- import Entity from "./Entity.js";
3
+ import type { Query } from "@lightsparkdev/core";
4
+ import type CurrencyAmount from "./CurrencyAmount.js";
5
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
6
+ import type Entity from "./Entity.js";
6
7
  import IncomingPaymentAttemptStatus from "./IncomingPaymentAttemptStatus.js";
7
8
 
8
9
  /** An attempt for a payment over a route from sender node to recipient node. **/
@@ -1,8 +1,7 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import IncomingPaymentAttempt, {
4
- IncomingPaymentAttemptFromJson,
5
- } from "./IncomingPaymentAttempt.js";
3
+ import type IncomingPaymentAttempt from "./IncomingPaymentAttempt.js";
4
+ import { IncomingPaymentAttemptFromJson } from "./IncomingPaymentAttempt.js";
6
5
 
7
6
  /** The connection from incoming payment to all attempts. **/
8
7
  type IncomingPaymentToAttemptsConnection = {
@@ -1,10 +1,12 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import { Query } from "@lightsparkdev/core";
4
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
5
- import Entity from "./Entity.js";
6
- import InvoiceData, { InvoiceDataFromJson } from "./InvoiceData.js";
7
- import PaymentRequest from "./PaymentRequest.js";
3
+ import type { Query } from "@lightsparkdev/core";
4
+ import type CurrencyAmount from "./CurrencyAmount.js";
5
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
6
+ import type Entity from "./Entity.js";
7
+ import type InvoiceData from "./InvoiceData.js";
8
+ import { InvoiceDataFromJson } from "./InvoiceData.js";
9
+ import type PaymentRequest from "./PaymentRequest.js";
8
10
  import PaymentRequestStatus from "./PaymentRequestStatus.js";
9
11
 
10
12
  /** This object represents a BOLT #11 invoice (https://github.com/lightning/bolts/blob/master/11-payment-encoding.md) initiated by a Lightspark Node. **/
@@ -1,9 +1,11 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
3
  import BitcoinNetwork from "./BitcoinNetwork.js";
4
- import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
5
- import Node, { NodeFromJson } from "./Node.js";
6
- import PaymentRequestData from "./PaymentRequestData.js";
4
+ import type CurrencyAmount from "./CurrencyAmount.js";
5
+ import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
6
+ import type Node from "./Node.js";
7
+ import { NodeFromJson } from "./Node.js";
8
+ import type PaymentRequestData from "./PaymentRequestData.js";
7
9
 
8
10
  /** This object represents the BOLT #11 invoice protocol for Lightning Payments. See https://github.com/lightning/bolts/blob/master/11-payment-encoding.md. **/
9
11
  type InvoiceData = PaymentRequestData & {