@lightsparkdev/lightspark-sdk 0.4.10 → 1.0.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 (125) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-NXUFC5J7.js → chunk-LZC5C5NI.js} +2908 -635
  4. package/dist/{index-3ffe9e7b.d.ts → index-09d4ac20.d.ts} +373 -62
  5. package/dist/index.cjs +3395 -842
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +390 -94
  8. package/dist/objects/index.cjs +2735 -553
  9. package/dist/objects/index.d.ts +1 -1
  10. package/dist/objects/index.js +17 -5
  11. package/package.json +12 -9
  12. package/src/NodeKeyLoaderCache.ts +87 -0
  13. package/src/SigningKeyLoader.ts +177 -0
  14. package/src/auth/AccountTokenAuthProvider.ts +4 -4
  15. package/src/client.ts +209 -118
  16. package/src/graphql/CreateInvoice.ts +3 -2
  17. package/src/graphql/CreateLnurlInvoice.ts +2 -0
  18. package/src/graphql/CreateUmaInvoice.ts +23 -0
  19. package/src/graphql/MultiNodeDashboard.ts +0 -3
  20. package/src/graphql/PayUmaInvoice.ts +29 -0
  21. package/src/graphql/RecoverNodeSigningKey.ts +1 -1
  22. package/src/graphql/SingleNodeDashboard.ts +0 -1
  23. package/src/lightspark_crypto/lightspark_crypto.d.ts +157 -0
  24. package/src/lightspark_crypto/lightspark_crypto.js +1010 -0
  25. package/src/lightspark_crypto/lightspark_crypto_bg.wasm +0 -0
  26. package/src/lightspark_crypto/lightspark_crypto_bg.wasm.d.ts +120 -0
  27. package/src/lightspark_crypto/package.json +11 -0
  28. package/src/objects/Account.ts +437 -120
  29. package/src/objects/AccountToApiTokensConnection.ts +3 -3
  30. package/src/objects/AccountToChannelsConnection.ts +4 -4
  31. package/src/objects/AccountToNodesConnection.ts +2 -15
  32. package/src/objects/AccountToPaymentRequestsConnection.ts +3 -3
  33. package/src/objects/AccountToTransactionsConnection.ts +6 -6
  34. package/src/objects/AccountToWalletsConnection.ts +2 -2
  35. package/src/objects/Balances.ts +2 -2
  36. package/src/objects/Channel.ts +4 -4
  37. package/src/objects/ChannelClosingTransaction.ts +2 -2
  38. package/src/objects/ChannelOpeningTransaction.ts +2 -2
  39. package/src/objects/ChannelToTransactionsConnection.ts +4 -4
  40. package/src/objects/{CryptoSanctionsScreeningProvider.ts → ComplianceProvider.ts} +3 -3
  41. package/src/objects/Connection.ts +25 -31
  42. package/src/objects/CreateApiTokenInput.ts +1 -1
  43. package/src/objects/CreateApiTokenOutput.ts +1 -1
  44. package/src/objects/CreateInvoiceInput.ts +0 -6
  45. package/src/objects/CreateLnurlInvoiceInput.ts +1 -7
  46. package/src/objects/CreateNodeWalletAddressInput.ts +1 -1
  47. package/src/objects/CreateNodeWalletAddressOutput.ts +1 -1
  48. package/src/objects/CreateTestModeInvoiceInput.ts +1 -1
  49. package/src/objects/CreateTestModeInvoiceOutput.ts +1 -1
  50. package/src/objects/CreateTestModePaymentInput.ts +1 -1
  51. package/src/objects/CreateTestModePaymentoutput.ts +14 -2
  52. package/src/objects/CreateUmaInvoiceInput.ts +24 -0
  53. package/src/objects/DeclineToSignMessagesInput.ts +16 -0
  54. package/src/objects/DeclineToSignMessagesOutput.ts +28 -0
  55. package/src/objects/DeleteApiTokenOutput.ts +1 -1
  56. package/src/objects/Entity.ts +401 -66
  57. package/src/objects/GraphNode.ts +3 -3
  58. package/src/objects/IdAndSignature.ts +16 -0
  59. package/src/objects/IncomingPayment.ts +21 -8
  60. package/src/objects/IncomingPaymentAttempt.ts +2 -2
  61. package/src/objects/IncomingPaymentToAttemptsConnection.ts +3 -3
  62. package/src/objects/Invoice.ts +118 -21
  63. package/src/objects/InvoiceData.ts +118 -21
  64. package/src/objects/LightningFeeEstimateForInvoiceInput.ts +1 -1
  65. package/src/objects/LightningFeeEstimateForNodeInput.ts +1 -1
  66. package/src/objects/LightningFeeEstimateOutput.ts +2 -2
  67. package/src/objects/LightningTransaction.ts +155 -31
  68. package/src/objects/LightsparkNode.ts +272 -112
  69. package/src/objects/LightsparkNodeOwner.ts +8 -4
  70. package/src/objects/LightsparkNodeToChannelsConnection.ts +3 -3
  71. package/src/objects/LightsparkNodeWithOSK.ts +389 -0
  72. package/src/objects/LightsparkNodeWithRemoteSigning.ts +384 -0
  73. package/src/objects/Node.ts +213 -60
  74. package/src/objects/NodeToAddressesConnection.ts +2 -2
  75. package/src/objects/OnChainTransaction.ts +2 -2
  76. package/src/objects/OutgoingPayment.ts +139 -24
  77. package/src/objects/OutgoingPaymentAttempt.ts +5 -5
  78. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +3 -3
  79. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +3 -3
  80. package/src/objects/OutgoingPaymentsForInvoiceQueryInput.ts +25 -0
  81. package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +28 -0
  82. package/src/objects/PayUmaInvoiceInput.ts +25 -0
  83. package/src/objects/{LightsparkNodePurpose.ts → PaymentDirection.ts} +5 -7
  84. package/src/objects/PaymentRequest.ts +119 -22
  85. package/src/objects/PaymentRequestData.ts +119 -22
  86. package/src/objects/PostTransactionData.ts +39 -0
  87. package/src/objects/RegisterPaymentInput.ts +31 -0
  88. package/src/objects/RegisterPaymentOutput.ts +23 -0
  89. package/src/objects/ReleaseChannelPerCommitmentSecretInput.ts +23 -0
  90. package/src/objects/ReleaseChannelPerCommitmentSecretOutput.ts +23 -0
  91. package/src/objects/ReleasePaymentPreimageInput.ts +20 -0
  92. package/src/objects/ReleasePaymentPreimageOutput.ts +23 -0
  93. package/src/objects/RemoteSigningSubEventType.ts +26 -0
  94. package/src/objects/RequestWithdrawalInput.ts +1 -1
  95. package/src/objects/RequestWithdrawalOutput.ts +1 -1
  96. package/src/objects/RoutingTransaction.ts +1 -1
  97. package/src/objects/ScreenNodeInput.ts +20 -0
  98. package/src/objects/ScreenNodeOutput.ts +22 -0
  99. package/src/objects/SetInvoicePaymentHashInput.ts +24 -0
  100. package/src/objects/SetInvoicePaymentHashOutput.ts +23 -0
  101. package/src/objects/SignInvoiceInput.ts +19 -0
  102. package/src/objects/SignInvoiceOutput.ts +21 -0
  103. package/src/objects/SignMessagesInput.ts +18 -0
  104. package/src/objects/SignMessagesOutput.ts +26 -0
  105. package/src/objects/Signable.ts +58 -0
  106. package/src/objects/SignablePayload.ts +93 -0
  107. package/src/objects/SignablePayloadStatus.ts +17 -0
  108. package/src/objects/SingleNodeDashboard.ts +0 -2
  109. package/src/objects/Transaction.ts +153 -29
  110. package/src/objects/TransactionFailures.ts +1 -1
  111. package/src/objects/UpdateChannelPerCommitmentPointInput.ts +25 -0
  112. package/src/objects/UpdateChannelPerCommitmentPointOutput.ts +23 -0
  113. package/src/objects/UpdateNodeSharedSecretInput.ts +18 -0
  114. package/src/objects/UpdateNodeSharedSecretOutput.ts +23 -0
  115. package/src/objects/Wallet.ts +271 -51
  116. package/src/objects/WalletToPaymentRequestsConnection.ts +3 -3
  117. package/src/objects/WalletToTransactionsConnection.ts +3 -3
  118. package/src/objects/WithdrawalRequest.ts +6 -6
  119. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +2 -2
  120. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +2 -2
  121. package/src/objects/index.ts +37 -4
  122. package/src/{__tests__ → tests}/webhooks.test.ts +1 -1
  123. package/src/webhooks.ts +1 -1
  124. package/src/objects/ScreenBitcoinAddressesInput.ts +0 -23
  125. package/src/objects/ScreenBitcoinAddressesOutput.ts +0 -25
@@ -21,6 +21,7 @@ export {
21
21
  } from "./ChannelOpeningTransaction.js";
22
22
  export { default as ChannelStatus } from "./ChannelStatus.js";
23
23
  export { default as ChannelToTransactionsConnection } from "./ChannelToTransactionsConnection.js";
24
+ export { default as ComplianceProvider } from "./ComplianceProvider.js";
24
25
  export { default as Connection } from "./Connection.js";
25
26
  export { default as CreateApiTokenInput } from "./CreateApiTokenInput.js";
26
27
  export { default as CreateApiTokenOutput } from "./CreateApiTokenOutput.js";
@@ -33,9 +34,11 @@ export { default as CreateTestModeInvoiceInput } from "./CreateTestModeInvoiceIn
33
34
  export { default as CreateTestModeInvoiceOutput } from "./CreateTestModeInvoiceOutput.js";
34
35
  export { default as CreateTestModePaymentInput } from "./CreateTestModePaymentInput.js";
35
36
  export { default as CreateTestModePaymentoutput } from "./CreateTestModePaymentoutput.js";
36
- export { default as CryptoSanctionsScreeningProvider } from "./CryptoSanctionsScreeningProvider.js";
37
+ export { default as CreateUmaInvoiceInput } from "./CreateUmaInvoiceInput.js";
37
38
  export { default as CurrencyAmount } from "./CurrencyAmount.js";
38
39
  export { default as CurrencyUnit } from "./CurrencyUnit.js";
40
+ export { default as DeclineToSignMessagesInput } from "./DeclineToSignMessagesInput.js";
41
+ export { default as DeclineToSignMessagesOutput } from "./DeclineToSignMessagesOutput.js";
39
42
  export { default as DeleteApiTokenInput } from "./DeleteApiTokenInput.js";
40
43
  export { default as DeleteApiTokenOutput } from "./DeleteApiTokenOutput.js";
41
44
  export { default as Deposit, getDepositQuery } from "./Deposit.js";
@@ -46,6 +49,7 @@ export { default as FundNodeOutput } from "./FundNodeOutput.js";
46
49
  export { default as GraphNode } from "./GraphNode.js";
47
50
  export { default as Hop, getHopQuery } from "./Hop.js";
48
51
  export { default as HtlcAttemptFailureCode } from "./HtlcAttemptFailureCode.js";
52
+ export { default as IdAndSignature } from "./IdAndSignature.js";
49
53
  export { default as IncomingPayment } from "./IncomingPayment.js";
50
54
  export {
51
55
  default as IncomingPaymentAttempt,
@@ -68,9 +72,10 @@ export {
68
72
  default as LightsparkNodeOwner,
69
73
  getLightsparkNodeOwnerQuery,
70
74
  } from "./LightsparkNodeOwner.js";
71
- export { default as LightsparkNodePurpose } from "./LightsparkNodePurpose.js";
72
75
  export { default as LightsparkNodeStatus } from "./LightsparkNodeStatus.js";
73
76
  export { default as LightsparkNodeToChannelsConnection } from "./LightsparkNodeToChannelsConnection.js";
77
+ export { default as LightsparkNodeWithOSK } from "./LightsparkNodeWithOSK.js";
78
+ export { default as LightsparkNodeWithRemoteSigning } from "./LightsparkNodeWithRemoteSigning.js";
74
79
  export { default as Node } from "./Node.js";
75
80
  export { default as NodeAddress } from "./NodeAddress.js";
76
81
  export { default as NodeAddressType } from "./NodeAddressType.js";
@@ -83,10 +88,13 @@ export { default as OutgoingPayment } from "./OutgoingPayment.js";
83
88
  export { default as OutgoingPaymentAttempt } from "./OutgoingPaymentAttempt.js";
84
89
  export { default as OutgoingPaymentAttemptStatus } from "./OutgoingPaymentAttemptStatus.js";
85
90
  export { default as OutgoingPaymentAttemptToHopsConnection } from "./OutgoingPaymentAttemptToHopsConnection.js";
91
+ export { default as OutgoingPaymentsForInvoiceQueryInput } from "./OutgoingPaymentsForInvoiceQueryInput.js";
92
+ export { default as OutgoingPaymentsForInvoiceQueryOutput } from "./OutgoingPaymentsForInvoiceQueryOutput.js";
86
93
  export { default as OutgoingPaymentToAttemptsConnection } from "./OutgoingPaymentToAttemptsConnection.js";
87
94
  export { default as PageInfo } from "./PageInfo.js";
88
95
  export { default as PayInvoiceInput } from "./PayInvoiceInput.js";
89
96
  export { default as PayInvoiceOutput } from "./PayInvoiceOutput.js";
97
+ export { default as PaymentDirection } from "./PaymentDirection.js";
90
98
  export { default as PaymentFailureReason } from "./PaymentFailureReason.js";
91
99
  export {
92
100
  default as PaymentRequest,
@@ -94,7 +102,16 @@ export {
94
102
  } from "./PaymentRequest.js";
95
103
  export { default as PaymentRequestData } from "./PaymentRequestData.js";
96
104
  export { default as PaymentRequestStatus } from "./PaymentRequestStatus.js";
105
+ export { default as PayUmaInvoiceInput } from "./PayUmaInvoiceInput.js";
97
106
  export { default as Permission } from "./Permission.js";
107
+ export { default as PostTransactionData } from "./PostTransactionData.js";
108
+ export { default as RegisterPaymentInput } from "./RegisterPaymentInput.js";
109
+ export { default as RegisterPaymentOutput } from "./RegisterPaymentOutput.js";
110
+ export { default as ReleaseChannelPerCommitmentSecretInput } from "./ReleaseChannelPerCommitmentSecretInput.js";
111
+ export { default as ReleaseChannelPerCommitmentSecretOutput } from "./ReleaseChannelPerCommitmentSecretOutput.js";
112
+ export { default as ReleasePaymentPreimageInput } from "./ReleasePaymentPreimageInput.js";
113
+ export { default as ReleasePaymentPreimageOutput } from "./ReleasePaymentPreimageOutput.js";
114
+ export { default as RemoteSigningSubEventType } from "./RemoteSigningSubEventType.js";
98
115
  export { default as RequestWithdrawalInput } from "./RequestWithdrawalInput.js";
99
116
  export { default as RequestWithdrawalOutput } from "./RequestWithdrawalOutput.js";
100
117
  export { default as RichText } from "./RichText.js";
@@ -104,17 +121,33 @@ export {
104
121
  getRoutingTransactionQuery,
105
122
  } from "./RoutingTransaction.js";
106
123
  export { default as RoutingTransactionFailureReason } from "./RoutingTransactionFailureReason.js";
107
- export { default as ScreenBitcoinAddressesInput } from "./ScreenBitcoinAddressesInput.js";
108
- export { default as ScreenBitcoinAddressesOutput } from "./ScreenBitcoinAddressesOutput.js";
124
+ export { default as ScreenNodeInput } from "./ScreenNodeInput.js";
125
+ export { default as ScreenNodeOutput } from "./ScreenNodeOutput.js";
109
126
  export { default as Secret } from "./Secret.js";
110
127
  export { default as SendPaymentInput } from "./SendPaymentInput.js";
111
128
  export { default as SendPaymentOutput } from "./SendPaymentOutput.js";
129
+ export { default as SetInvoicePaymentHashInput } from "./SetInvoicePaymentHashInput.js";
130
+ export { default as SetInvoicePaymentHashOutput } from "./SetInvoicePaymentHashOutput.js";
131
+ export { default as Signable, getSignableQuery } from "./Signable.js";
132
+ export {
133
+ default as SignablePayload,
134
+ getSignablePayloadQuery,
135
+ } from "./SignablePayload.js";
136
+ export { default as SignablePayloadStatus } from "./SignablePayloadStatus.js";
137
+ export { default as SignInvoiceInput } from "./SignInvoiceInput.js";
138
+ export { default as SignInvoiceOutput } from "./SignInvoiceOutput.js";
139
+ export { default as SignMessagesInput } from "./SignMessagesInput.js";
140
+ export { default as SignMessagesOutput } from "./SignMessagesOutput.js";
112
141
  export { default as SingleNodeDashboard } from "./SingleNodeDashboard.js";
113
142
  export { default as Transaction, getTransactionQuery } from "./Transaction.js";
114
143
  export { default as TransactionFailures } from "./TransactionFailures.js";
115
144
  export { default as TransactionStatus } from "./TransactionStatus.js";
116
145
  export { default as TransactionType } from "./TransactionType.js";
117
146
  export { default as TransactionUpdate } from "./TransactionUpdate.js";
147
+ export { default as UpdateChannelPerCommitmentPointInput } from "./UpdateChannelPerCommitmentPointInput.js";
148
+ export { default as UpdateChannelPerCommitmentPointOutput } from "./UpdateChannelPerCommitmentPointOutput.js";
149
+ export { default as UpdateNodeSharedSecretInput } from "./UpdateNodeSharedSecretInput.js";
150
+ export { default as UpdateNodeSharedSecretOutput } from "./UpdateNodeSharedSecretOutput.js";
118
151
  export { default as Wallet } from "./Wallet.js";
119
152
  export { default as WalletStatus } from "./WalletStatus.js";
120
153
  export { default as WalletToPaymentRequestsConnection } from "./WalletToPaymentRequestsConnection.js";
@@ -15,7 +15,7 @@ describe("Webhooks", () => {
15
15
  const webhook = await verifyAndParseWebhook(
16
16
  Buffer.from(data, "utf-8"),
17
17
  hexdigest,
18
- webhookSecret
18
+ webhookSecret,
19
19
  );
20
20
 
21
21
  expect(webhook.entity_id).toBe(entityId);
package/src/webhooks.ts CHANGED
@@ -14,7 +14,7 @@ export interface WebhookEvent {
14
14
  export const verifyAndParseWebhook = (
15
15
  data: Uint8Array,
16
16
  hexdigest: string,
17
- webhook_secret: string
17
+ webhook_secret: string,
18
18
  ): Promise<WebhookEvent> => {
19
19
  const sig = createHmac("sha256", webhook_secret).update(data).digest("hex");
20
20
 
@@ -1,23 +0,0 @@
1
- // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
-
3
- import CryptoSanctionsScreeningProvider from "./CryptoSanctionsScreeningProvider.js";
4
-
5
- type ScreenBitcoinAddressesInput = {
6
- provider: CryptoSanctionsScreeningProvider;
7
-
8
- addresses: string[];
9
- };
10
-
11
- export const ScreenBitcoinAddressesInputFromJson = (
12
- obj: any
13
- ): ScreenBitcoinAddressesInput => {
14
- return {
15
- provider:
16
- CryptoSanctionsScreeningProvider[
17
- obj["screen_bitcoin_addresses_input_provider"]
18
- ] ?? CryptoSanctionsScreeningProvider.FUTURE_VALUE,
19
- addresses: obj["screen_bitcoin_addresses_input_addresses"],
20
- } as ScreenBitcoinAddressesInput;
21
- };
22
-
23
- export default ScreenBitcoinAddressesInput;
@@ -1,25 +0,0 @@
1
- // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
-
3
- import RiskRating from "./RiskRating.js";
4
-
5
- type ScreenBitcoinAddressesOutput = {
6
- ratings: RiskRating[];
7
- };
8
-
9
- export const ScreenBitcoinAddressesOutputFromJson = (
10
- obj: any
11
- ): ScreenBitcoinAddressesOutput => {
12
- return {
13
- ratings: obj["screen_bitcoin_addresses_output_ratings"].map(
14
- (e) => RiskRating[e]
15
- ),
16
- } as ScreenBitcoinAddressesOutput;
17
- };
18
-
19
- export const FRAGMENT = `
20
- fragment ScreenBitcoinAddressesOutputFragment on ScreenBitcoinAddressesOutput {
21
- __typename
22
- screen_bitcoin_addresses_output_ratings: ratings
23
- }`;
24
-
25
- export default ScreenBitcoinAddressesOutput;