@buildonspark/spark-sdk 0.0.14 → 0.0.16

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 (148) hide show
  1. package/dist/proto/spark.d.ts +111 -3
  2. package/dist/proto/spark.js +994 -43
  3. package/dist/proto/spark.js.map +1 -1
  4. package/dist/services/lightning.js +1 -0
  5. package/dist/services/lightning.js.map +1 -1
  6. package/dist/services/transfer.js +2 -0
  7. package/dist/services/transfer.js.map +1 -1
  8. package/dist/services/wallet-config.d.ts +1 -0
  9. package/dist/services/wallet-config.js +1 -0
  10. package/dist/services/wallet-config.js.map +1 -1
  11. package/dist/signer/signer.js +1 -1
  12. package/dist/signer/signer.js.map +1 -1
  13. package/dist/spark-sdk.d.ts +1 -1
  14. package/dist/spark-sdk.js +8 -4
  15. package/dist/spark-sdk.js.map +1 -1
  16. package/dist/tests/utils/test-faucet.d.ts +1 -0
  17. package/dist/tests/utils/test-faucet.js +9 -0
  18. package/dist/tests/utils/test-faucet.js.map +1 -1
  19. package/dist/utils/keys.d.ts +1 -1
  20. package/dist/utils/keys.js +4 -3
  21. package/dist/utils/keys.js.map +1 -1
  22. package/dist/utils/wasm-wrapper.js +9 -9
  23. package/dist/utils/wasm-wrapper.js.map +1 -1
  24. package/package.json +4 -3
  25. package/src/examples/example.js +247 -0
  26. package/src/examples/example.ts +207 -0
  27. package/src/graphql/client.ts +282 -0
  28. package/src/graphql/mutations/CompleteCoopExit.ts +19 -0
  29. package/src/graphql/mutations/CompleteLeavesSwap.ts +17 -0
  30. package/src/graphql/mutations/RequestCoopExit.ts +20 -0
  31. package/src/graphql/mutations/RequestLightningReceive.ts +26 -0
  32. package/src/graphql/mutations/RequestLightningSend.ts +17 -0
  33. package/src/graphql/mutations/RequestSwapLeaves.ts +24 -0
  34. package/src/graphql/objects/BitcoinNetwork.ts +22 -0
  35. package/src/graphql/objects/CompleteCoopExitInput.ts +41 -0
  36. package/src/graphql/objects/CompleteCoopExitOutput.ts +45 -0
  37. package/src/graphql/objects/CompleteLeavesSwapInput.ts +45 -0
  38. package/src/graphql/objects/CompleteLeavesSwapOutput.ts +45 -0
  39. package/src/graphql/objects/CompleteSeedReleaseInput.ts +41 -0
  40. package/src/graphql/objects/CompleteSeedReleaseOutput.ts +43 -0
  41. package/src/graphql/objects/Connection.ts +90 -0
  42. package/src/graphql/objects/CoopExitFeeEstimateInput.ts +41 -0
  43. package/src/graphql/objects/CoopExitFeeEstimateOutput.ts +52 -0
  44. package/src/graphql/objects/CoopExitRequest.ts +118 -0
  45. package/src/graphql/objects/CurrencyAmount.ts +74 -0
  46. package/src/graphql/objects/CurrencyUnit.ts +32 -0
  47. package/src/graphql/objects/Entity.ts +202 -0
  48. package/src/graphql/objects/GetChallengeInput.ts +37 -0
  49. package/src/graphql/objects/GetChallengeOutput.ts +43 -0
  50. package/src/graphql/objects/Invoice.ts +83 -0
  51. package/src/graphql/objects/Leaf.ts +59 -0
  52. package/src/graphql/objects/LeavesSwapFeeEstimateInput.ts +37 -0
  53. package/src/graphql/objects/LeavesSwapFeeEstimateOutput.ts +52 -0
  54. package/src/graphql/objects/LeavesSwapRequest.ts +192 -0
  55. package/src/graphql/objects/LightningReceiveFeeEstimateInput.ts +41 -0
  56. package/src/graphql/objects/LightningReceiveFeeEstimateOutput.ts +52 -0
  57. package/src/graphql/objects/LightningReceiveRequest.ts +147 -0
  58. package/src/graphql/objects/LightningReceiveRequestStatus.ts +34 -0
  59. package/src/graphql/objects/LightningSendFeeEstimateInput.ts +37 -0
  60. package/src/graphql/objects/LightningSendFeeEstimateOutput.ts +52 -0
  61. package/src/graphql/objects/LightningSendRequest.ts +134 -0
  62. package/src/graphql/objects/LightningSendRequestStatus.ts +28 -0
  63. package/src/graphql/objects/NotifyReceiverTransferInput.ts +41 -0
  64. package/src/graphql/objects/PageInfo.ts +58 -0
  65. package/src/graphql/objects/Provider.ts +41 -0
  66. package/src/graphql/objects/RequestCoopExitInput.ts +41 -0
  67. package/src/graphql/objects/RequestCoopExitOutput.ts +45 -0
  68. package/src/graphql/objects/RequestLeavesSwapInput.ts +55 -0
  69. package/src/graphql/objects/RequestLeavesSwapOutput.ts +45 -0
  70. package/src/graphql/objects/RequestLightningReceiveInput.ts +58 -0
  71. package/src/graphql/objects/RequestLightningReceiveOutput.ts +45 -0
  72. package/src/graphql/objects/RequestLightningSendInput.ts +41 -0
  73. package/src/graphql/objects/RequestLightningSendOutput.ts +45 -0
  74. package/src/graphql/objects/SparkCoopExitRequestStatus.ts +20 -0
  75. package/src/graphql/objects/SparkLeavesSwapRequestStatus.ts +20 -0
  76. package/src/graphql/objects/SparkTransferToLeavesConnection.ts +79 -0
  77. package/src/graphql/objects/SparkWalletUser.ts +86 -0
  78. package/src/graphql/objects/StartSeedReleaseInput.ts +37 -0
  79. package/src/graphql/objects/SwapLeaf.ts +53 -0
  80. package/src/graphql/objects/Transfer.ts +98 -0
  81. package/src/graphql/objects/UserLeafInput.ts +28 -0
  82. package/src/graphql/objects/VerifyChallengeInput.ts +51 -0
  83. package/src/graphql/objects/VerifyChallengeOutput.ts +43 -0
  84. package/src/graphql/objects/WalletUserIdentityPublicKeyInput.ts +37 -0
  85. package/src/graphql/objects/WalletUserIdentityPublicKeyOutput.ts +43 -0
  86. package/src/graphql/objects/index.ts +67 -0
  87. package/src/graphql/queries/CoopExitFeeEstimate.ts +18 -0
  88. package/src/graphql/queries/CurrentUser.ts +10 -0
  89. package/src/graphql/queries/LightningReceiveFeeEstimate.ts +18 -0
  90. package/src/graphql/queries/LightningSendFeeEstimate.ts +16 -0
  91. package/src/proto/common.ts +431 -0
  92. package/src/proto/google/protobuf/descriptor.ts +6625 -0
  93. package/src/proto/google/protobuf/duration.ts +197 -0
  94. package/src/proto/google/protobuf/empty.ts +83 -0
  95. package/src/proto/google/protobuf/timestamp.ts +226 -0
  96. package/src/proto/mock.ts +151 -0
  97. package/src/proto/spark.ts +12727 -0
  98. package/src/proto/spark_authn.ts +673 -0
  99. package/src/proto/validate/validate.ts +6047 -0
  100. package/src/services/config.ts +71 -0
  101. package/src/services/connection.ts +264 -0
  102. package/src/services/coop-exit.ts +190 -0
  103. package/src/services/deposit.ts +327 -0
  104. package/src/services/lightning.ts +341 -0
  105. package/src/services/lrc20.ts +42 -0
  106. package/src/services/token-transactions.ts +499 -0
  107. package/src/services/transfer.ts +1188 -0
  108. package/src/services/tree-creation.ts +618 -0
  109. package/src/services/wallet-config.ts +141 -0
  110. package/src/signer/signer.ts +531 -0
  111. package/src/spark-sdk.ts +1644 -0
  112. package/src/tests/adaptor-signature.test.ts +64 -0
  113. package/src/tests/bitcoin.test.ts +122 -0
  114. package/src/tests/coop-exit.test.ts +233 -0
  115. package/src/tests/deposit.test.ts +98 -0
  116. package/src/tests/keys.test.ts +82 -0
  117. package/src/tests/lightning.test.ts +307 -0
  118. package/src/tests/secret-sharing.test.ts +63 -0
  119. package/src/tests/swap.test.ts +252 -0
  120. package/src/tests/test-util.ts +92 -0
  121. package/src/tests/tokens.test.ts +47 -0
  122. package/src/tests/transfer.test.ts +371 -0
  123. package/src/tests/tree-creation.test.ts +56 -0
  124. package/src/tests/utils/spark-testing-wallet.ts +37 -0
  125. package/src/tests/utils/test-faucet.ts +257 -0
  126. package/src/types/grpc.ts +8 -0
  127. package/src/types/index.ts +3 -0
  128. package/src/utils/adaptor-signature.ts +189 -0
  129. package/src/utils/bitcoin.ts +138 -0
  130. package/src/utils/crypto.ts +14 -0
  131. package/src/utils/index.ts +12 -0
  132. package/src/utils/keys.ts +92 -0
  133. package/src/utils/mempool.ts +42 -0
  134. package/src/utils/network.ts +70 -0
  135. package/src/utils/proof.ts +17 -0
  136. package/src/utils/response-validation.ts +26 -0
  137. package/src/utils/secret-sharing.ts +263 -0
  138. package/src/utils/signing.ts +96 -0
  139. package/src/utils/token-hashing.ts +163 -0
  140. package/src/utils/token-keyshares.ts +31 -0
  141. package/src/utils/token-transactions.ts +71 -0
  142. package/src/utils/transaction.ts +45 -0
  143. package/src/utils/wasm-wrapper.ts +57 -0
  144. package/src/utils/wasm.ts +154 -0
  145. package/src/wasm/spark_bindings.d.ts +208 -0
  146. package/src/wasm/spark_bindings.js +1161 -0
  147. package/src/wasm/spark_bindings_bg.wasm +0 -0
  148. package/src/wasm/spark_bindings_bg.wasm.d.ts +136 -0
@@ -0,0 +1,90 @@
1
+
2
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
+
4
+
5
+ import SparkTransferToLeavesConnection from './SparkTransferToLeavesConnection.js';
6
+ import {PageInfoToJson} from './PageInfo.js';
7
+ import {LeafToJson} from './Leaf.js';
8
+ import {PageInfoFromJson} from './PageInfo.js';
9
+ import { LightsparkException } from '@lightsparkdev/core';
10
+ import {LeafFromJson} from './Leaf.js';
11
+ import PageInfo from './PageInfo.js';
12
+
13
+
14
+ interface Connection {
15
+
16
+
17
+ /**
18
+ * The total count of objects in this connection, using the current filters. It is different from the
19
+ * number of objects returned in the current page (in the `entities` field).
20
+ **/
21
+ count: number;
22
+
23
+ /** An object that holds pagination information about the objects in this connection. **/
24
+ pageInfo: PageInfo;
25
+
26
+ /** The typename of the object **/
27
+ typename: string;
28
+
29
+
30
+
31
+
32
+ }
33
+
34
+ export const ConnectionFromJson = (obj: any): Connection => {
35
+ if (obj["__typename"] == "SparkTransferToLeavesConnection") {
36
+ return {
37
+ count: obj["spark_transfer_to_leaves_connection_count"],
38
+ pageInfo: PageInfoFromJson(obj["spark_transfer_to_leaves_connection_page_info"]),
39
+ entities: obj["spark_transfer_to_leaves_connection_entities"].map((e) => LeafFromJson(e)),
40
+ typename: "SparkTransferToLeavesConnection",
41
+ } as SparkTransferToLeavesConnection;
42
+
43
+ } throw new LightsparkException("DeserializationError", `Couldn't find a concrete type for interface Connection corresponding to the typename=${obj["__typename"]}`)
44
+ }
45
+ export const ConnectionToJson = (obj: Connection): any => {
46
+ if (obj.typename == "SparkTransferToLeavesConnection") {
47
+ const sparkTransferToLeavesConnection = obj as SparkTransferToLeavesConnection;
48
+ return {
49
+ __typename: "SparkTransferToLeavesConnection",spark_transfer_to_leaves_connection_count: sparkTransferToLeavesConnection.count,
50
+ spark_transfer_to_leaves_connection_page_info: PageInfoToJson(sparkTransferToLeavesConnection.pageInfo),
51
+ spark_transfer_to_leaves_connection_entities: sparkTransferToLeavesConnection.entities.map((e) => LeafToJson(e)),
52
+
53
+ }
54
+
55
+ } throw new LightsparkException("DeserializationError", `Couldn't find a concrete type for interface Connection corresponding to the typename=${obj.typename}`)
56
+ }
57
+
58
+
59
+ export const FRAGMENT = `
60
+ fragment ConnectionFragment on Connection {
61
+ __typename
62
+ ... on SparkTransferToLeavesConnection {
63
+ __typename
64
+ spark_transfer_to_leaves_connection_count: count
65
+ spark_transfer_to_leaves_connection_page_info: page_info {
66
+ __typename
67
+ page_info_has_next_page: has_next_page
68
+ page_info_has_previous_page: has_previous_page
69
+ page_info_start_cursor: start_cursor
70
+ page_info_end_cursor: end_cursor
71
+ }
72
+ spark_transfer_to_leaves_connection_entities: entities {
73
+ __typename
74
+ leaf_amount: amount {
75
+ __typename
76
+ currency_amount_original_value: original_value
77
+ currency_amount_original_unit: original_unit
78
+ currency_amount_preferred_currency_unit: preferred_currency_unit
79
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
80
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
81
+ }
82
+ leaf_spark_node_id: spark_node_id
83
+ }
84
+ }
85
+ }`;
86
+
87
+
88
+
89
+
90
+ export default Connection;
@@ -0,0 +1,41 @@
1
+
2
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
+
4
+
5
+
6
+
7
+
8
+ interface CoopExitFeeEstimateInput {
9
+
10
+
11
+ leafExternalIds: string[];
12
+
13
+ withdrawalAddress: string;
14
+
15
+
16
+
17
+
18
+ }
19
+
20
+ export const CoopExitFeeEstimateInputFromJson = (obj: any): CoopExitFeeEstimateInput => {
21
+ return {
22
+ leafExternalIds: obj["coop_exit_fee_estimate_input_leaf_external_ids"],
23
+ withdrawalAddress: obj["coop_exit_fee_estimate_input_withdrawal_address"],
24
+
25
+ } as CoopExitFeeEstimateInput;
26
+
27
+ }
28
+ export const CoopExitFeeEstimateInputToJson = (obj: CoopExitFeeEstimateInput): any => {
29
+ return {
30
+ coop_exit_fee_estimate_input_leaf_external_ids: obj.leafExternalIds,
31
+ coop_exit_fee_estimate_input_withdrawal_address: obj.withdrawalAddress,
32
+
33
+ }
34
+
35
+ }
36
+
37
+
38
+
39
+
40
+
41
+ export default CoopExitFeeEstimateInput;
@@ -0,0 +1,52 @@
1
+
2
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
+
4
+
5
+ import {CurrencyAmountToJson} from './CurrencyAmount.js';
6
+ import {CurrencyAmountFromJson} from './CurrencyAmount.js';
7
+ import CurrencyAmount from './CurrencyAmount.js';
8
+
9
+
10
+ interface CoopExitFeeEstimateOutput {
11
+
12
+
13
+ feeEstimate: CurrencyAmount;
14
+
15
+
16
+
17
+
18
+ }
19
+
20
+ export const CoopExitFeeEstimateOutputFromJson = (obj: any): CoopExitFeeEstimateOutput => {
21
+ return {
22
+ feeEstimate: CurrencyAmountFromJson(obj["coop_exit_fee_estimate_output_fee_estimate"]),
23
+
24
+ } as CoopExitFeeEstimateOutput;
25
+
26
+ }
27
+ export const CoopExitFeeEstimateOutputToJson = (obj: CoopExitFeeEstimateOutput): any => {
28
+ return {
29
+ coop_exit_fee_estimate_output_fee_estimate: CurrencyAmountToJson(obj.feeEstimate),
30
+
31
+ }
32
+
33
+ }
34
+
35
+
36
+ export const FRAGMENT = `
37
+ fragment CoopExitFeeEstimateOutputFragment on CoopExitFeeEstimateOutput {
38
+ __typename
39
+ coop_exit_fee_estimate_output_fee_estimate: fee_estimate {
40
+ __typename
41
+ currency_amount_original_value: original_value
42
+ currency_amount_original_unit: original_unit
43
+ currency_amount_preferred_currency_unit: preferred_currency_unit
44
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
45
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
46
+ }
47
+ }`;
48
+
49
+
50
+
51
+
52
+ export default CoopExitFeeEstimateOutput;
@@ -0,0 +1,118 @@
1
+
2
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
+
4
+ import Entity from './Entity.js';
5
+ import {CurrencyAmountToJson} from './CurrencyAmount.js';
6
+ import {CurrencyAmountFromJson} from './CurrencyAmount.js';
7
+ import SparkCoopExitRequestStatus from './SparkCoopExitRequestStatus.js';
8
+ import CurrencyAmount from './CurrencyAmount.js';
9
+ import { Query, isObject } from '@lightsparkdev/core';
10
+
11
+
12
+ interface CoopExitRequest {
13
+
14
+
15
+ /**
16
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
17
+ * string.
18
+ **/
19
+ id: string;
20
+
21
+ /** The date and time when the entity was first created. **/
22
+ createdAt: string;
23
+
24
+ /** The date and time when the entity was last updated. **/
25
+ updatedAt: string;
26
+
27
+ /**
28
+ * The fee includes what user pays for the coop exit and the L1 broadcast fee. The amount user will
29
+ * receive on L1 is total_amount - fee.
30
+ **/
31
+ fee: CurrencyAmount;
32
+
33
+ /** The status of the request. **/
34
+ status: SparkCoopExitRequestStatus;
35
+
36
+ /** The time when the coop exit request expires and the UTXOs are released. **/
37
+ expiresAt: string;
38
+
39
+ /** The raw connector transaction. **/
40
+ rawConnectorTransaction: string;
41
+
42
+ /** The typename of the object **/
43
+ typename: string;
44
+
45
+
46
+
47
+
48
+ }
49
+
50
+ export const CoopExitRequestFromJson = (obj: any): CoopExitRequest => {
51
+ return {
52
+ id: obj["coop_exit_request_id"],
53
+ createdAt: obj["coop_exit_request_created_at"],
54
+ updatedAt: obj["coop_exit_request_updated_at"],
55
+ fee: CurrencyAmountFromJson(obj["coop_exit_request_fee"]),
56
+ status: SparkCoopExitRequestStatus[obj["coop_exit_request_status"]] ?? SparkCoopExitRequestStatus.FUTURE_VALUE,
57
+ expiresAt: obj["coop_exit_request_expires_at"],
58
+ rawConnectorTransaction: obj["coop_exit_request_raw_connector_transaction"],
59
+ typename: "CoopExitRequest",
60
+ } as CoopExitRequest;
61
+
62
+ }
63
+ export const CoopExitRequestToJson = (obj: CoopExitRequest): any => {
64
+ return {
65
+ __typename: "CoopExitRequest",coop_exit_request_id: obj.id,
66
+ coop_exit_request_created_at: obj.createdAt,
67
+ coop_exit_request_updated_at: obj.updatedAt,
68
+ coop_exit_request_fee: CurrencyAmountToJson(obj.fee),
69
+ coop_exit_request_status: obj.status,
70
+ coop_exit_request_expires_at: obj.expiresAt,
71
+ coop_exit_request_raw_connector_transaction: obj.rawConnectorTransaction,
72
+
73
+ }
74
+
75
+ }
76
+
77
+
78
+ export const FRAGMENT = `
79
+ fragment CoopExitRequestFragment on CoopExitRequest {
80
+ __typename
81
+ coop_exit_request_id: id
82
+ coop_exit_request_created_at: created_at
83
+ coop_exit_request_updated_at: updated_at
84
+ coop_exit_request_fee: fee {
85
+ __typename
86
+ currency_amount_original_value: original_value
87
+ currency_amount_original_unit: original_unit
88
+ currency_amount_preferred_currency_unit: preferred_currency_unit
89
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
90
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
91
+ }
92
+ coop_exit_request_status: status
93
+ coop_exit_request_expires_at: expires_at
94
+ coop_exit_request_raw_connector_transaction: raw_connector_transaction
95
+ }`;
96
+
97
+
98
+
99
+ export const getCoopExitRequestQuery = (id: string): Query<CoopExitRequest> => {
100
+ return {
101
+ queryPayload: `
102
+ query GetCoopExitRequest($id: ID!) {
103
+ entity(id: $id) {
104
+ ... on CoopExitRequest {
105
+ ...CoopExitRequestFragment
106
+ }
107
+ }
108
+ }
109
+
110
+ ${FRAGMENT}
111
+ `,
112
+ variables: {id},
113
+ constructObject: (data: unknown) => isObject(data) && "entity" in data && isObject(data.entity) ? CoopExitRequestFromJson(data.entity) : null,
114
+ }
115
+ }
116
+
117
+
118
+ export default CoopExitRequest;
@@ -0,0 +1,74 @@
1
+
2
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
+
4
+
5
+ import CurrencyUnit from './CurrencyUnit.js';
6
+
7
+ /** This object represents the value and unit for an amount of currency. **/
8
+ interface CurrencyAmount {
9
+
10
+
11
+ /** The original numeric value for this CurrencyAmount. **/
12
+ originalValue: number;
13
+
14
+ /** The original unit of currency for this CurrencyAmount. **/
15
+ originalUnit: CurrencyUnit;
16
+
17
+ /** The unit of user's preferred currency. **/
18
+ preferredCurrencyUnit: CurrencyUnit;
19
+
20
+ /**
21
+ * The rounded numeric value for this CurrencyAmount in the very base level of user's preferred
22
+ * currency. For example, for USD, the value will be in cents.
23
+ **/
24
+ preferredCurrencyValueRounded: number;
25
+
26
+ /**
27
+ * The approximate float value for this CurrencyAmount in the very base level of user's preferred
28
+ * currency. For example, for USD, the value will be in cents.
29
+ **/
30
+ preferredCurrencyValueApprox: number;
31
+
32
+
33
+
34
+
35
+ }
36
+
37
+ export const CurrencyAmountFromJson = (obj: any): CurrencyAmount => {
38
+ return {
39
+ originalValue: obj["currency_amount_original_value"],
40
+ originalUnit: CurrencyUnit[obj["currency_amount_original_unit"]] ?? CurrencyUnit.FUTURE_VALUE,
41
+ preferredCurrencyUnit: CurrencyUnit[obj["currency_amount_preferred_currency_unit"]] ?? CurrencyUnit.FUTURE_VALUE,
42
+ preferredCurrencyValueRounded: obj["currency_amount_preferred_currency_value_rounded"],
43
+ preferredCurrencyValueApprox: obj["currency_amount_preferred_currency_value_approx"],
44
+
45
+ } as CurrencyAmount;
46
+
47
+ }
48
+ export const CurrencyAmountToJson = (obj: CurrencyAmount): any => {
49
+ return {
50
+ currency_amount_original_value: obj.originalValue,
51
+ currency_amount_original_unit: obj.originalUnit,
52
+ currency_amount_preferred_currency_unit: obj.preferredCurrencyUnit,
53
+ currency_amount_preferred_currency_value_rounded: obj.preferredCurrencyValueRounded,
54
+ currency_amount_preferred_currency_value_approx: obj.preferredCurrencyValueApprox,
55
+
56
+ }
57
+
58
+ }
59
+
60
+
61
+ export const FRAGMENT = `
62
+ fragment CurrencyAmountFragment on CurrencyAmount {
63
+ __typename
64
+ currency_amount_original_value: original_value
65
+ currency_amount_original_unit: original_unit
66
+ currency_amount_preferred_currency_unit: preferred_currency_unit
67
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
68
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
69
+ }`;
70
+
71
+
72
+
73
+
74
+ export default CurrencyAmount;
@@ -0,0 +1,32 @@
1
+
2
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
+
4
+ /** This enum identifies the unit of currency associated with a CurrencyAmount. **/
5
+ export enum CurrencyUnit {
6
+ /**
7
+ * This is an enum value that represents values that could be added in the future.
8
+ * Clients should support unknown values as more of them could be added without notice.
9
+ */
10
+ FUTURE_VALUE = "FUTURE_VALUE",
11
+ /** Bitcoin is the cryptocurrency native to the Bitcoin network. It is used as the native medium for value transfer for the Lightning Network. **/
12
+ BITCOIN = "BITCOIN",
13
+ /** 0.00000001 (10e-8) Bitcoin or one hundred millionth of a Bitcoin. This is the unit most commonly used in Lightning transactions. **/
14
+ SATOSHI = "SATOSHI",
15
+ /** 0.001 Satoshi, or 10e-11 Bitcoin. We recommend using the Satoshi unit instead when possible. **/
16
+ MILLISATOSHI = "MILLISATOSHI",
17
+ /** United States Dollar. **/
18
+ USD = "USD",
19
+ /** Mexican Peso. **/
20
+ MXN = "MXN",
21
+ /** Philippine Peso. **/
22
+ PHP = "PHP",
23
+ /** 0.000000001 (10e-9) Bitcoin or a billionth of a Bitcoin. We recommend using the Satoshi unit instead when possible. **/
24
+ NANOBITCOIN = "NANOBITCOIN",
25
+ /** 0.000001 (10e-6) Bitcoin or a millionth of a Bitcoin. We recommend using the Satoshi unit instead when possible. **/
26
+ MICROBITCOIN = "MICROBITCOIN",
27
+ /** 0.001 (10e-3) Bitcoin or a thousandth of a Bitcoin. We recommend using the Satoshi unit instead when possible. **/
28
+ MILLIBITCOIN = "MILLIBITCOIN",
29
+
30
+ }
31
+
32
+ export default CurrencyUnit;
@@ -0,0 +1,202 @@
1
+
2
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
+
4
+
5
+ import { Query, isObject } from '@lightsparkdev/core';
6
+
7
+ /** This interface is used by all the entities in the Lightspark system. It defines a few core fields that are available everywhere. Any object that implements this interface can be queried using the `entity` query and its ID. **/
8
+ interface Entity {
9
+
10
+
11
+ /**
12
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
13
+ * string.
14
+ **/
15
+ id: string;
16
+
17
+ /** The date and time when the entity was first created. **/
18
+ createdAt: string;
19
+
20
+ /** The date and time when the entity was last updated. **/
21
+ updatedAt: string;
22
+
23
+ /** The typename of the object **/
24
+ typename: string;
25
+
26
+
27
+
28
+
29
+ }
30
+
31
+
32
+
33
+
34
+
35
+ export const FRAGMENT = `
36
+ fragment EntityFragment on Entity {
37
+ __typename
38
+ ... on CoopExitRequest {
39
+ __typename
40
+ coop_exit_request_id: id
41
+ coop_exit_request_created_at: created_at
42
+ coop_exit_request_updated_at: updated_at
43
+ coop_exit_request_fee: fee {
44
+ __typename
45
+ currency_amount_original_value: original_value
46
+ currency_amount_original_unit: original_unit
47
+ currency_amount_preferred_currency_unit: preferred_currency_unit
48
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
49
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
50
+ }
51
+ coop_exit_request_status: status
52
+ coop_exit_request_expires_at: expires_at
53
+ coop_exit_request_raw_connector_transaction: raw_connector_transaction
54
+ }
55
+ ... on LeavesSwapRequest {
56
+ __typename
57
+ leaves_swap_request_id: id
58
+ leaves_swap_request_created_at: created_at
59
+ leaves_swap_request_updated_at: updated_at
60
+ leaves_swap_request_status: status
61
+ leaves_swap_request_total_amount: total_amount {
62
+ __typename
63
+ currency_amount_original_value: original_value
64
+ currency_amount_original_unit: original_unit
65
+ currency_amount_preferred_currency_unit: preferred_currency_unit
66
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
67
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
68
+ }
69
+ leaves_swap_request_target_amount: target_amount {
70
+ __typename
71
+ currency_amount_original_value: original_value
72
+ currency_amount_original_unit: original_unit
73
+ currency_amount_preferred_currency_unit: preferred_currency_unit
74
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
75
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
76
+ }
77
+ leaves_swap_request_fee: fee {
78
+ __typename
79
+ currency_amount_original_value: original_value
80
+ currency_amount_original_unit: original_unit
81
+ currency_amount_preferred_currency_unit: preferred_currency_unit
82
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
83
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
84
+ }
85
+ leaves_swap_request_inbound_transfer: inbound_transfer {
86
+ __typename
87
+ transfer_total_amount: total_amount {
88
+ __typename
89
+ currency_amount_original_value: original_value
90
+ currency_amount_original_unit: original_unit
91
+ currency_amount_preferred_currency_unit: preferred_currency_unit
92
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
93
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
94
+ }
95
+ transfer_spark_id: spark_id
96
+ }
97
+ leaves_swap_request_outbound_transfer: outbound_transfer {
98
+ __typename
99
+ transfer_total_amount: total_amount {
100
+ __typename
101
+ currency_amount_original_value: original_value
102
+ currency_amount_original_unit: original_unit
103
+ currency_amount_preferred_currency_unit: preferred_currency_unit
104
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
105
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
106
+ }
107
+ transfer_spark_id: spark_id
108
+ }
109
+ leaves_swap_request_expires_at: expires_at
110
+ leaves_swap_request_swap_leaves: swap_leaves {
111
+ __typename
112
+ swap_leaf_leaf_id: leaf_id
113
+ swap_leaf_raw_unsigned_refund_transaction: raw_unsigned_refund_transaction
114
+ swap_leaf_adaptor_signed_signature: adaptor_signed_signature
115
+ }
116
+ }
117
+ ... on LightningReceiveRequest {
118
+ __typename
119
+ lightning_receive_request_id: id
120
+ lightning_receive_request_created_at: created_at
121
+ lightning_receive_request_updated_at: updated_at
122
+ lightning_receive_request_invoice: invoice {
123
+ __typename
124
+ invoice_encoded_envoice: encoded_envoice
125
+ invoice_bitcoin_network: bitcoin_network
126
+ invoice_payment_hash: payment_hash
127
+ invoice_amount: amount {
128
+ __typename
129
+ currency_amount_original_value: original_value
130
+ currency_amount_original_unit: original_unit
131
+ currency_amount_preferred_currency_unit: preferred_currency_unit
132
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
133
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
134
+ }
135
+ invoice_created_at: created_at
136
+ invoice_expires_at: expires_at
137
+ invoice_memo: memo
138
+ }
139
+ lightning_receive_request_fee: fee {
140
+ __typename
141
+ currency_amount_original_value: original_value
142
+ currency_amount_original_unit: original_unit
143
+ currency_amount_preferred_currency_unit: preferred_currency_unit
144
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
145
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
146
+ }
147
+ lightning_receive_request_status: status
148
+ lightning_receive_request_transfer: transfer {
149
+ __typename
150
+ transfer_total_amount: total_amount {
151
+ __typename
152
+ currency_amount_original_value: original_value
153
+ currency_amount_original_unit: original_unit
154
+ currency_amount_preferred_currency_unit: preferred_currency_unit
155
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
156
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
157
+ }
158
+ transfer_spark_id: spark_id
159
+ }
160
+ }
161
+ ... on LightningSendRequest {
162
+ __typename
163
+ lightning_send_request_id: id
164
+ lightning_send_request_created_at: created_at
165
+ lightning_send_request_updated_at: updated_at
166
+ lightning_send_request_encoded_invoice: encoded_invoice
167
+ lightning_send_request_fee: fee {
168
+ __typename
169
+ currency_amount_original_value: original_value
170
+ currency_amount_original_unit: original_unit
171
+ currency_amount_preferred_currency_unit: preferred_currency_unit
172
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
173
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
174
+ }
175
+ lightning_send_request_idempotency_key: idempotency_key
176
+ lightning_send_request_status: status
177
+ lightning_send_request_transfer: transfer {
178
+ __typename
179
+ transfer_total_amount: total_amount {
180
+ __typename
181
+ currency_amount_original_value: original_value
182
+ currency_amount_original_unit: original_unit
183
+ currency_amount_preferred_currency_unit: preferred_currency_unit
184
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
185
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
186
+ }
187
+ transfer_spark_id: spark_id
188
+ }
189
+ }
190
+ ... on SparkWalletUser {
191
+ __typename
192
+ spark_wallet_user_id: id
193
+ spark_wallet_user_created_at: created_at
194
+ spark_wallet_user_updated_at: updated_at
195
+ spark_wallet_user_identity_public_key: identity_public_key
196
+ }
197
+ }`;
198
+
199
+
200
+
201
+
202
+ export default Entity;
@@ -0,0 +1,37 @@
1
+
2
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
+
4
+
5
+
6
+
7
+
8
+ interface GetChallengeInput {
9
+
10
+
11
+ publicKey: string;
12
+
13
+
14
+
15
+
16
+ }
17
+
18
+ export const GetChallengeInputFromJson = (obj: any): GetChallengeInput => {
19
+ return {
20
+ publicKey: obj["get_challenge_input_public_key"],
21
+
22
+ } as GetChallengeInput;
23
+
24
+ }
25
+ export const GetChallengeInputToJson = (obj: GetChallengeInput): any => {
26
+ return {
27
+ get_challenge_input_public_key: obj.publicKey,
28
+
29
+ }
30
+
31
+ }
32
+
33
+
34
+
35
+
36
+
37
+ export default GetChallengeInput;
@@ -0,0 +1,43 @@
1
+
2
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
+
4
+
5
+
6
+
7
+
8
+ interface GetChallengeOutput {
9
+
10
+
11
+ protectedChallenge: string;
12
+
13
+
14
+
15
+
16
+ }
17
+
18
+ export const GetChallengeOutputFromJson = (obj: any): GetChallengeOutput => {
19
+ return {
20
+ protectedChallenge: obj["get_challenge_output_protected_challenge"],
21
+
22
+ } as GetChallengeOutput;
23
+
24
+ }
25
+ export const GetChallengeOutputToJson = (obj: GetChallengeOutput): any => {
26
+ return {
27
+ get_challenge_output_protected_challenge: obj.protectedChallenge,
28
+
29
+ }
30
+
31
+ }
32
+
33
+
34
+ export const FRAGMENT = `
35
+ fragment GetChallengeOutputFragment on GetChallengeOutput {
36
+ __typename
37
+ get_challenge_output_protected_challenge: protected_challenge
38
+ }`;
39
+
40
+
41
+
42
+
43
+ export default GetChallengeOutput;