@buildonspark/spark-sdk 0.0.15 → 0.0.17
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.
- package/dist/services/config.d.ts +1 -0
- package/dist/services/config.js +4 -1
- package/dist/services/config.js.map +1 -1
- package/dist/services/wallet-config.d.ts +2 -0
- package/dist/services/wallet-config.js +2 -0
- package/dist/services/wallet-config.js.map +1 -1
- package/dist/signer/signer.js +4 -3
- package/dist/signer/signer.js.map +1 -1
- package/dist/spark-sdk.d.ts +4 -4
- package/dist/spark-sdk.js +26 -10
- package/dist/spark-sdk.js.map +1 -1
- package/package.json +4 -3
- package/src/examples/example.js +247 -0
- package/src/examples/example.ts +207 -0
- package/src/graphql/client.ts +282 -0
- package/src/graphql/mutations/CompleteCoopExit.ts +19 -0
- package/src/graphql/mutations/CompleteLeavesSwap.ts +17 -0
- package/src/graphql/mutations/RequestCoopExit.ts +20 -0
- package/src/graphql/mutations/RequestLightningReceive.ts +26 -0
- package/src/graphql/mutations/RequestLightningSend.ts +17 -0
- package/src/graphql/mutations/RequestSwapLeaves.ts +24 -0
- package/src/graphql/objects/BitcoinNetwork.ts +22 -0
- package/src/graphql/objects/CompleteCoopExitInput.ts +41 -0
- package/src/graphql/objects/CompleteCoopExitOutput.ts +45 -0
- package/src/graphql/objects/CompleteLeavesSwapInput.ts +45 -0
- package/src/graphql/objects/CompleteLeavesSwapOutput.ts +45 -0
- package/src/graphql/objects/CompleteSeedReleaseInput.ts +41 -0
- package/src/graphql/objects/CompleteSeedReleaseOutput.ts +43 -0
- package/src/graphql/objects/Connection.ts +90 -0
- package/src/graphql/objects/CoopExitFeeEstimateInput.ts +41 -0
- package/src/graphql/objects/CoopExitFeeEstimateOutput.ts +52 -0
- package/src/graphql/objects/CoopExitRequest.ts +118 -0
- package/src/graphql/objects/CurrencyAmount.ts +74 -0
- package/src/graphql/objects/CurrencyUnit.ts +32 -0
- package/src/graphql/objects/Entity.ts +202 -0
- package/src/graphql/objects/GetChallengeInput.ts +37 -0
- package/src/graphql/objects/GetChallengeOutput.ts +43 -0
- package/src/graphql/objects/Invoice.ts +83 -0
- package/src/graphql/objects/Leaf.ts +59 -0
- package/src/graphql/objects/LeavesSwapFeeEstimateInput.ts +37 -0
- package/src/graphql/objects/LeavesSwapFeeEstimateOutput.ts +52 -0
- package/src/graphql/objects/LeavesSwapRequest.ts +192 -0
- package/src/graphql/objects/LightningReceiveFeeEstimateInput.ts +41 -0
- package/src/graphql/objects/LightningReceiveFeeEstimateOutput.ts +52 -0
- package/src/graphql/objects/LightningReceiveRequest.ts +147 -0
- package/src/graphql/objects/LightningReceiveRequestStatus.ts +34 -0
- package/src/graphql/objects/LightningSendFeeEstimateInput.ts +37 -0
- package/src/graphql/objects/LightningSendFeeEstimateOutput.ts +52 -0
- package/src/graphql/objects/LightningSendRequest.ts +134 -0
- package/src/graphql/objects/LightningSendRequestStatus.ts +28 -0
- package/src/graphql/objects/NotifyReceiverTransferInput.ts +41 -0
- package/src/graphql/objects/PageInfo.ts +58 -0
- package/src/graphql/objects/Provider.ts +41 -0
- package/src/graphql/objects/RequestCoopExitInput.ts +41 -0
- package/src/graphql/objects/RequestCoopExitOutput.ts +45 -0
- package/src/graphql/objects/RequestLeavesSwapInput.ts +55 -0
- package/src/graphql/objects/RequestLeavesSwapOutput.ts +45 -0
- package/src/graphql/objects/RequestLightningReceiveInput.ts +58 -0
- package/src/graphql/objects/RequestLightningReceiveOutput.ts +45 -0
- package/src/graphql/objects/RequestLightningSendInput.ts +41 -0
- package/src/graphql/objects/RequestLightningSendOutput.ts +45 -0
- package/src/graphql/objects/SparkCoopExitRequestStatus.ts +20 -0
- package/src/graphql/objects/SparkLeavesSwapRequestStatus.ts +20 -0
- package/src/graphql/objects/SparkTransferToLeavesConnection.ts +79 -0
- package/src/graphql/objects/SparkWalletUser.ts +86 -0
- package/src/graphql/objects/StartSeedReleaseInput.ts +37 -0
- package/src/graphql/objects/SwapLeaf.ts +53 -0
- package/src/graphql/objects/Transfer.ts +98 -0
- package/src/graphql/objects/UserLeafInput.ts +28 -0
- package/src/graphql/objects/VerifyChallengeInput.ts +51 -0
- package/src/graphql/objects/VerifyChallengeOutput.ts +43 -0
- package/src/graphql/objects/WalletUserIdentityPublicKeyInput.ts +37 -0
- package/src/graphql/objects/WalletUserIdentityPublicKeyOutput.ts +43 -0
- package/src/graphql/objects/index.ts +67 -0
- package/src/graphql/queries/CoopExitFeeEstimate.ts +18 -0
- package/src/graphql/queries/CurrentUser.ts +10 -0
- package/src/graphql/queries/LightningReceiveFeeEstimate.ts +18 -0
- package/src/graphql/queries/LightningSendFeeEstimate.ts +16 -0
- package/src/proto/common.ts +431 -0
- package/src/proto/google/protobuf/descriptor.ts +6625 -0
- package/src/proto/google/protobuf/duration.ts +197 -0
- package/src/proto/google/protobuf/empty.ts +83 -0
- package/src/proto/google/protobuf/timestamp.ts +226 -0
- package/src/proto/mock.ts +151 -0
- package/src/proto/spark.ts +12727 -0
- package/src/proto/spark_authn.ts +673 -0
- package/src/proto/validate/validate.ts +6047 -0
- package/src/services/config.ts +75 -0
- package/src/services/connection.ts +264 -0
- package/src/services/coop-exit.ts +190 -0
- package/src/services/deposit.ts +327 -0
- package/src/services/lightning.ts +341 -0
- package/src/services/lrc20.ts +42 -0
- package/src/services/token-transactions.ts +499 -0
- package/src/services/transfer.ts +1188 -0
- package/src/services/tree-creation.ts +618 -0
- package/src/services/wallet-config.ts +143 -0
- package/src/signer/signer.ts +532 -0
- package/src/spark-sdk.ts +1665 -0
- package/src/tests/adaptor-signature.test.ts +64 -0
- package/src/tests/bitcoin.test.ts +122 -0
- package/src/tests/coop-exit.test.ts +233 -0
- package/src/tests/deposit.test.ts +98 -0
- package/src/tests/keys.test.ts +82 -0
- package/src/tests/lightning.test.ts +307 -0
- package/src/tests/secret-sharing.test.ts +63 -0
- package/src/tests/swap.test.ts +252 -0
- package/src/tests/test-util.ts +92 -0
- package/src/tests/tokens.test.ts +47 -0
- package/src/tests/transfer.test.ts +371 -0
- package/src/tests/tree-creation.test.ts +56 -0
- package/src/tests/utils/spark-testing-wallet.ts +37 -0
- package/src/tests/utils/test-faucet.ts +257 -0
- package/src/types/grpc.ts +8 -0
- package/src/types/index.ts +3 -0
- package/src/utils/adaptor-signature.ts +189 -0
- package/src/utils/bitcoin.ts +138 -0
- package/src/utils/crypto.ts +14 -0
- package/src/utils/index.ts +12 -0
- package/src/utils/keys.ts +92 -0
- package/src/utils/mempool.ts +42 -0
- package/src/utils/network.ts +70 -0
- package/src/utils/proof.ts +17 -0
- package/src/utils/response-validation.ts +26 -0
- package/src/utils/secret-sharing.ts +263 -0
- package/src/utils/signing.ts +96 -0
- package/src/utils/token-hashing.ts +163 -0
- package/src/utils/token-keyshares.ts +31 -0
- package/src/utils/token-transactions.ts +71 -0
- package/src/utils/transaction.ts +45 -0
- package/src/utils/wasm-wrapper.ts +57 -0
- package/src/utils/wasm.ts +154 -0
- package/src/wasm/spark_bindings.d.ts +208 -0
- package/src/wasm/spark_bindings.js +1161 -0
- package/src/wasm/spark_bindings_bg.wasm +0 -0
- package/src/wasm/spark_bindings_bg.wasm.d.ts +136 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
interface LightningSendFeeEstimateInput {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
encodedInvoice: string;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const LightningSendFeeEstimateInputFromJson = (obj: any): LightningSendFeeEstimateInput => {
|
|
19
|
+
return {
|
|
20
|
+
encodedInvoice: obj["lightning_send_fee_estimate_input_encoded_invoice"],
|
|
21
|
+
|
|
22
|
+
} as LightningSendFeeEstimateInput;
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
export const LightningSendFeeEstimateInputToJson = (obj: LightningSendFeeEstimateInput): any => {
|
|
26
|
+
return {
|
|
27
|
+
lightning_send_fee_estimate_input_encoded_invoice: obj.encodedInvoice,
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export default LightningSendFeeEstimateInput;
|
|
@@ -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 LightningSendFeeEstimateOutput {
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
feeEstimate: CurrencyAmount;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const LightningSendFeeEstimateOutputFromJson = (obj: any): LightningSendFeeEstimateOutput => {
|
|
21
|
+
return {
|
|
22
|
+
feeEstimate: CurrencyAmountFromJson(obj["lightning_send_fee_estimate_output_fee_estimate"]),
|
|
23
|
+
|
|
24
|
+
} as LightningSendFeeEstimateOutput;
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
export const LightningSendFeeEstimateOutputToJson = (obj: LightningSendFeeEstimateOutput): any => {
|
|
28
|
+
return {
|
|
29
|
+
lightning_send_fee_estimate_output_fee_estimate: CurrencyAmountToJson(obj.feeEstimate),
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export const FRAGMENT = `
|
|
37
|
+
fragment LightningSendFeeEstimateOutputFragment on LightningSendFeeEstimateOutput {
|
|
38
|
+
__typename
|
|
39
|
+
lightning_send_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 LightningSendFeeEstimateOutput;
|
|
@@ -0,0 +1,134 @@
|
|
|
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 LightningSendRequestStatus from './LightningSendRequestStatus.js';
|
|
8
|
+
import {TransferFromJson} from './Transfer.js';
|
|
9
|
+
import CurrencyAmount from './CurrencyAmount.js';
|
|
10
|
+
import { Query, isObject } from '@lightsparkdev/core';
|
|
11
|
+
import Transfer from './Transfer.js';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
interface LightningSendRequest {
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
19
|
+
* string.
|
|
20
|
+
**/
|
|
21
|
+
id: string;
|
|
22
|
+
|
|
23
|
+
/** The date and time when the entity was first created. **/
|
|
24
|
+
createdAt: string;
|
|
25
|
+
|
|
26
|
+
/** The date and time when the entity was last updated. **/
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
|
|
29
|
+
/** The lightning invoice user requested to pay. **/
|
|
30
|
+
encodedInvoice: string;
|
|
31
|
+
|
|
32
|
+
/** The fee charged for paying the lightning invoice. **/
|
|
33
|
+
fee: CurrencyAmount;
|
|
34
|
+
|
|
35
|
+
/** The idempotency key of the request. **/
|
|
36
|
+
idempotencyKey: string;
|
|
37
|
+
|
|
38
|
+
/** The status of the request. **/
|
|
39
|
+
status: LightningSendRequestStatus;
|
|
40
|
+
|
|
41
|
+
/** The typename of the object **/
|
|
42
|
+
typename: string;
|
|
43
|
+
|
|
44
|
+
/** The leaves transfer after lightning payment was sent. **/
|
|
45
|
+
transfer?: Transfer | undefined;
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const LightningSendRequestFromJson = (obj: any): LightningSendRequest => {
|
|
53
|
+
return {
|
|
54
|
+
id: obj["lightning_send_request_id"],
|
|
55
|
+
createdAt: obj["lightning_send_request_created_at"],
|
|
56
|
+
updatedAt: obj["lightning_send_request_updated_at"],
|
|
57
|
+
encodedInvoice: obj["lightning_send_request_encoded_invoice"],
|
|
58
|
+
fee: CurrencyAmountFromJson(obj["lightning_send_request_fee"]),
|
|
59
|
+
idempotencyKey: obj["lightning_send_request_idempotency_key"],
|
|
60
|
+
status: LightningSendRequestStatus[obj["lightning_send_request_status"]] ?? LightningSendRequestStatus.FUTURE_VALUE,
|
|
61
|
+
typename: "LightningSendRequest", transfer: (!!obj["lightning_send_request_transfer"] ? TransferFromJson(obj["lightning_send_request_transfer"]) : undefined),
|
|
62
|
+
|
|
63
|
+
} as LightningSendRequest;
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
export const LightningSendRequestToJson = (obj: LightningSendRequest): any => {
|
|
67
|
+
return {
|
|
68
|
+
__typename: "LightningSendRequest",lightning_send_request_id: obj.id,
|
|
69
|
+
lightning_send_request_created_at: obj.createdAt,
|
|
70
|
+
lightning_send_request_updated_at: obj.updatedAt,
|
|
71
|
+
lightning_send_request_encoded_invoice: obj.encodedInvoice,
|
|
72
|
+
lightning_send_request_fee: CurrencyAmountToJson(obj.fee),
|
|
73
|
+
lightning_send_request_idempotency_key: obj.idempotencyKey,
|
|
74
|
+
lightning_send_request_status: obj.status,
|
|
75
|
+
lightning_send_request_transfer: (obj.transfer ? obj.transfer.toJson() : undefined),
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
export const FRAGMENT = `
|
|
83
|
+
fragment LightningSendRequestFragment on LightningSendRequest {
|
|
84
|
+
__typename
|
|
85
|
+
lightning_send_request_id: id
|
|
86
|
+
lightning_send_request_created_at: created_at
|
|
87
|
+
lightning_send_request_updated_at: updated_at
|
|
88
|
+
lightning_send_request_encoded_invoice: encoded_invoice
|
|
89
|
+
lightning_send_request_fee: fee {
|
|
90
|
+
__typename
|
|
91
|
+
currency_amount_original_value: original_value
|
|
92
|
+
currency_amount_original_unit: original_unit
|
|
93
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
94
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
95
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
96
|
+
}
|
|
97
|
+
lightning_send_request_idempotency_key: idempotency_key
|
|
98
|
+
lightning_send_request_status: status
|
|
99
|
+
lightning_send_request_transfer: transfer {
|
|
100
|
+
__typename
|
|
101
|
+
transfer_total_amount: total_amount {
|
|
102
|
+
__typename
|
|
103
|
+
currency_amount_original_value: original_value
|
|
104
|
+
currency_amount_original_unit: original_unit
|
|
105
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
106
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
107
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
108
|
+
}
|
|
109
|
+
transfer_spark_id: spark_id
|
|
110
|
+
}
|
|
111
|
+
}`;
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
export const getLightningSendRequestQuery = (id: string): Query<LightningSendRequest> => {
|
|
116
|
+
return {
|
|
117
|
+
queryPayload: `
|
|
118
|
+
query GetLightningSendRequest($id: ID!) {
|
|
119
|
+
entity(id: $id) {
|
|
120
|
+
... on LightningSendRequest {
|
|
121
|
+
...LightningSendRequestFragment
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
${FRAGMENT}
|
|
127
|
+
`,
|
|
128
|
+
variables: {id},
|
|
129
|
+
constructObject: (data: unknown) => isObject(data) && "entity" in data && isObject(data.entity) ? LightningSendRequestFromJson(data.entity) : null,
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
export default LightningSendRequest;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export enum LightningSendRequestStatus {
|
|
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
|
+
|
|
12
|
+
CREATED = "CREATED",
|
|
13
|
+
|
|
14
|
+
REQUEST_VALIDATED = "REQUEST_VALIDATED",
|
|
15
|
+
|
|
16
|
+
LIGHTNING_PAYMENT_INITIATED = "LIGHTNING_PAYMENT_INITIATED",
|
|
17
|
+
|
|
18
|
+
LIGHTNING_PAYMENT_FAILED = "LIGHTNING_PAYMENT_FAILED",
|
|
19
|
+
|
|
20
|
+
LIGHTNING_PAYMENT_SUCCEEDED = "LIGHTNING_PAYMENT_SUCCEEDED",
|
|
21
|
+
|
|
22
|
+
PREIMAGE_PROVIDED = "PREIMAGE_PROVIDED",
|
|
23
|
+
|
|
24
|
+
TRANSFER_COMPLETED = "TRANSFER_COMPLETED",
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default LightningSendRequestStatus;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
interface NotifyReceiverTransferInput {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
phoneNumber: string;
|
|
12
|
+
|
|
13
|
+
amountSats: number;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const NotifyReceiverTransferInputFromJson = (obj: any): NotifyReceiverTransferInput => {
|
|
21
|
+
return {
|
|
22
|
+
phoneNumber: obj["notify_receiver_transfer_input_phone_number"],
|
|
23
|
+
amountSats: obj["notify_receiver_transfer_input_amount_sats"],
|
|
24
|
+
|
|
25
|
+
} as NotifyReceiverTransferInput;
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
export const NotifyReceiverTransferInputToJson = (obj: NotifyReceiverTransferInput): any => {
|
|
29
|
+
return {
|
|
30
|
+
notify_receiver_transfer_input_phone_number: obj.phoneNumber,
|
|
31
|
+
notify_receiver_transfer_input_amount_sats: obj.amountSats,
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
export default NotifyReceiverTransferInput;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/** This is an object representing information about a page returned by the Lightspark API. For more information, please see the “Pagination” section of our API docs for more information about its usage. **/
|
|
8
|
+
interface PageInfo {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
hasNextPage?: boolean | undefined;
|
|
12
|
+
|
|
13
|
+
hasPreviousPage?: boolean | undefined;
|
|
14
|
+
|
|
15
|
+
startCursor?: string | undefined;
|
|
16
|
+
|
|
17
|
+
endCursor?: string | undefined;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const PageInfoFromJson = (obj: any): PageInfo => {
|
|
25
|
+
return {
|
|
26
|
+
hasNextPage: obj["page_info_has_next_page"],
|
|
27
|
+
hasPreviousPage: obj["page_info_has_previous_page"],
|
|
28
|
+
startCursor: obj["page_info_start_cursor"],
|
|
29
|
+
endCursor: obj["page_info_end_cursor"],
|
|
30
|
+
|
|
31
|
+
} as PageInfo;
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
export const PageInfoToJson = (obj: PageInfo): any => {
|
|
35
|
+
return {
|
|
36
|
+
page_info_has_next_page: obj.hasNextPage,
|
|
37
|
+
page_info_has_previous_page: obj.hasPreviousPage,
|
|
38
|
+
page_info_start_cursor: obj.startCursor,
|
|
39
|
+
page_info_end_cursor: obj.endCursor,
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
export const FRAGMENT = `
|
|
47
|
+
fragment PageInfoFragment on PageInfo {
|
|
48
|
+
__typename
|
|
49
|
+
page_info_has_next_page: has_next_page
|
|
50
|
+
page_info_has_previous_page: has_previous_page
|
|
51
|
+
page_info_start_cursor: start_cursor
|
|
52
|
+
page_info_end_cursor: end_cursor
|
|
53
|
+
}`;
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
export default PageInfo;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
interface Provider {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
accountId: string;
|
|
12
|
+
|
|
13
|
+
jwt: string;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const ProviderFromJson = (obj: any): Provider => {
|
|
21
|
+
return {
|
|
22
|
+
accountId: obj["provider_account_id"],
|
|
23
|
+
jwt: obj["provider_jwt"],
|
|
24
|
+
|
|
25
|
+
} as Provider;
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
export const ProviderToJson = (obj: Provider): any => {
|
|
29
|
+
return {
|
|
30
|
+
provider_account_id: obj.accountId,
|
|
31
|
+
provider_jwt: obj.jwt,
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
export default Provider;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
interface RequestCoopExitInput {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
leafExternalIds: string[];
|
|
12
|
+
|
|
13
|
+
withdrawalAddress: string;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const RequestCoopExitInputFromJson = (obj: any): RequestCoopExitInput => {
|
|
21
|
+
return {
|
|
22
|
+
leafExternalIds: obj["request_coop_exit_input_leaf_external_ids"],
|
|
23
|
+
withdrawalAddress: obj["request_coop_exit_input_withdrawal_address"],
|
|
24
|
+
|
|
25
|
+
} as RequestCoopExitInput;
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
export const RequestCoopExitInputToJson = (obj: RequestCoopExitInput): any => {
|
|
29
|
+
return {
|
|
30
|
+
request_coop_exit_input_leaf_external_ids: obj.leafExternalIds,
|
|
31
|
+
request_coop_exit_input_withdrawal_address: obj.withdrawalAddress,
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
export default RequestCoopExitInput;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
interface RequestCoopExitOutput {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
requestId: string;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const RequestCoopExitOutputFromJson = (obj: any): RequestCoopExitOutput => {
|
|
19
|
+
return {
|
|
20
|
+
requestId: obj["request_coop_exit_output_request"].id,
|
|
21
|
+
|
|
22
|
+
} as RequestCoopExitOutput;
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
export const RequestCoopExitOutputToJson = (obj: RequestCoopExitOutput): any => {
|
|
26
|
+
return {
|
|
27
|
+
request_coop_exit_output_request: { id: obj.requestId },
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export const FRAGMENT = `
|
|
35
|
+
fragment RequestCoopExitOutputFragment on RequestCoopExitOutput {
|
|
36
|
+
__typename
|
|
37
|
+
request_coop_exit_output_request: request {
|
|
38
|
+
id
|
|
39
|
+
}
|
|
40
|
+
}`;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export default RequestCoopExitOutput;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import {UserLeafInputFromJson} from './UserLeafInput.js';
|
|
6
|
+
import UserLeafInput from './UserLeafInput.js';
|
|
7
|
+
import {UserLeafInputToJson} from './UserLeafInput.js';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
interface RequestLeavesSwapInput {
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
adaptorPubkey: string;
|
|
14
|
+
|
|
15
|
+
totalAmountSats: number;
|
|
16
|
+
|
|
17
|
+
targetAmountSats: number;
|
|
18
|
+
|
|
19
|
+
feeSats: number;
|
|
20
|
+
|
|
21
|
+
userLeaves: UserLeafInput[];
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const RequestLeavesSwapInputFromJson = (obj: any): RequestLeavesSwapInput => {
|
|
29
|
+
return {
|
|
30
|
+
adaptorPubkey: obj["request_leaves_swap_input_adaptor_pubkey"],
|
|
31
|
+
totalAmountSats: obj["request_leaves_swap_input_total_amount_sats"],
|
|
32
|
+
targetAmountSats: obj["request_leaves_swap_input_target_amount_sats"],
|
|
33
|
+
feeSats: obj["request_leaves_swap_input_fee_sats"],
|
|
34
|
+
userLeaves: obj["request_leaves_swap_input_user_leaves"].map((e) => UserLeafInputFromJson(e)),
|
|
35
|
+
|
|
36
|
+
} as RequestLeavesSwapInput;
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
export const RequestLeavesSwapInputToJson = (obj: RequestLeavesSwapInput): any => {
|
|
40
|
+
return {
|
|
41
|
+
request_leaves_swap_input_adaptor_pubkey: obj.adaptorPubkey,
|
|
42
|
+
request_leaves_swap_input_total_amount_sats: obj.totalAmountSats,
|
|
43
|
+
request_leaves_swap_input_target_amount_sats: obj.targetAmountSats,
|
|
44
|
+
request_leaves_swap_input_fee_sats: obj.feeSats,
|
|
45
|
+
request_leaves_swap_input_user_leaves: obj.userLeaves.map((e) => UserLeafInputToJson(e)),
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
export default RequestLeavesSwapInput;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
interface RequestLeavesSwapOutput {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
requestId: string;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const RequestLeavesSwapOutputFromJson = (obj: any): RequestLeavesSwapOutput => {
|
|
19
|
+
return {
|
|
20
|
+
requestId: obj["request_leaves_swap_output_request"].id,
|
|
21
|
+
|
|
22
|
+
} as RequestLeavesSwapOutput;
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
export const RequestLeavesSwapOutputToJson = (obj: RequestLeavesSwapOutput): any => {
|
|
26
|
+
return {
|
|
27
|
+
request_leaves_swap_output_request: { id: obj.requestId },
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export const FRAGMENT = `
|
|
35
|
+
fragment RequestLeavesSwapOutputFragment on RequestLeavesSwapOutput {
|
|
36
|
+
__typename
|
|
37
|
+
request_leaves_swap_output_request: request {
|
|
38
|
+
id
|
|
39
|
+
}
|
|
40
|
+
}`;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export default RequestLeavesSwapOutput;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import BitcoinNetwork from './BitcoinNetwork.js';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
interface RequestLightningReceiveInput {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/** The bitcoin network the lightning invoice is created on. **/
|
|
12
|
+
network: BitcoinNetwork;
|
|
13
|
+
|
|
14
|
+
/** The amount for which the lightning invoice should be created in satoshis. **/
|
|
15
|
+
amountSats: number;
|
|
16
|
+
|
|
17
|
+
/** The 32-byte hash of the payment preimage to use when generating the lightning invoice. **/
|
|
18
|
+
paymentHash: string;
|
|
19
|
+
|
|
20
|
+
/** The expiry of the lightning invoice in seconds. Default value is 3600 (1 hour). **/
|
|
21
|
+
expirySecs?: number | undefined;
|
|
22
|
+
|
|
23
|
+
/** The memo to include in the lightning invoice. **/
|
|
24
|
+
memo?: string | undefined;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const RequestLightningReceiveInputFromJson = (obj: any): RequestLightningReceiveInput => {
|
|
32
|
+
return {
|
|
33
|
+
network: BitcoinNetwork[obj["request_lightning_receive_input_network"]] ?? BitcoinNetwork.FUTURE_VALUE,
|
|
34
|
+
amountSats: obj["request_lightning_receive_input_amount_sats"],
|
|
35
|
+
paymentHash: obj["request_lightning_receive_input_payment_hash"],
|
|
36
|
+
expirySecs: obj["request_lightning_receive_input_expiry_secs"],
|
|
37
|
+
memo: obj["request_lightning_receive_input_memo"],
|
|
38
|
+
|
|
39
|
+
} as RequestLightningReceiveInput;
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
export const RequestLightningReceiveInputToJson = (obj: RequestLightningReceiveInput): any => {
|
|
43
|
+
return {
|
|
44
|
+
request_lightning_receive_input_network: obj.network,
|
|
45
|
+
request_lightning_receive_input_amount_sats: obj.amountSats,
|
|
46
|
+
request_lightning_receive_input_payment_hash: obj.paymentHash,
|
|
47
|
+
request_lightning_receive_input_expiry_secs: obj.expirySecs,
|
|
48
|
+
request_lightning_receive_input_memo: obj.memo,
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
export default RequestLightningReceiveInput;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
interface RequestLightningReceiveOutput {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
requestId: string;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const RequestLightningReceiveOutputFromJson = (obj: any): RequestLightningReceiveOutput => {
|
|
19
|
+
return {
|
|
20
|
+
requestId: obj["request_lightning_receive_output_request"].id,
|
|
21
|
+
|
|
22
|
+
} as RequestLightningReceiveOutput;
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
export const RequestLightningReceiveOutputToJson = (obj: RequestLightningReceiveOutput): any => {
|
|
26
|
+
return {
|
|
27
|
+
request_lightning_receive_output_request: { id: obj.requestId },
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export const FRAGMENT = `
|
|
35
|
+
fragment RequestLightningReceiveOutputFragment on RequestLightningReceiveOutput {
|
|
36
|
+
__typename
|
|
37
|
+
request_lightning_receive_output_request: request {
|
|
38
|
+
id
|
|
39
|
+
}
|
|
40
|
+
}`;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export default RequestLightningReceiveOutput;
|