@lightsparkdev/lightspark-sdk 0.3.3 → 0.4.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 +19 -0
- package/dist/{chunk-PD33OHE4.js → chunk-VAJWSX3C.js} +186 -32
- package/dist/{index-d2343f8f.d.ts → index-aa922ada.d.ts} +98 -28
- package/dist/index.cjs +994 -795
- package/dist/index.d.ts +3 -2
- package/dist/index.js +69 -14
- package/dist/objects/index.cjs +168 -17
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +5 -1
- package/package.json +3 -2
- package/src/client.ts +34 -0
- package/src/graphql/CreateLnurlInvoice.ts +21 -0
- package/src/objects/Account.ts +12 -2
- package/src/objects/CreateLnurlInvoiceInput.ts +27 -0
- package/src/objects/Entity.ts +10 -0
- package/src/objects/Invoice.ts +3 -0
- package/src/objects/InvoiceData.ts +3 -0
- package/src/objects/LightningTransaction.ts +3 -0
- package/src/objects/LightsparkNode.ts +5 -0
- package/src/objects/LightsparkNodeOwner.ts +125 -0
- package/src/objects/Node.ts +4 -0
- package/src/objects/OutgoingPayment.ts +3 -0
- package/src/objects/PaymentRequest.ts +3 -0
- package/src/objects/PaymentRequestData.ts +3 -0
- package/src/objects/Transaction.ts +3 -0
- package/src/objects/Wallet.ts +11 -7
- package/src/objects/WalletStatus.ts +29 -0
- package/src/objects/index.ts +6 -0
- package/src/webhooks.ts +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuthProvider } from '@lightsparkdev/core';
|
|
2
|
-
import { W as WebhookEventType } from './index-
|
|
3
|
-
export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as ApiToken, B as Balances, i as BitcoinNetwork, j as BlockchainBalance, C as Channel, k as ChannelClosingTransaction, m as ChannelFees, n as ChannelOpeningTransaction, p as ChannelStatus, q as ChannelToTransactionsConnection, r as CreateApiTokenInput, s as CreateApiTokenOutput, t as CreateInvoiceInput, u as CreateInvoiceOutput, v as
|
|
2
|
+
import { W as WebhookEventType } from './index-aa922ada.js';
|
|
3
|
+
export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as ApiToken, B as Balances, i as BitcoinNetwork, j as BlockchainBalance, C as Channel, k as ChannelClosingTransaction, m as ChannelFees, n as ChannelOpeningTransaction, p as ChannelStatus, q as ChannelToTransactionsConnection, r as CreateApiTokenInput, s as CreateApiTokenOutput, t as CreateInvoiceInput, u as CreateInvoiceOutput, v as CreateLnurlInvoiceInput, w as CreateNodeWalletAddressInput, x as CreateNodeWalletAddressOutput, y as CreateTestModeInvoiceInput, z as CreateTestModeInvoiceOutput, D as CreateTestModePaymentInput, E as CreateTestModePaymentoutput, F as CurrencyAmount, G as CurrencyUnit, H as DeleteApiTokenInput, I as DeleteApiTokenOutput, J as Deposit, M as Entity, N as FeeEstimate, O as FundNodeInput, P as FundNodeOutput, Q as GraphNode, R as Hop, T as HtlcAttemptFailureCode, U as IncomingPayment, V as IncomingPaymentAttempt, Y as IncomingPaymentAttemptStatus, Z as IncomingPaymentToAttemptsConnection, _ as Invoice, a0 as InvoiceData, a1 as InvoiceType, a2 as LightningFeeEstimateForInvoiceInput, a3 as LightningFeeEstimateForNodeInput, a4 as LightningFeeEstimateOutput, a5 as LightningTransaction, L as LightsparkClient, a7 as LightsparkNode, a8 as LightsparkNodeOwner, aa as LightsparkNodePurpose, ab as LightsparkNodeStatus, ac as LightsparkNodeToChannelsConnection, ad as Node, ae as NodeAddress, af as NodeAddressType, ag as NodeToAddressesConnection, ah as OnChainTransaction, aj as OutgoingPayment, ak as OutgoingPaymentAttempt, al as OutgoingPaymentAttemptStatus, am as OutgoingPaymentAttemptToHopsConnection, an as OutgoingPaymentToAttemptsConnection, ao as PageInfo, ap as PayInvoiceInput, aq as PayInvoiceOutput, ar as PaymentFailureReason, as as PaymentRequest, au as PaymentRequestData, av as PaymentRequestStatus, aw as Permission, ax as RequestWithdrawalInput, ay as RequestWithdrawalOutput, az as RichText, aA as RoutingTransaction, aC as RoutingTransactionFailureReason, aD as Secret, aE as SendPaymentInput, aF as SendPaymentOutput, aG as SingleNodeDashboard, aH as Transaction, aJ as TransactionFailures, aK as TransactionStatus, aL as TransactionType, aM as TransactionUpdate, aN as Wallet, aO as WalletStatus, aP as Withdrawal, aR as WithdrawalMode, aS as WithdrawalRequest, aT as WithdrawalRequestStatus, aU as WithdrawalRequestToChannelClosingTransactionsConnection, aV as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, l as getChannelClosingTransactionQuery, o as getChannelOpeningTransactionQuery, K as getDepositQuery, S as getHopQuery, X as getIncomingPaymentAttemptQuery, $ as getInvoiceQuery, a6 as getLightningTransactionQuery, a9 as getLightsparkNodeOwnerQuery, ai as getOnChainTransactionQuery, at as getPaymentRequestQuery, aB as getRoutingTransactionQuery, aI as getTransactionQuery, aQ as getWithdrawalQuery } from './index-aa922ada.js';
|
|
4
4
|
import 'zen-observable';
|
|
5
5
|
|
|
6
6
|
declare class AccountTokenAuthProvider implements AuthProvider {
|
|
@@ -19,6 +19,7 @@ interface WebhookEvent {
|
|
|
19
19
|
event_id: string;
|
|
20
20
|
timestamp: Date;
|
|
21
21
|
entity_id: string;
|
|
22
|
+
wallet_id?: string;
|
|
22
23
|
}
|
|
23
24
|
declare const verifyAndParseWebhook: (data: Uint8Array, hexdigest: string, webhook_secret: string) => Promise<WebhookEvent>;
|
|
24
25
|
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
CurrencyAmountFromJson,
|
|
9
9
|
CurrencyUnit_default,
|
|
10
10
|
FRAGMENT,
|
|
11
|
+
FRAGMENT10,
|
|
11
12
|
FRAGMENT2,
|
|
12
13
|
FRAGMENT3,
|
|
13
14
|
FRAGMENT4,
|
|
@@ -22,6 +23,7 @@ import {
|
|
|
22
23
|
IncomingPaymentAttemptStatus_default,
|
|
23
24
|
IncomingPayment_default,
|
|
24
25
|
InvoiceDataFromJson,
|
|
26
|
+
InvoiceFromJson,
|
|
25
27
|
InvoiceType_default,
|
|
26
28
|
LightsparkNodePurpose_default,
|
|
27
29
|
LightsparkNodeStatus_default,
|
|
@@ -40,6 +42,7 @@ import {
|
|
|
40
42
|
TransactionStatus_default,
|
|
41
43
|
TransactionType_default,
|
|
42
44
|
TransactionUpdateFromJson,
|
|
45
|
+
WalletStatus_default,
|
|
43
46
|
Wallet_default,
|
|
44
47
|
WebhookEventType,
|
|
45
48
|
WebhookEventType_default,
|
|
@@ -55,12 +58,13 @@ import {
|
|
|
55
58
|
getIncomingPaymentAttemptQuery,
|
|
56
59
|
getInvoiceQuery,
|
|
57
60
|
getLightningTransactionQuery,
|
|
61
|
+
getLightsparkNodeOwnerQuery,
|
|
58
62
|
getOnChainTransactionQuery,
|
|
59
63
|
getPaymentRequestQuery,
|
|
60
64
|
getRoutingTransactionQuery,
|
|
61
65
|
getTransactionQuery,
|
|
62
66
|
getWithdrawalQuery
|
|
63
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-VAJWSX3C.js";
|
|
64
68
|
import {
|
|
65
69
|
__commonJS
|
|
66
70
|
} from "./chunk-NIMBE7W3.js";
|
|
@@ -70,7 +74,7 @@ var require_package = __commonJS({
|
|
|
70
74
|
"package.json"(exports, module) {
|
|
71
75
|
module.exports = {
|
|
72
76
|
name: "@lightsparkdev/lightspark-sdk",
|
|
73
|
-
version: "0.
|
|
77
|
+
version: "0.4.0",
|
|
74
78
|
description: "Lightspark JS SDK",
|
|
75
79
|
author: "Lightspark Inc.",
|
|
76
80
|
keywords: [
|
|
@@ -139,7 +143,7 @@ var require_package = __commonJS({
|
|
|
139
143
|
},
|
|
140
144
|
license: "Apache-2.0",
|
|
141
145
|
dependencies: {
|
|
142
|
-
"@lightsparkdev/core": "0.3.
|
|
146
|
+
"@lightsparkdev/core": "0.3.3",
|
|
143
147
|
"auto-bind": "^5.0.1",
|
|
144
148
|
crypto: "^1.0.1",
|
|
145
149
|
"crypto-browserify": "^3.12.0",
|
|
@@ -155,6 +159,7 @@ var require_package = __commonJS({
|
|
|
155
159
|
"@types/ws": "^8.5.4",
|
|
156
160
|
jest: "^29.4.1",
|
|
157
161
|
prettier: "2.8.7",
|
|
162
|
+
"prettier-plugin-organize-imports": "^3.2.2",
|
|
158
163
|
"ts-jest": "^29.0.5",
|
|
159
164
|
"ts-node": "^10.9.1",
|
|
160
165
|
tsconfig: "*",
|
|
@@ -209,6 +214,7 @@ import {
|
|
|
209
214
|
Requester,
|
|
210
215
|
StubAuthProvider
|
|
211
216
|
} from "@lightsparkdev/core";
|
|
217
|
+
import { createHash } from "crypto";
|
|
212
218
|
|
|
213
219
|
// src/graphql/BitcoinFeeEstimate.ts
|
|
214
220
|
var BitcoinFeeEstimate = `
|
|
@@ -259,6 +265,26 @@ var CreateInvoice = `
|
|
|
259
265
|
}
|
|
260
266
|
`;
|
|
261
267
|
|
|
268
|
+
// src/graphql/CreateLnurlInvoice.ts
|
|
269
|
+
var CreateLnurlInvoice = `
|
|
270
|
+
mutation CreateLnurlInvoice(
|
|
271
|
+
$node_id: ID!
|
|
272
|
+
$amount_msats: Long!
|
|
273
|
+
$metadata_hash: String!
|
|
274
|
+
) {
|
|
275
|
+
create_lnurl_invoice(input: {
|
|
276
|
+
node_id: $node_id
|
|
277
|
+
amount_msats: $amount_msats
|
|
278
|
+
metadata_hash: $metadata_hash
|
|
279
|
+
}) {
|
|
280
|
+
invoice {
|
|
281
|
+
...InvoiceFragment
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
${FRAGMENT5}
|
|
286
|
+
`;
|
|
287
|
+
|
|
262
288
|
// src/graphql/CreateNodeWalletAddress.ts
|
|
263
289
|
var CreateNodeWalletAddress = `
|
|
264
290
|
mutation CreateNodeWalletAddress(
|
|
@@ -309,7 +335,7 @@ mutation CreateTestModePayment(
|
|
|
309
335
|
}
|
|
310
336
|
}
|
|
311
337
|
|
|
312
|
-
${
|
|
338
|
+
${FRAGMENT6}
|
|
313
339
|
`;
|
|
314
340
|
|
|
315
341
|
// src/graphql/DecodeInvoice.ts
|
|
@@ -323,7 +349,7 @@ var DecodeInvoice = `
|
|
|
323
349
|
}
|
|
324
350
|
}
|
|
325
351
|
|
|
326
|
-
${
|
|
352
|
+
${FRAGMENT4}
|
|
327
353
|
`;
|
|
328
354
|
|
|
329
355
|
// src/graphql/DeleteApiToken.ts
|
|
@@ -371,7 +397,7 @@ var LightningFeeEstimateForInvoice = `
|
|
|
371
397
|
}
|
|
372
398
|
}
|
|
373
399
|
|
|
374
|
-
${
|
|
400
|
+
${FRAGMENT7}
|
|
375
401
|
`;
|
|
376
402
|
|
|
377
403
|
// src/graphql/LightningFeeEstimateForNode.ts
|
|
@@ -390,7 +416,7 @@ var LightningFeeEstimateForNode = `
|
|
|
390
416
|
}
|
|
391
417
|
}
|
|
392
418
|
|
|
393
|
-
${
|
|
419
|
+
${FRAGMENT7}
|
|
394
420
|
`;
|
|
395
421
|
|
|
396
422
|
// src/graphql/MultiNodeDashboard.ts
|
|
@@ -493,7 +519,7 @@ var PayInvoice = `
|
|
|
493
519
|
}
|
|
494
520
|
}
|
|
495
521
|
|
|
496
|
-
${
|
|
522
|
+
${FRAGMENT6}
|
|
497
523
|
`;
|
|
498
524
|
|
|
499
525
|
// src/graphql/RecoverNodeSigningKey.ts
|
|
@@ -531,7 +557,7 @@ var RequestWithdrawal = `
|
|
|
531
557
|
}
|
|
532
558
|
}
|
|
533
559
|
|
|
534
|
-
${
|
|
560
|
+
${FRAGMENT8}
|
|
535
561
|
`;
|
|
536
562
|
|
|
537
563
|
// src/graphql/SendPayment.ts
|
|
@@ -558,7 +584,7 @@ var SendPayment = `
|
|
|
558
584
|
}
|
|
559
585
|
}
|
|
560
586
|
|
|
561
|
-
${
|
|
587
|
+
${FRAGMENT6}
|
|
562
588
|
`;
|
|
563
589
|
|
|
564
590
|
// src/graphql/SingleNodeDashboard.ts
|
|
@@ -670,7 +696,7 @@ query SingleNodeDashboard(
|
|
|
670
696
|
}
|
|
671
697
|
}
|
|
672
698
|
|
|
673
|
-
${
|
|
699
|
+
${FRAGMENT9}
|
|
674
700
|
${FRAGMENT}
|
|
675
701
|
`;
|
|
676
702
|
|
|
@@ -709,7 +735,7 @@ query TransactionsForNode(
|
|
|
709
735
|
}
|
|
710
736
|
}
|
|
711
737
|
|
|
712
|
-
${
|
|
738
|
+
${FRAGMENT9}
|
|
713
739
|
${FRAGMENT}
|
|
714
740
|
`;
|
|
715
741
|
|
|
@@ -724,7 +750,7 @@ subscription TransactionSubscription(
|
|
|
724
750
|
}
|
|
725
751
|
}
|
|
726
752
|
|
|
727
|
-
${
|
|
753
|
+
${FRAGMENT10}
|
|
728
754
|
`;
|
|
729
755
|
|
|
730
756
|
// src/client.ts
|
|
@@ -984,6 +1010,32 @@ var LightsparkClient = class {
|
|
|
984
1010
|
});
|
|
985
1011
|
return response.create_invoice?.invoice.data?.encoded_payment_request;
|
|
986
1012
|
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Generates a Lightning Invoice (follows the Bolt 11 specification) to request a payment
|
|
1015
|
+
* from another Lightning Node. This should only be used for generating invoices for LNURLs,
|
|
1016
|
+
* with [createInvoice] preferred in the general case.
|
|
1017
|
+
*
|
|
1018
|
+
* Test mode note: You can simulate a payment of this invoice in test move using [createTestModePayment].
|
|
1019
|
+
*
|
|
1020
|
+
* @param nodeId The node ID for which to create an invoice.
|
|
1021
|
+
* @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
|
|
1022
|
+
* @param metadata The LNURL metadata payload field in the initial payreq response. This wil be hashed and present in the
|
|
1023
|
+
* h-tag (SHA256 purpose of payment) of the resulting Bolt 11 invoice. See
|
|
1024
|
+
* [this spec](https://github.com/lnurl/luds/blob/luds/06.md#pay-to-static-qrnfclink) for details.
|
|
1025
|
+
* @returns An Invoice object representing the generated invoice.
|
|
1026
|
+
*/
|
|
1027
|
+
async createLnurlInvoice(nodeId, amountMsats, metadata) {
|
|
1028
|
+
const response = await this.requester.makeRawRequest(CreateLnurlInvoice, {
|
|
1029
|
+
node_id: nodeId,
|
|
1030
|
+
amount_msats: amountMsats,
|
|
1031
|
+
metadata_hash: createHash("sha256").update(metadata).digest("hex")
|
|
1032
|
+
});
|
|
1033
|
+
const invoiceJson = response.create_lnurl_invoice?.invoice;
|
|
1034
|
+
if (!invoiceJson) {
|
|
1035
|
+
return void 0;
|
|
1036
|
+
}
|
|
1037
|
+
return InvoiceFromJson(invoiceJson);
|
|
1038
|
+
}
|
|
987
1039
|
/**
|
|
988
1040
|
* Decodes an encoded lightning invoice string.
|
|
989
1041
|
*
|
|
@@ -1372,7 +1424,8 @@ var parseWebhook = async (data) => {
|
|
|
1372
1424
|
event_type: WebhookEventType[event.event_type],
|
|
1373
1425
|
event_id: event.event_id,
|
|
1374
1426
|
timestamp: new Date(event.timestamp),
|
|
1375
|
-
entity_id: event.entity_id
|
|
1427
|
+
entity_id: event.entity_id,
|
|
1428
|
+
wallet_id: event.wallet_id
|
|
1376
1429
|
};
|
|
1377
1430
|
};
|
|
1378
1431
|
export {
|
|
@@ -1405,6 +1458,7 @@ export {
|
|
|
1405
1458
|
TransactionType_default as TransactionType,
|
|
1406
1459
|
WEBHOOKS_SIGNATURE_HEADER,
|
|
1407
1460
|
Wallet_default as Wallet,
|
|
1461
|
+
WalletStatus_default as WalletStatus,
|
|
1408
1462
|
WebhookEventType_default as WebhookEventType,
|
|
1409
1463
|
WithdrawalMode_default as WithdrawalMode,
|
|
1410
1464
|
WithdrawalRequest_default as WithdrawalRequest,
|
|
@@ -1417,6 +1471,7 @@ export {
|
|
|
1417
1471
|
getIncomingPaymentAttemptQuery,
|
|
1418
1472
|
getInvoiceQuery,
|
|
1419
1473
|
getLightningTransactionQuery,
|
|
1474
|
+
getLightsparkNodeOwnerQuery,
|
|
1420
1475
|
getOnChainTransactionQuery,
|
|
1421
1476
|
getPaymentRequestQuery,
|
|
1422
1477
|
getRoutingTransactionQuery,
|
package/dist/objects/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ __export(objects_exports, {
|
|
|
56
56
|
TransactionStatus: () => TransactionStatus_default,
|
|
57
57
|
TransactionType: () => TransactionType_default,
|
|
58
58
|
Wallet: () => Wallet_default,
|
|
59
|
+
WalletStatus: () => WalletStatus_default,
|
|
59
60
|
WebhookEventType: () => WebhookEventType_default,
|
|
60
61
|
WithdrawalMode: () => WithdrawalMode_default,
|
|
61
62
|
WithdrawalRequest: () => WithdrawalRequest_default,
|
|
@@ -68,6 +69,7 @@ __export(objects_exports, {
|
|
|
68
69
|
getIncomingPaymentAttemptQuery: () => getIncomingPaymentAttemptQuery,
|
|
69
70
|
getInvoiceQuery: () => getInvoiceQuery,
|
|
70
71
|
getLightningTransactionQuery: () => getLightningTransactionQuery,
|
|
72
|
+
getLightsparkNodeOwnerQuery: () => getLightsparkNodeOwnerQuery,
|
|
71
73
|
getOnChainTransactionQuery: () => getOnChainTransactionQuery,
|
|
72
74
|
getPaymentRequestQuery: () => getPaymentRequestQuery,
|
|
73
75
|
getRoutingTransactionQuery: () => getRoutingTransactionQuery,
|
|
@@ -588,13 +590,14 @@ var SecretFromJson = (obj) => {
|
|
|
588
590
|
|
|
589
591
|
// src/objects/LightsparkNode.ts
|
|
590
592
|
var LightsparkNode = class {
|
|
591
|
-
constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, accountId, typename, alias, color, conductivity, publicKey, blockchainBalance, encryptedSigningPrivateKey, totalBalance, totalLocalBalance, localBalance, purpose, remoteBalance, status) {
|
|
593
|
+
constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, accountId, ownerId, typename, alias, color, conductivity, publicKey, blockchainBalance, encryptedSigningPrivateKey, totalBalance, totalLocalBalance, localBalance, purpose, remoteBalance, status) {
|
|
592
594
|
this.id = id;
|
|
593
595
|
this.createdAt = createdAt;
|
|
594
596
|
this.updatedAt = updatedAt;
|
|
595
597
|
this.bitcoinNetwork = bitcoinNetwork;
|
|
596
598
|
this.displayName = displayName;
|
|
597
599
|
this.accountId = accountId;
|
|
600
|
+
this.ownerId = ownerId;
|
|
598
601
|
this.typename = typename;
|
|
599
602
|
this.alias = alias;
|
|
600
603
|
this.color = color;
|
|
@@ -784,6 +787,7 @@ var LightsparkNodeFromJson = (obj) => {
|
|
|
784
787
|
BitcoinNetwork_default[obj["lightspark_node_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
|
|
785
788
|
obj["lightspark_node_display_name"],
|
|
786
789
|
obj["lightspark_node_account"].id,
|
|
790
|
+
obj["lightspark_node_owner"].id,
|
|
787
791
|
"LightsparkNode",
|
|
788
792
|
obj["lightspark_node_alias"],
|
|
789
793
|
obj["lightspark_node_color"],
|
|
@@ -814,6 +818,9 @@ fragment LightsparkNodeFragment on LightsparkNode {
|
|
|
814
818
|
lightspark_node_account: account {
|
|
815
819
|
id
|
|
816
820
|
}
|
|
821
|
+
lightspark_node_owner: owner {
|
|
822
|
+
id
|
|
823
|
+
}
|
|
817
824
|
lightspark_node_blockchain_balance: blockchain_balance {
|
|
818
825
|
__typename
|
|
819
826
|
blockchain_balance_total_balance: total_balance {
|
|
@@ -1097,6 +1104,7 @@ var NodeFromJson = (obj) => {
|
|
|
1097
1104
|
BitcoinNetwork_default[obj["lightspark_node_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
|
|
1098
1105
|
obj["lightspark_node_display_name"],
|
|
1099
1106
|
obj["lightspark_node_account"].id,
|
|
1107
|
+
obj["lightspark_node_owner"].id,
|
|
1100
1108
|
"LightsparkNode",
|
|
1101
1109
|
obj["lightspark_node_alias"],
|
|
1102
1110
|
obj["lightspark_node_color"],
|
|
@@ -1146,6 +1154,9 @@ fragment NodeFragment on Node {
|
|
|
1146
1154
|
lightspark_node_account: account {
|
|
1147
1155
|
id
|
|
1148
1156
|
}
|
|
1157
|
+
lightspark_node_owner: owner {
|
|
1158
|
+
id
|
|
1159
|
+
}
|
|
1149
1160
|
lightspark_node_blockchain_balance: blockchain_balance {
|
|
1150
1161
|
__typename
|
|
1151
1162
|
blockchain_balance_total_balance: total_balance {
|
|
@@ -1334,6 +1345,9 @@ fragment PaymentRequestFragment on PaymentRequest {
|
|
|
1334
1345
|
lightspark_node_account: account {
|
|
1335
1346
|
id
|
|
1336
1347
|
}
|
|
1348
|
+
lightspark_node_owner: owner {
|
|
1349
|
+
id
|
|
1350
|
+
}
|
|
1337
1351
|
lightspark_node_blockchain_balance: blockchain_balance {
|
|
1338
1352
|
__typename
|
|
1339
1353
|
blockchain_balance_total_balance: total_balance {
|
|
@@ -2167,6 +2181,9 @@ fragment OutgoingPaymentFragment on OutgoingPayment {
|
|
|
2167
2181
|
lightspark_node_account: account {
|
|
2168
2182
|
id
|
|
2169
2183
|
}
|
|
2184
|
+
lightspark_node_owner: owner {
|
|
2185
|
+
id
|
|
2186
|
+
}
|
|
2170
2187
|
lightspark_node_blockchain_balance: blockchain_balance {
|
|
2171
2188
|
__typename
|
|
2172
2189
|
blockchain_balance_total_balance: total_balance {
|
|
@@ -2611,6 +2628,9 @@ fragment TransactionFragment on Transaction {
|
|
|
2611
2628
|
lightspark_node_account: account {
|
|
2612
2629
|
id
|
|
2613
2630
|
}
|
|
2631
|
+
lightspark_node_owner: owner {
|
|
2632
|
+
id
|
|
2633
|
+
}
|
|
2614
2634
|
lightspark_node_blockchain_balance: blockchain_balance {
|
|
2615
2635
|
__typename
|
|
2616
2636
|
blockchain_balance_total_balance: total_balance {
|
|
@@ -2836,13 +2856,30 @@ var BalancesFromJson = (obj) => {
|
|
|
2836
2856
|
};
|
|
2837
2857
|
};
|
|
2838
2858
|
|
|
2859
|
+
// src/objects/WalletStatus.ts
|
|
2860
|
+
var WalletStatus = /* @__PURE__ */ ((WalletStatus2) => {
|
|
2861
|
+
WalletStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
2862
|
+
WalletStatus2["NOT_SETUP"] = "NOT_SETUP";
|
|
2863
|
+
WalletStatus2["DEPLOYING"] = "DEPLOYING";
|
|
2864
|
+
WalletStatus2["DEPLOYED"] = "DEPLOYED";
|
|
2865
|
+
WalletStatus2["INITIALIZING"] = "INITIALIZING";
|
|
2866
|
+
WalletStatus2["READY"] = "READY";
|
|
2867
|
+
WalletStatus2["UNAVAILABLE"] = "UNAVAILABLE";
|
|
2868
|
+
WalletStatus2["FAILED"] = "FAILED";
|
|
2869
|
+
WalletStatus2["TERMINATING"] = "TERMINATING";
|
|
2870
|
+
WalletStatus2["TERMINATED"] = "TERMINATED";
|
|
2871
|
+
return WalletStatus2;
|
|
2872
|
+
})(WalletStatus || {});
|
|
2873
|
+
var WalletStatus_default = WalletStatus;
|
|
2874
|
+
|
|
2839
2875
|
// src/objects/Wallet.ts
|
|
2840
2876
|
var Wallet = class {
|
|
2841
|
-
constructor(id, createdAt, updatedAt, thirdPartyIdentifier, typename, lastLoginAt, balances) {
|
|
2877
|
+
constructor(id, createdAt, updatedAt, thirdPartyIdentifier, status, typename, lastLoginAt, balances) {
|
|
2842
2878
|
this.id = id;
|
|
2843
2879
|
this.createdAt = createdAt;
|
|
2844
2880
|
this.updatedAt = updatedAt;
|
|
2845
2881
|
this.thirdPartyIdentifier = thirdPartyIdentifier;
|
|
2882
|
+
this.status = status;
|
|
2846
2883
|
this.typename = typename;
|
|
2847
2884
|
this.lastLoginAt = lastLoginAt;
|
|
2848
2885
|
this.balances = balances;
|
|
@@ -2904,11 +2941,11 @@ query FetchWalletTotalAmountSent($created_after_date: DateTime, $created_before_
|
|
|
2904
2941
|
}
|
|
2905
2942
|
});
|
|
2906
2943
|
}
|
|
2907
|
-
static getWalletQuery() {
|
|
2944
|
+
static getWalletQuery(id) {
|
|
2908
2945
|
return {
|
|
2909
2946
|
queryPayload: `
|
|
2910
|
-
query GetWallet {
|
|
2911
|
-
|
|
2947
|
+
query GetWallet($id: ID!) {
|
|
2948
|
+
entity(id: $id) {
|
|
2912
2949
|
... on Wallet {
|
|
2913
2950
|
...WalletFragment
|
|
2914
2951
|
}
|
|
@@ -2917,8 +2954,8 @@ query GetWallet {
|
|
|
2917
2954
|
|
|
2918
2955
|
${FRAGMENT13}
|
|
2919
2956
|
`,
|
|
2920
|
-
variables: {},
|
|
2921
|
-
constructObject: (data) => WalletFromJson(data.
|
|
2957
|
+
variables: { id },
|
|
2958
|
+
constructObject: (data) => WalletFromJson(data.entity)
|
|
2922
2959
|
};
|
|
2923
2960
|
}
|
|
2924
2961
|
};
|
|
@@ -2928,6 +2965,7 @@ var WalletFromJson = (obj) => {
|
|
|
2928
2965
|
obj["wallet_created_at"],
|
|
2929
2966
|
obj["wallet_updated_at"],
|
|
2930
2967
|
obj["wallet_third_party_identifier"],
|
|
2968
|
+
WalletStatus_default[obj["wallet_status"]] ?? WalletStatus_default.FUTURE_VALUE,
|
|
2931
2969
|
"Wallet",
|
|
2932
2970
|
obj["wallet_last_login_at"],
|
|
2933
2971
|
!!obj["wallet_balances"] ? BalancesFromJson(obj["wallet_balances"]) : void 0
|
|
@@ -2968,6 +3006,7 @@ fragment WalletFragment on Wallet {
|
|
|
2968
3006
|
}
|
|
2969
3007
|
}
|
|
2970
3008
|
wallet_third_party_identifier: third_party_identifier
|
|
3009
|
+
wallet_status: status
|
|
2971
3010
|
}`;
|
|
2972
3011
|
var Wallet_default = Wallet;
|
|
2973
3012
|
|
|
@@ -3171,6 +3210,9 @@ query FetchAccountToNodesConnection($first: Int, $bitcoin_networks: [BitcoinNetw
|
|
|
3171
3210
|
lightspark_node_account: account {
|
|
3172
3211
|
id
|
|
3173
3212
|
}
|
|
3213
|
+
lightspark_node_owner: owner {
|
|
3214
|
+
id
|
|
3215
|
+
}
|
|
3174
3216
|
lightspark_node_blockchain_balance: blockchain_balance {
|
|
3175
3217
|
__typename
|
|
3176
3218
|
blockchain_balance_total_balance: total_balance {
|
|
@@ -3680,6 +3722,9 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types:
|
|
|
3680
3722
|
lightspark_node_account: account {
|
|
3681
3723
|
id
|
|
3682
3724
|
}
|
|
3725
|
+
lightspark_node_owner: owner {
|
|
3726
|
+
id
|
|
3727
|
+
}
|
|
3683
3728
|
lightspark_node_blockchain_balance: blockchain_balance {
|
|
3684
3729
|
__typename
|
|
3685
3730
|
blockchain_balance_total_balance: total_balance {
|
|
@@ -3938,6 +3983,9 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
|
|
|
3938
3983
|
lightspark_node_account: account {
|
|
3939
3984
|
id
|
|
3940
3985
|
}
|
|
3986
|
+
lightspark_node_owner: owner {
|
|
3987
|
+
id
|
|
3988
|
+
}
|
|
3941
3989
|
lightspark_node_blockchain_balance: blockchain_balance {
|
|
3942
3990
|
__typename
|
|
3943
3991
|
blockchain_balance_total_balance: total_balance {
|
|
@@ -4118,6 +4166,7 @@ query FetchAccountToWalletsConnection($first: Int) {
|
|
|
4118
4166
|
}
|
|
4119
4167
|
}
|
|
4120
4168
|
wallet_third_party_identifier: third_party_identifier
|
|
4169
|
+
wallet_status: status
|
|
4121
4170
|
}
|
|
4122
4171
|
}
|
|
4123
4172
|
}
|
|
@@ -4449,6 +4498,9 @@ fragment InvoiceFragment on Invoice {
|
|
|
4449
4498
|
lightspark_node_account: account {
|
|
4450
4499
|
id
|
|
4451
4500
|
}
|
|
4501
|
+
lightspark_node_owner: owner {
|
|
4502
|
+
id
|
|
4503
|
+
}
|
|
4452
4504
|
lightspark_node_blockchain_balance: blockchain_balance {
|
|
4453
4505
|
__typename
|
|
4454
4506
|
blockchain_balance_total_balance: total_balance {
|
|
@@ -4735,6 +4787,9 @@ fragment LightningTransactionFragment on LightningTransaction {
|
|
|
4735
4787
|
lightspark_node_account: account {
|
|
4736
4788
|
id
|
|
4737
4789
|
}
|
|
4790
|
+
lightspark_node_owner: owner {
|
|
4791
|
+
id
|
|
4792
|
+
}
|
|
4738
4793
|
lightspark_node_blockchain_balance: blockchain_balance {
|
|
4739
4794
|
__typename
|
|
4740
4795
|
blockchain_balance_total_balance: total_balance {
|
|
@@ -4890,8 +4945,102 @@ ${FRAGMENT19}
|
|
|
4890
4945
|
};
|
|
4891
4946
|
};
|
|
4892
4947
|
|
|
4893
|
-
// src/objects/
|
|
4948
|
+
// src/objects/LightsparkNodeOwner.ts
|
|
4894
4949
|
var import_core6 = require("@lightsparkdev/core");
|
|
4950
|
+
var LightsparkNodeOwnerFromJson = (obj) => {
|
|
4951
|
+
if (obj["__typename"] == "Account") {
|
|
4952
|
+
return new Account_default(
|
|
4953
|
+
obj["account_id"],
|
|
4954
|
+
obj["account_created_at"],
|
|
4955
|
+
obj["account_updated_at"],
|
|
4956
|
+
"Account",
|
|
4957
|
+
obj["account_name"]
|
|
4958
|
+
);
|
|
4959
|
+
}
|
|
4960
|
+
if (obj["__typename"] == "Wallet") {
|
|
4961
|
+
return new Wallet_default(
|
|
4962
|
+
obj["wallet_id"],
|
|
4963
|
+
obj["wallet_created_at"],
|
|
4964
|
+
obj["wallet_updated_at"],
|
|
4965
|
+
obj["wallet_third_party_identifier"],
|
|
4966
|
+
WalletStatus_default[obj["wallet_status"]] ?? WalletStatus_default.FUTURE_VALUE,
|
|
4967
|
+
"Wallet",
|
|
4968
|
+
obj["wallet_last_login_at"],
|
|
4969
|
+
!!obj["wallet_balances"] ? BalancesFromJson(obj["wallet_balances"]) : void 0
|
|
4970
|
+
);
|
|
4971
|
+
}
|
|
4972
|
+
throw new import_core6.LightsparkException(
|
|
4973
|
+
"DeserializationError",
|
|
4974
|
+
`Couldn't find a concrete type for interface LightsparkNodeOwner corresponding to the typename=${obj["__typename"]}`
|
|
4975
|
+
);
|
|
4976
|
+
};
|
|
4977
|
+
var FRAGMENT20 = `
|
|
4978
|
+
fragment LightsparkNodeOwnerFragment on LightsparkNodeOwner {
|
|
4979
|
+
__typename
|
|
4980
|
+
... on Account {
|
|
4981
|
+
__typename
|
|
4982
|
+
account_id: id
|
|
4983
|
+
account_created_at: created_at
|
|
4984
|
+
account_updated_at: updated_at
|
|
4985
|
+
account_name: name
|
|
4986
|
+
}
|
|
4987
|
+
... on Wallet {
|
|
4988
|
+
__typename
|
|
4989
|
+
wallet_id: id
|
|
4990
|
+
wallet_created_at: created_at
|
|
4991
|
+
wallet_updated_at: updated_at
|
|
4992
|
+
wallet_last_login_at: last_login_at
|
|
4993
|
+
wallet_balances: balances {
|
|
4994
|
+
__typename
|
|
4995
|
+
balances_owned_balance: owned_balance {
|
|
4996
|
+
__typename
|
|
4997
|
+
currency_amount_original_value: original_value
|
|
4998
|
+
currency_amount_original_unit: original_unit
|
|
4999
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
5000
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
5001
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
5002
|
+
}
|
|
5003
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
5004
|
+
__typename
|
|
5005
|
+
currency_amount_original_value: original_value
|
|
5006
|
+
currency_amount_original_unit: original_unit
|
|
5007
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
5008
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
5009
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
5010
|
+
}
|
|
5011
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
5012
|
+
__typename
|
|
5013
|
+
currency_amount_original_value: original_value
|
|
5014
|
+
currency_amount_original_unit: original_unit
|
|
5015
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
5016
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
5017
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
5018
|
+
}
|
|
5019
|
+
}
|
|
5020
|
+
wallet_third_party_identifier: third_party_identifier
|
|
5021
|
+
wallet_status: status
|
|
5022
|
+
}
|
|
5023
|
+
}`;
|
|
5024
|
+
var getLightsparkNodeOwnerQuery = (id) => {
|
|
5025
|
+
return {
|
|
5026
|
+
queryPayload: `
|
|
5027
|
+
query GetLightsparkNodeOwner($id: ID!) {
|
|
5028
|
+
entity(id: $id) {
|
|
5029
|
+
... on LightsparkNodeOwner {
|
|
5030
|
+
...LightsparkNodeOwnerFragment
|
|
5031
|
+
}
|
|
5032
|
+
}
|
|
5033
|
+
}
|
|
5034
|
+
|
|
5035
|
+
${FRAGMENT20}
|
|
5036
|
+
`,
|
|
5037
|
+
variables: { id },
|
|
5038
|
+
constructObject: (data) => LightsparkNodeOwnerFromJson(data.entity)
|
|
5039
|
+
};
|
|
5040
|
+
};
|
|
5041
|
+
|
|
5042
|
+
// src/objects/OnChainTransaction.ts
|
|
5043
|
+
var import_core7 = require("@lightsparkdev/core");
|
|
4895
5044
|
var OnChainTransactionFromJson = (obj) => {
|
|
4896
5045
|
if (obj["__typename"] == "ChannelClosingTransaction") {
|
|
4897
5046
|
return {
|
|
@@ -4965,12 +5114,12 @@ var OnChainTransactionFromJson = (obj) => {
|
|
|
4965
5114
|
numConfirmations: obj["withdrawal_num_confirmations"]
|
|
4966
5115
|
};
|
|
4967
5116
|
}
|
|
4968
|
-
throw new
|
|
5117
|
+
throw new import_core7.LightsparkException(
|
|
4969
5118
|
"DeserializationError",
|
|
4970
5119
|
`Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`
|
|
4971
5120
|
);
|
|
4972
5121
|
};
|
|
4973
|
-
var
|
|
5122
|
+
var FRAGMENT21 = `
|
|
4974
5123
|
fragment OnChainTransactionFragment on OnChainTransaction {
|
|
4975
5124
|
__typename
|
|
4976
5125
|
... on ChannelClosingTransaction {
|
|
@@ -5113,7 +5262,7 @@ query GetOnChainTransaction($id: ID!) {
|
|
|
5113
5262
|
}
|
|
5114
5263
|
}
|
|
5115
5264
|
|
|
5116
|
-
${
|
|
5265
|
+
${FRAGMENT21}
|
|
5117
5266
|
`,
|
|
5118
5267
|
variables: { id },
|
|
5119
5268
|
constructObject: (data) => OnChainTransactionFromJson(data.entity)
|
|
@@ -5147,7 +5296,7 @@ var RoutingTransactionFromJson = (obj) => {
|
|
|
5147
5296
|
failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
|
|
5148
5297
|
};
|
|
5149
5298
|
};
|
|
5150
|
-
var
|
|
5299
|
+
var FRAGMENT22 = `
|
|
5151
5300
|
fragment RoutingTransactionFragment on RoutingTransaction {
|
|
5152
5301
|
__typename
|
|
5153
5302
|
routing_transaction_id: id
|
|
@@ -5195,7 +5344,7 @@ query GetRoutingTransaction($id: ID!) {
|
|
|
5195
5344
|
}
|
|
5196
5345
|
}
|
|
5197
5346
|
|
|
5198
|
-
${
|
|
5347
|
+
${FRAGMENT22}
|
|
5199
5348
|
`,
|
|
5200
5349
|
variables: { id },
|
|
5201
5350
|
constructObject: (data) => RoutingTransactionFromJson(data.entity)
|
|
@@ -5252,7 +5401,7 @@ var WithdrawalFromJson = (obj) => {
|
|
|
5252
5401
|
numConfirmations: obj["withdrawal_num_confirmations"]
|
|
5253
5402
|
};
|
|
5254
5403
|
};
|
|
5255
|
-
var
|
|
5404
|
+
var FRAGMENT23 = `
|
|
5256
5405
|
fragment WithdrawalFragment on Withdrawal {
|
|
5257
5406
|
__typename
|
|
5258
5407
|
withdrawal_id: id
|
|
@@ -5296,7 +5445,7 @@ query GetWithdrawal($id: ID!) {
|
|
|
5296
5445
|
}
|
|
5297
5446
|
}
|
|
5298
5447
|
|
|
5299
|
-
${
|
|
5448
|
+
${FRAGMENT23}
|
|
5300
5449
|
`,
|
|
5301
5450
|
variables: { id },
|
|
5302
5451
|
constructObject: (data) => WithdrawalFromJson(data.entity)
|
|
@@ -5489,7 +5638,7 @@ query GetWithdrawalRequest($id: ID!) {
|
|
|
5489
5638
|
}
|
|
5490
5639
|
}
|
|
5491
5640
|
|
|
5492
|
-
${
|
|
5641
|
+
${FRAGMENT24}
|
|
5493
5642
|
`,
|
|
5494
5643
|
variables: { id },
|
|
5495
5644
|
constructObject: (data) => WithdrawalRequestFromJson(data.entity)
|
|
@@ -5511,7 +5660,7 @@ var WithdrawalRequestFromJson = (obj) => {
|
|
|
5511
5660
|
obj["withdrawal_request_withdrawal"]?.id ?? void 0
|
|
5512
5661
|
);
|
|
5513
5662
|
};
|
|
5514
|
-
var
|
|
5663
|
+
var FRAGMENT24 = `
|
|
5515
5664
|
fragment WithdrawalRequestFragment on WithdrawalRequest {
|
|
5516
5665
|
__typename
|
|
5517
5666
|
withdrawal_request_id: id
|
|
@@ -5570,6 +5719,7 @@ var WithdrawalRequest_default = WithdrawalRequest;
|
|
|
5570
5719
|
TransactionStatus,
|
|
5571
5720
|
TransactionType,
|
|
5572
5721
|
Wallet,
|
|
5722
|
+
WalletStatus,
|
|
5573
5723
|
WebhookEventType,
|
|
5574
5724
|
WithdrawalMode,
|
|
5575
5725
|
WithdrawalRequest,
|
|
@@ -5582,6 +5732,7 @@ var WithdrawalRequest_default = WithdrawalRequest;
|
|
|
5582
5732
|
getIncomingPaymentAttemptQuery,
|
|
5583
5733
|
getInvoiceQuery,
|
|
5584
5734
|
getLightningTransactionQuery,
|
|
5735
|
+
getLightsparkNodeOwnerQuery,
|
|
5585
5736
|
getOnChainTransactionQuery,
|
|
5586
5737
|
getPaymentRequestQuery,
|
|
5587
5738
|
getRoutingTransactionQuery,
|