@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
@@ -0,0 +1,23 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type RegisterPaymentOutput = {
4
+ paymentId: string;
5
+ };
6
+
7
+ export const RegisterPaymentOutputFromJson = (
8
+ obj: any,
9
+ ): RegisterPaymentOutput => {
10
+ return {
11
+ paymentId: obj["register_payment_output_payment"].id,
12
+ } as RegisterPaymentOutput;
13
+ };
14
+
15
+ export const FRAGMENT = `
16
+ fragment RegisterPaymentOutputFragment on RegisterPaymentOutput {
17
+ __typename
18
+ register_payment_output_payment: payment {
19
+ id
20
+ }
21
+ }`;
22
+
23
+ export default RegisterPaymentOutput;
@@ -0,0 +1,23 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type ReleaseChannelPerCommitmentSecretInput = {
4
+ channelId: string;
5
+
6
+ perCommitmentSecret: string;
7
+
8
+ perCommitmentIndex: number;
9
+ };
10
+
11
+ export const ReleaseChannelPerCommitmentSecretInputFromJson = (
12
+ obj: any,
13
+ ): ReleaseChannelPerCommitmentSecretInput => {
14
+ return {
15
+ channelId: obj["release_channel_per_commitment_secret_input_channel_id"],
16
+ perCommitmentSecret:
17
+ obj["release_channel_per_commitment_secret_input_per_commitment_secret"],
18
+ perCommitmentIndex:
19
+ obj["release_channel_per_commitment_secret_input_per_commitment_index"],
20
+ } as ReleaseChannelPerCommitmentSecretInput;
21
+ };
22
+
23
+ export default ReleaseChannelPerCommitmentSecretInput;
@@ -0,0 +1,23 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type ReleaseChannelPerCommitmentSecretOutput = {
4
+ channelId: string;
5
+ };
6
+
7
+ export const ReleaseChannelPerCommitmentSecretOutputFromJson = (
8
+ obj: any,
9
+ ): ReleaseChannelPerCommitmentSecretOutput => {
10
+ return {
11
+ channelId: obj["release_channel_per_commitment_secret_output_channel"].id,
12
+ } as ReleaseChannelPerCommitmentSecretOutput;
13
+ };
14
+
15
+ export const FRAGMENT = `
16
+ fragment ReleaseChannelPerCommitmentSecretOutputFragment on ReleaseChannelPerCommitmentSecretOutput {
17
+ __typename
18
+ release_channel_per_commitment_secret_output_channel: channel {
19
+ id
20
+ }
21
+ }`;
22
+
23
+ export default ReleaseChannelPerCommitmentSecretOutput;
@@ -0,0 +1,20 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type ReleasePaymentPreimageInput = {
4
+ /** The invoice the preimage belongs to. **/
5
+ invoiceId: string;
6
+
7
+ /** The preimage to release. **/
8
+ paymentPreimage: string;
9
+ };
10
+
11
+ export const ReleasePaymentPreimageInputFromJson = (
12
+ obj: any,
13
+ ): ReleasePaymentPreimageInput => {
14
+ return {
15
+ invoiceId: obj["release_payment_preimage_input_invoice_id"],
16
+ paymentPreimage: obj["release_payment_preimage_input_payment_preimage"],
17
+ } as ReleasePaymentPreimageInput;
18
+ };
19
+
20
+ export default ReleasePaymentPreimageInput;
@@ -0,0 +1,23 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type ReleasePaymentPreimageOutput = {
4
+ invoiceId: string;
5
+ };
6
+
7
+ export const ReleasePaymentPreimageOutputFromJson = (
8
+ obj: any,
9
+ ): ReleasePaymentPreimageOutput => {
10
+ return {
11
+ invoiceId: obj["release_payment_preimage_output_invoice"].id,
12
+ } as ReleasePaymentPreimageOutput;
13
+ };
14
+
15
+ export const FRAGMENT = `
16
+ fragment ReleasePaymentPreimageOutputFragment on ReleasePaymentPreimageOutput {
17
+ __typename
18
+ release_payment_preimage_output_invoice: invoice {
19
+ id
20
+ }
21
+ }`;
22
+
23
+ export default ReleasePaymentPreimageOutput;
@@ -0,0 +1,26 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ /** This is an enum of the potential sub-event types for Remote Signing webook events. **/
4
+ export enum RemoteSigningSubEventType {
5
+ /**
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.
8
+ */
9
+ FUTURE_VALUE = "FUTURE_VALUE",
10
+
11
+ ECDH = "ECDH",
12
+
13
+ GET_PER_COMMITMENT_POINT = "GET_PER_COMMITMENT_POINT",
14
+
15
+ RELEASE_PER_COMMITMENT_SECRET = "RELEASE_PER_COMMITMENT_SECRET",
16
+
17
+ SIGN_INVOICE = "SIGN_INVOICE",
18
+
19
+ DERIVE_KEY_AND_SIGN = "DERIVE_KEY_AND_SIGN",
20
+
21
+ RELEASE_PAYMENT_PREIMAGE = "RELEASE_PAYMENT_PREIMAGE",
22
+
23
+ REQUEST_INVOICE_PAYMENT_HASH = "REQUEST_INVOICE_PAYMENT_HASH",
24
+ }
25
+
26
+ export default RemoteSigningSubEventType;
@@ -20,7 +20,7 @@ type RequestWithdrawalInput = {
20
20
  };
21
21
 
22
22
  export const RequestWithdrawalInputFromJson = (
23
- obj: any
23
+ obj: any,
24
24
  ): RequestWithdrawalInput => {
25
25
  return {
26
26
  nodeId: obj["request_withdrawal_input_node_id"],
@@ -6,7 +6,7 @@ type RequestWithdrawalOutput = {
6
6
  };
7
7
 
8
8
  export const RequestWithdrawalOutputFromJson = (
9
- obj: any
9
+ obj: any,
10
10
  ): RequestWithdrawalOutput => {
11
11
  return {
12
12
  requestId: obj["request_withdrawal_output_request"].id,
@@ -130,7 +130,7 @@ fragment RoutingTransactionFragment on RoutingTransaction {
130
130
  }`;
131
131
 
132
132
  export const getRoutingTransactionQuery = (
133
- id: string
133
+ id: string,
134
134
  ): Query<RoutingTransaction> => {
135
135
  return {
136
136
  queryPayload: `
@@ -0,0 +1,20 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import ComplianceProvider from "./ComplianceProvider.js";
4
+
5
+ type ScreenNodeInput = {
6
+ provider: ComplianceProvider;
7
+
8
+ nodePubkey: string;
9
+ };
10
+
11
+ export const ScreenNodeInputFromJson = (obj: any): ScreenNodeInput => {
12
+ return {
13
+ provider:
14
+ ComplianceProvider[obj["screen_node_input_provider"]] ??
15
+ ComplianceProvider.FUTURE_VALUE,
16
+ nodePubkey: obj["screen_node_input_node_pubkey"],
17
+ } as ScreenNodeInput;
18
+ };
19
+
20
+ export default ScreenNodeInput;
@@ -0,0 +1,22 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import RiskRating from "./RiskRating.js";
4
+
5
+ type ScreenNodeOutput = {
6
+ rating: RiskRating;
7
+ };
8
+
9
+ export const ScreenNodeOutputFromJson = (obj: any): ScreenNodeOutput => {
10
+ return {
11
+ rating:
12
+ RiskRating[obj["screen_node_output_rating"]] ?? RiskRating.FUTURE_VALUE,
13
+ } as ScreenNodeOutput;
14
+ };
15
+
16
+ export const FRAGMENT = `
17
+ fragment ScreenNodeOutputFragment on ScreenNodeOutput {
18
+ __typename
19
+ screen_node_output_rating: rating
20
+ }`;
21
+
22
+ export default ScreenNodeOutput;
@@ -0,0 +1,24 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type SetInvoicePaymentHashInput = {
4
+ /** The invoice that needs to be updated. **/
5
+ invoiceId: string;
6
+
7
+ /** The 32-byte hash of the payment preimage. **/
8
+ paymentHash: string;
9
+
10
+ /** The 32-byte nonce used to generate the invoice preimage. **/
11
+ preimageNonce: string;
12
+ };
13
+
14
+ export const SetInvoicePaymentHashInputFromJson = (
15
+ obj: any,
16
+ ): SetInvoicePaymentHashInput => {
17
+ return {
18
+ invoiceId: obj["set_invoice_payment_hash_input_invoice_id"],
19
+ paymentHash: obj["set_invoice_payment_hash_input_payment_hash"],
20
+ preimageNonce: obj["set_invoice_payment_hash_input_preimage_nonce"],
21
+ } as SetInvoicePaymentHashInput;
22
+ };
23
+
24
+ export default SetInvoicePaymentHashInput;
@@ -0,0 +1,23 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type SetInvoicePaymentHashOutput = {
4
+ invoiceId: string;
5
+ };
6
+
7
+ export const SetInvoicePaymentHashOutputFromJson = (
8
+ obj: any,
9
+ ): SetInvoicePaymentHashOutput => {
10
+ return {
11
+ invoiceId: obj["set_invoice_payment_hash_output_invoice"].id,
12
+ } as SetInvoicePaymentHashOutput;
13
+ };
14
+
15
+ export const FRAGMENT = `
16
+ fragment SetInvoicePaymentHashOutputFragment on SetInvoicePaymentHashOutput {
17
+ __typename
18
+ set_invoice_payment_hash_output_invoice: invoice {
19
+ id
20
+ }
21
+ }`;
22
+
23
+ export default SetInvoicePaymentHashOutput;
@@ -0,0 +1,19 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type SignInvoiceInput = {
4
+ invoiceId: string;
5
+
6
+ signature: string;
7
+
8
+ recoveryId: number;
9
+ };
10
+
11
+ export const SignInvoiceInputFromJson = (obj: any): SignInvoiceInput => {
12
+ return {
13
+ invoiceId: obj["sign_invoice_input_invoice_id"],
14
+ signature: obj["sign_invoice_input_signature"],
15
+ recoveryId: obj["sign_invoice_input_recovery_id"],
16
+ } as SignInvoiceInput;
17
+ };
18
+
19
+ export default SignInvoiceInput;
@@ -0,0 +1,21 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type SignInvoiceOutput = {
4
+ invoiceId: string;
5
+ };
6
+
7
+ export const SignInvoiceOutputFromJson = (obj: any): SignInvoiceOutput => {
8
+ return {
9
+ invoiceId: obj["sign_invoice_output_invoice"].id,
10
+ } as SignInvoiceOutput;
11
+ };
12
+
13
+ export const FRAGMENT = `
14
+ fragment SignInvoiceOutputFragment on SignInvoiceOutput {
15
+ __typename
16
+ sign_invoice_output_invoice: invoice {
17
+ id
18
+ }
19
+ }`;
20
+
21
+ export default SignInvoiceOutput;
@@ -0,0 +1,18 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import type IdAndSignature from "./IdAndSignature.js";
4
+ import { IdAndSignatureFromJson } from "./IdAndSignature.js";
5
+
6
+ type SignMessagesInput = {
7
+ signatures: IdAndSignature[];
8
+ };
9
+
10
+ export const SignMessagesInputFromJson = (obj: any): SignMessagesInput => {
11
+ return {
12
+ signatures: obj["sign_messages_input_signatures"].map((e) =>
13
+ IdAndSignatureFromJson(e),
14
+ ),
15
+ } as SignMessagesInput;
16
+ };
17
+
18
+ export default SignMessagesInput;
@@ -0,0 +1,26 @@
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 SignMessagesOutput = {
7
+ signedPayloads: SignablePayload[];
8
+ };
9
+
10
+ export const SignMessagesOutputFromJson = (obj: any): SignMessagesOutput => {
11
+ return {
12
+ signedPayloads: obj["sign_messages_output_signed_payloads"].map((e) =>
13
+ SignablePayloadFromJson(e),
14
+ ),
15
+ } as SignMessagesOutput;
16
+ };
17
+
18
+ export const FRAGMENT = `
19
+ fragment SignMessagesOutputFragment on SignMessagesOutput {
20
+ __typename
21
+ sign_messages_output_signed_payloads: signed_payloads {
22
+ id
23
+ }
24
+ }`;
25
+
26
+ export default SignMessagesOutput;
@@ -0,0 +1,58 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { type Query } from "@lightsparkdev/core";
4
+ import type Entity from "./Entity.js";
5
+
6
+ type Signable = Entity & {
7
+ /**
8
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
9
+ * string.
10
+ **/
11
+ id: string;
12
+
13
+ /** The date and time when the entity was first created. **/
14
+ createdAt: string;
15
+
16
+ /** The date and time when the entity was last updated. **/
17
+ updatedAt: string;
18
+
19
+ /** The typename of the object **/
20
+ typename: string;
21
+ };
22
+
23
+ export const SignableFromJson = (obj: any): Signable => {
24
+ return {
25
+ id: obj["signable_id"],
26
+ createdAt: obj["signable_created_at"],
27
+ updatedAt: obj["signable_updated_at"],
28
+ typename: "Signable",
29
+ } as Signable;
30
+ };
31
+
32
+ export const FRAGMENT = `
33
+ fragment SignableFragment on Signable {
34
+ __typename
35
+ signable_id: id
36
+ signable_created_at: created_at
37
+ signable_updated_at: updated_at
38
+ }`;
39
+
40
+ export const getSignableQuery = (id: string): Query<Signable> => {
41
+ return {
42
+ queryPayload: `
43
+ query GetSignable($id: ID!) {
44
+ entity(id: $id) {
45
+ ... on Signable {
46
+ ...SignableFragment
47
+ }
48
+ }
49
+ }
50
+
51
+ ${FRAGMENT}
52
+ `,
53
+ variables: { id },
54
+ constructObject: (data: any) => SignableFromJson(data.entity),
55
+ };
56
+ };
57
+
58
+ export default Signable;
@@ -0,0 +1,93 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { type Query } from "@lightsparkdev/core";
4
+ import type Entity from "./Entity.js";
5
+ import SignablePayloadStatus from "./SignablePayloadStatus.js";
6
+
7
+ type SignablePayload = Entity & {
8
+ /**
9
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
10
+ * string.
11
+ **/
12
+ id: string;
13
+
14
+ /** The date and time when the entity was first created. **/
15
+ createdAt: string;
16
+
17
+ /** The date and time when the entity was last updated. **/
18
+ updatedAt: string;
19
+
20
+ /** The payload that needs to be signed. **/
21
+ payload: string;
22
+
23
+ /** The consistent method for generating the same set of accounts and wallets for a given private key **/
24
+ derivationPath: string;
25
+
26
+ /** The status of the payload. **/
27
+ status: SignablePayloadStatus;
28
+
29
+ /** The signable this payload belongs to. **/
30
+ signableId: string;
31
+
32
+ /** The typename of the object **/
33
+ typename: string;
34
+
35
+ /** The tweak value to add. **/
36
+ addTweak?: string;
37
+
38
+ /** The tweak value to multiply. **/
39
+ mulTweak?: string;
40
+ };
41
+
42
+ export const SignablePayloadFromJson = (obj: any): SignablePayload => {
43
+ return {
44
+ id: obj["signable_payload_id"],
45
+ createdAt: obj["signable_payload_created_at"],
46
+ updatedAt: obj["signable_payload_updated_at"],
47
+ payload: obj["signable_payload_payload"],
48
+ derivationPath: obj["signable_payload_derivation_path"],
49
+ status:
50
+ SignablePayloadStatus[obj["signable_payload_status"]] ??
51
+ SignablePayloadStatus.FUTURE_VALUE,
52
+ signableId: obj["signable_payload_signable"].id,
53
+ typename: "SignablePayload",
54
+ addTweak: obj["signable_payload_add_tweak"],
55
+ mulTweak: obj["signable_payload_mul_tweak"],
56
+ } as SignablePayload;
57
+ };
58
+
59
+ export const FRAGMENT = `
60
+ fragment SignablePayloadFragment on SignablePayload {
61
+ __typename
62
+ signable_payload_id: id
63
+ signable_payload_created_at: created_at
64
+ signable_payload_updated_at: updated_at
65
+ signable_payload_payload: payload
66
+ signable_payload_derivation_path: derivation_path
67
+ signable_payload_status: status
68
+ signable_payload_add_tweak: add_tweak
69
+ signable_payload_mul_tweak: mul_tweak
70
+ signable_payload_signable: signable {
71
+ id
72
+ }
73
+ }`;
74
+
75
+ export const getSignablePayloadQuery = (id: string): Query<SignablePayload> => {
76
+ return {
77
+ queryPayload: `
78
+ query GetSignablePayload($id: ID!) {
79
+ entity(id: $id) {
80
+ ... on SignablePayload {
81
+ ...SignablePayloadFragment
82
+ }
83
+ }
84
+ }
85
+
86
+ ${FRAGMENT}
87
+ `,
88
+ variables: { id },
89
+ constructObject: (data: any) => SignablePayloadFromJson(data.entity),
90
+ };
91
+ };
92
+
93
+ export default SignablePayload;
@@ -0,0 +1,17 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ export enum SignablePayloadStatus {
4
+ /**
5
+ * This is an enum value that represents values that could be added in the future.
6
+ * Clients should support unknown values as more of them could be added without notice.
7
+ */
8
+ FUTURE_VALUE = "FUTURE_VALUE",
9
+
10
+ CREATED = "CREATED",
11
+
12
+ SIGNED = "SIGNED",
13
+
14
+ VALIDATION_FAILED = "VALIDATION_FAILED",
15
+ }
16
+
17
+ export default SignablePayloadStatus;
@@ -1,6 +1,5 @@
1
1
  import type { Maybe } from "@lightsparkdev/core";
2
2
  import type CurrencyAmount from "./CurrencyAmount.js";
3
- import type LightsparkNodePurpose from "./LightsparkNodePurpose.js";
4
3
  import type LightsparkNodeStatus from "./LightsparkNodeStatus.js";
5
4
  import type NodeAddressType from "./NodeAddressType.js";
6
5
  import type Transaction from "./Transaction.js";
@@ -8,7 +7,6 @@ import type Transaction from "./Transaction.js";
8
7
  type SingleNodeDashboard = {
9
8
  id: string;
10
9
  displayName: string;
11
- purpose: Maybe<LightsparkNodePurpose>;
12
10
  color: Maybe<string>;
13
11
  publicKey: Maybe<string>;
14
12
  status: Maybe<LightsparkNodeStatus>;