@lightsparkdev/lightspark-sdk 0.4.11 → 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 (84) hide show
  1. package/CHANGELOG.md +22 -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 +3393 -841
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +388 -93
  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 +10 -8
  12. package/src/NodeKeyLoaderCache.ts +87 -0
  13. package/src/SigningKeyLoader.ts +177 -0
  14. package/src/client.ts +160 -71
  15. package/src/graphql/CreateInvoice.ts +3 -2
  16. package/src/graphql/CreateLnurlInvoice.ts +2 -0
  17. package/src/graphql/CreateUmaInvoice.ts +23 -0
  18. package/src/graphql/MultiNodeDashboard.ts +0 -3
  19. package/src/graphql/PayUmaInvoice.ts +29 -0
  20. package/src/graphql/RecoverNodeSigningKey.ts +1 -1
  21. package/src/graphql/SingleNodeDashboard.ts +0 -1
  22. package/src/lightspark_crypto/lightspark_crypto.d.ts +157 -0
  23. package/src/lightspark_crypto/lightspark_crypto.js +1010 -0
  24. package/src/lightspark_crypto/lightspark_crypto_bg.wasm +0 -0
  25. package/src/lightspark_crypto/lightspark_crypto_bg.wasm.d.ts +120 -0
  26. package/src/lightspark_crypto/package.json +11 -0
  27. package/src/objects/Account.ts +424 -107
  28. package/src/objects/AccountToNodesConnection.ts +0 -13
  29. package/src/objects/{CryptoSanctionsScreeningProvider.ts → ComplianceProvider.ts} +3 -3
  30. package/src/objects/Connection.ts +0 -6
  31. package/src/objects/CreateInvoiceInput.ts +0 -6
  32. package/src/objects/CreateLnurlInvoiceInput.ts +0 -6
  33. package/src/objects/CreateTestModePaymentoutput.ts +13 -1
  34. package/src/objects/CreateUmaInvoiceInput.ts +24 -0
  35. package/src/objects/DeclineToSignMessagesInput.ts +16 -0
  36. package/src/objects/DeclineToSignMessagesOutput.ts +28 -0
  37. package/src/objects/Entity.ts +401 -66
  38. package/src/objects/IdAndSignature.ts +16 -0
  39. package/src/objects/IncomingPayment.ts +18 -5
  40. package/src/objects/Invoice.ts +118 -21
  41. package/src/objects/InvoiceData.ts +118 -21
  42. package/src/objects/LightningTransaction.ts +149 -25
  43. package/src/objects/LightsparkNode.ts +270 -110
  44. package/src/objects/LightsparkNodeOwner.ts +4 -0
  45. package/src/objects/LightsparkNodeWithOSK.ts +389 -0
  46. package/src/objects/LightsparkNodeWithRemoteSigning.ts +384 -0
  47. package/src/objects/Node.ts +209 -56
  48. package/src/objects/OutgoingPayment.ts +136 -21
  49. package/src/objects/OutgoingPaymentsForInvoiceQueryInput.ts +25 -0
  50. package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +28 -0
  51. package/src/objects/PayUmaInvoiceInput.ts +25 -0
  52. package/src/objects/{LightsparkNodePurpose.ts → PaymentDirection.ts} +5 -7
  53. package/src/objects/PaymentRequest.ts +118 -21
  54. package/src/objects/PaymentRequestData.ts +118 -21
  55. package/src/objects/PostTransactionData.ts +39 -0
  56. package/src/objects/RegisterPaymentInput.ts +31 -0
  57. package/src/objects/RegisterPaymentOutput.ts +23 -0
  58. package/src/objects/ReleaseChannelPerCommitmentSecretInput.ts +23 -0
  59. package/src/objects/ReleaseChannelPerCommitmentSecretOutput.ts +23 -0
  60. package/src/objects/ReleasePaymentPreimageInput.ts +20 -0
  61. package/src/objects/ReleasePaymentPreimageOutput.ts +23 -0
  62. package/src/objects/RemoteSigningSubEventType.ts +26 -0
  63. package/src/objects/ScreenNodeInput.ts +20 -0
  64. package/src/objects/ScreenNodeOutput.ts +22 -0
  65. package/src/objects/SetInvoicePaymentHashInput.ts +24 -0
  66. package/src/objects/SetInvoicePaymentHashOutput.ts +23 -0
  67. package/src/objects/SignInvoiceInput.ts +19 -0
  68. package/src/objects/SignInvoiceOutput.ts +21 -0
  69. package/src/objects/SignMessagesInput.ts +18 -0
  70. package/src/objects/SignMessagesOutput.ts +26 -0
  71. package/src/objects/Signable.ts +58 -0
  72. package/src/objects/SignablePayload.ts +93 -0
  73. package/src/objects/SignablePayloadStatus.ts +17 -0
  74. package/src/objects/SingleNodeDashboard.ts +0 -2
  75. package/src/objects/Transaction.ts +149 -25
  76. package/src/objects/UpdateChannelPerCommitmentPointInput.ts +25 -0
  77. package/src/objects/UpdateChannelPerCommitmentPointOutput.ts +23 -0
  78. package/src/objects/UpdateNodeSharedSecretInput.ts +18 -0
  79. package/src/objects/UpdateNodeSharedSecretOutput.ts +23 -0
  80. package/src/objects/Wallet.ts +265 -45
  81. package/src/objects/index.ts +37 -4
  82. package/src/objects/ScreenBitcoinAddressesInput.ts +0 -23
  83. package/src/objects/ScreenBitcoinAddressesOutput.ts +0 -25
  84. /package/src/{__tests__ → tests}/webhooks.test.ts +0 -0
@@ -3,7 +3,6 @@
3
3
  import type Connection from "./Connection.js";
4
4
  import type LightsparkNode from "./LightsparkNode.js";
5
5
  import { LightsparkNodeFromJson } from "./LightsparkNode.js";
6
- import LightsparkNodePurpose from "./LightsparkNodePurpose.js";
7
6
  import type PageInfo from "./PageInfo.js";
8
7
  import { PageInfoFromJson } from "./PageInfo.js";
9
8
 
@@ -23,13 +22,6 @@ type AccountToNodesConnection = Connection & {
23
22
 
24
23
  /** The typename of the object **/
25
24
  typename: string;
26
-
27
- /**
28
- * The main purpose for the selected set of nodes. It is automatically determined from the nodes that
29
- * are selected in this connection and is used for optimization purposes, as well as to determine the
30
- * variation of the UI that should be presented to the user.
31
- **/
32
- purpose?: LightsparkNodePurpose;
33
25
  };
34
26
 
35
27
  export const AccountToNodesConnectionFromJson = (
@@ -42,10 +34,6 @@ export const AccountToNodesConnectionFromJson = (
42
34
  LightsparkNodeFromJson(e),
43
35
  ),
44
36
  typename: "AccountToNodesConnection",
45
- purpose: !!obj["account_to_nodes_connection_purpose"]
46
- ? LightsparkNodePurpose[obj["account_to_nodes_connection_purpose"]] ??
47
- LightsparkNodePurpose.FUTURE_VALUE
48
- : null,
49
37
  } as AccountToNodesConnection;
50
38
  };
51
39
 
@@ -60,7 +48,6 @@ fragment AccountToNodesConnectionFragment on AccountToNodesConnection {
60
48
  page_info_start_cursor: start_cursor
61
49
  page_info_end_cursor: end_cursor
62
50
  }
63
- account_to_nodes_connection_purpose: purpose
64
51
  account_to_nodes_connection_entities: entities {
65
52
  id
66
53
  }
@@ -1,7 +1,7 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- /** This is an enum identifying a type of crypto sanctions screening provider. **/
4
- export enum CryptoSanctionsScreeningProvider {
3
+ /** This is an enum identifying a type of compliance provider. **/
4
+ export enum ComplianceProvider {
5
5
  /**
6
6
  * This is an enum value that represents values that could be added in the future.
7
7
  * Clients should support unknown values as more of them could be added without notice.
@@ -11,4 +11,4 @@ export enum CryptoSanctionsScreeningProvider {
11
11
  CHAINALYSIS = "CHAINALYSIS",
12
12
  }
13
13
 
14
- export default CryptoSanctionsScreeningProvider;
14
+ export default ComplianceProvider;
@@ -13,7 +13,6 @@ import { HopFromJson } from "./Hop.js";
13
13
  import { IncomingPaymentAttemptFromJson } from "./IncomingPaymentAttempt.js";
14
14
  import type IncomingPaymentToAttemptsConnection from "./IncomingPaymentToAttemptsConnection.js";
15
15
  import { LightsparkNodeFromJson } from "./LightsparkNode.js";
16
- import LightsparkNodePurpose from "./LightsparkNodePurpose.js";
17
16
  import type LightsparkNodeToChannelsConnection from "./LightsparkNodeToChannelsConnection.js";
18
17
  import { OutgoingPaymentAttemptFromJson } from "./OutgoingPaymentAttempt.js";
19
18
  import type OutgoingPaymentAttemptToHopsConnection from "./OutgoingPaymentAttemptToHopsConnection.js";
@@ -61,10 +60,6 @@ export const ConnectionFromJson = (obj: any): Connection => {
61
60
  LightsparkNodeFromJson(e),
62
61
  ),
63
62
  typename: "AccountToNodesConnection",
64
- purpose: !!obj["account_to_nodes_connection_purpose"]
65
- ? LightsparkNodePurpose[obj["account_to_nodes_connection_purpose"]] ??
66
- LightsparkNodePurpose.FUTURE_VALUE
67
- : null,
68
63
  } as AccountToNodesConnection;
69
64
  }
70
65
  if (obj["__typename"] == "AccountToPaymentRequestsConnection") {
@@ -227,7 +222,6 @@ fragment ConnectionFragment on Connection {
227
222
  page_info_start_cursor: start_cursor
228
223
  page_info_end_cursor: end_cursor
229
224
  }
230
- account_to_nodes_connection_purpose: purpose
231
225
  account_to_nodes_connection_entities: entities {
232
226
  id
233
227
  }
@@ -15,10 +15,6 @@ type CreateInvoiceInput = {
15
15
 
16
16
  /** The expiry of the invoice in seconds. Default value is 86400 (1 day). **/
17
17
  expirySecs?: number;
18
-
19
- paymentHash?: string;
20
-
21
- preimageNonce?: string;
22
18
  };
23
19
 
24
20
  export const CreateInvoiceInputFromJson = (obj: any): CreateInvoiceInput => {
@@ -31,8 +27,6 @@ export const CreateInvoiceInputFromJson = (obj: any): CreateInvoiceInput => {
31
27
  InvoiceType.FUTURE_VALUE
32
28
  : null,
33
29
  expirySecs: obj["create_invoice_input_expiry_secs"],
34
- paymentHash: obj["create_invoice_input_payment_hash"],
35
- preimageNonce: obj["create_invoice_input_preimage_nonce"],
36
30
  } as CreateInvoiceInput;
37
31
  };
38
32
 
@@ -15,10 +15,6 @@ type CreateLnurlInvoiceInput = {
15
15
 
16
16
  /** The expiry of the invoice in seconds. Default value is 86400 (1 day). **/
17
17
  expirySecs?: number;
18
-
19
- paymentHash?: string;
20
-
21
- preimageNonce?: string;
22
18
  };
23
19
 
24
20
  export const CreateLnurlInvoiceInputFromJson = (
@@ -29,8 +25,6 @@ export const CreateLnurlInvoiceInputFromJson = (
29
25
  amountMsats: obj["create_lnurl_invoice_input_amount_msats"],
30
26
  metadataHash: obj["create_lnurl_invoice_input_metadata_hash"],
31
27
  expirySecs: obj["create_lnurl_invoice_input_expiry_secs"],
32
- paymentHash: obj["create_lnurl_invoice_input_payment_hash"],
33
- preimageNonce: obj["create_lnurl_invoice_input_preimage_nonce"],
34
28
  } as CreateLnurlInvoiceInput;
35
29
  };
36
30
 
@@ -2,8 +2,15 @@
2
2
 
3
3
  /** This is an object identifying the output of a test mode payment. This object can be used to retrieve the associated payment made from a Test Mode Payment call. **/
4
4
  type CreateTestModePaymentoutput = {
5
- /** The payment that has been sent. **/
5
+ /**
6
+ * The payment that has been sent.
7
+ *
8
+ * @deprecated Use incoming_payment instead.
9
+ **/
6
10
  paymentId: string;
11
+
12
+ /** The payment that has been received. **/
13
+ incomingPaymentId: string;
7
14
  };
8
15
 
9
16
  export const CreateTestModePaymentoutputFromJson = (
@@ -11,6 +18,8 @@ export const CreateTestModePaymentoutputFromJson = (
11
18
  ): CreateTestModePaymentoutput => {
12
19
  return {
13
20
  paymentId: obj["create_test_mode_paymentoutput_payment"].id,
21
+ incomingPaymentId:
22
+ obj["create_test_mode_paymentoutput_incoming_payment"].id,
14
23
  } as CreateTestModePaymentoutput;
15
24
  };
16
25
 
@@ -20,6 +29,9 @@ fragment CreateTestModePaymentoutputFragment on CreateTestModePaymentoutput {
20
29
  create_test_mode_paymentoutput_payment: payment {
21
30
  id
22
31
  }
32
+ create_test_mode_paymentoutput_incoming_payment: incoming_payment {
33
+ id
34
+ }
23
35
  }`;
24
36
 
25
37
  export default CreateTestModePaymentoutput;
@@ -0,0 +1,24 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type CreateUmaInvoiceInput = {
4
+ nodeId: string;
5
+
6
+ amountMsats: number;
7
+
8
+ metadataHash: string;
9
+
10
+ expirySecs?: number;
11
+ };
12
+
13
+ export const CreateUmaInvoiceInputFromJson = (
14
+ obj: any,
15
+ ): CreateUmaInvoiceInput => {
16
+ return {
17
+ nodeId: obj["create_uma_invoice_input_node_id"],
18
+ amountMsats: obj["create_uma_invoice_input_amount_msats"],
19
+ metadataHash: obj["create_uma_invoice_input_metadata_hash"],
20
+ expirySecs: obj["create_uma_invoice_input_expiry_secs"],
21
+ } as CreateUmaInvoiceInput;
22
+ };
23
+
24
+ export default CreateUmaInvoiceInput;
@@ -0,0 +1,16 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type DeclineToSignMessagesInput = {
4
+ /** List of payload ids to decline to sign because validation failed. **/
5
+ payloadIds: string[];
6
+ };
7
+
8
+ export const DeclineToSignMessagesInputFromJson = (
9
+ obj: any,
10
+ ): DeclineToSignMessagesInput => {
11
+ return {
12
+ payloadIds: obj["decline_to_sign_messages_input_payload_ids"],
13
+ } as DeclineToSignMessagesInput;
14
+ };
15
+
16
+ export default DeclineToSignMessagesInput;
@@ -0,0 +1,28 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import type SignablePayload from "./SignablePayload.js";
4
+ import { SignablePayloadFromJson } from "./SignablePayload.js";
5
+
6
+ type DeclineToSignMessagesOutput = {
7
+ declinedPayloads: SignablePayload[];
8
+ };
9
+
10
+ export const DeclineToSignMessagesOutputFromJson = (
11
+ obj: any,
12
+ ): DeclineToSignMessagesOutput => {
13
+ return {
14
+ declinedPayloads: obj[
15
+ "decline_to_sign_messages_output_declined_payloads"
16
+ ].map((e) => SignablePayloadFromJson(e)),
17
+ } as DeclineToSignMessagesOutput;
18
+ };
19
+
20
+ export const FRAGMENT = `
21
+ fragment DeclineToSignMessagesOutputFragment on DeclineToSignMessagesOutput {
22
+ __typename
23
+ decline_to_sign_messages_output_declined_payloads: declined_payloads {
24
+ id
25
+ }
26
+ }`;
27
+
28
+ export default DeclineToSignMessagesOutput;