@lightsparkdev/lightspark-sdk 1.8.0 → 1.8.2
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 +15 -0
- package/dist/{chunk-J7GJGYME.js → chunk-4KFNQOMH.js} +84 -39
- package/dist/{index-9a69ef6a.d.ts → index-27dad75b.d.ts} +22 -1
- package/dist/index.cjs +240 -91
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +103 -3
- package/dist/objects/index.cjs +97 -52
- package/dist/objects/index.d.cts +1 -1
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +1 -1
- package/package.json +2 -2
- package/src/client.ts +89 -8
- package/src/graphql/IncomingPaymentsForInvoice.ts +21 -0
- package/src/graphql/OutgoingPaymentsForInvoice.ts +21 -0
- package/src/objects/Account.ts +4 -2
- package/src/objects/ApiToken.ts +2 -2
- package/src/objects/AuditLogActor.ts +2 -2
- package/src/objects/Channel.ts +2 -2
- package/src/objects/ChannelClosingTransaction.ts +2 -2
- package/src/objects/ChannelOpeningTransaction.ts +2 -2
- package/src/objects/ChannelSnapshot.ts +2 -2
- package/src/objects/Deposit.ts +2 -2
- package/src/objects/GraphNode.ts +2 -2
- package/src/objects/Hop.ts +2 -2
- package/src/objects/IncomingPayment.ts +2 -2
- package/src/objects/IncomingPaymentAttempt.ts +2 -2
- package/src/objects/Invoice.ts +2 -2
- package/src/objects/LightningTransaction.ts +2 -2
- package/src/objects/LightsparkNode.ts +2 -2
- package/src/objects/LightsparkNodeOwner.ts +2 -2
- package/src/objects/LightsparkNodeWithOSK.ts +2 -2
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +2 -2
- package/src/objects/Node.ts +2 -2
- package/src/objects/OnChainTransaction.ts +2 -2
- package/src/objects/OutgoingPayment.ts +2 -2
- package/src/objects/OutgoingPaymentAttempt.ts +2 -2
- package/src/objects/PaymentRequest.ts +2 -2
- package/src/objects/RoutingTransaction.ts +2 -2
- package/src/objects/Signable.ts +2 -2
- package/src/objects/SignablePayload.ts +2 -2
- package/src/objects/Transaction.ts +2 -2
- package/src/objects/UmaInvitation.ts +2 -2
- package/src/objects/Wallet.ts +2 -2
- package/src/objects/Withdrawal.ts +2 -2
- package/src/objects/WithdrawalRequest.ts +2 -2
- package/src/tests/generated-objects.test.ts +93 -0
- package/src/tests/serialization.test.ts +0 -21
package/dist/index.cjs
CHANGED
|
@@ -1981,12 +1981,12 @@ var AccountTokenAuthProvider = class {
|
|
|
1981
1981
|
var AccountTokenAuthProvider_default = AccountTokenAuthProvider;
|
|
1982
1982
|
|
|
1983
1983
|
// src/client.ts
|
|
1984
|
-
var
|
|
1984
|
+
var import_core28 = require("@lightsparkdev/core");
|
|
1985
1985
|
|
|
1986
1986
|
// package.json
|
|
1987
1987
|
var package_default = {
|
|
1988
1988
|
name: "@lightsparkdev/lightspark-sdk",
|
|
1989
|
-
version: "1.8.
|
|
1989
|
+
version: "1.8.2",
|
|
1990
1990
|
description: "Lightspark JS SDK",
|
|
1991
1991
|
author: "Lightspark Inc.",
|
|
1992
1992
|
keywords: [
|
|
@@ -2071,7 +2071,7 @@ var package_default = {
|
|
|
2071
2071
|
},
|
|
2072
2072
|
license: "Apache-2.0",
|
|
2073
2073
|
dependencies: {
|
|
2074
|
-
"@lightsparkdev/core": "1.2.
|
|
2074
|
+
"@lightsparkdev/core": "1.2.1",
|
|
2075
2075
|
"@lightsparkdev/crypto-wasm": "0.1.4",
|
|
2076
2076
|
"crypto-browserify": "^3.12.0",
|
|
2077
2077
|
dayjs: "^1.11.7",
|
|
@@ -2364,6 +2364,9 @@ var BitcoinFeeEstimate = `
|
|
|
2364
2364
|
${FRAGMENT2}
|
|
2365
2365
|
`;
|
|
2366
2366
|
|
|
2367
|
+
// src/objects/Invoice.ts
|
|
2368
|
+
var import_core9 = require("@lightsparkdev/core");
|
|
2369
|
+
|
|
2367
2370
|
// src/objects/BitcoinNetwork.ts
|
|
2368
2371
|
var BitcoinNetwork = /* @__PURE__ */ ((BitcoinNetwork2) => {
|
|
2369
2372
|
BitcoinNetwork2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
@@ -2376,7 +2379,7 @@ var BitcoinNetwork = /* @__PURE__ */ ((BitcoinNetwork2) => {
|
|
|
2376
2379
|
var BitcoinNetwork_default = BitcoinNetwork;
|
|
2377
2380
|
|
|
2378
2381
|
// src/objects/Node.ts
|
|
2379
|
-
var
|
|
2382
|
+
var import_core8 = require("@lightsparkdev/core");
|
|
2380
2383
|
|
|
2381
2384
|
// src/objects/Balances.ts
|
|
2382
2385
|
var BalancesFromJson = (obj) => {
|
|
@@ -2424,6 +2427,9 @@ var BlockchainBalanceToJson = (obj) => {
|
|
|
2424
2427
|
};
|
|
2425
2428
|
};
|
|
2426
2429
|
|
|
2430
|
+
// src/objects/GraphNode.ts
|
|
2431
|
+
var import_core4 = require("@lightsparkdev/core");
|
|
2432
|
+
|
|
2427
2433
|
// src/objects/NodeAddressType.ts
|
|
2428
2434
|
var NodeAddressType = /* @__PURE__ */ ((NodeAddressType2) => {
|
|
2429
2435
|
NodeAddressType2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
@@ -2507,7 +2513,7 @@ query GetGraphNode($id: ID!) {
|
|
|
2507
2513
|
${FRAGMENT3}
|
|
2508
2514
|
`,
|
|
2509
2515
|
variables: { id },
|
|
2510
|
-
constructObject: (data) =>
|
|
2516
|
+
constructObject: (data) => (0, import_core4.isObject)(data) && "entity" in data && (0, import_core4.isObject)(data.entity) ? GraphNodeFromJson(data.entity) : null
|
|
2511
2517
|
};
|
|
2512
2518
|
}
|
|
2513
2519
|
toJson() {
|
|
@@ -2571,6 +2577,12 @@ var LightsparkNodeStatus = /* @__PURE__ */ ((LightsparkNodeStatus2) => {
|
|
|
2571
2577
|
})(LightsparkNodeStatus || {});
|
|
2572
2578
|
var LightsparkNodeStatus_default = LightsparkNodeStatus;
|
|
2573
2579
|
|
|
2580
|
+
// src/objects/LightsparkNodeWithOSK.ts
|
|
2581
|
+
var import_core6 = require("@lightsparkdev/core");
|
|
2582
|
+
|
|
2583
|
+
// src/objects/Channel.ts
|
|
2584
|
+
var import_core5 = require("@lightsparkdev/core");
|
|
2585
|
+
|
|
2574
2586
|
// src/objects/ChannelFees.ts
|
|
2575
2587
|
var ChannelFeesFromJson = (obj) => {
|
|
2576
2588
|
return {
|
|
@@ -2725,7 +2737,7 @@ query GetChannel($id: ID!) {
|
|
|
2725
2737
|
${FRAGMENT4}
|
|
2726
2738
|
`,
|
|
2727
2739
|
variables: { id },
|
|
2728
|
-
constructObject: (data) =>
|
|
2740
|
+
constructObject: (data) => (0, import_core5.isObject)(data) && "entity" in data && (0, import_core5.isObject)(data.entity) ? ChannelFromJson(data.entity) : null
|
|
2729
2741
|
};
|
|
2730
2742
|
}
|
|
2731
2743
|
toJson() {
|
|
@@ -3175,7 +3187,7 @@ query GetLightsparkNodeWithOSK($id: ID!) {
|
|
|
3175
3187
|
${FRAGMENT5}
|
|
3176
3188
|
`,
|
|
3177
3189
|
variables: { id },
|
|
3178
|
-
constructObject: (data) =>
|
|
3190
|
+
constructObject: (data) => (0, import_core6.isObject)(data) && "entity" in data && (0, import_core6.isObject)(data.entity) ? LightsparkNodeWithOSKFromJson(data.entity) : null
|
|
3179
3191
|
};
|
|
3180
3192
|
}
|
|
3181
3193
|
toJson() {
|
|
@@ -3369,6 +3381,7 @@ fragment LightsparkNodeWithOSKFragment on LightsparkNodeWithOSK {
|
|
|
3369
3381
|
var LightsparkNodeWithOSK_default = LightsparkNodeWithOSK;
|
|
3370
3382
|
|
|
3371
3383
|
// src/objects/LightsparkNodeWithRemoteSigning.ts
|
|
3384
|
+
var import_core7 = require("@lightsparkdev/core");
|
|
3372
3385
|
var LightsparkNodeWithRemoteSigning = class {
|
|
3373
3386
|
constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, ownerId, umaPrescreeningUtxos, typename, alias, color, conductivity, publicKey, status, totalBalance, totalLocalBalance, localBalance, remoteBalance, blockchainBalance, balances) {
|
|
3374
3387
|
this.id = id;
|
|
@@ -3604,7 +3617,7 @@ query GetLightsparkNodeWithRemoteSigning($id: ID!) {
|
|
|
3604
3617
|
${FRAGMENT6}
|
|
3605
3618
|
`,
|
|
3606
3619
|
variables: { id },
|
|
3607
|
-
constructObject: (data) =>
|
|
3620
|
+
constructObject: (data) => (0, import_core7.isObject)(data) && "entity" in data && (0, import_core7.isObject)(data.entity) ? LightsparkNodeWithRemoteSigningFromJson(data.entity) : null
|
|
3608
3621
|
};
|
|
3609
3622
|
}
|
|
3610
3623
|
toJson() {
|
|
@@ -3879,7 +3892,7 @@ var NodeFromJson = (obj) => {
|
|
|
3879
3892
|
!!obj["lightspark_node_with_remote_signing_balances"] ? BalancesFromJson(obj["lightspark_node_with_remote_signing_balances"]) : void 0
|
|
3880
3893
|
);
|
|
3881
3894
|
}
|
|
3882
|
-
throw new
|
|
3895
|
+
throw new import_core8.LightsparkException(
|
|
3883
3896
|
"DeserializationError",
|
|
3884
3897
|
`Couldn't find a concrete type for interface Node corresponding to the typename=${obj["__typename"]}`
|
|
3885
3898
|
);
|
|
@@ -3955,7 +3968,7 @@ var NodeToJson = (obj) => {
|
|
|
3955
3968
|
lightspark_node_with_remote_signing_balances: lightsparkNodeWithRemoteSigning.balances ? BalancesToJson(lightsparkNodeWithRemoteSigning.balances) : void 0
|
|
3956
3969
|
};
|
|
3957
3970
|
}
|
|
3958
|
-
throw new
|
|
3971
|
+
throw new import_core8.LightsparkException(
|
|
3959
3972
|
"DeserializationError",
|
|
3960
3973
|
`Couldn't find a concrete type for interface Node corresponding to the typename=${obj.typename}`
|
|
3961
3974
|
);
|
|
@@ -4249,7 +4262,7 @@ query GetNode($id: ID!) {
|
|
|
4249
4262
|
${FRAGMENT7}
|
|
4250
4263
|
`,
|
|
4251
4264
|
variables: { id },
|
|
4252
|
-
constructObject: (data) =>
|
|
4265
|
+
constructObject: (data) => (0, import_core8.isObject)(data) && "entity" in data && (0, import_core8.isObject)(data.entity) ? NodeFromJson(data.entity) : null
|
|
4253
4266
|
};
|
|
4254
4267
|
};
|
|
4255
4268
|
|
|
@@ -4906,7 +4919,7 @@ query GetInvoice($id: ID!) {
|
|
|
4906
4919
|
${FRAGMENT9}
|
|
4907
4920
|
`,
|
|
4908
4921
|
variables: { id },
|
|
4909
|
-
constructObject: (data) =>
|
|
4922
|
+
constructObject: (data) => (0, import_core9.isObject)(data) && "entity" in data && (0, import_core9.isObject)(data.entity) ? InvoiceFromJson(data.entity) : null
|
|
4910
4923
|
};
|
|
4911
4924
|
};
|
|
4912
4925
|
|
|
@@ -4925,6 +4938,9 @@ var CancelInvoice = `
|
|
|
4925
4938
|
${FRAGMENT9}
|
|
4926
4939
|
`;
|
|
4927
4940
|
|
|
4941
|
+
// src/objects/UmaInvitation.ts
|
|
4942
|
+
var import_core10 = require("@lightsparkdev/core");
|
|
4943
|
+
|
|
4928
4944
|
// src/objects/IncentivesIneligibilityReason.ts
|
|
4929
4945
|
var IncentivesIneligibilityReason = /* @__PURE__ */ ((IncentivesIneligibilityReason2) => {
|
|
4930
4946
|
IncentivesIneligibilityReason2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
@@ -4990,7 +5006,7 @@ query GetUmaInvitation($id: ID!) {
|
|
|
4990
5006
|
${FRAGMENT10}
|
|
4991
5007
|
`,
|
|
4992
5008
|
variables: { id },
|
|
4993
|
-
constructObject: (data) =>
|
|
5009
|
+
constructObject: (data) => (0, import_core10.isObject)(data) && "entity" in data && (0, import_core10.isObject)(data.entity) ? UmaInvitationFromJson(data.entity) : null
|
|
4994
5010
|
};
|
|
4995
5011
|
};
|
|
4996
5012
|
|
|
@@ -5036,6 +5052,9 @@ var ClaimUmaInvitationWithIncentives = `
|
|
|
5036
5052
|
${FRAGMENT10}
|
|
5037
5053
|
`;
|
|
5038
5054
|
|
|
5055
|
+
// src/objects/ApiToken.ts
|
|
5056
|
+
var import_core11 = require("@lightsparkdev/core");
|
|
5057
|
+
|
|
5039
5058
|
// src/objects/Permission.ts
|
|
5040
5059
|
var Permission = /* @__PURE__ */ ((Permission2) => {
|
|
5041
5060
|
Permission2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
@@ -5095,7 +5114,7 @@ query GetApiToken($id: ID!) {
|
|
|
5095
5114
|
${FRAGMENT11}
|
|
5096
5115
|
`,
|
|
5097
5116
|
variables: { id },
|
|
5098
|
-
constructObject: (data) =>
|
|
5117
|
+
constructObject: (data) => (0, import_core11.isObject)(data) && "entity" in data && (0, import_core11.isObject)(data.entity) ? ApiTokenFromJson(data.entity) : null
|
|
5099
5118
|
};
|
|
5100
5119
|
};
|
|
5101
5120
|
|
|
@@ -5192,6 +5211,12 @@ mutation CreateTestModeInvoice(
|
|
|
5192
5211
|
}
|
|
5193
5212
|
`;
|
|
5194
5213
|
|
|
5214
|
+
// src/objects/IncomingPayment.ts
|
|
5215
|
+
var import_core13 = require("@lightsparkdev/core");
|
|
5216
|
+
|
|
5217
|
+
// src/objects/IncomingPaymentAttempt.ts
|
|
5218
|
+
var import_core12 = require("@lightsparkdev/core");
|
|
5219
|
+
|
|
5195
5220
|
// src/objects/IncomingPaymentAttemptStatus.ts
|
|
5196
5221
|
var IncomingPaymentAttemptStatus = /* @__PURE__ */ ((IncomingPaymentAttemptStatus2) => {
|
|
5197
5222
|
IncomingPaymentAttemptStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
@@ -5250,7 +5275,7 @@ query GetIncomingPaymentAttempt($id: ID!) {
|
|
|
5250
5275
|
${FRAGMENT12}
|
|
5251
5276
|
`,
|
|
5252
5277
|
variables: { id },
|
|
5253
|
-
constructObject: (data) =>
|
|
5278
|
+
constructObject: (data) => (0, import_core12.isObject)(data) && "entity" in data && (0, import_core12.isObject)(data.entity) ? IncomingPaymentAttemptFromJson(data.entity) : null
|
|
5254
5279
|
};
|
|
5255
5280
|
};
|
|
5256
5281
|
|
|
@@ -5379,7 +5404,7 @@ query GetIncomingPayment($id: ID!) {
|
|
|
5379
5404
|
${FRAGMENT13}
|
|
5380
5405
|
`,
|
|
5381
5406
|
variables: { id },
|
|
5382
|
-
constructObject: (data) =>
|
|
5407
|
+
constructObject: (data) => (0, import_core13.isObject)(data) && "entity" in data && (0, import_core13.isObject)(data.entity) ? IncomingPaymentFromJson(data.entity) : null
|
|
5383
5408
|
};
|
|
5384
5409
|
}
|
|
5385
5410
|
toJson() {
|
|
@@ -5598,6 +5623,25 @@ var FundNode = `
|
|
|
5598
5623
|
${FRAGMENT}
|
|
5599
5624
|
`;
|
|
5600
5625
|
|
|
5626
|
+
// src/graphql/IncomingPaymentsForInvoice.ts
|
|
5627
|
+
var IncomingPaymentsForInvoice = `
|
|
5628
|
+
query IncomingPaymentsForInvoice(
|
|
5629
|
+
$invoice_id: Hash32!,
|
|
5630
|
+
$statuses: [TransactionStatus!]
|
|
5631
|
+
) {
|
|
5632
|
+
incoming_payments_for_invoice(input: {
|
|
5633
|
+
invoice_id: $invoice_id
|
|
5634
|
+
statuses: $statuses
|
|
5635
|
+
}) {
|
|
5636
|
+
payments {
|
|
5637
|
+
...IncomingPaymentFragment
|
|
5638
|
+
}
|
|
5639
|
+
}
|
|
5640
|
+
}
|
|
5641
|
+
|
|
5642
|
+
${FRAGMENT13}
|
|
5643
|
+
`;
|
|
5644
|
+
|
|
5601
5645
|
// src/graphql/InvoiceForPaymentHash.ts
|
|
5602
5646
|
var InvoiceForPaymentHash = `
|
|
5603
5647
|
query InvoiceForPaymentHash($payment_hash: Hash32!) {
|
|
@@ -5740,6 +5784,12 @@ var MultiNodeDashboard = `
|
|
|
5740
5784
|
${FRAGMENT}
|
|
5741
5785
|
`;
|
|
5742
5786
|
|
|
5787
|
+
// src/objects/OutgoingPayment.ts
|
|
5788
|
+
var import_core17 = require("@lightsparkdev/core");
|
|
5789
|
+
|
|
5790
|
+
// src/objects/OutgoingPaymentAttempt.ts
|
|
5791
|
+
var import_core15 = require("@lightsparkdev/core");
|
|
5792
|
+
|
|
5743
5793
|
// src/objects/HtlcAttemptFailureCode.ts
|
|
5744
5794
|
var HtlcAttemptFailureCode = /* @__PURE__ */ ((HtlcAttemptFailureCode2) => {
|
|
5745
5795
|
HtlcAttemptFailureCode2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
@@ -5786,6 +5836,7 @@ var OutgoingPaymentAttemptStatus = /* @__PURE__ */ ((OutgoingPaymentAttemptStatu
|
|
|
5786
5836
|
var OutgoingPaymentAttemptStatus_default = OutgoingPaymentAttemptStatus;
|
|
5787
5837
|
|
|
5788
5838
|
// src/objects/Hop.ts
|
|
5839
|
+
var import_core14 = require("@lightsparkdev/core");
|
|
5789
5840
|
var HopFromJson = (obj) => {
|
|
5790
5841
|
return {
|
|
5791
5842
|
id: obj["hop_id"],
|
|
@@ -5843,7 +5894,7 @@ query GetHop($id: ID!) {
|
|
|
5843
5894
|
${FRAGMENT15}
|
|
5844
5895
|
`,
|
|
5845
5896
|
variables: { id },
|
|
5846
|
-
constructObject: (data) =>
|
|
5897
|
+
constructObject: (data) => (0, import_core14.isObject)(data) && "entity" in data && (0, import_core14.isObject)(data.entity) ? HopFromJson(data.entity) : null
|
|
5847
5898
|
};
|
|
5848
5899
|
};
|
|
5849
5900
|
|
|
@@ -5949,7 +6000,7 @@ query GetOutgoingPaymentAttempt($id: ID!) {
|
|
|
5949
6000
|
${FRAGMENT16}
|
|
5950
6001
|
`,
|
|
5951
6002
|
variables: { id },
|
|
5952
|
-
constructObject: (data) =>
|
|
6003
|
+
constructObject: (data) => (0, import_core15.isObject)(data) && "entity" in data && (0, import_core15.isObject)(data.entity) ? OutgoingPaymentAttemptFromJson(data.entity) : null
|
|
5953
6004
|
};
|
|
5954
6005
|
}
|
|
5955
6006
|
toJson() {
|
|
@@ -6057,7 +6108,7 @@ var PaymentFailureReason = /* @__PURE__ */ ((PaymentFailureReason2) => {
|
|
|
6057
6108
|
var PaymentFailureReason_default = PaymentFailureReason;
|
|
6058
6109
|
|
|
6059
6110
|
// src/objects/PaymentRequestData.ts
|
|
6060
|
-
var
|
|
6111
|
+
var import_core16 = require("@lightsparkdev/core");
|
|
6061
6112
|
var PaymentRequestDataFromJson = (obj) => {
|
|
6062
6113
|
if (obj["__typename"] == "InvoiceData") {
|
|
6063
6114
|
return {
|
|
@@ -6072,7 +6123,7 @@ var PaymentRequestDataFromJson = (obj) => {
|
|
|
6072
6123
|
memo: obj["invoice_data_memo"]
|
|
6073
6124
|
};
|
|
6074
6125
|
}
|
|
6075
|
-
throw new
|
|
6126
|
+
throw new import_core16.LightsparkException(
|
|
6076
6127
|
"DeserializationError",
|
|
6077
6128
|
`Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj["__typename"]}`
|
|
6078
6129
|
);
|
|
@@ -6092,7 +6143,7 @@ var PaymentRequestDataToJson = (obj) => {
|
|
|
6092
6143
|
invoice_data_destination: NodeToJson(invoiceData.destination)
|
|
6093
6144
|
};
|
|
6094
6145
|
}
|
|
6095
|
-
throw new
|
|
6146
|
+
throw new import_core16.LightsparkException(
|
|
6096
6147
|
"DeserializationError",
|
|
6097
6148
|
`Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj.typename}`
|
|
6098
6149
|
);
|
|
@@ -6209,7 +6260,7 @@ query GetOutgoingPayment($id: ID!) {
|
|
|
6209
6260
|
${FRAGMENT17}
|
|
6210
6261
|
`,
|
|
6211
6262
|
variables: { id },
|
|
6212
|
-
constructObject: (data) =>
|
|
6263
|
+
constructObject: (data) => (0, import_core17.isObject)(data) && "entity" in data && (0, import_core17.isObject)(data.entity) ? OutgoingPaymentFromJson(data.entity) : null
|
|
6213
6264
|
};
|
|
6214
6265
|
}
|
|
6215
6266
|
toJson() {
|
|
@@ -6610,6 +6661,25 @@ fragment OutgoingPaymentFragment on OutgoingPayment {
|
|
|
6610
6661
|
}`;
|
|
6611
6662
|
var OutgoingPayment_default = OutgoingPayment;
|
|
6612
6663
|
|
|
6664
|
+
// src/graphql/OutgoingPaymentsForInvoice.ts
|
|
6665
|
+
var OutgoingPaymentsForInvoice = `
|
|
6666
|
+
query OutgoingPaymentsForInvoice(
|
|
6667
|
+
$encoded_invoice: Hash32!,
|
|
6668
|
+
$statuses: [TransactionStatus!]
|
|
6669
|
+
) {
|
|
6670
|
+
outgoing_payments_for_invoice(input: {
|
|
6671
|
+
encoded_invoice: $encoded_invoice
|
|
6672
|
+
statuses: $statuses
|
|
6673
|
+
}) {
|
|
6674
|
+
payments {
|
|
6675
|
+
...OutgoingPaymentFragment
|
|
6676
|
+
}
|
|
6677
|
+
}
|
|
6678
|
+
}
|
|
6679
|
+
|
|
6680
|
+
${FRAGMENT17}
|
|
6681
|
+
`;
|
|
6682
|
+
|
|
6613
6683
|
// src/graphql/OutgoingPaymentsForPaymentHash.ts
|
|
6614
6684
|
var OutgoingPaymentsForPaymentHash = `
|
|
6615
6685
|
query OutgoingPaymentsForPaymentHash(
|
|
@@ -6686,7 +6756,7 @@ var PayUmaInvoice = `
|
|
|
6686
6756
|
`;
|
|
6687
6757
|
|
|
6688
6758
|
// src/objects/PaymentRequest.ts
|
|
6689
|
-
var
|
|
6759
|
+
var import_core18 = require("@lightsparkdev/core");
|
|
6690
6760
|
var PaymentRequestFromJson = (obj) => {
|
|
6691
6761
|
if (obj["__typename"] == "Invoice") {
|
|
6692
6762
|
return {
|
|
@@ -6701,7 +6771,7 @@ var PaymentRequestFromJson = (obj) => {
|
|
|
6701
6771
|
isLnurl: obj["invoice_is_lnurl"]
|
|
6702
6772
|
};
|
|
6703
6773
|
}
|
|
6704
|
-
throw new
|
|
6774
|
+
throw new import_core18.LightsparkException(
|
|
6705
6775
|
"DeserializationError",
|
|
6706
6776
|
`Couldn't find a concrete type for interface PaymentRequest corresponding to the typename=${obj["__typename"]}`
|
|
6707
6777
|
);
|
|
@@ -7032,7 +7102,7 @@ query GetPaymentRequest($id: ID!) {
|
|
|
7032
7102
|
${FRAGMENT18}
|
|
7033
7103
|
`,
|
|
7034
7104
|
variables: { id },
|
|
7035
|
-
constructObject: (data) =>
|
|
7105
|
+
constructObject: (data) => (0, import_core18.isObject)(data) && "entity" in data && (0, import_core18.isObject)(data.entity) ? PaymentRequestFromJson(data.entity) : null
|
|
7036
7106
|
};
|
|
7037
7107
|
};
|
|
7038
7108
|
|
|
@@ -7088,6 +7158,9 @@ mutation RegisterPayment(
|
|
|
7088
7158
|
}
|
|
7089
7159
|
`;
|
|
7090
7160
|
|
|
7161
|
+
// src/objects/WithdrawalRequest.ts
|
|
7162
|
+
var import_core22 = require("@lightsparkdev/core");
|
|
7163
|
+
|
|
7091
7164
|
// src/objects/RequestInitiator.ts
|
|
7092
7165
|
var RequestInitiator = /* @__PURE__ */ ((RequestInitiator2) => {
|
|
7093
7166
|
RequestInitiator2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
@@ -7120,6 +7193,7 @@ var WithdrawalRequestStatus = /* @__PURE__ */ ((WithdrawalRequestStatus2) => {
|
|
|
7120
7193
|
var WithdrawalRequestStatus_default = WithdrawalRequestStatus;
|
|
7121
7194
|
|
|
7122
7195
|
// src/objects/ChannelClosingTransaction.ts
|
|
7196
|
+
var import_core19 = require("@lightsparkdev/core");
|
|
7123
7197
|
var ChannelClosingTransactionFromJson = (obj) => {
|
|
7124
7198
|
return {
|
|
7125
7199
|
id: obj["channel_closing_transaction_id"],
|
|
@@ -7185,7 +7259,7 @@ query GetChannelClosingTransaction($id: ID!) {
|
|
|
7185
7259
|
${FRAGMENT19}
|
|
7186
7260
|
`,
|
|
7187
7261
|
variables: { id },
|
|
7188
|
-
constructObject: (data) =>
|
|
7262
|
+
constructObject: (data) => (0, import_core19.isObject)(data) && "entity" in data && (0, import_core19.isObject)(data.entity) ? ChannelClosingTransactionFromJson(data.entity) : null
|
|
7189
7263
|
};
|
|
7190
7264
|
};
|
|
7191
7265
|
|
|
@@ -7202,6 +7276,7 @@ var WithdrawalRequestToChannelClosingTransactionsConnectionFromJson = (obj) => {
|
|
|
7202
7276
|
};
|
|
7203
7277
|
|
|
7204
7278
|
// src/objects/ChannelOpeningTransaction.ts
|
|
7279
|
+
var import_core20 = require("@lightsparkdev/core");
|
|
7205
7280
|
var ChannelOpeningTransactionFromJson = (obj) => {
|
|
7206
7281
|
return {
|
|
7207
7282
|
id: obj["channel_opening_transaction_id"],
|
|
@@ -7267,7 +7342,7 @@ query GetChannelOpeningTransaction($id: ID!) {
|
|
|
7267
7342
|
${FRAGMENT20}
|
|
7268
7343
|
`,
|
|
7269
7344
|
variables: { id },
|
|
7270
|
-
constructObject: (data) =>
|
|
7345
|
+
constructObject: (data) => (0, import_core20.isObject)(data) && "entity" in data && (0, import_core20.isObject)(data.entity) ? ChannelOpeningTransactionFromJson(data.entity) : null
|
|
7271
7346
|
};
|
|
7272
7347
|
};
|
|
7273
7348
|
|
|
@@ -7284,6 +7359,7 @@ var WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson = (obj) => {
|
|
|
7284
7359
|
};
|
|
7285
7360
|
|
|
7286
7361
|
// src/objects/Withdrawal.ts
|
|
7362
|
+
var import_core21 = require("@lightsparkdev/core");
|
|
7287
7363
|
var WithdrawalFromJson = (obj) => {
|
|
7288
7364
|
return {
|
|
7289
7365
|
id: obj["withdrawal_id"],
|
|
@@ -7349,7 +7425,7 @@ query GetWithdrawal($id: ID!) {
|
|
|
7349
7425
|
${FRAGMENT21}
|
|
7350
7426
|
`,
|
|
7351
7427
|
variables: { id },
|
|
7352
|
-
constructObject: (data) =>
|
|
7428
|
+
constructObject: (data) => (0, import_core21.isObject)(data) && "entity" in data && (0, import_core21.isObject)(data.entity) ? WithdrawalFromJson(data.entity) : null
|
|
7353
7429
|
};
|
|
7354
7430
|
};
|
|
7355
7431
|
|
|
@@ -7575,7 +7651,7 @@ query GetWithdrawalRequest($id: ID!) {
|
|
|
7575
7651
|
${FRAGMENT22}
|
|
7576
7652
|
`,
|
|
7577
7653
|
variables: { id },
|
|
7578
|
-
constructObject: (data) =>
|
|
7654
|
+
constructObject: (data) => (0, import_core22.isObject)(data) && "entity" in data && (0, import_core22.isObject)(data.entity) ? WithdrawalRequestFromJson(data.entity) : null
|
|
7579
7655
|
};
|
|
7580
7656
|
}
|
|
7581
7657
|
toJson() {
|
|
@@ -7745,7 +7821,7 @@ var SendPayment = `
|
|
|
7745
7821
|
`;
|
|
7746
7822
|
|
|
7747
7823
|
// src/objects/Transaction.ts
|
|
7748
|
-
var
|
|
7824
|
+
var import_core23 = require("@lightsparkdev/core");
|
|
7749
7825
|
|
|
7750
7826
|
// src/objects/RoutingTransactionFailureReason.ts
|
|
7751
7827
|
var RoutingTransactionFailureReason = /* @__PURE__ */ ((RoutingTransactionFailureReason2) => {
|
|
@@ -7894,7 +7970,7 @@ var TransactionFromJson = (obj) => {
|
|
|
7894
7970
|
numConfirmations: obj["withdrawal_num_confirmations"]
|
|
7895
7971
|
};
|
|
7896
7972
|
}
|
|
7897
|
-
throw new
|
|
7973
|
+
throw new import_core23.LightsparkException(
|
|
7898
7974
|
"DeserializationError",
|
|
7899
7975
|
`Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj["__typename"]}`
|
|
7900
7976
|
);
|
|
@@ -8464,7 +8540,7 @@ query GetTransaction($id: ID!) {
|
|
|
8464
8540
|
${FRAGMENT23}
|
|
8465
8541
|
`,
|
|
8466
8542
|
variables: { id },
|
|
8467
|
-
constructObject: (data) =>
|
|
8543
|
+
constructObject: (data) => (0, import_core23.isObject)(data) && "entity" in data && (0, import_core23.isObject)(data.entity) ? TransactionFromJson(data.entity) : null
|
|
8468
8544
|
};
|
|
8469
8545
|
};
|
|
8470
8546
|
|
|
@@ -8705,6 +8781,13 @@ var WithdrawalFeeEstimate = `
|
|
|
8705
8781
|
${FRAGMENT25}
|
|
8706
8782
|
`;
|
|
8707
8783
|
|
|
8784
|
+
// src/logger.ts
|
|
8785
|
+
var import_core24 = require("@lightsparkdev/core");
|
|
8786
|
+
var logger = new import_core24.Logger("@lightsparkdev/lightspark-sdk");
|
|
8787
|
+
|
|
8788
|
+
// src/objects/Account.ts
|
|
8789
|
+
var import_core27 = require("@lightsparkdev/core");
|
|
8790
|
+
|
|
8708
8791
|
// src/objects/AccountToApiTokensConnection.ts
|
|
8709
8792
|
var AccountToApiTokensConnectionFromJson = (obj) => {
|
|
8710
8793
|
return {
|
|
@@ -8732,7 +8815,7 @@ var AccountToChannelsConnectionFromJson = (obj) => {
|
|
|
8732
8815
|
};
|
|
8733
8816
|
|
|
8734
8817
|
// src/objects/LightsparkNode.ts
|
|
8735
|
-
var
|
|
8818
|
+
var import_core25 = require("@lightsparkdev/core");
|
|
8736
8819
|
var LightsparkNodeFromJson = (obj) => {
|
|
8737
8820
|
if (obj["__typename"] == "LightsparkNodeWithOSK") {
|
|
8738
8821
|
return new LightsparkNodeWithOSK_default(
|
|
@@ -8803,7 +8886,7 @@ var LightsparkNodeFromJson = (obj) => {
|
|
|
8803
8886
|
!!obj["lightspark_node_with_remote_signing_balances"] ? BalancesFromJson(obj["lightspark_node_with_remote_signing_balances"]) : void 0
|
|
8804
8887
|
);
|
|
8805
8888
|
}
|
|
8806
|
-
throw new
|
|
8889
|
+
throw new import_core25.LightsparkException(
|
|
8807
8890
|
"DeserializationError",
|
|
8808
8891
|
`Couldn't find a concrete type for interface LightsparkNode corresponding to the typename=${obj["__typename"]}`
|
|
8809
8892
|
);
|
|
@@ -9085,7 +9168,7 @@ query GetLightsparkNode($id: ID!) {
|
|
|
9085
9168
|
${FRAGMENT26}
|
|
9086
9169
|
`,
|
|
9087
9170
|
variables: { id },
|
|
9088
|
-
constructObject: (data) =>
|
|
9171
|
+
constructObject: (data) => (0, import_core25.isObject)(data) && "entity" in data && (0, import_core25.isObject)(data.entity) ? LightsparkNodeFromJson(data.entity) : null
|
|
9089
9172
|
};
|
|
9090
9173
|
};
|
|
9091
9174
|
|
|
@@ -9138,6 +9221,9 @@ var AccountToTransactionsConnectionFromJson = (obj) => {
|
|
|
9138
9221
|
};
|
|
9139
9222
|
};
|
|
9140
9223
|
|
|
9224
|
+
// src/objects/Wallet.ts
|
|
9225
|
+
var import_core26 = require("@lightsparkdev/core");
|
|
9226
|
+
|
|
9141
9227
|
// src/objects/WalletStatus.ts
|
|
9142
9228
|
var WalletStatus = /* @__PURE__ */ ((WalletStatus2) => {
|
|
9143
9229
|
WalletStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
@@ -10303,7 +10389,7 @@ query GetWallet($id: ID!) {
|
|
|
10303
10389
|
${FRAGMENT27}
|
|
10304
10390
|
`,
|
|
10305
10391
|
variables: { id },
|
|
10306
|
-
constructObject: (data) =>
|
|
10392
|
+
constructObject: (data) => (0, import_core26.isObject)(data) && "entity" in data && (0, import_core26.isObject)(data.entity) ? WalletFromJson(data.entity) : null
|
|
10307
10393
|
};
|
|
10308
10394
|
}
|
|
10309
10395
|
toJson() {
|
|
@@ -12163,7 +12249,7 @@ query GetAccount {
|
|
|
12163
12249
|
${FRAGMENT28}
|
|
12164
12250
|
`,
|
|
12165
12251
|
variables: {},
|
|
12166
|
-
constructObject: (data) =>
|
|
12252
|
+
constructObject: (data) => (0, import_core27.isObject)(data) && "current_account" in data && (0, import_core27.isObject)(data.current_account) ? AccountFromJson(data.current_account) : null
|
|
12167
12253
|
};
|
|
12168
12254
|
}
|
|
12169
12255
|
toJson() {
|
|
@@ -12218,16 +12304,16 @@ var LightsparkClient = class {
|
|
|
12218
12304
|
* For React Native, you should use the `ReactNativeCrypto`
|
|
12219
12305
|
* implementation from `@lightsparkdev/react-native`.
|
|
12220
12306
|
*/
|
|
12221
|
-
constructor(authProvider = new
|
|
12307
|
+
constructor(authProvider = new import_core28.StubAuthProvider(), serverUrl = "api.lightspark.com", cryptoImpl = import_core28.DefaultCrypto) {
|
|
12222
12308
|
this.authProvider = authProvider;
|
|
12223
12309
|
this.serverUrl = serverUrl;
|
|
12224
12310
|
this.cryptoImpl = cryptoImpl;
|
|
12225
|
-
this.nodeKeyCache = new
|
|
12311
|
+
this.nodeKeyCache = new import_core28.NodeKeyCache(this.cryptoImpl);
|
|
12226
12312
|
this.nodeKeyLoaderCache = new NodeKeyLoaderCache(
|
|
12227
12313
|
this.nodeKeyCache,
|
|
12228
12314
|
this.cryptoImpl
|
|
12229
12315
|
);
|
|
12230
|
-
this.requester = new
|
|
12316
|
+
this.requester = new import_core28.Requester(
|
|
12231
12317
|
this.nodeKeyCache,
|
|
12232
12318
|
this.LIGHTSPARK_SDK_ENDPOINT,
|
|
12233
12319
|
`js-lightspark-sdk/${sdkVersion}`,
|
|
@@ -12274,7 +12360,7 @@ var LightsparkClient = class {
|
|
|
12274
12360
|
* @param authProvider
|
|
12275
12361
|
*/
|
|
12276
12362
|
setAuthProvider(authProvider) {
|
|
12277
|
-
this.requester = new
|
|
12363
|
+
this.requester = new import_core28.Requester(
|
|
12278
12364
|
this.nodeKeyCache,
|
|
12279
12365
|
this.LIGHTSPARK_SDK_ENDPOINT,
|
|
12280
12366
|
`js-lightspark-sdk/${sdkVersion}`,
|
|
@@ -12379,10 +12465,10 @@ var LightsparkClient = class {
|
|
|
12379
12465
|
network: bitcoinNetwork
|
|
12380
12466
|
});
|
|
12381
12467
|
if (!response.current_account) {
|
|
12382
|
-
throw new
|
|
12468
|
+
throw new import_core28.LightsparkAuthException("No current account");
|
|
12383
12469
|
}
|
|
12384
12470
|
if (!response.current_account.dashboard_overview_nodes || response.current_account.dashboard_overview_nodes.entities.length === 0) {
|
|
12385
|
-
throw new
|
|
12471
|
+
throw new import_core28.LightsparkException(
|
|
12386
12472
|
"NO_NODES_FOUND",
|
|
12387
12473
|
`No nodes found for this dashboard request. This could mean one of a few things:
|
|
12388
12474
|
1. You are requesting MAINNET nodes, but you have no MAINNET nodes yet. In this case, request BitcoinNetwork.REGTEST instead.
|
|
@@ -12453,11 +12539,11 @@ var LightsparkClient = class {
|
|
|
12453
12539
|
}
|
|
12454
12540
|
);
|
|
12455
12541
|
if (!response.current_account) {
|
|
12456
|
-
throw new
|
|
12542
|
+
throw new import_core28.LightsparkAuthException("No current account");
|
|
12457
12543
|
}
|
|
12458
12544
|
const account = response.current_account;
|
|
12459
12545
|
if (!account.dashboard_overview_nodes || !account.dashboard_overview_nodes.entities || account.dashboard_overview_nodes.entities.length === 0) {
|
|
12460
|
-
throw new
|
|
12546
|
+
throw new import_core28.LightsparkException(
|
|
12461
12547
|
"InvalidOrMissingNode",
|
|
12462
12548
|
"No nodes found for node dashboard"
|
|
12463
12549
|
);
|
|
@@ -12551,7 +12637,7 @@ var LightsparkClient = class {
|
|
|
12551
12637
|
* @returns An Invoice object representing the generated invoice.
|
|
12552
12638
|
*/
|
|
12553
12639
|
async createLnurlInvoice(nodeId, amountMsats, metadata, expirySecs = void 0) {
|
|
12554
|
-
const metadataHash = await (0,
|
|
12640
|
+
const metadataHash = await (0, import_core28.createSha256Hash)(metadata, true);
|
|
12555
12641
|
const variables = {
|
|
12556
12642
|
node_id: nodeId,
|
|
12557
12643
|
amount_msats: amountMsats,
|
|
@@ -12590,11 +12676,11 @@ var LightsparkClient = class {
|
|
|
12590
12676
|
* @returns An Invoice object representing the generated invoice.
|
|
12591
12677
|
*/
|
|
12592
12678
|
async createUmaInvoice(nodeId, amountMsats, metadata, expirySecs = void 0, signingPrivateKey = void 0, receiverIdentifier = void 0) {
|
|
12593
|
-
const metadataHash = await (0,
|
|
12679
|
+
const metadataHash = await (0, import_core28.createSha256Hash)(metadata, true);
|
|
12594
12680
|
let receiverHash = void 0;
|
|
12595
12681
|
if (receiverIdentifier !== void 0) {
|
|
12596
12682
|
if (signingPrivateKey == void 0) {
|
|
12597
|
-
throw new
|
|
12683
|
+
throw new import_core28.LightsparkException(
|
|
12598
12684
|
"CreateUmaInvoiceError",
|
|
12599
12685
|
"Receiver identifier provided without signing private key"
|
|
12600
12686
|
);
|
|
@@ -12735,7 +12821,7 @@ var LightsparkClient = class {
|
|
|
12735
12821
|
}
|
|
12736
12822
|
});
|
|
12737
12823
|
if (!response) {
|
|
12738
|
-
throw new
|
|
12824
|
+
throw new import_core28.LightsparkException(
|
|
12739
12825
|
"WithdrawalFeeEstimateError",
|
|
12740
12826
|
"Null or invalid fee estimate response from server"
|
|
12741
12827
|
);
|
|
@@ -12752,7 +12838,7 @@ var LightsparkClient = class {
|
|
|
12752
12838
|
await this.nodeKeyCache.loadKey(
|
|
12753
12839
|
nodeId,
|
|
12754
12840
|
signingPrivateKeyOrAlias,
|
|
12755
|
-
|
|
12841
|
+
import_core28.SigningKeyType.RSASigningKey
|
|
12756
12842
|
);
|
|
12757
12843
|
}
|
|
12758
12844
|
/**
|
|
@@ -12776,7 +12862,7 @@ var LightsparkClient = class {
|
|
|
12776
12862
|
*/
|
|
12777
12863
|
async payInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0) {
|
|
12778
12864
|
if (!this.nodeKeyCache.hasKey(payerNodeId)) {
|
|
12779
|
-
throw new
|
|
12865
|
+
throw new import_core28.LightsparkSigningException("Paying node is not unlocked");
|
|
12780
12866
|
}
|
|
12781
12867
|
const variables = {
|
|
12782
12868
|
node_id: payerNodeId,
|
|
@@ -12793,7 +12879,7 @@ var LightsparkClient = class {
|
|
|
12793
12879
|
payerNodeId
|
|
12794
12880
|
);
|
|
12795
12881
|
if (response.pay_invoice?.payment.outgoing_payment_failure_message) {
|
|
12796
|
-
throw new
|
|
12882
|
+
throw new import_core28.LightsparkException(
|
|
12797
12883
|
"PaymentError",
|
|
12798
12884
|
response.pay_invoice?.payment.outgoing_payment_failure_message.rich_text_text
|
|
12799
12885
|
);
|
|
@@ -12825,12 +12911,12 @@ var LightsparkClient = class {
|
|
|
12825
12911
|
*/
|
|
12826
12912
|
async payUmaInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0, signingPrivateKey = void 0, senderIdentifier = void 0) {
|
|
12827
12913
|
if (!this.nodeKeyCache.hasKey(payerNodeId)) {
|
|
12828
|
-
throw new
|
|
12914
|
+
throw new import_core28.LightsparkSigningException("Paying node is not unlocked");
|
|
12829
12915
|
}
|
|
12830
12916
|
let senderHash = void 0;
|
|
12831
12917
|
if (senderIdentifier !== void 0) {
|
|
12832
12918
|
if (signingPrivateKey == void 0) {
|
|
12833
|
-
throw new
|
|
12919
|
+
throw new import_core28.LightsparkException(
|
|
12834
12920
|
"PayUmaInvoiceError",
|
|
12835
12921
|
"Sender identifier provided without signing private key"
|
|
12836
12922
|
);
|
|
@@ -12858,7 +12944,7 @@ var LightsparkClient = class {
|
|
|
12858
12944
|
payerNodeId
|
|
12859
12945
|
);
|
|
12860
12946
|
if (response.pay_uma_invoice?.payment.outgoing_payment_failure_message) {
|
|
12861
|
-
throw new
|
|
12947
|
+
throw new import_core28.LightsparkException(
|
|
12862
12948
|
"PaymentError",
|
|
12863
12949
|
response.pay_uma_invoice?.payment.outgoing_payment_failure_message.rich_text_text
|
|
12864
12950
|
);
|
|
@@ -12876,7 +12962,7 @@ var LightsparkClient = class {
|
|
|
12876
12962
|
const pollIntervalMs = 250;
|
|
12877
12963
|
const pollMaxTimeouts = pollTimeoutSecs * 1e3 / pollIntervalMs;
|
|
12878
12964
|
const pollIgnoreErrors = false;
|
|
12879
|
-
const transaction = await (0,
|
|
12965
|
+
const transaction = await (0, import_core28.pollUntil)(
|
|
12880
12966
|
() => {
|
|
12881
12967
|
return this.getTransaction(transactionId);
|
|
12882
12968
|
},
|
|
@@ -12896,7 +12982,7 @@ var LightsparkClient = class {
|
|
|
12896
12982
|
pollIntervalMs,
|
|
12897
12983
|
pollMaxTimeouts,
|
|
12898
12984
|
pollIgnoreErrors,
|
|
12899
|
-
() => new
|
|
12985
|
+
() => new import_core28.LightsparkException(
|
|
12900
12986
|
"Timeout",
|
|
12901
12987
|
"Timeout waiting for transaction to complete."
|
|
12902
12988
|
)
|
|
@@ -12920,7 +13006,7 @@ var LightsparkClient = class {
|
|
|
12920
13006
|
*/
|
|
12921
13007
|
async sendPayment(payerNodeId, destinationPublicKey, timeoutSecs = 60, amountMsats, maximumFeesMsats) {
|
|
12922
13008
|
if (!this.nodeKeyCache.hasKey(payerNodeId)) {
|
|
12923
|
-
throw new
|
|
13009
|
+
throw new import_core28.LightsparkSigningException("Paying node is not unlocked");
|
|
12924
13010
|
}
|
|
12925
13011
|
const response = await this.requester.makeRawRequest(
|
|
12926
13012
|
SendPayment,
|
|
@@ -12934,7 +13020,7 @@ var LightsparkClient = class {
|
|
|
12934
13020
|
payerNodeId
|
|
12935
13021
|
);
|
|
12936
13022
|
if (response.send_payment?.payment.outgoing_payment_failure_message) {
|
|
12937
|
-
throw new
|
|
13023
|
+
throw new import_core28.LightsparkException(
|
|
12938
13024
|
"PaymentError",
|
|
12939
13025
|
response.send_payment?.payment.outgoing_payment_failure_message.rich_text_text
|
|
12940
13026
|
);
|
|
@@ -13061,7 +13147,7 @@ var LightsparkClient = class {
|
|
|
13061
13147
|
constructObject: (responseJson) => {
|
|
13062
13148
|
const encodedPaymentRequest = responseJson.create_test_mode_invoice?.encoded_payment_request;
|
|
13063
13149
|
if (!encodedPaymentRequest) {
|
|
13064
|
-
throw new
|
|
13150
|
+
throw new import_core28.LightsparkException(
|
|
13065
13151
|
"CreateTestModeInvoiceError",
|
|
13066
13152
|
"Unable to create test mode invoice"
|
|
13067
13153
|
);
|
|
@@ -13112,7 +13198,7 @@ var LightsparkClient = class {
|
|
|
13112
13198
|
},
|
|
13113
13199
|
constructObject: (responseJson) => {
|
|
13114
13200
|
if (responseJson.screen_node?.rating === void 0) {
|
|
13115
|
-
throw new
|
|
13201
|
+
throw new import_core28.LightsparkException(
|
|
13116
13202
|
"ScreenNodeError",
|
|
13117
13203
|
"Unable to screen node"
|
|
13118
13204
|
);
|
|
@@ -13144,7 +13230,7 @@ var LightsparkClient = class {
|
|
|
13144
13230
|
},
|
|
13145
13231
|
constructObject: (responseJson) => {
|
|
13146
13232
|
if (!responseJson.register_payment?.payment?.id) {
|
|
13147
|
-
throw new
|
|
13233
|
+
throw new import_core28.LightsparkException(
|
|
13148
13234
|
"RegisterPaymentError",
|
|
13149
13235
|
"Unable to register payment"
|
|
13150
13236
|
);
|
|
@@ -13168,7 +13254,7 @@ var LightsparkClient = class {
|
|
|
13168
13254
|
},
|
|
13169
13255
|
constructObject: (responseJson) => {
|
|
13170
13256
|
if (!responseJson.create_uma_invitation?.invitation) {
|
|
13171
|
-
throw new
|
|
13257
|
+
throw new import_core28.LightsparkException(
|
|
13172
13258
|
"CreateUmaInvitationError",
|
|
13173
13259
|
"Unable to create UMA invitation"
|
|
13174
13260
|
);
|
|
@@ -13197,7 +13283,7 @@ var LightsparkClient = class {
|
|
|
13197
13283
|
},
|
|
13198
13284
|
constructObject: (responseJson) => {
|
|
13199
13285
|
if (!responseJson.create_uma_invitation_with_incentives?.invitation) {
|
|
13200
|
-
throw new
|
|
13286
|
+
throw new import_core28.LightsparkException(
|
|
13201
13287
|
"CreateUmaInvitationError",
|
|
13202
13288
|
"Unable to create UMA invitation"
|
|
13203
13289
|
);
|
|
@@ -13225,7 +13311,7 @@ var LightsparkClient = class {
|
|
|
13225
13311
|
},
|
|
13226
13312
|
constructObject: (responseJson) => {
|
|
13227
13313
|
if (!responseJson.claim_uma_invitation?.invitation) {
|
|
13228
|
-
throw new
|
|
13314
|
+
throw new import_core28.LightsparkException(
|
|
13229
13315
|
"ClaimUmaInvitationError",
|
|
13230
13316
|
"Unable to claim UMA invitation"
|
|
13231
13317
|
);
|
|
@@ -13257,7 +13343,7 @@ var LightsparkClient = class {
|
|
|
13257
13343
|
},
|
|
13258
13344
|
constructObject: (responseJson) => {
|
|
13259
13345
|
if (!responseJson.claim_uma_invitation_with_incentives?.invitation) {
|
|
13260
|
-
throw new
|
|
13346
|
+
throw new import_core28.LightsparkException(
|
|
13261
13347
|
"ClaimUmaInvitationError",
|
|
13262
13348
|
"Unable to claim UMA invitation"
|
|
13263
13349
|
);
|
|
@@ -13331,20 +13417,66 @@ var LightsparkClient = class {
|
|
|
13331
13417
|
}
|
|
13332
13418
|
});
|
|
13333
13419
|
}
|
|
13420
|
+
/**
|
|
13421
|
+
* Fetches Outgoing payments for a given invoice if there are any.
|
|
13422
|
+
*
|
|
13423
|
+
* @param encodedInvoice encoded invoice associated with outgoing payment
|
|
13424
|
+
* @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
|
|
13425
|
+
*/
|
|
13426
|
+
async outgoingPaymentsForInvoice(encodedInvoice, statuses = void 0) {
|
|
13427
|
+
return await this.executeRawQuery({
|
|
13428
|
+
queryPayload: OutgoingPaymentsForInvoice,
|
|
13429
|
+
variables: {
|
|
13430
|
+
encoded_invoice: encodedInvoice,
|
|
13431
|
+
statuses
|
|
13432
|
+
},
|
|
13433
|
+
constructObject: (responseJson) => {
|
|
13434
|
+
if (!responseJson.outgoing_payments_for_invoice || !responseJson.outgoing_payments_for_invoice.payments) {
|
|
13435
|
+
return [];
|
|
13436
|
+
}
|
|
13437
|
+
return responseJson.outgoing_payments_for_invoice.payments.map(
|
|
13438
|
+
(payment) => OutgoingPaymentFromJson(payment)
|
|
13439
|
+
);
|
|
13440
|
+
}
|
|
13441
|
+
});
|
|
13442
|
+
}
|
|
13443
|
+
/**
|
|
13444
|
+
* Fetches Incoming payments for a given invoice if there are any.
|
|
13445
|
+
*
|
|
13446
|
+
* @param invoiceId id of associated invoice
|
|
13447
|
+
* @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
|
|
13448
|
+
*/
|
|
13449
|
+
async incomingPaymentsForInvoice(invoiceId, statuses = void 0) {
|
|
13450
|
+
return await this.executeRawQuery({
|
|
13451
|
+
queryPayload: IncomingPaymentsForInvoice,
|
|
13452
|
+
variables: {
|
|
13453
|
+
invoice_id: invoiceId,
|
|
13454
|
+
statuses
|
|
13455
|
+
},
|
|
13456
|
+
constructObject: (responseJson) => {
|
|
13457
|
+
if (!responseJson.incoming_payments_for_invoice || !responseJson.incoming_payments_for_invoice.payments) {
|
|
13458
|
+
return [];
|
|
13459
|
+
}
|
|
13460
|
+
return responseJson.incoming_payments_for_invoice.payments.map(
|
|
13461
|
+
(payment) => IncomingPaymentFromJson(payment)
|
|
13462
|
+
);
|
|
13463
|
+
}
|
|
13464
|
+
});
|
|
13465
|
+
}
|
|
13334
13466
|
async hashPhoneNumber(e164PhoneNumber) {
|
|
13335
13467
|
const e164PhoneRegex = /^\+[1-9]\d{1,14}$/;
|
|
13336
13468
|
if (!e164PhoneRegex.test(e164PhoneNumber)) {
|
|
13337
|
-
throw new
|
|
13469
|
+
throw new import_core28.LightsparkException(
|
|
13338
13470
|
"InvalidPhoneNumber",
|
|
13339
13471
|
"Invalid phone number. Phone number must be in E164 format."
|
|
13340
13472
|
);
|
|
13341
13473
|
}
|
|
13342
|
-
return await (0,
|
|
13474
|
+
return await (0, import_core28.createSha256Hash)(e164PhoneNumber, true);
|
|
13343
13475
|
}
|
|
13344
13476
|
async hashUmaIdentifier(identifier, signingPrivateKey) {
|
|
13345
13477
|
const now = this.getUtcDateTime();
|
|
13346
|
-
const input = identifier + `${now.getUTCMonth() + 1}-${now.getUTCFullYear()}` + (0,
|
|
13347
|
-
return await (0,
|
|
13478
|
+
const input = identifier + `${now.getUTCMonth() + 1}-${now.getUTCFullYear()}` + (0, import_core28.bytesToHex)(signingPrivateKey);
|
|
13479
|
+
return await (0, import_core28.createSha256Hash)(input, true);
|
|
13348
13480
|
}
|
|
13349
13481
|
getUtcDateTime() {
|
|
13350
13482
|
return /* @__PURE__ */ new Date();
|
|
@@ -13362,6 +13494,16 @@ var LightsparkClient = class {
|
|
|
13362
13494
|
executeRawQuery(query) {
|
|
13363
13495
|
return this.requester.executeQuery(query);
|
|
13364
13496
|
}
|
|
13497
|
+
/**
|
|
13498
|
+
* Enable logging for debugging purposes
|
|
13499
|
+
*
|
|
13500
|
+
* @param enabled Whether logging should be enabled.
|
|
13501
|
+
* @param level The logging level to use.
|
|
13502
|
+
* */
|
|
13503
|
+
setLoggingEnabled(enabled, level = import_core28.LoggingLevel.Info) {
|
|
13504
|
+
import_core28.logger.setEnabled(enabled, level);
|
|
13505
|
+
logger.setEnabled(enabled, level);
|
|
13506
|
+
}
|
|
13365
13507
|
};
|
|
13366
13508
|
var client_default = LightsparkClient;
|
|
13367
13509
|
|
|
@@ -13390,7 +13532,7 @@ var getBitcoinNetworkOrThrow = (bitcoinNetwork) => {
|
|
|
13390
13532
|
};
|
|
13391
13533
|
|
|
13392
13534
|
// src/objects/AuditLogActor.ts
|
|
13393
|
-
var
|
|
13535
|
+
var import_core29 = require("@lightsparkdev/core");
|
|
13394
13536
|
var AuditLogActorFromJson = (obj) => {
|
|
13395
13537
|
if (obj["__typename"] == "ApiToken") {
|
|
13396
13538
|
return {
|
|
@@ -13404,7 +13546,7 @@ var AuditLogActorFromJson = (obj) => {
|
|
|
13404
13546
|
typename: "ApiToken"
|
|
13405
13547
|
};
|
|
13406
13548
|
}
|
|
13407
|
-
throw new
|
|
13549
|
+
throw new import_core29.LightsparkException(
|
|
13408
13550
|
"DeserializationError",
|
|
13409
13551
|
`Couldn't find a concrete type for interface AuditLogActor corresponding to the typename=${obj["__typename"]}`
|
|
13410
13552
|
);
|
|
@@ -13437,11 +13579,12 @@ query GetAuditLogActor($id: ID!) {
|
|
|
13437
13579
|
${FRAGMENT29}
|
|
13438
13580
|
`,
|
|
13439
13581
|
variables: { id },
|
|
13440
|
-
constructObject: (data) =>
|
|
13582
|
+
constructObject: (data) => (0, import_core29.isObject)(data) && "entity" in data && (0, import_core29.isObject)(data.entity) ? AuditLogActorFromJson(data.entity) : null
|
|
13441
13583
|
};
|
|
13442
13584
|
};
|
|
13443
13585
|
|
|
13444
13586
|
// src/objects/ChannelSnapshot.ts
|
|
13587
|
+
var import_core30 = require("@lightsparkdev/core");
|
|
13445
13588
|
var ChannelSnapshotFromJson = (obj) => {
|
|
13446
13589
|
return {
|
|
13447
13590
|
id: obj["channel_snapshot_id"],
|
|
@@ -13524,7 +13667,7 @@ query GetChannelSnapshot($id: ID!) {
|
|
|
13524
13667
|
${FRAGMENT30}
|
|
13525
13668
|
`,
|
|
13526
13669
|
variables: { id },
|
|
13527
|
-
constructObject: (data) =>
|
|
13670
|
+
constructObject: (data) => (0, import_core30.isObject)(data) && "entity" in data && (0, import_core30.isObject)(data.entity) ? ChannelSnapshotFromJson(data.entity) : null
|
|
13528
13671
|
};
|
|
13529
13672
|
};
|
|
13530
13673
|
|
|
@@ -13794,7 +13937,10 @@ var ComplianceProvider = /* @__PURE__ */ ((ComplianceProvider2) => {
|
|
|
13794
13937
|
var ComplianceProvider_default = ComplianceProvider;
|
|
13795
13938
|
|
|
13796
13939
|
// src/objects/Connection.ts
|
|
13797
|
-
var
|
|
13940
|
+
var import_core31 = require("@lightsparkdev/core");
|
|
13941
|
+
|
|
13942
|
+
// src/objects/SignablePayload.ts
|
|
13943
|
+
var import_core32 = require("@lightsparkdev/core");
|
|
13798
13944
|
|
|
13799
13945
|
// src/objects/SignablePayloadStatus.ts
|
|
13800
13946
|
var SignablePayloadStatus = /* @__PURE__ */ ((SignablePayloadStatus2) => {
|
|
@@ -13851,11 +13997,12 @@ query GetSignablePayload($id: ID!) {
|
|
|
13851
13997
|
${FRAGMENT31}
|
|
13852
13998
|
`,
|
|
13853
13999
|
variables: { id },
|
|
13854
|
-
constructObject: (data) =>
|
|
14000
|
+
constructObject: (data) => (0, import_core32.isObject)(data) && "entity" in data && (0, import_core32.isObject)(data.entity) ? SignablePayloadFromJson(data.entity) : null
|
|
13855
14001
|
};
|
|
13856
14002
|
};
|
|
13857
14003
|
|
|
13858
14004
|
// src/objects/Deposit.ts
|
|
14005
|
+
var import_core33 = require("@lightsparkdev/core");
|
|
13859
14006
|
var DepositFromJson = (obj) => {
|
|
13860
14007
|
return {
|
|
13861
14008
|
id: obj["deposit_id"],
|
|
@@ -13921,12 +14068,12 @@ query GetDeposit($id: ID!) {
|
|
|
13921
14068
|
${FRAGMENT32}
|
|
13922
14069
|
`,
|
|
13923
14070
|
variables: { id },
|
|
13924
|
-
constructObject: (data) =>
|
|
14071
|
+
constructObject: (data) => (0, import_core33.isObject)(data) && "entity" in data && (0, import_core33.isObject)(data.entity) ? DepositFromJson(data.entity) : null
|
|
13925
14072
|
};
|
|
13926
14073
|
};
|
|
13927
14074
|
|
|
13928
14075
|
// src/objects/LightningTransaction.ts
|
|
13929
|
-
var
|
|
14076
|
+
var import_core34 = require("@lightsparkdev/core");
|
|
13930
14077
|
var LightningTransactionFromJson = (obj) => {
|
|
13931
14078
|
if (obj["__typename"] == "IncomingPayment") {
|
|
13932
14079
|
return new IncomingPayment_default(
|
|
@@ -13991,7 +14138,7 @@ var LightningTransactionFromJson = (obj) => {
|
|
|
13991
14138
|
failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
|
|
13992
14139
|
};
|
|
13993
14140
|
}
|
|
13994
|
-
throw new
|
|
14141
|
+
throw new import_core34.LightsparkException(
|
|
13995
14142
|
"DeserializationError",
|
|
13996
14143
|
`Couldn't find a concrete type for interface LightningTransaction corresponding to the typename=${obj["__typename"]}`
|
|
13997
14144
|
);
|
|
@@ -14433,12 +14580,12 @@ query GetLightningTransaction($id: ID!) {
|
|
|
14433
14580
|
${FRAGMENT33}
|
|
14434
14581
|
`,
|
|
14435
14582
|
variables: { id },
|
|
14436
|
-
constructObject: (data) =>
|
|
14583
|
+
constructObject: (data) => (0, import_core34.isObject)(data) && "entity" in data && (0, import_core34.isObject)(data.entity) ? LightningTransactionFromJson(data.entity) : null
|
|
14437
14584
|
};
|
|
14438
14585
|
};
|
|
14439
14586
|
|
|
14440
14587
|
// src/objects/LightsparkNodeOwner.ts
|
|
14441
|
-
var
|
|
14588
|
+
var import_core35 = require("@lightsparkdev/core");
|
|
14442
14589
|
var LightsparkNodeOwnerFromJson = (obj) => {
|
|
14443
14590
|
if (obj["__typename"] == "Account") {
|
|
14444
14591
|
return new Account_default(
|
|
@@ -14462,7 +14609,7 @@ var LightsparkNodeOwnerFromJson = (obj) => {
|
|
|
14462
14609
|
obj["wallet_account"]?.id ?? void 0
|
|
14463
14610
|
);
|
|
14464
14611
|
}
|
|
14465
|
-
throw new
|
|
14612
|
+
throw new import_core35.LightsparkException(
|
|
14466
14613
|
"DeserializationError",
|
|
14467
14614
|
`Couldn't find a concrete type for interface LightsparkNodeOwner corresponding to the typename=${obj["__typename"]}`
|
|
14468
14615
|
);
|
|
@@ -14531,7 +14678,7 @@ query GetLightsparkNodeOwner($id: ID!) {
|
|
|
14531
14678
|
${FRAGMENT34}
|
|
14532
14679
|
`,
|
|
14533
14680
|
variables: { id },
|
|
14534
|
-
constructObject: (data) =>
|
|
14681
|
+
constructObject: (data) => (0, import_core35.isObject)(data) && "entity" in data && (0, import_core35.isObject)(data.entity) ? LightsparkNodeOwnerFromJson(data.entity) : null
|
|
14535
14682
|
};
|
|
14536
14683
|
};
|
|
14537
14684
|
|
|
@@ -14547,7 +14694,7 @@ var OnChainFeeTarget = /* @__PURE__ */ ((OnChainFeeTarget2) => {
|
|
|
14547
14694
|
var OnChainFeeTarget_default = OnChainFeeTarget;
|
|
14548
14695
|
|
|
14549
14696
|
// src/objects/OnChainTransaction.ts
|
|
14550
|
-
var
|
|
14697
|
+
var import_core36 = require("@lightsparkdev/core");
|
|
14551
14698
|
var OnChainTransactionFromJson = (obj) => {
|
|
14552
14699
|
if (obj["__typename"] == "ChannelClosingTransaction") {
|
|
14553
14700
|
return {
|
|
@@ -14621,7 +14768,7 @@ var OnChainTransactionFromJson = (obj) => {
|
|
|
14621
14768
|
numConfirmations: obj["withdrawal_num_confirmations"]
|
|
14622
14769
|
};
|
|
14623
14770
|
}
|
|
14624
|
-
throw new
|
|
14771
|
+
throw new import_core36.LightsparkException(
|
|
14625
14772
|
"DeserializationError",
|
|
14626
14773
|
`Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`
|
|
14627
14774
|
);
|
|
@@ -14772,7 +14919,7 @@ query GetOnChainTransaction($id: ID!) {
|
|
|
14772
14919
|
${FRAGMENT35}
|
|
14773
14920
|
`,
|
|
14774
14921
|
variables: { id },
|
|
14775
|
-
constructObject: (data) =>
|
|
14922
|
+
constructObject: (data) => (0, import_core36.isObject)(data) && "entity" in data && (0, import_core36.isObject)(data.entity) ? OnChainTransactionFromJson(data.entity) : null
|
|
14776
14923
|
};
|
|
14777
14924
|
};
|
|
14778
14925
|
|
|
@@ -14812,6 +14959,7 @@ var RiskRating = /* @__PURE__ */ ((RiskRating2) => {
|
|
|
14812
14959
|
var RiskRating_default = RiskRating;
|
|
14813
14960
|
|
|
14814
14961
|
// src/objects/RoutingTransaction.ts
|
|
14962
|
+
var import_core37 = require("@lightsparkdev/core");
|
|
14815
14963
|
var RoutingTransactionFromJson = (obj) => {
|
|
14816
14964
|
return {
|
|
14817
14965
|
id: obj["routing_transaction_id"],
|
|
@@ -14880,11 +15028,12 @@ query GetRoutingTransaction($id: ID!) {
|
|
|
14880
15028
|
${FRAGMENT36}
|
|
14881
15029
|
`,
|
|
14882
15030
|
variables: { id },
|
|
14883
|
-
constructObject: (data) =>
|
|
15031
|
+
constructObject: (data) => (0, import_core37.isObject)(data) && "entity" in data && (0, import_core37.isObject)(data.entity) ? RoutingTransactionFromJson(data.entity) : null
|
|
14884
15032
|
};
|
|
14885
15033
|
};
|
|
14886
15034
|
|
|
14887
15035
|
// src/objects/Signable.ts
|
|
15036
|
+
var import_core38 = require("@lightsparkdev/core");
|
|
14888
15037
|
var SignableFromJson = (obj) => {
|
|
14889
15038
|
return {
|
|
14890
15039
|
id: obj["signable_id"],
|
|
@@ -14914,7 +15063,7 @@ query GetSignable($id: ID!) {
|
|
|
14914
15063
|
${FRAGMENT37}
|
|
14915
15064
|
`,
|
|
14916
15065
|
variables: { id },
|
|
14917
|
-
constructObject: (data) =>
|
|
15066
|
+
constructObject: (data) => (0, import_core38.isObject)(data) && "entity" in data && (0, import_core38.isObject)(data.entity) ? SignableFromJson(data.entity) : null
|
|
14918
15067
|
};
|
|
14919
15068
|
};
|
|
14920
15069
|
|
|
@@ -14957,7 +15106,7 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
|
|
|
14957
15106
|
var WebhookEventType_default = WebhookEventType;
|
|
14958
15107
|
|
|
14959
15108
|
// src/webhooks.ts
|
|
14960
|
-
var
|
|
15109
|
+
var import_core39 = require("@lightsparkdev/core");
|
|
14961
15110
|
var WEBHOOKS_SIGNATURE_HEADER = "lightspark-signature";
|
|
14962
15111
|
var verifyAndParseWebhook = async (data, hexdigest, webhook_secret) => {
|
|
14963
15112
|
const { createHmac } = await import("crypto");
|
|
@@ -14993,8 +15142,8 @@ var RemoteSigningWebhookHandler = class {
|
|
|
14993
15142
|
this.validator = validator;
|
|
14994
15143
|
}
|
|
14995
15144
|
async handleWebhookRequest(data, webhookSignature, webhookSecret) {
|
|
14996
|
-
if (!
|
|
14997
|
-
throw new
|
|
15145
|
+
if (!import_core39.isNode) {
|
|
15146
|
+
throw new import_core39.LightsparkSigningException(
|
|
14998
15147
|
"Environment not supported for handling webhooks."
|
|
14999
15148
|
);
|
|
15000
15149
|
}
|