@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
package/src/objects/Invoice.ts
CHANGED
|
@@ -2,40 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
import { type Query } from "@lightsparkdev/core";
|
|
4
4
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
CurrencyAmountFromJson,
|
|
7
|
+
CurrencyAmountToJson,
|
|
8
|
+
} from "./CurrencyAmount.js";
|
|
7
9
|
import type InvoiceData from "./InvoiceData.js";
|
|
8
|
-
import { InvoiceDataFromJson } from "./InvoiceData.js";
|
|
9
|
-
import type PaymentRequest from "./PaymentRequest.js";
|
|
10
|
+
import { InvoiceDataFromJson, InvoiceDataToJson } from "./InvoiceData.js";
|
|
10
11
|
import PaymentRequestStatus from "./PaymentRequestStatus.js";
|
|
11
12
|
|
|
12
13
|
/** This object represents a BOLT #11 invoice (https://github.com/lightning/bolts/blob/master/11-payment-encoding.md) created by a Lightspark Node. You can retrieve this object to receive relevant payment information for a specific invoice generated by a Lightspark node. **/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
id: string;
|
|
14
|
+
interface Invoice {
|
|
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
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/** The date and time when the entity was first created. **/
|
|
22
|
+
createdAt: string;
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
/** The date and time when the entity was last updated. **/
|
|
25
|
+
updatedAt: string;
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
/** The details of the invoice. **/
|
|
28
|
+
data: InvoiceData;
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
/** The status of the payment request. **/
|
|
31
|
+
status: PaymentRequestStatus;
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
/** The typename of the object **/
|
|
34
|
+
typename: string;
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
/** The total amount that has been paid to this invoice. **/
|
|
37
|
+
amountPaid?: CurrencyAmount | undefined;
|
|
38
|
+
}
|
|
39
39
|
|
|
40
40
|
export const InvoiceFromJson = (obj: any): Invoice => {
|
|
41
41
|
return {
|
|
@@ -52,6 +52,19 @@ export const InvoiceFromJson = (obj: any): Invoice => {
|
|
|
52
52
|
: undefined,
|
|
53
53
|
} as Invoice;
|
|
54
54
|
};
|
|
55
|
+
export const InvoiceToJson = (obj: Invoice): any => {
|
|
56
|
+
return {
|
|
57
|
+
__typename: "Invoice",
|
|
58
|
+
invoice_id: obj.id,
|
|
59
|
+
invoice_created_at: obj.createdAt,
|
|
60
|
+
invoice_updated_at: obj.updatedAt,
|
|
61
|
+
invoice_data: InvoiceDataToJson(obj.data),
|
|
62
|
+
invoice_status: obj.status,
|
|
63
|
+
invoice_amount_paid: obj.amountPaid
|
|
64
|
+
? CurrencyAmountToJson(obj.amountPaid)
|
|
65
|
+
: undefined,
|
|
66
|
+
};
|
|
67
|
+
};
|
|
55
68
|
|
|
56
69
|
export const FRAGMENT = `
|
|
57
70
|
fragment InvoiceFragment on Invoice {
|
|
@@ -188,6 +201,33 @@ fragment InvoiceFragment on Invoice {
|
|
|
188
201
|
}
|
|
189
202
|
}
|
|
190
203
|
lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
|
|
204
|
+
lightspark_node_with_o_s_k_balances: balances {
|
|
205
|
+
__typename
|
|
206
|
+
balances_owned_balance: owned_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_send_balance: available_to_send_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
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
223
|
+
__typename
|
|
224
|
+
currency_amount_original_value: original_value
|
|
225
|
+
currency_amount_original_unit: original_unit
|
|
226
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
227
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
228
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
229
|
+
}
|
|
230
|
+
}
|
|
191
231
|
lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
|
|
192
232
|
__typename
|
|
193
233
|
secret_encrypted_value: encrypted_value
|
|
@@ -293,6 +333,33 @@ fragment InvoiceFragment on Invoice {
|
|
|
293
333
|
}
|
|
294
334
|
}
|
|
295
335
|
lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
|
|
336
|
+
lightspark_node_with_remote_signing_balances: balances {
|
|
337
|
+
__typename
|
|
338
|
+
balances_owned_balance: owned_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_send_balance: available_to_send_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
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
355
|
+
__typename
|
|
356
|
+
currency_amount_original_value: original_value
|
|
357
|
+
currency_amount_original_unit: original_unit
|
|
358
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
359
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
360
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
361
|
+
}
|
|
362
|
+
}
|
|
296
363
|
}
|
|
297
364
|
}
|
|
298
365
|
}
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import BitcoinNetwork from "./BitcoinNetwork.js";
|
|
4
4
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
CurrencyAmountFromJson,
|
|
7
|
+
CurrencyAmountToJson,
|
|
8
|
+
} from "./CurrencyAmount.js";
|
|
6
9
|
import type Node from "./Node.js";
|
|
7
|
-
import { NodeFromJson } from "./Node.js";
|
|
8
|
-
import type PaymentRequestData from "./PaymentRequestData.js";
|
|
10
|
+
import { NodeFromJson, NodeToJson } from "./Node.js";
|
|
9
11
|
|
|
10
12
|
/** This object represents the data associated with a BOLT #11 invoice. You can retrieve this object to receive the relevant data associated with a specific invoice. **/
|
|
11
|
-
|
|
13
|
+
interface InvoiceData {
|
|
12
14
|
encodedPaymentRequest: string;
|
|
13
15
|
|
|
14
16
|
bitcoinNetwork: BitcoinNetwork;
|
|
@@ -35,8 +37,8 @@ type InvoiceData = PaymentRequestData & {
|
|
|
35
37
|
typename: string;
|
|
36
38
|
|
|
37
39
|
/** A short, UTF-8 encoded, description of the purpose of this invoice. **/
|
|
38
|
-
memo?: string;
|
|
39
|
-
}
|
|
40
|
+
memo?: string | undefined;
|
|
41
|
+
}
|
|
40
42
|
|
|
41
43
|
export const InvoiceDataFromJson = (obj: any): InvoiceData => {
|
|
42
44
|
return {
|
|
@@ -53,6 +55,19 @@ export const InvoiceDataFromJson = (obj: any): InvoiceData => {
|
|
|
53
55
|
memo: obj["invoice_data_memo"],
|
|
54
56
|
} as InvoiceData;
|
|
55
57
|
};
|
|
58
|
+
export const InvoiceDataToJson = (obj: InvoiceData): any => {
|
|
59
|
+
return {
|
|
60
|
+
__typename: "InvoiceData",
|
|
61
|
+
invoice_data_encoded_payment_request: obj.encodedPaymentRequest,
|
|
62
|
+
invoice_data_bitcoin_network: obj.bitcoinNetwork,
|
|
63
|
+
invoice_data_payment_hash: obj.paymentHash,
|
|
64
|
+
invoice_data_amount: CurrencyAmountToJson(obj.amount),
|
|
65
|
+
invoice_data_created_at: obj.createdAt,
|
|
66
|
+
invoice_data_expires_at: obj.expiresAt,
|
|
67
|
+
invoice_data_memo: obj.memo,
|
|
68
|
+
invoice_data_destination: NodeToJson(obj.destination),
|
|
69
|
+
};
|
|
70
|
+
};
|
|
56
71
|
|
|
57
72
|
export const FRAGMENT = `
|
|
58
73
|
fragment InvoiceDataFragment on InvoiceData {
|
|
@@ -184,6 +199,33 @@ fragment InvoiceDataFragment on InvoiceData {
|
|
|
184
199
|
}
|
|
185
200
|
}
|
|
186
201
|
lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
|
|
202
|
+
lightspark_node_with_o_s_k_balances: balances {
|
|
203
|
+
__typename
|
|
204
|
+
balances_owned_balance: owned_balance {
|
|
205
|
+
__typename
|
|
206
|
+
currency_amount_original_value: original_value
|
|
207
|
+
currency_amount_original_unit: original_unit
|
|
208
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
209
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
210
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
211
|
+
}
|
|
212
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
213
|
+
__typename
|
|
214
|
+
currency_amount_original_value: original_value
|
|
215
|
+
currency_amount_original_unit: original_unit
|
|
216
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
217
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
218
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
219
|
+
}
|
|
220
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
221
|
+
__typename
|
|
222
|
+
currency_amount_original_value: original_value
|
|
223
|
+
currency_amount_original_unit: original_unit
|
|
224
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
225
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
226
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
227
|
+
}
|
|
228
|
+
}
|
|
187
229
|
lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
|
|
188
230
|
__typename
|
|
189
231
|
secret_encrypted_value: encrypted_value
|
|
@@ -289,6 +331,33 @@ fragment InvoiceDataFragment on InvoiceData {
|
|
|
289
331
|
}
|
|
290
332
|
}
|
|
291
333
|
lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
|
|
334
|
+
lightspark_node_with_remote_signing_balances: balances {
|
|
335
|
+
__typename
|
|
336
|
+
balances_owned_balance: owned_balance {
|
|
337
|
+
__typename
|
|
338
|
+
currency_amount_original_value: original_value
|
|
339
|
+
currency_amount_original_unit: original_unit
|
|
340
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
341
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
342
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
343
|
+
}
|
|
344
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
345
|
+
__typename
|
|
346
|
+
currency_amount_original_value: original_value
|
|
347
|
+
currency_amount_original_unit: original_unit
|
|
348
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
349
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
350
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
351
|
+
}
|
|
352
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
353
|
+
__typename
|
|
354
|
+
currency_amount_original_value: original_value
|
|
355
|
+
currency_amount_original_unit: original_unit
|
|
356
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
357
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
358
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
359
|
+
}
|
|
360
|
+
}
|
|
292
361
|
}
|
|
293
362
|
}
|
|
294
363
|
}`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface LightningFeeEstimateForInvoiceInput {
|
|
4
4
|
/** The node from where you want to send the payment. **/
|
|
5
5
|
nodeId: string;
|
|
6
6
|
|
|
@@ -11,8 +11,8 @@ type LightningFeeEstimateForInvoiceInput = {
|
|
|
11
11
|
* If the invoice does not specify a payment amount, then the amount that you wish to pay, expressed
|
|
12
12
|
* in msats.
|
|
13
13
|
**/
|
|
14
|
-
amountMsats?: number;
|
|
15
|
-
}
|
|
14
|
+
amountMsats?: number | undefined;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
export const LightningFeeEstimateForInvoiceInputFromJson = (
|
|
18
18
|
obj: any,
|
|
@@ -24,5 +24,15 @@ export const LightningFeeEstimateForInvoiceInputFromJson = (
|
|
|
24
24
|
amountMsats: obj["lightning_fee_estimate_for_invoice_input_amount_msats"],
|
|
25
25
|
} as LightningFeeEstimateForInvoiceInput;
|
|
26
26
|
};
|
|
27
|
+
export const LightningFeeEstimateForInvoiceInputToJson = (
|
|
28
|
+
obj: LightningFeeEstimateForInvoiceInput,
|
|
29
|
+
): any => {
|
|
30
|
+
return {
|
|
31
|
+
lightning_fee_estimate_for_invoice_input_node_id: obj.nodeId,
|
|
32
|
+
lightning_fee_estimate_for_invoice_input_encoded_payment_request:
|
|
33
|
+
obj.encodedPaymentRequest,
|
|
34
|
+
lightning_fee_estimate_for_invoice_input_amount_msats: obj.amountMsats,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
27
37
|
|
|
28
38
|
export default LightningFeeEstimateForInvoiceInput;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface LightningFeeEstimateForNodeInput {
|
|
4
4
|
/** The node from where you want to send the payment. **/
|
|
5
5
|
nodeId: string;
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ type LightningFeeEstimateForNodeInput = {
|
|
|
9
9
|
|
|
10
10
|
/** The payment amount expressed in msats. **/
|
|
11
11
|
amountMsats: number;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
|
|
14
14
|
export const LightningFeeEstimateForNodeInputFromJson = (
|
|
15
15
|
obj: any,
|
|
@@ -21,5 +21,15 @@ export const LightningFeeEstimateForNodeInputFromJson = (
|
|
|
21
21
|
amountMsats: obj["lightning_fee_estimate_for_node_input_amount_msats"],
|
|
22
22
|
} as LightningFeeEstimateForNodeInput;
|
|
23
23
|
};
|
|
24
|
+
export const LightningFeeEstimateForNodeInputToJson = (
|
|
25
|
+
obj: LightningFeeEstimateForNodeInput,
|
|
26
|
+
): any => {
|
|
27
|
+
return {
|
|
28
|
+
lightning_fee_estimate_for_node_input_node_id: obj.nodeId,
|
|
29
|
+
lightning_fee_estimate_for_node_input_destination_node_public_key:
|
|
30
|
+
obj.destinationNodePublicKey,
|
|
31
|
+
lightning_fee_estimate_for_node_input_amount_msats: obj.amountMsats,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
24
34
|
|
|
25
35
|
export default LightningFeeEstimateForNodeInput;
|
|
@@ -1,12 +1,15 @@
|
|
|
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
|
+
interface LightningFeeEstimateOutput {
|
|
7
10
|
/** The estimated fees for the payment. **/
|
|
8
11
|
feeEstimate: CurrencyAmount;
|
|
9
|
-
}
|
|
12
|
+
}
|
|
10
13
|
|
|
11
14
|
export const LightningFeeEstimateOutputFromJson = (
|
|
12
15
|
obj: any,
|
|
@@ -17,6 +20,15 @@ export const LightningFeeEstimateOutputFromJson = (
|
|
|
17
20
|
),
|
|
18
21
|
} as LightningFeeEstimateOutput;
|
|
19
22
|
};
|
|
23
|
+
export const LightningFeeEstimateOutputToJson = (
|
|
24
|
+
obj: LightningFeeEstimateOutput,
|
|
25
|
+
): any => {
|
|
26
|
+
return {
|
|
27
|
+
lightning_fee_estimate_output_fee_estimate: CurrencyAmountToJson(
|
|
28
|
+
obj.feeEstimate,
|
|
29
|
+
),
|
|
30
|
+
};
|
|
31
|
+
};
|
|
20
32
|
|
|
21
33
|
export const FRAGMENT = `
|
|
22
34
|
fragment LightningFeeEstimateOutputFragment on LightningFeeEstimateOutput {
|
|
@@ -2,49 +2,55 @@
|
|
|
2
2
|
|
|
3
3
|
import { LightsparkException, type Query } from "@lightsparkdev/core";
|
|
4
4
|
import type CurrencyAmount from "./CurrencyAmount.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
CurrencyAmountFromJson,
|
|
7
|
+
CurrencyAmountToJson,
|
|
8
|
+
} from "./CurrencyAmount.js";
|
|
7
9
|
import IncomingPayment from "./IncomingPayment.js";
|
|
8
10
|
import OutgoingPayment from "./OutgoingPayment.js";
|
|
9
11
|
import PaymentFailureReason from "./PaymentFailureReason.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
import {
|
|
13
|
+
PaymentRequestDataFromJson,
|
|
14
|
+
PaymentRequestDataToJson,
|
|
15
|
+
} from "./PaymentRequestData.js";
|
|
16
|
+
import {
|
|
17
|
+
PostTransactionDataFromJson,
|
|
18
|
+
PostTransactionDataToJson,
|
|
19
|
+
} from "./PostTransactionData.js";
|
|
20
|
+
import { RichTextFromJson, RichTextToJson } from "./RichText.js";
|
|
13
21
|
import type RoutingTransaction from "./RoutingTransaction.js";
|
|
14
22
|
import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.js";
|
|
15
|
-
import type Transaction from "./Transaction.js";
|
|
16
23
|
import TransactionStatus from "./TransactionStatus.js";
|
|
17
24
|
|
|
18
25
|
/** This is an object representing a transaction made over the Lightning Network. You can retrieve this object to receive information about a specific transaction made over Lightning for a Lightspark node. **/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
id: string;
|
|
26
|
+
interface LightningTransaction {
|
|
27
|
+
/**
|
|
28
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
29
|
+
* string.
|
|
30
|
+
**/
|
|
31
|
+
id: string;
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
/** The date and time when this transaction was initiated. **/
|
|
34
|
+
createdAt: string;
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
/** The date and time when the entity was last updated. **/
|
|
37
|
+
updatedAt: string;
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
/** The current status of this transaction. **/
|
|
40
|
+
status: TransactionStatus;
|
|
35
41
|
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
/** The amount of money involved in this transaction. **/
|
|
43
|
+
amount: CurrencyAmount;
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
/** The typename of the object **/
|
|
46
|
+
typename: string;
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
/** The date and time when this transaction was completed or failed. **/
|
|
49
|
+
resolvedAt?: string | undefined;
|
|
44
50
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
/** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
|
|
52
|
+
transactionHash?: string | undefined;
|
|
53
|
+
}
|
|
48
54
|
|
|
49
55
|
export const LightningTransactionFromJson = (
|
|
50
56
|
obj: any,
|
|
@@ -135,6 +141,89 @@ export const LightningTransactionFromJson = (
|
|
|
135
141
|
`Couldn't find a concrete type for interface LightningTransaction corresponding to the typename=${obj["__typename"]}`,
|
|
136
142
|
);
|
|
137
143
|
};
|
|
144
|
+
export const LightningTransactionToJson = (obj: LightningTransaction): any => {
|
|
145
|
+
if (obj.typename == "IncomingPayment") {
|
|
146
|
+
const incomingPayment = obj as IncomingPayment;
|
|
147
|
+
return {
|
|
148
|
+
__typename: "IncomingPayment",
|
|
149
|
+
incoming_payment_id: incomingPayment.id,
|
|
150
|
+
incoming_payment_created_at: incomingPayment.createdAt,
|
|
151
|
+
incoming_payment_updated_at: incomingPayment.updatedAt,
|
|
152
|
+
incoming_payment_status: incomingPayment.status,
|
|
153
|
+
incoming_payment_resolved_at: incomingPayment.resolvedAt,
|
|
154
|
+
incoming_payment_amount: CurrencyAmountToJson(incomingPayment.amount),
|
|
155
|
+
incoming_payment_transaction_hash: incomingPayment.transactionHash,
|
|
156
|
+
incoming_payment_destination: { id: incomingPayment.destinationId },
|
|
157
|
+
incoming_payment_payment_request:
|
|
158
|
+
{ id: incomingPayment.paymentRequestId } ?? undefined,
|
|
159
|
+
incoming_payment_uma_post_transaction_data:
|
|
160
|
+
incomingPayment.umaPostTransactionData?.map((e) =>
|
|
161
|
+
PostTransactionDataToJson(e),
|
|
162
|
+
),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
if (obj.typename == "OutgoingPayment") {
|
|
166
|
+
const outgoingPayment = obj as OutgoingPayment;
|
|
167
|
+
return {
|
|
168
|
+
__typename: "OutgoingPayment",
|
|
169
|
+
outgoing_payment_id: outgoingPayment.id,
|
|
170
|
+
outgoing_payment_created_at: outgoingPayment.createdAt,
|
|
171
|
+
outgoing_payment_updated_at: outgoingPayment.updatedAt,
|
|
172
|
+
outgoing_payment_status: outgoingPayment.status,
|
|
173
|
+
outgoing_payment_resolved_at: outgoingPayment.resolvedAt,
|
|
174
|
+
outgoing_payment_amount: CurrencyAmountToJson(outgoingPayment.amount),
|
|
175
|
+
outgoing_payment_transaction_hash: outgoingPayment.transactionHash,
|
|
176
|
+
outgoing_payment_origin: { id: outgoingPayment.originId },
|
|
177
|
+
outgoing_payment_destination:
|
|
178
|
+
{ id: outgoingPayment.destinationId } ?? undefined,
|
|
179
|
+
outgoing_payment_fees: outgoingPayment.fees
|
|
180
|
+
? CurrencyAmountToJson(outgoingPayment.fees)
|
|
181
|
+
: undefined,
|
|
182
|
+
outgoing_payment_payment_request_data: outgoingPayment.paymentRequestData
|
|
183
|
+
? PaymentRequestDataToJson(outgoingPayment.paymentRequestData)
|
|
184
|
+
: undefined,
|
|
185
|
+
outgoing_payment_failure_reason: outgoingPayment.failureReason,
|
|
186
|
+
outgoing_payment_failure_message: outgoingPayment.failureMessage
|
|
187
|
+
? RichTextToJson(outgoingPayment.failureMessage)
|
|
188
|
+
: undefined,
|
|
189
|
+
outgoing_payment_uma_post_transaction_data:
|
|
190
|
+
outgoingPayment.umaPostTransactionData?.map((e) =>
|
|
191
|
+
PostTransactionDataToJson(e),
|
|
192
|
+
),
|
|
193
|
+
outgoing_payment_payment_preimage: outgoingPayment.paymentPreimage,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
if (obj.typename == "RoutingTransaction") {
|
|
197
|
+
const routingTransaction = obj as RoutingTransaction;
|
|
198
|
+
return {
|
|
199
|
+
__typename: "RoutingTransaction",
|
|
200
|
+
routing_transaction_id: routingTransaction.id,
|
|
201
|
+
routing_transaction_created_at: routingTransaction.createdAt,
|
|
202
|
+
routing_transaction_updated_at: routingTransaction.updatedAt,
|
|
203
|
+
routing_transaction_status: routingTransaction.status,
|
|
204
|
+
routing_transaction_resolved_at: routingTransaction.resolvedAt,
|
|
205
|
+
routing_transaction_amount: CurrencyAmountToJson(
|
|
206
|
+
routingTransaction.amount,
|
|
207
|
+
),
|
|
208
|
+
routing_transaction_transaction_hash: routingTransaction.transactionHash,
|
|
209
|
+
routing_transaction_incoming_channel:
|
|
210
|
+
{ id: routingTransaction.incomingChannelId } ?? undefined,
|
|
211
|
+
routing_transaction_outgoing_channel:
|
|
212
|
+
{ id: routingTransaction.outgoingChannelId } ?? undefined,
|
|
213
|
+
routing_transaction_fees: routingTransaction.fees
|
|
214
|
+
? CurrencyAmountToJson(routingTransaction.fees)
|
|
215
|
+
: undefined,
|
|
216
|
+
routing_transaction_failure_message: routingTransaction.failureMessage
|
|
217
|
+
? RichTextToJson(routingTransaction.failureMessage)
|
|
218
|
+
: undefined,
|
|
219
|
+
routing_transaction_failure_reason: routingTransaction.failureReason,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
throw new LightsparkException(
|
|
223
|
+
"DeserializationError",
|
|
224
|
+
`Couldn't find a concrete type for interface LightningTransaction corresponding to the typename=${obj.typename}`,
|
|
225
|
+
);
|
|
226
|
+
};
|
|
138
227
|
|
|
139
228
|
export const FRAGMENT = `
|
|
140
229
|
fragment LightningTransactionFragment on LightningTransaction {
|
|
@@ -335,6 +424,33 @@ fragment LightningTransactionFragment on LightningTransaction {
|
|
|
335
424
|
}
|
|
336
425
|
}
|
|
337
426
|
lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
|
|
427
|
+
lightspark_node_with_o_s_k_balances: balances {
|
|
428
|
+
__typename
|
|
429
|
+
balances_owned_balance: owned_balance {
|
|
430
|
+
__typename
|
|
431
|
+
currency_amount_original_value: original_value
|
|
432
|
+
currency_amount_original_unit: original_unit
|
|
433
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
434
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
435
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
436
|
+
}
|
|
437
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
438
|
+
__typename
|
|
439
|
+
currency_amount_original_value: original_value
|
|
440
|
+
currency_amount_original_unit: original_unit
|
|
441
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
442
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
443
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
444
|
+
}
|
|
445
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
446
|
+
__typename
|
|
447
|
+
currency_amount_original_value: original_value
|
|
448
|
+
currency_amount_original_unit: original_unit
|
|
449
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
450
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
451
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
452
|
+
}
|
|
453
|
+
}
|
|
338
454
|
lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
|
|
339
455
|
__typename
|
|
340
456
|
secret_encrypted_value: encrypted_value
|
|
@@ -440,6 +556,33 @@ fragment LightningTransactionFragment on LightningTransaction {
|
|
|
440
556
|
}
|
|
441
557
|
}
|
|
442
558
|
lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
|
|
559
|
+
lightspark_node_with_remote_signing_balances: balances {
|
|
560
|
+
__typename
|
|
561
|
+
balances_owned_balance: owned_balance {
|
|
562
|
+
__typename
|
|
563
|
+
currency_amount_original_value: original_value
|
|
564
|
+
currency_amount_original_unit: original_unit
|
|
565
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
566
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
567
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
568
|
+
}
|
|
569
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
570
|
+
__typename
|
|
571
|
+
currency_amount_original_value: original_value
|
|
572
|
+
currency_amount_original_unit: original_unit
|
|
573
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
574
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
575
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
576
|
+
}
|
|
577
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
578
|
+
__typename
|
|
579
|
+
currency_amount_original_value: original_value
|
|
580
|
+
currency_amount_original_unit: original_unit
|
|
581
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
582
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
583
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
584
|
+
}
|
|
585
|
+
}
|
|
443
586
|
}
|
|
444
587
|
}
|
|
445
588
|
}
|