@lightsparkdev/lightspark-sdk 1.1.6 → 1.2.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.
- package/CHANGELOG.md +14 -0
- package/dist/{chunk-7UNNCH5S.js → chunk-VTPDR6P4.js} +1270 -342
- package/dist/{index-5235e43b.d.ts → index-f040db9f.d.ts} +707 -407
- package/dist/index.cjs +1247 -319
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/objects/index.cjs +1180 -306
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +5 -5
- package/package.json +2 -2
- package/src/objects/Account.ts +175 -2
- package/src/objects/AccountToApiTokensConnection.ts +16 -5
- package/src/objects/AccountToChannelsConnection.ts +9 -0
- package/src/objects/AccountToNodesConnection.ts +19 -5
- package/src/objects/AccountToPaymentRequestsConnection.ts +21 -5
- package/src/objects/AccountToTransactionsConnection.ts +33 -9
- package/src/objects/AccountToWalletsConnection.ts +13 -4
- package/src/objects/ApiToken.ts +13 -3
- package/src/objects/Balances.ts +17 -3
- package/src/objects/BlockchainBalance.ts +34 -9
- package/src/objects/Channel.ts +61 -16
- package/src/objects/ChannelClosingTransaction.ts +81 -61
- package/src/objects/ChannelFees.ts +16 -5
- package/src/objects/ChannelOpeningTransaction.ts +81 -61
- package/src/objects/ChannelSnapshot.ts +66 -6
- package/src/objects/ChannelToTransactionsConnection.ts +26 -6
- package/src/objects/Connection.ts +205 -10
- package/src/objects/CreateApiTokenInput.ts +8 -2
- package/src/objects/CreateApiTokenOutput.ts +9 -3
- package/src/objects/CreateInvoiceInput.ts +14 -5
- package/src/objects/CreateInvoiceOutput.ts +7 -2
- package/src/objects/CreateLnurlInvoiceInput.ts +13 -3
- package/src/objects/CreateNodeWalletAddressInput.ts +9 -2
- package/src/objects/CreateNodeWalletAddressOutput.ts +10 -2
- package/src/objects/CreateTestModeInvoiceInput.ts +14 -4
- package/src/objects/CreateTestModeInvoiceOutput.ts +10 -2
- package/src/objects/CreateTestModePaymentInput.ts +12 -3
- package/src/objects/CreateTestModePaymentoutput.ts +12 -2
- package/src/objects/CreateUmaInvoiceInput.ts +13 -3
- package/src/objects/CurrencyAmount.ts +13 -2
- package/src/objects/DeclineToSignMessagesInput.ts +9 -2
- package/src/objects/DeclineToSignMessagesOutput.ts +15 -3
- package/src/objects/DeleteApiTokenInput.ts +7 -2
- package/src/objects/DeleteApiTokenOutput.ts +7 -2
- package/src/objects/Deposit.ts +77 -61
- package/src/objects/Entity.ts +184 -2
- package/src/objects/FeeEstimate.ts +12 -3
- package/src/objects/FundNodeInput.ts +9 -3
- package/src/objects/FundNodeOutput.ts +11 -3
- package/src/objects/GraphNode.ts +21 -5
- package/src/objects/Hop.ts +27 -9
- package/src/objects/HtlcAttemptFailureCode.ts +2 -0
- package/src/objects/IdAndSignature.ts +8 -2
- package/src/objects/IncomingPayment.ts +33 -7
- package/src/objects/IncomingPaymentAttempt.ts +21 -5
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +21 -5
- package/src/objects/Invoice.ts +91 -24
- package/src/objects/InvoiceData.ts +75 -6
- package/src/objects/LightningFeeEstimateForInvoiceInput.ts +13 -3
- package/src/objects/LightningFeeEstimateForNodeInput.ts +12 -2
- package/src/objects/LightningFeeEstimateOutput.ts +15 -3
- package/src/objects/LightningTransaction.ts +171 -28
- package/src/objects/LightsparkNode.ts +311 -208
- package/src/objects/LightsparkNodeOwner.ts +35 -4
- package/src/objects/LightsparkNodeToChannelsConnection.ts +17 -4
- package/src/objects/LightsparkNodeWithOSK.ts +97 -15
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +93 -13
- package/src/objects/Node.ts +269 -67
- package/src/objects/NodeAddress.ts +8 -2
- package/src/objects/NodeToAddressesConnection.ts +13 -3
- package/src/objects/OnChainTransaction.ts +156 -44
- package/src/objects/OutgoingPayment.ts +127 -14
- package/src/objects/OutgoingPaymentAttempt.ts +57 -8
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +18 -5
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +17 -4
- package/src/objects/OutgoingPaymentsForInvoiceQueryInput.ts +12 -3
- package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +11 -2
- package/src/objects/PageInfo.ts +14 -6
- package/src/objects/PayInvoiceInput.ts +12 -3
- package/src/objects/PayInvoiceOutput.ts +7 -2
- package/src/objects/PayUmaInvoiceInput.ts +12 -3
- package/src/objects/PaymentRequest.ts +81 -5
- package/src/objects/PaymentRequestData.ts +81 -4
- package/src/objects/PostTransactionData.ts +12 -3
- package/src/objects/RegisterPaymentInput.ts +10 -2
- package/src/objects/RegisterPaymentOutput.ts +9 -2
- package/src/objects/ReleaseChannelPerCommitmentSecretInput.ts +13 -2
- package/src/objects/ReleaseChannelPerCommitmentSecretOutput.ts +9 -2
- package/src/objects/ReleasePaymentPreimageInput.ts +10 -2
- package/src/objects/ReleasePaymentPreimageOutput.ts +9 -2
- package/src/objects/RequestWithdrawalInput.ts +12 -2
- package/src/objects/RequestWithdrawalOutput.ts +9 -2
- package/src/objects/RichText.ts +7 -2
- package/src/objects/RoutingTransaction.ts +62 -41
- package/src/objects/ScreenNodeInput.ts +8 -2
- package/src/objects/ScreenNodeOutput.ts +7 -2
- package/src/objects/Secret.ts +8 -2
- package/src/objects/SendPaymentInput.ts +11 -2
- package/src/objects/SendPaymentOutput.ts +7 -2
- package/src/objects/SetInvoicePaymentHashInput.ts +12 -3
- package/src/objects/SetInvoicePaymentHashOutput.ts +9 -2
- package/src/objects/SignInvoiceInput.ts +9 -2
- package/src/objects/SignInvoiceOutput.ts +7 -2
- package/src/objects/SignMessagesInput.ts +13 -3
- package/src/objects/SignMessagesOutput.ts +13 -3
- package/src/objects/Signable.ts +10 -3
- package/src/objects/SignablePayload.ts +18 -5
- package/src/objects/Transaction.ts +260 -9
- package/src/objects/TransactionFailures.ts +11 -4
- package/src/objects/UpdateChannelPerCommitmentPointInput.ts +13 -2
- package/src/objects/UpdateChannelPerCommitmentPointOutput.ts +9 -2
- package/src/objects/UpdateNodeSharedSecretInput.ts +10 -2
- package/src/objects/UpdateNodeSharedSecretOutput.ts +9 -2
- package/src/objects/Wallet.ts +130 -5
- package/src/objects/WalletToPaymentRequestsConnection.ts +21 -5
- package/src/objects/WalletToTransactionsConnection.ts +16 -5
- package/src/objects/Withdrawal.ts +77 -61
- package/src/objects/WithdrawalRequest.ts +25 -4
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +19 -4
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +19 -4
- package/src/objects/index.ts +5 -2
- package/src/tests/integration/client.test.ts +46 -7
- package/src/tests/serialization.test.ts +18 -0
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import type OutgoingPayment from "./OutgoingPayment.js";
|
|
4
4
|
import { OutgoingPaymentFromJson } from "./OutgoingPayment.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
interface OutgoingPaymentsForInvoiceQueryOutput {
|
|
7
7
|
payments: OutgoingPayment[];
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
|
|
10
10
|
export const OutgoingPaymentsForInvoiceQueryOutputFromJson = (
|
|
11
11
|
obj: any,
|
|
@@ -16,6 +16,15 @@ export const OutgoingPaymentsForInvoiceQueryOutputFromJson = (
|
|
|
16
16
|
),
|
|
17
17
|
} as OutgoingPaymentsForInvoiceQueryOutput;
|
|
18
18
|
};
|
|
19
|
+
export const OutgoingPaymentsForInvoiceQueryOutputToJson = (
|
|
20
|
+
obj: OutgoingPaymentsForInvoiceQueryOutput,
|
|
21
|
+
): any => {
|
|
22
|
+
return {
|
|
23
|
+
outgoing_payments_for_invoice_query_output_payments: obj.payments.map((e) =>
|
|
24
|
+
e.toJson(),
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
};
|
|
19
28
|
|
|
20
29
|
export const FRAGMENT = `
|
|
21
30
|
fragment OutgoingPaymentsForInvoiceQueryOutputFragment on OutgoingPaymentsForInvoiceQueryOutput {
|
package/src/objects/PageInfo.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
/** 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. **/
|
|
4
|
-
|
|
5
|
-
hasNextPage?: boolean;
|
|
4
|
+
interface PageInfo {
|
|
5
|
+
hasNextPage?: boolean | undefined;
|
|
6
6
|
|
|
7
|
-
hasPreviousPage?: boolean;
|
|
7
|
+
hasPreviousPage?: boolean | undefined;
|
|
8
8
|
|
|
9
|
-
startCursor?: string;
|
|
9
|
+
startCursor?: string | undefined;
|
|
10
10
|
|
|
11
|
-
endCursor?: string;
|
|
12
|
-
}
|
|
11
|
+
endCursor?: string | undefined;
|
|
12
|
+
}
|
|
13
13
|
|
|
14
14
|
export const PageInfoFromJson = (obj: any): PageInfo => {
|
|
15
15
|
return {
|
|
@@ -19,6 +19,14 @@ export const PageInfoFromJson = (obj: any): PageInfo => {
|
|
|
19
19
|
endCursor: obj["page_info_end_cursor"],
|
|
20
20
|
} as PageInfo;
|
|
21
21
|
};
|
|
22
|
+
export const PageInfoToJson = (obj: PageInfo): any => {
|
|
23
|
+
return {
|
|
24
|
+
page_info_has_next_page: obj.hasNextPage,
|
|
25
|
+
page_info_has_previous_page: obj.hasPreviousPage,
|
|
26
|
+
page_info_start_cursor: obj.startCursor,
|
|
27
|
+
page_info_end_cursor: obj.endCursor,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
22
30
|
|
|
23
31
|
export const FRAGMENT = `
|
|
24
32
|
fragment PageInfoFragment on PageInfo {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface PayInvoiceInput {
|
|
4
4
|
/** The node from where you want to send the payment. **/
|
|
5
5
|
nodeId: string;
|
|
6
6
|
|
|
@@ -17,8 +17,8 @@ type PayInvoiceInput = {
|
|
|
17
17
|
* The amount you will pay for this invoice, expressed in msats. It should ONLY be set when the
|
|
18
18
|
* invoice amount is zero.
|
|
19
19
|
**/
|
|
20
|
-
amountMsats?: number;
|
|
21
|
-
}
|
|
20
|
+
amountMsats?: number | undefined;
|
|
21
|
+
}
|
|
22
22
|
|
|
23
23
|
export const PayInvoiceInputFromJson = (obj: any): PayInvoiceInput => {
|
|
24
24
|
return {
|
|
@@ -29,5 +29,14 @@ export const PayInvoiceInputFromJson = (obj: any): PayInvoiceInput => {
|
|
|
29
29
|
amountMsats: obj["pay_invoice_input_amount_msats"],
|
|
30
30
|
} as PayInvoiceInput;
|
|
31
31
|
};
|
|
32
|
+
export const PayInvoiceInputToJson = (obj: PayInvoiceInput): any => {
|
|
33
|
+
return {
|
|
34
|
+
pay_invoice_input_node_id: obj.nodeId,
|
|
35
|
+
pay_invoice_input_encoded_invoice: obj.encodedInvoice,
|
|
36
|
+
pay_invoice_input_timeout_secs: obj.timeoutSecs,
|
|
37
|
+
pay_invoice_input_maximum_fees_msats: obj.maximumFeesMsats,
|
|
38
|
+
pay_invoice_input_amount_msats: obj.amountMsats,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
32
41
|
|
|
33
42
|
export default PayInvoiceInput;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface PayInvoiceOutput {
|
|
4
4
|
/** The payment that has been sent. **/
|
|
5
5
|
paymentId: string;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
|
|
8
8
|
export const PayInvoiceOutputFromJson = (obj: any): PayInvoiceOutput => {
|
|
9
9
|
return {
|
|
10
10
|
paymentId: obj["pay_invoice_output_payment"].id,
|
|
11
11
|
} as PayInvoiceOutput;
|
|
12
12
|
};
|
|
13
|
+
export const PayInvoiceOutputToJson = (obj: PayInvoiceOutput): any => {
|
|
14
|
+
return {
|
|
15
|
+
pay_invoice_output_payment: { id: obj.paymentId },
|
|
16
|
+
};
|
|
17
|
+
};
|
|
13
18
|
|
|
14
19
|
export const FRAGMENT = `
|
|
15
20
|
fragment PayInvoiceOutputFragment on PayInvoiceOutput {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface PayUmaInvoiceInput {
|
|
4
4
|
nodeId: string;
|
|
5
5
|
|
|
6
6
|
encodedInvoice: string;
|
|
@@ -9,8 +9,8 @@ type PayUmaInvoiceInput = {
|
|
|
9
9
|
|
|
10
10
|
maximumFeesMsats: number;
|
|
11
11
|
|
|
12
|
-
amountMsats?: number;
|
|
13
|
-
}
|
|
12
|
+
amountMsats?: number | undefined;
|
|
13
|
+
}
|
|
14
14
|
|
|
15
15
|
export const PayUmaInvoiceInputFromJson = (obj: any): PayUmaInvoiceInput => {
|
|
16
16
|
return {
|
|
@@ -21,5 +21,14 @@ export const PayUmaInvoiceInputFromJson = (obj: any): PayUmaInvoiceInput => {
|
|
|
21
21
|
amountMsats: obj["pay_uma_invoice_input_amount_msats"],
|
|
22
22
|
} as PayUmaInvoiceInput;
|
|
23
23
|
};
|
|
24
|
+
export const PayUmaInvoiceInputToJson = (obj: PayUmaInvoiceInput): any => {
|
|
25
|
+
return {
|
|
26
|
+
pay_uma_invoice_input_node_id: obj.nodeId,
|
|
27
|
+
pay_uma_invoice_input_encoded_invoice: obj.encodedInvoice,
|
|
28
|
+
pay_uma_invoice_input_timeout_secs: obj.timeoutSecs,
|
|
29
|
+
pay_uma_invoice_input_maximum_fees_msats: obj.maximumFeesMsats,
|
|
30
|
+
pay_uma_invoice_input_amount_msats: obj.amountMsats,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
24
33
|
|
|
25
34
|
export default PayUmaInvoiceInput;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import { LightsparkException, type Query } from "@lightsparkdev/core";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
CurrencyAmountFromJson,
|
|
6
|
+
CurrencyAmountToJson,
|
|
7
|
+
} from "./CurrencyAmount.js";
|
|
6
8
|
import type Invoice from "./Invoice.js";
|
|
7
|
-
import { InvoiceDataFromJson } from "./InvoiceData.js";
|
|
9
|
+
import { InvoiceDataFromJson, InvoiceDataToJson } from "./InvoiceData.js";
|
|
8
10
|
import type PaymentRequestData from "./PaymentRequestData.js";
|
|
9
11
|
import PaymentRequestStatus from "./PaymentRequestStatus.js";
|
|
10
12
|
|
|
11
13
|
/** This object contains information related to a payment request generated or received by a LightsparkNode. You can retrieve this object to receive payment information about a specific invoice. **/
|
|
12
|
-
|
|
14
|
+
interface PaymentRequest {
|
|
13
15
|
/**
|
|
14
16
|
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
15
17
|
* string.
|
|
@@ -30,7 +32,7 @@ type PaymentRequest = Entity & {
|
|
|
30
32
|
|
|
31
33
|
/** The typename of the object **/
|
|
32
34
|
typename: string;
|
|
33
|
-
}
|
|
35
|
+
}
|
|
34
36
|
|
|
35
37
|
export const PaymentRequestFromJson = (obj: any): PaymentRequest => {
|
|
36
38
|
if (obj["__typename"] == "Invoice") {
|
|
@@ -53,6 +55,26 @@ export const PaymentRequestFromJson = (obj: any): PaymentRequest => {
|
|
|
53
55
|
`Couldn't find a concrete type for interface PaymentRequest corresponding to the typename=${obj["__typename"]}`,
|
|
54
56
|
);
|
|
55
57
|
};
|
|
58
|
+
export const PaymentRequestToJson = (obj: PaymentRequest): any => {
|
|
59
|
+
if (obj.typename == "Invoice") {
|
|
60
|
+
const invoice = obj as Invoice;
|
|
61
|
+
return {
|
|
62
|
+
__typename: "Invoice",
|
|
63
|
+
invoice_id: invoice.id,
|
|
64
|
+
invoice_created_at: invoice.createdAt,
|
|
65
|
+
invoice_updated_at: invoice.updatedAt,
|
|
66
|
+
invoice_data: InvoiceDataToJson(invoice.data),
|
|
67
|
+
invoice_status: invoice.status,
|
|
68
|
+
invoice_amount_paid: invoice.amountPaid
|
|
69
|
+
? CurrencyAmountToJson(invoice.amountPaid)
|
|
70
|
+
: undefined,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
throw new LightsparkException(
|
|
74
|
+
"DeserializationError",
|
|
75
|
+
`Couldn't find a concrete type for interface PaymentRequest corresponding to the typename=${obj.typename}`,
|
|
76
|
+
);
|
|
77
|
+
};
|
|
56
78
|
|
|
57
79
|
export const FRAGMENT = `
|
|
58
80
|
fragment PaymentRequestFragment on PaymentRequest {
|
|
@@ -191,6 +213,33 @@ fragment PaymentRequestFragment on PaymentRequest {
|
|
|
191
213
|
}
|
|
192
214
|
}
|
|
193
215
|
lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
|
|
216
|
+
lightspark_node_with_o_s_k_balances: balances {
|
|
217
|
+
__typename
|
|
218
|
+
balances_owned_balance: owned_balance {
|
|
219
|
+
__typename
|
|
220
|
+
currency_amount_original_value: original_value
|
|
221
|
+
currency_amount_original_unit: original_unit
|
|
222
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
223
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
224
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
225
|
+
}
|
|
226
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
227
|
+
__typename
|
|
228
|
+
currency_amount_original_value: original_value
|
|
229
|
+
currency_amount_original_unit: original_unit
|
|
230
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
231
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
232
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
233
|
+
}
|
|
234
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
235
|
+
__typename
|
|
236
|
+
currency_amount_original_value: original_value
|
|
237
|
+
currency_amount_original_unit: original_unit
|
|
238
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
239
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
240
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
241
|
+
}
|
|
242
|
+
}
|
|
194
243
|
lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
|
|
195
244
|
__typename
|
|
196
245
|
secret_encrypted_value: encrypted_value
|
|
@@ -296,6 +345,33 @@ fragment PaymentRequestFragment on PaymentRequest {
|
|
|
296
345
|
}
|
|
297
346
|
}
|
|
298
347
|
lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
|
|
348
|
+
lightspark_node_with_remote_signing_balances: balances {
|
|
349
|
+
__typename
|
|
350
|
+
balances_owned_balance: owned_balance {
|
|
351
|
+
__typename
|
|
352
|
+
currency_amount_original_value: original_value
|
|
353
|
+
currency_amount_original_unit: original_unit
|
|
354
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
355
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
356
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
357
|
+
}
|
|
358
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
359
|
+
__typename
|
|
360
|
+
currency_amount_original_value: original_value
|
|
361
|
+
currency_amount_original_unit: original_unit
|
|
362
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
363
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
364
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
365
|
+
}
|
|
366
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
367
|
+
__typename
|
|
368
|
+
currency_amount_original_value: original_value
|
|
369
|
+
currency_amount_original_unit: original_unit
|
|
370
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
371
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
372
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
373
|
+
}
|
|
374
|
+
}
|
|
299
375
|
}
|
|
300
376
|
}
|
|
301
377
|
}
|
|
@@ -2,19 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
import { LightsparkException } from "@lightsparkdev/core";
|
|
4
4
|
import BitcoinNetwork from "./BitcoinNetwork.js";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
CurrencyAmountFromJson,
|
|
7
|
+
CurrencyAmountToJson,
|
|
8
|
+
} from "./CurrencyAmount.js";
|
|
6
9
|
import type InvoiceData from "./InvoiceData.js";
|
|
7
|
-
import { NodeFromJson } from "./Node.js";
|
|
10
|
+
import { NodeFromJson, NodeToJson } from "./Node.js";
|
|
8
11
|
|
|
9
12
|
/** This object is an interface of a payment request on the Lightning Network (i.e., a Lightning Invoice). It contains data related to parsing the payment details of a Lightning Invoice. **/
|
|
10
|
-
|
|
13
|
+
interface PaymentRequestData {
|
|
11
14
|
encodedPaymentRequest: string;
|
|
12
15
|
|
|
13
16
|
bitcoinNetwork: BitcoinNetwork;
|
|
14
17
|
|
|
15
18
|
/** The typename of the object **/
|
|
16
19
|
typename: string;
|
|
17
|
-
}
|
|
20
|
+
}
|
|
18
21
|
|
|
19
22
|
export const PaymentRequestDataFromJson = (obj: any): PaymentRequestData => {
|
|
20
23
|
if (obj["__typename"] == "InvoiceData") {
|
|
@@ -37,6 +40,26 @@ export const PaymentRequestDataFromJson = (obj: any): PaymentRequestData => {
|
|
|
37
40
|
`Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj["__typename"]}`,
|
|
38
41
|
);
|
|
39
42
|
};
|
|
43
|
+
export const PaymentRequestDataToJson = (obj: PaymentRequestData): any => {
|
|
44
|
+
if (obj.typename == "InvoiceData") {
|
|
45
|
+
const invoiceData = obj as InvoiceData;
|
|
46
|
+
return {
|
|
47
|
+
__typename: "InvoiceData",
|
|
48
|
+
invoice_data_encoded_payment_request: invoiceData.encodedPaymentRequest,
|
|
49
|
+
invoice_data_bitcoin_network: invoiceData.bitcoinNetwork,
|
|
50
|
+
invoice_data_payment_hash: invoiceData.paymentHash,
|
|
51
|
+
invoice_data_amount: CurrencyAmountToJson(invoiceData.amount),
|
|
52
|
+
invoice_data_created_at: invoiceData.createdAt,
|
|
53
|
+
invoice_data_expires_at: invoiceData.expiresAt,
|
|
54
|
+
invoice_data_memo: invoiceData.memo,
|
|
55
|
+
invoice_data_destination: NodeToJson(invoiceData.destination),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
throw new LightsparkException(
|
|
59
|
+
"DeserializationError",
|
|
60
|
+
`Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj.typename}`,
|
|
61
|
+
);
|
|
62
|
+
};
|
|
40
63
|
|
|
41
64
|
export const FRAGMENT = `
|
|
42
65
|
fragment PaymentRequestDataFragment on PaymentRequestData {
|
|
@@ -170,6 +193,33 @@ fragment PaymentRequestDataFragment on PaymentRequestData {
|
|
|
170
193
|
}
|
|
171
194
|
}
|
|
172
195
|
lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
|
|
196
|
+
lightspark_node_with_o_s_k_balances: balances {
|
|
197
|
+
__typename
|
|
198
|
+
balances_owned_balance: owned_balance {
|
|
199
|
+
__typename
|
|
200
|
+
currency_amount_original_value: original_value
|
|
201
|
+
currency_amount_original_unit: original_unit
|
|
202
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
203
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
204
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
205
|
+
}
|
|
206
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
207
|
+
__typename
|
|
208
|
+
currency_amount_original_value: original_value
|
|
209
|
+
currency_amount_original_unit: original_unit
|
|
210
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
211
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
212
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
213
|
+
}
|
|
214
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
215
|
+
__typename
|
|
216
|
+
currency_amount_original_value: original_value
|
|
217
|
+
currency_amount_original_unit: original_unit
|
|
218
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
219
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
220
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
221
|
+
}
|
|
222
|
+
}
|
|
173
223
|
lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
|
|
174
224
|
__typename
|
|
175
225
|
secret_encrypted_value: encrypted_value
|
|
@@ -275,6 +325,33 @@ fragment PaymentRequestDataFragment on PaymentRequestData {
|
|
|
275
325
|
}
|
|
276
326
|
}
|
|
277
327
|
lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
|
|
328
|
+
lightspark_node_with_remote_signing_balances: balances {
|
|
329
|
+
__typename
|
|
330
|
+
balances_owned_balance: owned_balance {
|
|
331
|
+
__typename
|
|
332
|
+
currency_amount_original_value: original_value
|
|
333
|
+
currency_amount_original_unit: original_unit
|
|
334
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
335
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
336
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
337
|
+
}
|
|
338
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
339
|
+
__typename
|
|
340
|
+
currency_amount_original_value: original_value
|
|
341
|
+
currency_amount_original_unit: original_unit
|
|
342
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
343
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
344
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
345
|
+
}
|
|
346
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
347
|
+
__typename
|
|
348
|
+
currency_amount_original_value: original_value
|
|
349
|
+
currency_amount_original_unit: original_unit
|
|
350
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
351
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
352
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
353
|
+
}
|
|
354
|
+
}
|
|
278
355
|
}
|
|
279
356
|
}
|
|
280
357
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CurrencyAmountFromJson,
|
|
6
|
+
CurrencyAmountToJson,
|
|
7
|
+
} from "./CurrencyAmount.js";
|
|
5
8
|
|
|
6
9
|
/** This object represents post-transaction data that could be used to register payment for KYT. **/
|
|
7
|
-
|
|
10
|
+
interface PostTransactionData {
|
|
8
11
|
/**
|
|
9
12
|
* The utxo of the channel over which the payment went through in the format of
|
|
10
13
|
* <transaction_hash>:<output_index>.
|
|
@@ -13,7 +16,7 @@ type PostTransactionData = {
|
|
|
13
16
|
|
|
14
17
|
/** The amount of funds transferred in the payment. **/
|
|
15
18
|
amount: CurrencyAmount;
|
|
16
|
-
}
|
|
19
|
+
}
|
|
17
20
|
|
|
18
21
|
export const PostTransactionDataFromJson = (obj: any): PostTransactionData => {
|
|
19
22
|
return {
|
|
@@ -21,6 +24,12 @@ export const PostTransactionDataFromJson = (obj: any): PostTransactionData => {
|
|
|
21
24
|
amount: CurrencyAmountFromJson(obj["post_transaction_data_amount"]),
|
|
22
25
|
} as PostTransactionData;
|
|
23
26
|
};
|
|
27
|
+
export const PostTransactionDataToJson = (obj: PostTransactionData): any => {
|
|
28
|
+
return {
|
|
29
|
+
post_transaction_data_utxo: obj.utxo,
|
|
30
|
+
post_transaction_data_amount: CurrencyAmountToJson(obj.amount),
|
|
31
|
+
};
|
|
32
|
+
};
|
|
24
33
|
|
|
25
34
|
export const FRAGMENT = `
|
|
26
35
|
fragment PostTransactionDataFragment on PostTransactionData {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import ComplianceProvider from "./ComplianceProvider.js";
|
|
4
4
|
import PaymentDirection from "./PaymentDirection.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
interface RegisterPaymentInput {
|
|
7
7
|
/**
|
|
8
8
|
* The compliance provider that is going to screen the node. You need to be a customer of the selected
|
|
9
9
|
* provider and store the API key on the Lightspark account setting page.
|
|
@@ -25,7 +25,7 @@ type RegisterPaymentInput = {
|
|
|
25
25
|
|
|
26
26
|
/** Indicates whether this payment is an OutgoingPayment or an IncomingPayment. **/
|
|
27
27
|
direction: PaymentDirection;
|
|
28
|
-
}
|
|
28
|
+
}
|
|
29
29
|
|
|
30
30
|
export const RegisterPaymentInputFromJson = (
|
|
31
31
|
obj: any,
|
|
@@ -41,5 +41,13 @@ export const RegisterPaymentInputFromJson = (
|
|
|
41
41
|
PaymentDirection.FUTURE_VALUE,
|
|
42
42
|
} as RegisterPaymentInput;
|
|
43
43
|
};
|
|
44
|
+
export const RegisterPaymentInputToJson = (obj: RegisterPaymentInput): any => {
|
|
45
|
+
return {
|
|
46
|
+
register_payment_input_provider: obj.provider,
|
|
47
|
+
register_payment_input_payment_id: obj.paymentId,
|
|
48
|
+
register_payment_input_node_pubkey: obj.nodePubkey,
|
|
49
|
+
register_payment_input_direction: obj.direction,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
44
52
|
|
|
45
53
|
export default RegisterPaymentInput;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface RegisterPaymentOutput {
|
|
4
4
|
paymentId: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
7
|
export const RegisterPaymentOutputFromJson = (
|
|
8
8
|
obj: any,
|
|
@@ -11,6 +11,13 @@ export const RegisterPaymentOutputFromJson = (
|
|
|
11
11
|
paymentId: obj["register_payment_output_payment"].id,
|
|
12
12
|
} as RegisterPaymentOutput;
|
|
13
13
|
};
|
|
14
|
+
export const RegisterPaymentOutputToJson = (
|
|
15
|
+
obj: RegisterPaymentOutput,
|
|
16
|
+
): any => {
|
|
17
|
+
return {
|
|
18
|
+
register_payment_output_payment: { id: obj.paymentId },
|
|
19
|
+
};
|
|
20
|
+
};
|
|
14
21
|
|
|
15
22
|
export const FRAGMENT = `
|
|
16
23
|
fragment RegisterPaymentOutputFragment on RegisterPaymentOutput {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface ReleaseChannelPerCommitmentSecretInput {
|
|
4
4
|
/** The unique identifier of the channel. **/
|
|
5
5
|
channelId: string;
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ type ReleaseChannelPerCommitmentSecretInput = {
|
|
|
9
9
|
|
|
10
10
|
/** The index associated with the per-commitment secret. **/
|
|
11
11
|
perCommitmentIndex: number;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
|
|
14
14
|
export const ReleaseChannelPerCommitmentSecretInputFromJson = (
|
|
15
15
|
obj: any,
|
|
@@ -22,5 +22,16 @@ export const ReleaseChannelPerCommitmentSecretInputFromJson = (
|
|
|
22
22
|
obj["release_channel_per_commitment_secret_input_per_commitment_index"],
|
|
23
23
|
} as ReleaseChannelPerCommitmentSecretInput;
|
|
24
24
|
};
|
|
25
|
+
export const ReleaseChannelPerCommitmentSecretInputToJson = (
|
|
26
|
+
obj: ReleaseChannelPerCommitmentSecretInput,
|
|
27
|
+
): any => {
|
|
28
|
+
return {
|
|
29
|
+
release_channel_per_commitment_secret_input_channel_id: obj.channelId,
|
|
30
|
+
release_channel_per_commitment_secret_input_per_commitment_secret:
|
|
31
|
+
obj.perCommitmentSecret,
|
|
32
|
+
release_channel_per_commitment_secret_input_per_commitment_index:
|
|
33
|
+
obj.perCommitmentIndex,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
25
36
|
|
|
26
37
|
export default ReleaseChannelPerCommitmentSecretInput;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface ReleaseChannelPerCommitmentSecretOutput {
|
|
4
4
|
/** The channel object after the per-commitment secret release operation. **/
|
|
5
5
|
channelId: string;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
|
|
8
8
|
export const ReleaseChannelPerCommitmentSecretOutputFromJson = (
|
|
9
9
|
obj: any,
|
|
@@ -12,6 +12,13 @@ export const ReleaseChannelPerCommitmentSecretOutputFromJson = (
|
|
|
12
12
|
channelId: obj["release_channel_per_commitment_secret_output_channel"].id,
|
|
13
13
|
} as ReleaseChannelPerCommitmentSecretOutput;
|
|
14
14
|
};
|
|
15
|
+
export const ReleaseChannelPerCommitmentSecretOutputToJson = (
|
|
16
|
+
obj: ReleaseChannelPerCommitmentSecretOutput,
|
|
17
|
+
): any => {
|
|
18
|
+
return {
|
|
19
|
+
release_channel_per_commitment_secret_output_channel: { id: obj.channelId },
|
|
20
|
+
};
|
|
21
|
+
};
|
|
15
22
|
|
|
16
23
|
export const FRAGMENT = `
|
|
17
24
|
fragment ReleaseChannelPerCommitmentSecretOutputFragment on ReleaseChannelPerCommitmentSecretOutput {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface ReleasePaymentPreimageInput {
|
|
4
4
|
/** The invoice the preimage belongs to. **/
|
|
5
5
|
invoiceId: string;
|
|
6
6
|
|
|
7
7
|
/** The preimage to release. **/
|
|
8
8
|
paymentPreimage: string;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
|
|
11
11
|
export const ReleasePaymentPreimageInputFromJson = (
|
|
12
12
|
obj: any,
|
|
@@ -16,5 +16,13 @@ export const ReleasePaymentPreimageInputFromJson = (
|
|
|
16
16
|
paymentPreimage: obj["release_payment_preimage_input_payment_preimage"],
|
|
17
17
|
} as ReleasePaymentPreimageInput;
|
|
18
18
|
};
|
|
19
|
+
export const ReleasePaymentPreimageInputToJson = (
|
|
20
|
+
obj: ReleasePaymentPreimageInput,
|
|
21
|
+
): any => {
|
|
22
|
+
return {
|
|
23
|
+
release_payment_preimage_input_invoice_id: obj.invoiceId,
|
|
24
|
+
release_payment_preimage_input_payment_preimage: obj.paymentPreimage,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
19
27
|
|
|
20
28
|
export default ReleasePaymentPreimageInput;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface ReleasePaymentPreimageOutput {
|
|
4
4
|
/** The invoice of the transaction. **/
|
|
5
5
|
invoiceId: string;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
|
|
8
8
|
export const ReleasePaymentPreimageOutputFromJson = (
|
|
9
9
|
obj: any,
|
|
@@ -12,6 +12,13 @@ export const ReleasePaymentPreimageOutputFromJson = (
|
|
|
12
12
|
invoiceId: obj["release_payment_preimage_output_invoice"].id,
|
|
13
13
|
} as ReleasePaymentPreimageOutput;
|
|
14
14
|
};
|
|
15
|
+
export const ReleasePaymentPreimageOutputToJson = (
|
|
16
|
+
obj: ReleasePaymentPreimageOutput,
|
|
17
|
+
): any => {
|
|
18
|
+
return {
|
|
19
|
+
release_payment_preimage_output_invoice: { id: obj.invoiceId },
|
|
20
|
+
};
|
|
21
|
+
};
|
|
15
22
|
|
|
16
23
|
export const FRAGMENT = `
|
|
17
24
|
fragment ReleasePaymentPreimageOutputFragment on ReleasePaymentPreimageOutput {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import WithdrawalMode from "./WithdrawalMode.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface RequestWithdrawalInput {
|
|
6
6
|
/** The node from which you'd like to make the withdrawal. **/
|
|
7
7
|
nodeId: string;
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ type RequestWithdrawalInput = {
|
|
|
17
17
|
|
|
18
18
|
/** The strategy that should be used to withdraw the funds from this node. **/
|
|
19
19
|
withdrawalMode: WithdrawalMode;
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
|
|
22
22
|
export const RequestWithdrawalInputFromJson = (
|
|
23
23
|
obj: any,
|
|
@@ -31,5 +31,15 @@ export const RequestWithdrawalInputFromJson = (
|
|
|
31
31
|
WithdrawalMode.FUTURE_VALUE,
|
|
32
32
|
} as RequestWithdrawalInput;
|
|
33
33
|
};
|
|
34
|
+
export const RequestWithdrawalInputToJson = (
|
|
35
|
+
obj: RequestWithdrawalInput,
|
|
36
|
+
): any => {
|
|
37
|
+
return {
|
|
38
|
+
request_withdrawal_input_node_id: obj.nodeId,
|
|
39
|
+
request_withdrawal_input_bitcoin_address: obj.bitcoinAddress,
|
|
40
|
+
request_withdrawal_input_amount_sats: obj.amountSats,
|
|
41
|
+
request_withdrawal_input_withdrawal_mode: obj.withdrawalMode,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
34
44
|
|
|
35
45
|
export default RequestWithdrawalInput;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface RequestWithdrawalOutput {
|
|
4
4
|
/** The request that is created for this withdrawal. **/
|
|
5
5
|
requestId: string;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
|
|
8
8
|
export const RequestWithdrawalOutputFromJson = (
|
|
9
9
|
obj: any,
|
|
@@ -12,6 +12,13 @@ export const RequestWithdrawalOutputFromJson = (
|
|
|
12
12
|
requestId: obj["request_withdrawal_output_request"].id,
|
|
13
13
|
} as RequestWithdrawalOutput;
|
|
14
14
|
};
|
|
15
|
+
export const RequestWithdrawalOutputToJson = (
|
|
16
|
+
obj: RequestWithdrawalOutput,
|
|
17
|
+
): any => {
|
|
18
|
+
return {
|
|
19
|
+
request_withdrawal_output_request: { id: obj.requestId },
|
|
20
|
+
};
|
|
21
|
+
};
|
|
15
22
|
|
|
16
23
|
export const FRAGMENT = `
|
|
17
24
|
fragment RequestWithdrawalOutputFragment on RequestWithdrawalOutput {
|