@lightsparkdev/lightspark-sdk 1.2.2 → 1.3.0

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 (104) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{BitcoinNetwork-a816c0be.d.ts → BitcoinNetwork-972b1d01.d.ts} +4 -1
  3. package/dist/{chunk-GLL4KTUT.js → chunk-Y55D3PD4.js} +11 -11
  4. package/dist/env.d.cts +1 -1
  5. package/dist/env.d.ts +1 -1
  6. package/dist/{index-eb604025.d.ts → index-a5028d74.d.ts} +866 -451
  7. package/dist/index.cjs +622 -557
  8. package/dist/index.d.cts +3 -3
  9. package/dist/index.d.ts +3 -3
  10. package/dist/index.js +363 -298
  11. package/dist/objects/index.d.cts +2 -2
  12. package/dist/objects/index.d.ts +2 -2
  13. package/dist/objects/index.js +1 -1
  14. package/package.json +4 -4
  15. package/src/NodeKeyLoaderCache.ts +4 -3
  16. package/src/SigningKeyLoader.ts +12 -7
  17. package/src/client.ts +117 -65
  18. package/src/env.ts +3 -1
  19. package/src/graphql/CancelInvoice.ts +17 -0
  20. package/src/objects/Account.ts +7 -3
  21. package/src/objects/AccountToApiTokensConnection.ts +3 -2
  22. package/src/objects/AccountToChannelsConnection.ts +3 -2
  23. package/src/objects/AccountToNodesConnection.ts +3 -2
  24. package/src/objects/AccountToPaymentRequestsConnection.ts +3 -2
  25. package/src/objects/AccountToTransactionsConnection.ts +7 -6
  26. package/src/objects/AccountToWalletsConnection.ts +3 -2
  27. package/src/objects/ApiToken.ts +10 -5
  28. package/src/objects/Balances.ts +20 -12
  29. package/src/objects/BitcoinNetwork.ts +4 -1
  30. package/src/objects/CancelInvoiceInput.ts +18 -0
  31. package/src/objects/CancelInvoiceOutput.ts +26 -0
  32. package/src/objects/Channel.ts +26 -12
  33. package/src/objects/ChannelClosingTransaction.ts +7 -3
  34. package/src/objects/ChannelOpeningTransaction.ts +7 -3
  35. package/src/objects/ChannelStatus.ts +24 -5
  36. package/src/objects/ChannelToTransactionsConnection.ts +9 -8
  37. package/src/objects/Connection.ts +3 -2
  38. package/src/objects/CreateApiTokenOutput.ts +3 -3
  39. package/src/objects/CreateLnurlInvoiceInput.ts +3 -2
  40. package/src/objects/CreateTestModePaymentInput.ts +2 -2
  41. package/src/objects/CreateTestModePaymentoutput.ts +5 -1
  42. package/src/objects/CurrencyAmount.ts +2 -2
  43. package/src/objects/CurrencyUnit.ts +29 -6
  44. package/src/objects/Deposit.ts +8 -3
  45. package/src/objects/Entity.ts +8 -3
  46. package/src/objects/FeeEstimate.ts +5 -1
  47. package/src/objects/GraphNode.ts +20 -11
  48. package/src/objects/Hop.ts +8 -3
  49. package/src/objects/HtlcAttemptFailureCode.ts +4 -1
  50. package/src/objects/IncentivesIneligibilityReason.ts +16 -4
  51. package/src/objects/IncentivesStatus.ts +9 -2
  52. package/src/objects/IncomingPayment.ts +9 -5
  53. package/src/objects/IncomingPaymentAttempt.ts +7 -3
  54. package/src/objects/IncomingPaymentToAttemptsConnection.ts +3 -2
  55. package/src/objects/Invoice.ts +2 -2
  56. package/src/objects/InvoiceData.ts +7 -3
  57. package/src/objects/LightningFeeEstimateForInvoiceInput.ts +2 -2
  58. package/src/objects/LightningTransaction.ts +7 -3
  59. package/src/objects/LightsparkNode.ts +21 -12
  60. package/src/objects/LightsparkNodeOwner.ts +2 -2
  61. package/src/objects/LightsparkNodeToChannelsConnection.ts +3 -2
  62. package/src/objects/LightsparkNodeWithOSK.ts +20 -12
  63. package/src/objects/LightsparkNodeWithRemoteSigning.ts +16 -11
  64. package/src/objects/Node.ts +19 -11
  65. package/src/objects/NodeAddressType.ts +4 -1
  66. package/src/objects/NodeToAddressesConnection.ts +7 -3
  67. package/src/objects/OnChainTransaction.ts +8 -3
  68. package/src/objects/OutgoingPayment.ts +8 -3
  69. package/src/objects/OutgoingPaymentAttempt.ts +16 -9
  70. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +7 -3
  71. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +3 -2
  72. package/src/objects/PageInfo.ts +5 -1
  73. package/src/objects/PayInvoiceInput.ts +4 -1
  74. package/src/objects/PaymentFailureReason.ts +4 -1
  75. package/src/objects/PaymentRequest.ts +7 -3
  76. package/src/objects/PaymentRequestData.ts +5 -1
  77. package/src/objects/PaymentRequestStatus.ts +4 -1
  78. package/src/objects/Permission.ts +4 -1
  79. package/src/objects/RegisterPaymentInput.ts +8 -7
  80. package/src/objects/RequestWithdrawalInput.ts +2 -2
  81. package/src/objects/RiskRating.ts +5 -1
  82. package/src/objects/RoutingTransaction.ts +11 -5
  83. package/src/objects/RoutingTransactionFailureReason.ts +4 -1
  84. package/src/objects/ScreenNodeInput.ts +3 -2
  85. package/src/objects/SendPaymentInput.ts +4 -1
  86. package/src/objects/SetInvoicePaymentHashInput.ts +3 -2
  87. package/src/objects/Signable.ts +2 -2
  88. package/src/objects/SignablePayload.ts +6 -3
  89. package/src/objects/Transaction.ts +8 -3
  90. package/src/objects/TransactionStatus.ts +8 -2
  91. package/src/objects/TransactionType.ts +16 -4
  92. package/src/objects/TransactionUpdate.ts +6 -3
  93. package/src/objects/UmaInvitation.ts +2 -2
  94. package/src/objects/Wallet.ts +12 -4
  95. package/src/objects/WalletStatus.ts +18 -4
  96. package/src/objects/WalletToPaymentRequestsConnection.ts +3 -2
  97. package/src/objects/WalletToTransactionsConnection.ts +3 -2
  98. package/src/objects/WebhookEventType.ts +4 -1
  99. package/src/objects/Withdrawal.ts +7 -3
  100. package/src/objects/WithdrawalRequest.ts +10 -5
  101. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +3 -2
  102. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +3 -2
  103. package/src/objects/index.ts +8 -6
  104. package/src/tests/integration/general-regtest.test.ts +15 -1
@@ -16,12 +16,17 @@ import { WithdrawalRequestToChannelClosingTransactionsConnectionFromJson } from
16
16
  import type WithdrawalRequestToChannelOpeningTransactionsConnection from "./WithdrawalRequestToChannelOpeningTransactionsConnection.js";
17
17
  import { WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson } from "./WithdrawalRequestToChannelOpeningTransactionsConnection.js";
18
18
 
19
- /** This object represents a request made for an L1 withdrawal from your Lightspark Node to any Bitcoin wallet. You can retrieve this object to receive detailed information about any withdrawal request made from your Lightspark account. **/
19
+ /**
20
+ * This object represents a request made for an L1 withdrawal from your Lightspark Node to any
21
+ * Bitcoin wallet. You can retrieve this object to receive detailed information about any
22
+ * withdrawal request made from your Lightspark account.
23
+ * *
24
+ */
20
25
  class WithdrawalRequest implements Entity {
21
26
  constructor(
22
27
  /**
23
- * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
24
- * string.
28
+ * The unique identifier of this entity across all Lightspark systems.
29
+ * Should be treated as an opaque string.
25
30
  **/
26
31
  public readonly id: string,
27
32
  /** The date and time when the entity was first created. **/
@@ -39,8 +44,8 @@ class WithdrawalRequest implements Entity {
39
44
  /** The typename of the object **/
40
45
  public readonly typename: string,
41
46
  /**
42
- * If the requested amount is `-1` (i.e. everything), this field may contain an estimate of the amount
43
- * for the withdrawal.
47
+ * If the requested amount is `-1` (i.e. everything),
48
+ * this field may contain an estimate of the amount for the withdrawal.
44
49
  **/
45
50
  public readonly estimatedAmount?: CurrencyAmount | undefined,
46
51
  /** The time at which this request was completed. **/
@@ -13,8 +13,9 @@ interface WithdrawalRequestToChannelClosingTransactionsConnection {
13
13
  pageInfo: PageInfo;
14
14
 
15
15
  /**
16
- * The total count of objects in this connection, using the current filters. It is different from the
17
- * number of objects returned in the current page (in the `entities` field).
16
+ * The total count of objects in this connection, using the current filters.
17
+ * It is different from the number of objects returned in the current page (in the `entities`
18
+ * field).
18
19
  **/
19
20
  count: number;
20
21
 
@@ -13,8 +13,9 @@ interface WithdrawalRequestToChannelOpeningTransactionsConnection {
13
13
  pageInfo: PageInfo;
14
14
 
15
15
  /**
16
- * The total count of objects in this connection, using the current filters. It is different from the
17
- * number of objects returned in the current page (in the `entities` field).
16
+ * The total count of objects in this connection, using the current filters.
17
+ * It is different from the number of objects returned in the current page (in the `entities`
18
+ * field).
18
19
  **/
19
20
  count: number;
20
21
 
@@ -9,6 +9,8 @@ export { default as ApiToken, getApiTokenQuery } from "./ApiToken.js";
9
9
  export { default as Balances } from "./Balances.js";
10
10
  export { default as BitcoinNetwork } from "./BitcoinNetwork.js";
11
11
  export { default as BlockchainBalance } from "./BlockchainBalance.js";
12
+ export { default as CancelInvoiceInput } from "./CancelInvoiceInput.js";
13
+ export { default as CancelInvoiceOutput } from "./CancelInvoiceOutput.js";
12
14
  export { default as Channel } from "./Channel.js";
13
15
  export {
14
16
  default as ChannelClosingTransaction,
@@ -102,12 +104,13 @@ export { default as OutgoingPayment } from "./OutgoingPayment.js";
102
104
  export { default as OutgoingPaymentAttempt } from "./OutgoingPaymentAttempt.js";
103
105
  export { default as OutgoingPaymentAttemptStatus } from "./OutgoingPaymentAttemptStatus.js";
104
106
  export { default as OutgoingPaymentAttemptToHopsConnection } from "./OutgoingPaymentAttemptToHopsConnection.js";
107
+ export { default as OutgoingPaymentToAttemptsConnection } from "./OutgoingPaymentToAttemptsConnection.js";
105
108
  export { default as OutgoingPaymentsForInvoiceQueryInput } from "./OutgoingPaymentsForInvoiceQueryInput.js";
106
109
  export { default as OutgoingPaymentsForInvoiceQueryOutput } from "./OutgoingPaymentsForInvoiceQueryOutput.js";
107
- export { default as OutgoingPaymentToAttemptsConnection } from "./OutgoingPaymentToAttemptsConnection.js";
108
110
  export { default as PageInfo } from "./PageInfo.js";
109
111
  export { default as PayInvoiceInput } from "./PayInvoiceInput.js";
110
112
  export { default as PayInvoiceOutput } from "./PayInvoiceOutput.js";
113
+ export { default as PayUmaInvoiceInput } from "./PayUmaInvoiceInput.js";
111
114
  export { default as PaymentDirection } from "./PaymentDirection.js";
112
115
  export { default as PaymentFailureReason } from "./PaymentFailureReason.js";
113
116
  export {
@@ -116,7 +119,6 @@ export {
116
119
  } from "./PaymentRequest.js";
117
120
  export { default as PaymentRequestData } from "./PaymentRequestData.js";
118
121
  export { default as PaymentRequestStatus } from "./PaymentRequestStatus.js";
119
- export { default as PayUmaInvoiceInput } from "./PayUmaInvoiceInput.js";
120
122
  export { default as Permission } from "./Permission.js";
121
123
  export { default as PostTransactionData } from "./PostTransactionData.js";
122
124
  export { default as RegionCode } from "./RegionCode.js";
@@ -143,16 +145,16 @@ export { default as SendPaymentInput } from "./SendPaymentInput.js";
143
145
  export { default as SendPaymentOutput } from "./SendPaymentOutput.js";
144
146
  export { default as SetInvoicePaymentHashInput } from "./SetInvoicePaymentHashInput.js";
145
147
  export { default as SetInvoicePaymentHashOutput } from "./SetInvoicePaymentHashOutput.js";
148
+ export { default as SignInvoiceInput } from "./SignInvoiceInput.js";
149
+ export { default as SignInvoiceOutput } from "./SignInvoiceOutput.js";
150
+ export { default as SignMessagesInput } from "./SignMessagesInput.js";
151
+ export { default as SignMessagesOutput } from "./SignMessagesOutput.js";
146
152
  export { default as Signable, getSignableQuery } from "./Signable.js";
147
153
  export {
148
154
  default as SignablePayload,
149
155
  getSignablePayloadQuery,
150
156
  } from "./SignablePayload.js";
151
157
  export { default as SignablePayloadStatus } from "./SignablePayloadStatus.js";
152
- export { default as SignInvoiceInput } from "./SignInvoiceInput.js";
153
- export { default as SignInvoiceOutput } from "./SignInvoiceOutput.js";
154
- export { default as SignMessagesInput } from "./SignMessagesInput.js";
155
- export { default as SignMessagesOutput } from "./SignMessagesOutput.js";
156
158
  export { default as SingleNodeDashboard } from "./SingleNodeDashboard.js";
157
159
  export { default as Transaction, getTransactionQuery } from "./Transaction.js";
158
160
  export { default as TransactionFailures } from "./TransactionFailures.js";
@@ -213,7 +213,7 @@ describe(initSuiteName, () => {
213
213
  throw new TypeError("No connections in account");
214
214
  }
215
215
 
216
- const [regtestNode] = nodesConnection?.entities;
216
+ const [regtestNode] = nodesConnection.entities;
217
217
  regtestNodeId = regtestNode?.id;
218
218
  log("regtestNodeId", regtestNode?.id);
219
219
 
@@ -485,6 +485,20 @@ describe(p1SuiteName, () => {
485
485
  TESTS_TIMEOUT,
486
486
  );
487
487
 
488
+ test("Should create and cancel uma invoice", async () => {
489
+ const umaInvoice = await lightsparkClient.createUmaInvoice(
490
+ getRegtestNodeId(),
491
+ 10_000,
492
+ "hi there!",
493
+ );
494
+ expect(umaInvoice).toBeDefined();
495
+ const cancelledInvoice = await lightsparkClient.cancelInvoice(
496
+ umaInvoice!.id,
497
+ );
498
+ expect(cancelledInvoice).toBeDefined();
499
+ expect(cancelledInvoice?.id).toBe(umaInvoice?.id);
500
+ });
501
+
488
502
  test(
489
503
  "Should create STANDARD a test mode invoice",
490
504
  async () => {