@lightsparkdev/lightspark-sdk 1.2.3 → 1.3.1

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 (110) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/{BitcoinNetwork-37e9f091.d.ts → BitcoinNetwork-972b1d01.d.ts} +4 -6
  3. package/dist/{chunk-NCPWHRFO.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-449c9f58.d.ts → index-a5028d74.d.ts} +572 -943
  7. package/dist/index.cjs +266 -235
  8. package/dist/index.d.cts +3 -3
  9. package/dist/index.d.ts +3 -3
  10. package/dist/index.js +46 -15
  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 +2 -2
  15. package/src/client.ts +21 -3
  16. package/src/graphql/CancelInvoice.ts +17 -0
  17. package/src/objects/Account.ts +2 -2
  18. package/src/objects/AccountToApiTokensConnection.ts +3 -6
  19. package/src/objects/AccountToChannelsConnection.ts +3 -3
  20. package/src/objects/AccountToNodesConnection.ts +3 -6
  21. package/src/objects/AccountToPaymentRequestsConnection.ts +3 -6
  22. package/src/objects/AccountToTransactionsConnection.ts +5 -8
  23. package/src/objects/AccountToWalletsConnection.ts +3 -6
  24. package/src/objects/ApiToken.ts +7 -8
  25. package/src/objects/Balances.ts +16 -18
  26. package/src/objects/BitcoinNetwork.ts +4 -6
  27. package/src/objects/BlockchainBalance.ts +1 -4
  28. package/src/objects/CancelInvoiceInput.ts +18 -0
  29. package/src/objects/CancelInvoiceOutput.ts +26 -0
  30. package/src/objects/Channel.ts +16 -25
  31. package/src/objects/ChannelClosingTransaction.ts +10 -17
  32. package/src/objects/ChannelFees.ts +1 -4
  33. package/src/objects/ChannelOpeningTransaction.ts +10 -17
  34. package/src/objects/ChannelStatus.ts +13 -19
  35. package/src/objects/ChannelToTransactionsConnection.ts +6 -6
  36. package/src/objects/ComplianceProvider.ts +2 -3
  37. package/src/objects/Connection.ts +3 -6
  38. package/src/objects/CreateApiTokenInput.ts +1 -4
  39. package/src/objects/CreateLnurlInvoiceInput.ts +2 -2
  40. package/src/objects/CreateTestModePaymentoutput.ts +2 -2
  41. package/src/objects/CurrencyAmount.ts +4 -6
  42. package/src/objects/CurrencyUnit.ts +7 -11
  43. package/src/objects/Deposit.ts +10 -16
  44. package/src/objects/Entity.ts +2 -2
  45. package/src/objects/FeeEstimate.ts +3 -3
  46. package/src/objects/GraphNode.ts +13 -20
  47. package/src/objects/Hop.ts +4 -7
  48. package/src/objects/HtlcAttemptFailureCode.ts +4 -5
  49. package/src/objects/IncentivesIneligibilityReason.ts +13 -25
  50. package/src/objects/IncentivesStatus.ts +5 -8
  51. package/src/objects/IncomingPayment.ts +5 -12
  52. package/src/objects/IncomingPaymentAttempt.ts +3 -4
  53. package/src/objects/IncomingPaymentAttemptStatus.ts +3 -7
  54. package/src/objects/IncomingPaymentToAttemptsConnection.ts +3 -6
  55. package/src/objects/InvoiceData.ts +2 -2
  56. package/src/objects/InvoiceType.ts +2 -3
  57. package/src/objects/LightningFeeEstimateForInvoiceInput.ts +2 -2
  58. package/src/objects/LightningTransaction.ts +4 -8
  59. package/src/objects/LightsparkNode.ts +19 -25
  60. package/src/objects/LightsparkNodeStatus.ts +2 -3
  61. package/src/objects/LightsparkNodeToChannelsConnection.ts +3 -6
  62. package/src/objects/LightsparkNodeWithOSK.ts +19 -27
  63. package/src/objects/LightsparkNodeWithRemoteSigning.ts +17 -25
  64. package/src/objects/Node.ts +13 -19
  65. package/src/objects/NodeAddressType.ts +4 -5
  66. package/src/objects/NodeToAddressesConnection.ts +4 -4
  67. package/src/objects/OnChainTransaction.ts +11 -18
  68. package/src/objects/OutgoingPayment.ts +7 -19
  69. package/src/objects/OutgoingPaymentAttempt.ts +11 -19
  70. package/src/objects/OutgoingPaymentAttemptStatus.ts +3 -7
  71. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +5 -9
  72. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +3 -6
  73. package/src/objects/PageInfo.ts +2 -3
  74. package/src/objects/PayInvoiceInput.ts +4 -4
  75. package/src/objects/PaymentDirection.ts +2 -3
  76. package/src/objects/PaymentFailureReason.ts +4 -5
  77. package/src/objects/PaymentRequest.ts +3 -4
  78. package/src/objects/PaymentRequestData.ts +3 -3
  79. package/src/objects/PaymentRequestStatus.ts +4 -5
  80. package/src/objects/Permission.ts +4 -5
  81. package/src/objects/PostTransactionData.ts +3 -6
  82. package/src/objects/RegionCode.ts +12 -43
  83. package/src/objects/RegisterPaymentInput.ts +5 -9
  84. package/src/objects/RemoteSigningSubEventType.ts +3 -7
  85. package/src/objects/RiskRating.ts +5 -6
  86. package/src/objects/RoutingTransaction.ts +8 -15
  87. package/src/objects/RoutingTransactionFailureReason.ts +4 -6
  88. package/src/objects/ScreenNodeInput.ts +2 -2
  89. package/src/objects/SendPaymentInput.ts +2 -2
  90. package/src/objects/SetInvoicePaymentHashInput.ts +2 -2
  91. package/src/objects/SignablePayload.ts +2 -2
  92. package/src/objects/SignablePayloadStatus.ts +2 -3
  93. package/src/objects/Transaction.ts +4 -9
  94. package/src/objects/TransactionFailures.ts +1 -4
  95. package/src/objects/TransactionStatus.ts +6 -11
  96. package/src/objects/TransactionType.ts +12 -22
  97. package/src/objects/UmaInvitation.ts +2 -8
  98. package/src/objects/Wallet.ts +3 -4
  99. package/src/objects/WalletStatus.ts +12 -25
  100. package/src/objects/WalletToPaymentRequestsConnection.ts +3 -6
  101. package/src/objects/WalletToTransactionsConnection.ts +3 -6
  102. package/src/objects/WebhookEventType.ts +4 -5
  103. package/src/objects/Withdrawal.ts +11 -18
  104. package/src/objects/WithdrawalMode.ts +3 -7
  105. package/src/objects/WithdrawalRequest.ts +3 -7
  106. package/src/objects/WithdrawalRequestStatus.ts +2 -3
  107. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +4 -10
  108. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +4 -10
  109. package/src/objects/index.ts +2 -0
  110. package/src/tests/integration/general-regtest.test.ts +14 -0
@@ -9,10 +9,9 @@ import {
9
9
  import TransactionStatus from "./TransactionStatus.js";
10
10
 
11
11
  /**
12
- * This object represents an L1 withdrawal from your Lightspark Node to any
13
- * Bitcoin wallet. You can retrieve this object to receive detailed information
14
- * about any L1 withdrawal associated with your Lightspark Node or account.
15
- * *
12
+ * This object represents an L1 withdrawal from your Lightspark Node to any Bitcoin wallet.
13
+ * You can retrieve this object to receive detailed information about any L1 withdrawal associated
14
+ * with your Lightspark Node or account. *
16
15
  */
17
16
  interface Withdrawal {
18
17
  /**
@@ -34,8 +33,8 @@ interface Withdrawal {
34
33
  amount: CurrencyAmount;
35
34
 
36
35
  /**
37
- * The height of the block that included this transaction.
38
- * This will be zero for unconfirmed transactions.
36
+ * The height of the block that included this transaction. This will be zero for unconfirmed
37
+ * transactions.
39
38
  **/
40
39
  blockHeight: number;
41
40
 
@@ -51,28 +50,22 @@ interface Withdrawal {
51
50
  /** The date and time when this transaction was completed or failed. **/
52
51
  resolvedAt?: string | undefined;
53
52
 
54
- /**
55
- * The hash of this transaction, so it can be uniquely identified on the
56
- * Lightning Network. *
57
- */
53
+ /** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
58
54
  transactionHash?: string | undefined;
59
55
 
60
56
  /**
61
- * The fees that were paid by the wallet sending the transaction to commit it
62
- * to the Bitcoin blockchain.
57
+ * The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
58
+ * blockchain.
63
59
  **/
64
60
  fees?: CurrencyAmount | undefined;
65
61
 
66
62
  /**
67
- * The hash of the block that included this transaction.
68
- * This will be null for unconfirmed transactions.
63
+ * The hash of the block that included this transaction. This will be null for unconfirmed
64
+ * transactions.
69
65
  **/
70
66
  blockHash?: string | undefined;
71
67
 
72
- /**
73
- * The number of blockchain confirmations for this transaction in real time.
74
- * *
75
- */
68
+ /** The number of blockchain confirmations for this transaction in real time. **/
76
69
  numConfirmations?: number | undefined;
77
70
  }
78
71
 
@@ -1,14 +1,10 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- /**
4
- * This is an enum of the potential modes that your Bitcoin withdrawal can
5
- * take. *
6
- */
3
+ /** This is an enum of the potential modes that your Bitcoin withdrawal can take. **/
7
4
  export enum WithdrawalMode {
8
5
  /**
9
- * This is an enum value that represents values that could be added in the
10
- * future. Clients should support unknown values as more of them could be
11
- * added without notice.
6
+ * This is an enum value that represents values that could be added in the future.
7
+ * Clients should support unknown values as more of them could be added without notice.
12
8
  */
13
9
  FUTURE_VALUE = "FUTURE_VALUE",
14
10
 
@@ -17,9 +17,8 @@ import type WithdrawalRequestToChannelOpeningTransactionsConnection from "./With
17
17
  import { WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson } from "./WithdrawalRequestToChannelOpeningTransactionsConnection.js";
18
18
 
19
19
  /**
20
- * This object represents a request made for an L1 withdrawal from your
21
- * Lightspark Node to any Bitcoin wallet.
22
- * You can retrieve this object to receive detailed information about any
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
23
22
  * withdrawal request made from your Lightspark account.
24
23
  * *
25
24
  */
@@ -38,10 +37,7 @@ class WithdrawalRequest implements Entity {
38
37
  public readonly amount: CurrencyAmount,
39
38
  /** The bitcoin address where the funds should be sent. **/
40
39
  public readonly bitcoinAddress: string,
41
- /**
42
- * The strategy that should be used to withdraw the funds from the account.
43
- * *
44
- */
40
+ /** The strategy that should be used to withdraw the funds from the account. **/
45
41
  public readonly withdrawalMode: WithdrawalMode,
46
42
  /** The current status of this withdrawal request. **/
47
43
  public readonly status: WithdrawalRequestStatus,
@@ -3,9 +3,8 @@
3
3
  /** This is an enum of the potential statuses that a Withdrawal can take. **/
4
4
  export enum WithdrawalRequestStatus {
5
5
  /**
6
- * This is an enum value that represents values that could be added in the
7
- * future. Clients should support unknown values as more of them could be
8
- * added without notice.
6
+ * This is an enum value that represents values that could be added in the future.
7
+ * Clients should support unknown values as more of them could be added without notice.
9
8
  */
10
9
  FUTURE_VALUE = "FUTURE_VALUE",
11
10
 
@@ -9,23 +9,17 @@ import type PageInfo from "./PageInfo.js";
9
9
  import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
10
10
 
11
11
  interface WithdrawalRequestToChannelClosingTransactionsConnection {
12
- /**
13
- * An object that holds pagination information about the objects in this
14
- * connection. *
15
- */
12
+ /** An object that holds pagination information about the objects in this connection. **/
16
13
  pageInfo: PageInfo;
17
14
 
18
15
  /**
19
16
  * The total count of objects in this connection, using the current filters.
20
- * It is different from the number of objects returned in the current page
21
- * (in the `entities` field).
17
+ * It is different from the number of objects returned in the current page (in the `entities`
18
+ * field).
22
19
  **/
23
20
  count: number;
24
21
 
25
- /**
26
- * The channel closing transactions for the current page of this connection.
27
- * *
28
- */
22
+ /** The channel closing transactions for the current page of this connection. **/
29
23
  entities: ChannelClosingTransaction[];
30
24
  }
31
25
 
@@ -9,23 +9,17 @@ import type PageInfo from "./PageInfo.js";
9
9
  import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
10
10
 
11
11
  interface WithdrawalRequestToChannelOpeningTransactionsConnection {
12
- /**
13
- * An object that holds pagination information about the objects in this
14
- * connection. *
15
- */
12
+ /** An object that holds pagination information about the objects in this connection. **/
16
13
  pageInfo: PageInfo;
17
14
 
18
15
  /**
19
16
  * The total count of objects in this connection, using the current filters.
20
- * It is different from the number of objects returned in the current page
21
- * (in the `entities` field).
17
+ * It is different from the number of objects returned in the current page (in the `entities`
18
+ * field).
22
19
  **/
23
20
  count: number;
24
21
 
25
- /**
26
- * The channel opening transactions for the current page of this connection.
27
- * *
28
- */
22
+ /** The channel opening transactions for the current page of this connection. **/
29
23
  entities: ChannelOpeningTransaction[];
30
24
  }
31
25
 
@@ -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,
@@ -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 () => {