@lightsparkdev/lightspark-sdk 1.1.7 → 1.2.1
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 +19 -0
- package/dist/{chunk-5RDIWPBE.js → chunk-D32EWIPX.js} +3 -1
- package/dist/{chunk-7UT6YX37.js → chunk-VTPDR6P4.js} +393 -275
- package/dist/env.cjs +3 -1
- package/dist/env.d.cts +17 -0
- package/dist/env.js +2 -2
- package/dist/{index-d31f4469.d.ts → index-5acc6526.d.ts} +1403 -408
- package/dist/index.cjs +424 -296
- package/dist/index.d.cts +41 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +32 -27
- package/dist/objects/index.cjs +395 -277
- package/dist/objects/index.d.cts +4 -0
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +6 -6
- package/dist/{text-encoding-MDIPJAHL.js → text-encoding-26SMKBAQ.js} +3 -1
- package/package.json +5 -5
- package/src/auth/AccountTokenAuthProvider.ts +15 -11
- package/src/client.ts +7 -6
- package/src/helpers.ts +3 -1
- package/src/objects/Account.ts +21 -2
- package/src/objects/AccountToApiTokensConnection.ts +16 -5
- package/src/objects/AccountToChannelsConnection.ts +14 -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 +92 -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 +32 -8
- 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 +2 -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 +49 -5
- package/src/objects/Hop.ts +27 -9
- package/src/objects/IdAndSignature.ts +8 -2
- package/src/objects/IncomingPayment.ts +50 -7
- package/src/objects/IncomingPaymentAttempt.ts +21 -5
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +21 -5
- package/src/objects/Invoice.ts +37 -24
- package/src/objects/InvoiceData.ts +21 -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 +117 -28
- package/src/objects/LightsparkNode.ts +250 -210
- package/src/objects/LightsparkNodeOwner.ts +35 -4
- package/src/objects/LightsparkNodeToChannelsConnection.ts +17 -4
- package/src/objects/LightsparkNodeWithOSK.ts +127 -17
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +122 -15
- package/src/objects/Node.ts +209 -68
- 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 +72 -14
- package/src/objects/OutgoingPaymentAttempt.ts +63 -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 +27 -5
- package/src/objects/PaymentRequestData.ts +27 -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 +206 -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 +34 -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 +42 -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/constants.ts +13 -0
- package/src/tests/integration/general-regtest.test.ts +652 -0
- package/src/tests/serialization.test.ts +21 -0
- package/src/webhooks.ts +1 -1
- package/src/tests/integration/client.test.ts +0 -207
- /package/dist/{chunk-NIMBE7W3.js → chunk-BMTV3EA2.js} +0 -0
|
@@ -1,9 +1,12 @@
|
|
|
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 ChannelToTransactionsConnection {
|
|
7
10
|
/**
|
|
8
11
|
* The total count of objects in this connection, using the current filters. It is different from the
|
|
9
12
|
* number of objects returned in the current page (in the `entities` field).
|
|
@@ -14,20 +17,20 @@ type ChannelToTransactionsConnection = {
|
|
|
14
17
|
* The average fee for the transactions that transited through this channel, according to the filters
|
|
15
18
|
* and constraints of the connection.
|
|
16
19
|
**/
|
|
17
|
-
averageFee?: CurrencyAmount;
|
|
20
|
+
averageFee?: CurrencyAmount | undefined;
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* The total amount transacted for the transactions that transited through this channel, according to
|
|
21
24
|
* the filters and constraints of the connection.
|
|
22
25
|
**/
|
|
23
|
-
totalAmountTransacted?: CurrencyAmount;
|
|
26
|
+
totalAmountTransacted?: CurrencyAmount | undefined;
|
|
24
27
|
|
|
25
28
|
/**
|
|
26
29
|
* The total amount of fees for the transactions that transited through this channel, according to the
|
|
27
30
|
* filters and constraints of the connection.
|
|
28
31
|
**/
|
|
29
|
-
totalFees?: CurrencyAmount;
|
|
30
|
-
}
|
|
32
|
+
totalFees?: CurrencyAmount | undefined;
|
|
33
|
+
}
|
|
31
34
|
|
|
32
35
|
export const ChannelToTransactionsConnectionFromJson = (
|
|
33
36
|
obj: any,
|
|
@@ -53,6 +56,23 @@ export const ChannelToTransactionsConnectionFromJson = (
|
|
|
53
56
|
: undefined,
|
|
54
57
|
} as ChannelToTransactionsConnection;
|
|
55
58
|
};
|
|
59
|
+
export const ChannelToTransactionsConnectionToJson = (
|
|
60
|
+
obj: ChannelToTransactionsConnection,
|
|
61
|
+
): any => {
|
|
62
|
+
return {
|
|
63
|
+
channel_to_transactions_connection_count: obj.count,
|
|
64
|
+
channel_to_transactions_connection_average_fee: obj.averageFee
|
|
65
|
+
? CurrencyAmountToJson(obj.averageFee)
|
|
66
|
+
: undefined,
|
|
67
|
+
channel_to_transactions_connection_total_amount_transacted:
|
|
68
|
+
obj.totalAmountTransacted
|
|
69
|
+
? CurrencyAmountToJson(obj.totalAmountTransacted)
|
|
70
|
+
: undefined,
|
|
71
|
+
channel_to_transactions_connection_total_fees: obj.totalFees
|
|
72
|
+
? CurrencyAmountToJson(obj.totalFees)
|
|
73
|
+
: undefined,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
56
76
|
|
|
57
77
|
export const FRAGMENT = `
|
|
58
78
|
fragment ChannelToTransactionsConnectionFragment on ChannelToTransactionsConnection {
|
|
@@ -6,26 +6,38 @@ import type AccountToNodesConnection from "./AccountToNodesConnection.js";
|
|
|
6
6
|
import type AccountToPaymentRequestsConnection from "./AccountToPaymentRequestsConnection.js";
|
|
7
7
|
import type AccountToTransactionsConnection from "./AccountToTransactionsConnection.js";
|
|
8
8
|
import type AccountToWalletsConnection from "./AccountToWalletsConnection.js";
|
|
9
|
-
import { ApiTokenFromJson } from "./ApiToken.js";
|
|
9
|
+
import { ApiTokenFromJson, ApiTokenToJson } from "./ApiToken.js";
|
|
10
10
|
import { ChannelFromJson } from "./Channel.js";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
import {
|
|
12
|
+
CurrencyAmountFromJson,
|
|
13
|
+
CurrencyAmountToJson,
|
|
14
|
+
} from "./CurrencyAmount.js";
|
|
15
|
+
import { HopFromJson, HopToJson } from "./Hop.js";
|
|
16
|
+
import {
|
|
17
|
+
IncomingPaymentAttemptFromJson,
|
|
18
|
+
IncomingPaymentAttemptToJson,
|
|
19
|
+
} from "./IncomingPaymentAttempt.js";
|
|
14
20
|
import type IncomingPaymentToAttemptsConnection from "./IncomingPaymentToAttemptsConnection.js";
|
|
15
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
LightsparkNodeFromJson,
|
|
23
|
+
LightsparkNodeToJson,
|
|
24
|
+
} from "./LightsparkNode.js";
|
|
16
25
|
import type LightsparkNodeToChannelsConnection from "./LightsparkNodeToChannelsConnection.js";
|
|
17
26
|
import { OutgoingPaymentAttemptFromJson } from "./OutgoingPaymentAttempt.js";
|
|
18
27
|
import type OutgoingPaymentAttemptToHopsConnection from "./OutgoingPaymentAttemptToHopsConnection.js";
|
|
19
28
|
import type OutgoingPaymentToAttemptsConnection from "./OutgoingPaymentToAttemptsConnection.js";
|
|
20
29
|
import type PageInfo from "./PageInfo.js";
|
|
21
|
-
import { PageInfoFromJson } from "./PageInfo.js";
|
|
22
|
-
import {
|
|
23
|
-
|
|
30
|
+
import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
|
|
31
|
+
import {
|
|
32
|
+
PaymentRequestFromJson,
|
|
33
|
+
PaymentRequestToJson,
|
|
34
|
+
} from "./PaymentRequest.js";
|
|
35
|
+
import { TransactionFromJson, TransactionToJson } from "./Transaction.js";
|
|
24
36
|
import { WalletFromJson } from "./Wallet.js";
|
|
25
37
|
import type WalletToPaymentRequestsConnection from "./WalletToPaymentRequestsConnection.js";
|
|
26
38
|
import type WalletToTransactionsConnection from "./WalletToTransactionsConnection.js";
|
|
27
39
|
|
|
28
|
-
|
|
40
|
+
interface Connection {
|
|
29
41
|
/**
|
|
30
42
|
* The total count of objects in this connection, using the current filters. It is different from the
|
|
31
43
|
* number of objects returned in the current page (in the `entities` field).
|
|
@@ -37,7 +49,7 @@ type Connection = {
|
|
|
37
49
|
|
|
38
50
|
/** The typename of the object **/
|
|
39
51
|
typename: string;
|
|
40
|
-
}
|
|
52
|
+
}
|
|
41
53
|
|
|
42
54
|
export const ConnectionFromJson = (obj: any): Connection => {
|
|
43
55
|
if (obj["__typename"] == "AccountToApiTokensConnection") {
|
|
@@ -194,6 +206,189 @@ export const ConnectionFromJson = (obj: any): Connection => {
|
|
|
194
206
|
`Couldn't find a concrete type for interface Connection corresponding to the typename=${obj["__typename"]}`,
|
|
195
207
|
);
|
|
196
208
|
};
|
|
209
|
+
export const ConnectionToJson = (obj: Connection): any => {
|
|
210
|
+
if (obj.typename == "AccountToApiTokensConnection") {
|
|
211
|
+
const accountToApiTokensConnection = obj as AccountToApiTokensConnection;
|
|
212
|
+
return {
|
|
213
|
+
__typename: "AccountToApiTokensConnection",
|
|
214
|
+
account_to_api_tokens_connection_count:
|
|
215
|
+
accountToApiTokensConnection.count,
|
|
216
|
+
account_to_api_tokens_connection_page_info: PageInfoToJson(
|
|
217
|
+
accountToApiTokensConnection.pageInfo,
|
|
218
|
+
),
|
|
219
|
+
account_to_api_tokens_connection_entities:
|
|
220
|
+
accountToApiTokensConnection.entities.map((e) => ApiTokenToJson(e)),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
if (obj.typename == "AccountToNodesConnection") {
|
|
224
|
+
const accountToNodesConnection = obj as AccountToNodesConnection;
|
|
225
|
+
return {
|
|
226
|
+
__typename: "AccountToNodesConnection",
|
|
227
|
+
account_to_nodes_connection_count: accountToNodesConnection.count,
|
|
228
|
+
account_to_nodes_connection_page_info: PageInfoToJson(
|
|
229
|
+
accountToNodesConnection.pageInfo,
|
|
230
|
+
),
|
|
231
|
+
account_to_nodes_connection_entities:
|
|
232
|
+
accountToNodesConnection.entities.map((e) => LightsparkNodeToJson(e)),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
if (obj.typename == "AccountToPaymentRequestsConnection") {
|
|
236
|
+
const accountToPaymentRequestsConnection =
|
|
237
|
+
obj as AccountToPaymentRequestsConnection;
|
|
238
|
+
return {
|
|
239
|
+
__typename: "AccountToPaymentRequestsConnection",
|
|
240
|
+
account_to_payment_requests_connection_count:
|
|
241
|
+
accountToPaymentRequestsConnection.count,
|
|
242
|
+
account_to_payment_requests_connection_page_info: PageInfoToJson(
|
|
243
|
+
accountToPaymentRequestsConnection.pageInfo,
|
|
244
|
+
),
|
|
245
|
+
account_to_payment_requests_connection_entities:
|
|
246
|
+
accountToPaymentRequestsConnection.entities.map((e) =>
|
|
247
|
+
PaymentRequestToJson(e),
|
|
248
|
+
),
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
if (obj.typename == "AccountToTransactionsConnection") {
|
|
252
|
+
const accountToTransactionsConnection =
|
|
253
|
+
obj as AccountToTransactionsConnection;
|
|
254
|
+
return {
|
|
255
|
+
__typename: "AccountToTransactionsConnection",
|
|
256
|
+
account_to_transactions_connection_count:
|
|
257
|
+
accountToTransactionsConnection.count,
|
|
258
|
+
account_to_transactions_connection_page_info: PageInfoToJson(
|
|
259
|
+
accountToTransactionsConnection.pageInfo,
|
|
260
|
+
),
|
|
261
|
+
account_to_transactions_connection_profit_loss:
|
|
262
|
+
accountToTransactionsConnection.profitLoss
|
|
263
|
+
? CurrencyAmountToJson(accountToTransactionsConnection.profitLoss)
|
|
264
|
+
: undefined,
|
|
265
|
+
account_to_transactions_connection_average_fee_earned:
|
|
266
|
+
accountToTransactionsConnection.averageFeeEarned
|
|
267
|
+
? CurrencyAmountToJson(
|
|
268
|
+
accountToTransactionsConnection.averageFeeEarned,
|
|
269
|
+
)
|
|
270
|
+
: undefined,
|
|
271
|
+
account_to_transactions_connection_total_amount_transacted:
|
|
272
|
+
accountToTransactionsConnection.totalAmountTransacted
|
|
273
|
+
? CurrencyAmountToJson(
|
|
274
|
+
accountToTransactionsConnection.totalAmountTransacted,
|
|
275
|
+
)
|
|
276
|
+
: undefined,
|
|
277
|
+
account_to_transactions_connection_entities:
|
|
278
|
+
accountToTransactionsConnection.entities.map((e) =>
|
|
279
|
+
TransactionToJson(e),
|
|
280
|
+
),
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
if (obj.typename == "AccountToWalletsConnection") {
|
|
284
|
+
const accountToWalletsConnection = obj as AccountToWalletsConnection;
|
|
285
|
+
return {
|
|
286
|
+
__typename: "AccountToWalletsConnection",
|
|
287
|
+
account_to_wallets_connection_count: accountToWalletsConnection.count,
|
|
288
|
+
account_to_wallets_connection_page_info: PageInfoToJson(
|
|
289
|
+
accountToWalletsConnection.pageInfo,
|
|
290
|
+
),
|
|
291
|
+
account_to_wallets_connection_entities:
|
|
292
|
+
accountToWalletsConnection.entities.map((e) => e.toJson()),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
if (obj.typename == "IncomingPaymentToAttemptsConnection") {
|
|
296
|
+
const incomingPaymentToAttemptsConnection =
|
|
297
|
+
obj as IncomingPaymentToAttemptsConnection;
|
|
298
|
+
return {
|
|
299
|
+
__typename: "IncomingPaymentToAttemptsConnection",
|
|
300
|
+
incoming_payment_to_attempts_connection_count:
|
|
301
|
+
incomingPaymentToAttemptsConnection.count,
|
|
302
|
+
incoming_payment_to_attempts_connection_page_info: PageInfoToJson(
|
|
303
|
+
incomingPaymentToAttemptsConnection.pageInfo,
|
|
304
|
+
),
|
|
305
|
+
incoming_payment_to_attempts_connection_entities:
|
|
306
|
+
incomingPaymentToAttemptsConnection.entities.map((e) =>
|
|
307
|
+
IncomingPaymentAttemptToJson(e),
|
|
308
|
+
),
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
if (obj.typename == "LightsparkNodeToChannelsConnection") {
|
|
312
|
+
const lightsparkNodeToChannelsConnection =
|
|
313
|
+
obj as LightsparkNodeToChannelsConnection;
|
|
314
|
+
return {
|
|
315
|
+
__typename: "LightsparkNodeToChannelsConnection",
|
|
316
|
+
lightspark_node_to_channels_connection_count:
|
|
317
|
+
lightsparkNodeToChannelsConnection.count,
|
|
318
|
+
lightspark_node_to_channels_connection_page_info: PageInfoToJson(
|
|
319
|
+
lightsparkNodeToChannelsConnection.pageInfo,
|
|
320
|
+
),
|
|
321
|
+
lightspark_node_to_channels_connection_entities:
|
|
322
|
+
lightsparkNodeToChannelsConnection.entities.map((e) => e.toJson()),
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
if (obj.typename == "OutgoingPaymentAttemptToHopsConnection") {
|
|
326
|
+
const outgoingPaymentAttemptToHopsConnection =
|
|
327
|
+
obj as OutgoingPaymentAttemptToHopsConnection;
|
|
328
|
+
return {
|
|
329
|
+
__typename: "OutgoingPaymentAttemptToHopsConnection",
|
|
330
|
+
outgoing_payment_attempt_to_hops_connection_count:
|
|
331
|
+
outgoingPaymentAttemptToHopsConnection.count,
|
|
332
|
+
outgoing_payment_attempt_to_hops_connection_page_info: PageInfoToJson(
|
|
333
|
+
outgoingPaymentAttemptToHopsConnection.pageInfo,
|
|
334
|
+
),
|
|
335
|
+
outgoing_payment_attempt_to_hops_connection_entities:
|
|
336
|
+
outgoingPaymentAttemptToHopsConnection.entities.map((e) =>
|
|
337
|
+
HopToJson(e),
|
|
338
|
+
),
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
if (obj.typename == "OutgoingPaymentToAttemptsConnection") {
|
|
342
|
+
const outgoingPaymentToAttemptsConnection =
|
|
343
|
+
obj as OutgoingPaymentToAttemptsConnection;
|
|
344
|
+
return {
|
|
345
|
+
__typename: "OutgoingPaymentToAttemptsConnection",
|
|
346
|
+
outgoing_payment_to_attempts_connection_count:
|
|
347
|
+
outgoingPaymentToAttemptsConnection.count,
|
|
348
|
+
outgoing_payment_to_attempts_connection_page_info: PageInfoToJson(
|
|
349
|
+
outgoingPaymentToAttemptsConnection.pageInfo,
|
|
350
|
+
),
|
|
351
|
+
outgoing_payment_to_attempts_connection_entities:
|
|
352
|
+
outgoingPaymentToAttemptsConnection.entities.map((e) => e.toJson()),
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
if (obj.typename == "WalletToPaymentRequestsConnection") {
|
|
356
|
+
const walletToPaymentRequestsConnection =
|
|
357
|
+
obj as WalletToPaymentRequestsConnection;
|
|
358
|
+
return {
|
|
359
|
+
__typename: "WalletToPaymentRequestsConnection",
|
|
360
|
+
wallet_to_payment_requests_connection_count:
|
|
361
|
+
walletToPaymentRequestsConnection.count,
|
|
362
|
+
wallet_to_payment_requests_connection_page_info: PageInfoToJson(
|
|
363
|
+
walletToPaymentRequestsConnection.pageInfo,
|
|
364
|
+
),
|
|
365
|
+
wallet_to_payment_requests_connection_entities:
|
|
366
|
+
walletToPaymentRequestsConnection.entities.map((e) =>
|
|
367
|
+
PaymentRequestToJson(e),
|
|
368
|
+
),
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
if (obj.typename == "WalletToTransactionsConnection") {
|
|
372
|
+
const walletToTransactionsConnection =
|
|
373
|
+
obj as WalletToTransactionsConnection;
|
|
374
|
+
return {
|
|
375
|
+
__typename: "WalletToTransactionsConnection",
|
|
376
|
+
wallet_to_transactions_connection_count:
|
|
377
|
+
walletToTransactionsConnection.count,
|
|
378
|
+
wallet_to_transactions_connection_page_info: PageInfoToJson(
|
|
379
|
+
walletToTransactionsConnection.pageInfo,
|
|
380
|
+
),
|
|
381
|
+
wallet_to_transactions_connection_entities:
|
|
382
|
+
walletToTransactionsConnection.entities.map((e) =>
|
|
383
|
+
TransactionToJson(e),
|
|
384
|
+
),
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
throw new LightsparkException(
|
|
388
|
+
"DeserializationError",
|
|
389
|
+
`Couldn't find a concrete type for interface Connection corresponding to the typename=${obj.typename}`,
|
|
390
|
+
);
|
|
391
|
+
};
|
|
197
392
|
|
|
198
393
|
export const FRAGMENT = `
|
|
199
394
|
fragment ConnectionFragment on Connection {
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import Permission from "./Permission.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface CreateApiTokenInput {
|
|
6
6
|
/** An arbitrary name that the user can choose to identify the API token in a list. **/
|
|
7
7
|
name: string;
|
|
8
8
|
|
|
9
9
|
/** List of permissions to grant to the API token **/
|
|
10
10
|
permissions: Permission[];
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
12
|
|
|
13
13
|
export const CreateApiTokenInputFromJson = (obj: any): CreateApiTokenInput => {
|
|
14
14
|
return {
|
|
@@ -18,5 +18,11 @@ export const CreateApiTokenInputFromJson = (obj: any): CreateApiTokenInput => {
|
|
|
18
18
|
),
|
|
19
19
|
} as CreateApiTokenInput;
|
|
20
20
|
};
|
|
21
|
+
export const CreateApiTokenInputToJson = (obj: CreateApiTokenInput): any => {
|
|
22
|
+
return {
|
|
23
|
+
create_api_token_input_name: obj.name,
|
|
24
|
+
create_api_token_input_permissions: obj.permissions,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
21
27
|
|
|
22
28
|
export default CreateApiTokenInput;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
import type ApiToken from "./ApiToken.js";
|
|
4
|
-
import { ApiTokenFromJson } from "./ApiToken.js";
|
|
4
|
+
import { ApiTokenFromJson, ApiTokenToJson } from "./ApiToken.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
interface CreateApiTokenOutput {
|
|
7
7
|
/** The API Token that has been created. **/
|
|
8
8
|
apiToken: ApiToken;
|
|
9
9
|
|
|
@@ -13,7 +13,7 @@ type CreateApiTokenOutput = {
|
|
|
13
13
|
* account.
|
|
14
14
|
**/
|
|
15
15
|
clientSecret: string;
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
|
|
18
18
|
export const CreateApiTokenOutputFromJson = (
|
|
19
19
|
obj: any,
|
|
@@ -23,6 +23,12 @@ export const CreateApiTokenOutputFromJson = (
|
|
|
23
23
|
clientSecret: obj["create_api_token_output_client_secret"],
|
|
24
24
|
} as CreateApiTokenOutput;
|
|
25
25
|
};
|
|
26
|
+
export const CreateApiTokenOutputToJson = (obj: CreateApiTokenOutput): any => {
|
|
27
|
+
return {
|
|
28
|
+
create_api_token_output_api_token: ApiTokenToJson(obj.apiToken),
|
|
29
|
+
create_api_token_output_client_secret: obj.clientSecret,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
26
32
|
|
|
27
33
|
export const FRAGMENT = `
|
|
28
34
|
fragment CreateApiTokenOutputFragment on CreateApiTokenOutput {
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
import InvoiceType from "./InvoiceType.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface CreateInvoiceInput {
|
|
6
6
|
/** The node from which to create the invoice. **/
|
|
7
7
|
nodeId: string;
|
|
8
8
|
|
|
9
9
|
/** The amount for which the invoice should be created, in millisatoshis. **/
|
|
10
10
|
amountMsats: number;
|
|
11
11
|
|
|
12
|
-
memo?: string;
|
|
12
|
+
memo?: string | undefined;
|
|
13
13
|
|
|
14
|
-
invoiceType?: InvoiceType;
|
|
14
|
+
invoiceType?: InvoiceType | undefined;
|
|
15
15
|
|
|
16
16
|
/** The expiry of the invoice in seconds. Default value is 86400 (1 day). **/
|
|
17
|
-
expirySecs?: number;
|
|
18
|
-
}
|
|
17
|
+
expirySecs?: number | undefined;
|
|
18
|
+
}
|
|
19
19
|
|
|
20
20
|
export const CreateInvoiceInputFromJson = (obj: any): CreateInvoiceInput => {
|
|
21
21
|
return {
|
|
@@ -29,5 +29,14 @@ export const CreateInvoiceInputFromJson = (obj: any): CreateInvoiceInput => {
|
|
|
29
29
|
expirySecs: obj["create_invoice_input_expiry_secs"],
|
|
30
30
|
} as CreateInvoiceInput;
|
|
31
31
|
};
|
|
32
|
+
export const CreateInvoiceInputToJson = (obj: CreateInvoiceInput): any => {
|
|
33
|
+
return {
|
|
34
|
+
create_invoice_input_node_id: obj.nodeId,
|
|
35
|
+
create_invoice_input_amount_msats: obj.amountMsats,
|
|
36
|
+
create_invoice_input_memo: obj.memo,
|
|
37
|
+
create_invoice_input_invoice_type: obj.invoiceType,
|
|
38
|
+
create_invoice_input_expiry_secs: obj.expirySecs,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
32
41
|
|
|
33
42
|
export default CreateInvoiceInput;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface CreateInvoiceOutput {
|
|
4
4
|
invoiceId: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
7
|
export const CreateInvoiceOutputFromJson = (obj: any): CreateInvoiceOutput => {
|
|
8
8
|
return {
|
|
9
9
|
invoiceId: obj["create_invoice_output_invoice"].id,
|
|
10
10
|
} as CreateInvoiceOutput;
|
|
11
11
|
};
|
|
12
|
+
export const CreateInvoiceOutputToJson = (obj: CreateInvoiceOutput): any => {
|
|
13
|
+
return {
|
|
14
|
+
create_invoice_output_invoice: { id: obj.invoiceId },
|
|
15
|
+
};
|
|
16
|
+
};
|
|
12
17
|
|
|
13
18
|
export const FRAGMENT = `
|
|
14
19
|
fragment CreateInvoiceOutputFragment on CreateInvoiceOutput {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface CreateLnurlInvoiceInput {
|
|
4
4
|
/** The node from which to create the invoice. **/
|
|
5
5
|
nodeId: string;
|
|
6
6
|
|
|
@@ -14,8 +14,8 @@ type CreateLnurlInvoiceInput = {
|
|
|
14
14
|
metadataHash: string;
|
|
15
15
|
|
|
16
16
|
/** The expiry of the invoice in seconds. Default value is 86400 (1 day). **/
|
|
17
|
-
expirySecs?: number;
|
|
18
|
-
}
|
|
17
|
+
expirySecs?: number | undefined;
|
|
18
|
+
}
|
|
19
19
|
|
|
20
20
|
export const CreateLnurlInvoiceInputFromJson = (
|
|
21
21
|
obj: any,
|
|
@@ -27,5 +27,15 @@ export const CreateLnurlInvoiceInputFromJson = (
|
|
|
27
27
|
expirySecs: obj["create_lnurl_invoice_input_expiry_secs"],
|
|
28
28
|
} as CreateLnurlInvoiceInput;
|
|
29
29
|
};
|
|
30
|
+
export const CreateLnurlInvoiceInputToJson = (
|
|
31
|
+
obj: CreateLnurlInvoiceInput,
|
|
32
|
+
): any => {
|
|
33
|
+
return {
|
|
34
|
+
create_lnurl_invoice_input_node_id: obj.nodeId,
|
|
35
|
+
create_lnurl_invoice_input_amount_msats: obj.amountMsats,
|
|
36
|
+
create_lnurl_invoice_input_metadata_hash: obj.metadataHash,
|
|
37
|
+
create_lnurl_invoice_input_expiry_secs: obj.expirySecs,
|
|
38
|
+
};
|
|
39
|
+
};
|
|
30
40
|
|
|
31
41
|
export default CreateLnurlInvoiceInput;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface CreateNodeWalletAddressInput {
|
|
4
4
|
nodeId: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
7
|
export const CreateNodeWalletAddressInputFromJson = (
|
|
8
8
|
obj: any,
|
|
@@ -11,5 +11,12 @@ export const CreateNodeWalletAddressInputFromJson = (
|
|
|
11
11
|
nodeId: obj["create_node_wallet_address_input_node_id"],
|
|
12
12
|
} as CreateNodeWalletAddressInput;
|
|
13
13
|
};
|
|
14
|
+
export const CreateNodeWalletAddressInputToJson = (
|
|
15
|
+
obj: CreateNodeWalletAddressInput,
|
|
16
|
+
): any => {
|
|
17
|
+
return {
|
|
18
|
+
create_node_wallet_address_input_node_id: obj.nodeId,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
14
21
|
|
|
15
22
|
export default CreateNodeWalletAddressInput;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface CreateNodeWalletAddressOutput {
|
|
4
4
|
nodeId: string;
|
|
5
5
|
|
|
6
6
|
walletAddress: string;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
|
|
9
9
|
export const CreateNodeWalletAddressOutputFromJson = (
|
|
10
10
|
obj: any,
|
|
@@ -14,6 +14,14 @@ export const CreateNodeWalletAddressOutputFromJson = (
|
|
|
14
14
|
walletAddress: obj["create_node_wallet_address_output_wallet_address"],
|
|
15
15
|
} as CreateNodeWalletAddressOutput;
|
|
16
16
|
};
|
|
17
|
+
export const CreateNodeWalletAddressOutputToJson = (
|
|
18
|
+
obj: CreateNodeWalletAddressOutput,
|
|
19
|
+
): any => {
|
|
20
|
+
return {
|
|
21
|
+
create_node_wallet_address_output_node: { id: obj.nodeId },
|
|
22
|
+
create_node_wallet_address_output_wallet_address: obj.walletAddress,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
17
25
|
|
|
18
26
|
export const FRAGMENT = `
|
|
19
27
|
fragment CreateNodeWalletAddressOutputFragment on CreateNodeWalletAddressOutput {
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import InvoiceType from "./InvoiceType.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface CreateTestModeInvoiceInput {
|
|
6
6
|
localNodeId: string;
|
|
7
7
|
|
|
8
8
|
amountMsats: number;
|
|
9
9
|
|
|
10
|
-
memo?: string;
|
|
10
|
+
memo?: string | undefined;
|
|
11
11
|
|
|
12
|
-
invoiceType?: InvoiceType;
|
|
13
|
-
}
|
|
12
|
+
invoiceType?: InvoiceType | undefined;
|
|
13
|
+
}
|
|
14
14
|
|
|
15
15
|
export const CreateTestModeInvoiceInputFromJson = (
|
|
16
16
|
obj: any,
|
|
@@ -25,5 +25,15 @@ export const CreateTestModeInvoiceInputFromJson = (
|
|
|
25
25
|
: null,
|
|
26
26
|
} as CreateTestModeInvoiceInput;
|
|
27
27
|
};
|
|
28
|
+
export const CreateTestModeInvoiceInputToJson = (
|
|
29
|
+
obj: CreateTestModeInvoiceInput,
|
|
30
|
+
): any => {
|
|
31
|
+
return {
|
|
32
|
+
create_test_mode_invoice_input_local_node_id: obj.localNodeId,
|
|
33
|
+
create_test_mode_invoice_input_amount_msats: obj.amountMsats,
|
|
34
|
+
create_test_mode_invoice_input_memo: obj.memo,
|
|
35
|
+
create_test_mode_invoice_input_invoice_type: obj.invoiceType,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
28
38
|
|
|
29
39
|
export default CreateTestModeInvoiceInput;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface CreateTestModeInvoiceOutput {
|
|
4
4
|
encodedPaymentRequest: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
7
|
export const CreateTestModeInvoiceOutputFromJson = (
|
|
8
8
|
obj: any,
|
|
@@ -12,6 +12,14 @@ export const CreateTestModeInvoiceOutputFromJson = (
|
|
|
12
12
|
obj["create_test_mode_invoice_output_encoded_payment_request"],
|
|
13
13
|
} as CreateTestModeInvoiceOutput;
|
|
14
14
|
};
|
|
15
|
+
export const CreateTestModeInvoiceOutputToJson = (
|
|
16
|
+
obj: CreateTestModeInvoiceOutput,
|
|
17
|
+
): any => {
|
|
18
|
+
return {
|
|
19
|
+
create_test_mode_invoice_output_encoded_payment_request:
|
|
20
|
+
obj.encodedPaymentRequest,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
15
23
|
|
|
16
24
|
export const FRAGMENT = `
|
|
17
25
|
fragment CreateTestModeInvoiceOutputFragment on CreateTestModeInvoiceOutput {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface CreateTestModePaymentInput {
|
|
4
4
|
/** The node to where you want to send the payment. **/
|
|
5
5
|
localNodeId: string;
|
|
6
6
|
|
|
@@ -11,8 +11,8 @@ type CreateTestModePaymentInput = {
|
|
|
11
11
|
* The amount you will be paid for this invoice, expressed in msats. It should ONLY be set when the
|
|
12
12
|
* invoice amount is zero.
|
|
13
13
|
**/
|
|
14
|
-
amountMsats?: number;
|
|
15
|
-
}
|
|
14
|
+
amountMsats?: number | undefined;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
export const CreateTestModePaymentInputFromJson = (
|
|
18
18
|
obj: any,
|
|
@@ -23,5 +23,14 @@ export const CreateTestModePaymentInputFromJson = (
|
|
|
23
23
|
amountMsats: obj["create_test_mode_payment_input_amount_msats"],
|
|
24
24
|
} as CreateTestModePaymentInput;
|
|
25
25
|
};
|
|
26
|
+
export const CreateTestModePaymentInputToJson = (
|
|
27
|
+
obj: CreateTestModePaymentInput,
|
|
28
|
+
): any => {
|
|
29
|
+
return {
|
|
30
|
+
create_test_mode_payment_input_local_node_id: obj.localNodeId,
|
|
31
|
+
create_test_mode_payment_input_encoded_invoice: obj.encodedInvoice,
|
|
32
|
+
create_test_mode_payment_input_amount_msats: obj.amountMsats,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
26
35
|
|
|
27
36
|
export default CreateTestModePaymentInput;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
3
|
/** This is an object identifying the output of a test mode payment. This object can be used to retrieve the associated payment made from a Test Mode Payment call. **/
|
|
4
|
-
|
|
4
|
+
interface CreateTestModePaymentoutput {
|
|
5
5
|
/**
|
|
6
6
|
* The payment that has been sent.
|
|
7
7
|
*
|
|
@@ -11,7 +11,7 @@ type CreateTestModePaymentoutput = {
|
|
|
11
11
|
|
|
12
12
|
/** The payment that has been received. **/
|
|
13
13
|
incomingPaymentId: string;
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
|
|
16
16
|
export const CreateTestModePaymentoutputFromJson = (
|
|
17
17
|
obj: any,
|
|
@@ -22,6 +22,16 @@ export const CreateTestModePaymentoutputFromJson = (
|
|
|
22
22
|
obj["create_test_mode_paymentoutput_incoming_payment"].id,
|
|
23
23
|
} as CreateTestModePaymentoutput;
|
|
24
24
|
};
|
|
25
|
+
export const CreateTestModePaymentoutputToJson = (
|
|
26
|
+
obj: CreateTestModePaymentoutput,
|
|
27
|
+
): any => {
|
|
28
|
+
return {
|
|
29
|
+
create_test_mode_paymentoutput_payment: { id: obj.paymentId },
|
|
30
|
+
create_test_mode_paymentoutput_incoming_payment: {
|
|
31
|
+
id: obj.incomingPaymentId,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
};
|
|
25
35
|
|
|
26
36
|
export const FRAGMENT = `
|
|
27
37
|
fragment CreateTestModePaymentoutputFragment on CreateTestModePaymentoutput {
|