@lightsparkdev/lightspark-sdk 1.8.1 → 1.8.3
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 +18 -0
- package/dist/BitcoinNetwork-CIfB1c0X.d.ts +21 -0
- package/dist/{chunk-4KFNQOMH.js → chunk-3SPTFEYJ.js} +1 -0
- package/dist/env.d.cts +2 -2
- package/dist/env.d.ts +2 -2
- package/dist/env.js +1 -1
- package/dist/index-B83OtHZi.d.cts +4819 -0
- package/dist/{index-9a69ef6a.d.ts → index-uoUldBPd.d.ts} +53 -19
- package/dist/index.cjs +185 -94
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +112 -15
- package/dist/objects/index.cjs +1 -0
- package/dist/objects/index.d.cts +2 -2
- package/dist/objects/index.d.ts +2 -2
- package/dist/objects/index.js +2 -2
- package/dist/{text-encoding-26SMKBAQ.js → text-encoding-3OZOB4NR.js} +6 -11
- package/package.json +9 -12
- package/src/client.ts +89 -8
- package/src/graphql/IncomingPaymentsForInvoice.ts +21 -0
- package/src/graphql/OutgoingPaymentsForInvoice.ts +21 -0
- package/src/objects/Channel.ts +2 -3
- package/src/objects/ChannelClosingTransaction.ts +1 -1
- package/src/objects/ChannelOpeningTransaction.ts +1 -1
- package/src/objects/FundNodeInput.ts +4 -0
- package/src/objects/Hop.ts +1 -1
- package/src/objects/IncomingPayment.ts +1 -2
- package/src/objects/IncomingPaymentsForPaymentHashQueryInput.ts +34 -0
- package/src/objects/IncomingPaymentsForPaymentHashQueryOutput.ts +37 -0
- package/src/objects/InvoiceForPaymentHashOutput.ts +1 -1
- package/src/objects/LightningTransaction.ts +10 -8
- package/src/objects/LightsparkNodeOwner.ts +1 -1
- package/src/objects/OnChainTransaction.ts +6 -4
- package/src/objects/OutgoingPayment.ts +1 -1
- package/src/objects/OutgoingPaymentAttempt.ts +1 -2
- package/src/objects/OutgoingPaymentForIdempotencyKeyOutput.ts +1 -2
- package/src/objects/RoutingTransaction.ts +2 -4
- package/src/objects/Transaction.ts +16 -12
- package/src/objects/Wallet.ts +1 -1
- package/src/objects/WebhookEventType.ts +2 -0
- package/src/objects/WithdrawalRequest.ts +1 -1
- package/src/objects/index.ts +9 -7
- /package/dist/{BitcoinNetwork-4f6ea015.d.ts → BitcoinNetwork-CIfB1c0X.d.cts} +0 -0
- /package/dist/{chunk-BMTV3EA2.js → chunk-FTA5RKYX.js} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -32,7 +32,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
|
|
33
33
|
// ../../node_modules/text-encoding/lib/encoding-indexes.js
|
|
34
34
|
var require_encoding_indexes = __commonJS({
|
|
35
|
-
"../../node_modules/text-encoding/lib/encoding-indexes.js"(
|
|
35
|
+
"../../node_modules/text-encoding/lib/encoding-indexes.js"(exports2, module2) {
|
|
36
36
|
"use strict";
|
|
37
37
|
(function(global) {
|
|
38
38
|
"use strict";
|
|
@@ -74,13 +74,13 @@ var require_encoding_indexes = __commonJS({
|
|
|
74
74
|
"windows-1258": [8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 138, 8249, 338, 141, 142, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, 8482, 154, 8250, 339, 157, 158, 376, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 258, 196, 197, 198, 199, 200, 201, 202, 203, 768, 205, 206, 207, 272, 209, 777, 211, 212, 416, 214, 215, 216, 217, 218, 219, 220, 431, 771, 223, 224, 225, 226, 259, 228, 229, 230, 231, 232, 233, 234, 235, 769, 237, 238, 239, 273, 241, 803, 243, 244, 417, 246, 247, 248, 249, 250, 251, 252, 432, 8363, 255],
|
|
75
75
|
"x-mac-cyrillic": [1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 8224, 176, 1168, 163, 167, 8226, 182, 1030, 174, 169, 8482, 1026, 1106, 8800, 1027, 1107, 8734, 177, 8804, 8805, 1110, 181, 1169, 1032, 1028, 1108, 1031, 1111, 1033, 1113, 1034, 1114, 1112, 1029, 172, 8730, 402, 8776, 8710, 171, 187, 8230, 160, 1035, 1115, 1036, 1116, 1109, 8211, 8212, 8220, 8221, 8216, 8217, 247, 8222, 1038, 1118, 1039, 1119, 8470, 1025, 1105, 1103, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 8364]
|
|
76
76
|
};
|
|
77
|
-
})(
|
|
77
|
+
})(exports2 || {});
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
// ../../node_modules/text-encoding/lib/encoding.js
|
|
82
82
|
var require_encoding = __commonJS({
|
|
83
|
-
"../../node_modules/text-encoding/lib/encoding.js"(
|
|
83
|
+
"../../node_modules/text-encoding/lib/encoding.js"(exports2, module2) {
|
|
84
84
|
"use strict";
|
|
85
85
|
(function(global) {
|
|
86
86
|
"use strict";
|
|
@@ -95,10 +95,8 @@ var require_encoding = __commonJS({
|
|
|
95
95
|
}
|
|
96
96
|
var floor = Math.floor;
|
|
97
97
|
function ToDictionary(o) {
|
|
98
|
-
if (o === void 0)
|
|
99
|
-
|
|
100
|
-
if (o === Object(o))
|
|
101
|
-
return o;
|
|
98
|
+
if (o === void 0) return {};
|
|
99
|
+
if (o === Object(o)) return o;
|
|
102
100
|
throw TypeError("Could not convert argument to dictionary");
|
|
103
101
|
}
|
|
104
102
|
function stringToCodePoints(string) {
|
|
@@ -723,8 +721,7 @@ var require_encoding = __commonJS({
|
|
|
723
721
|
var encoders = {};
|
|
724
722
|
var decoders = {};
|
|
725
723
|
function indexCodePointFor(pointer, index2) {
|
|
726
|
-
if (!index2)
|
|
727
|
-
return null;
|
|
724
|
+
if (!index2) return null;
|
|
728
725
|
return index2[pointer] || null;
|
|
729
726
|
}
|
|
730
727
|
function indexPointerFor(code_point, index2) {
|
|
@@ -740,8 +737,7 @@ var require_encoding = __commonJS({
|
|
|
740
737
|
function indexGB18030RangesCodePointFor(pointer) {
|
|
741
738
|
if (pointer > 39419 && pointer < 189e3 || pointer > 1237575)
|
|
742
739
|
return null;
|
|
743
|
-
if (pointer === 7457)
|
|
744
|
-
return 59335;
|
|
740
|
+
if (pointer === 7457) return 59335;
|
|
745
741
|
var offset = 0;
|
|
746
742
|
var code_point_offset = 0;
|
|
747
743
|
var idx = index("gb18030-ranges");
|
|
@@ -758,8 +754,7 @@ var require_encoding = __commonJS({
|
|
|
758
754
|
return code_point_offset + pointer - offset;
|
|
759
755
|
}
|
|
760
756
|
function indexGB18030RangesPointerFor(code_point) {
|
|
761
|
-
if (code_point === 59335)
|
|
762
|
-
return 7457;
|
|
757
|
+
if (code_point === 59335) return 7457;
|
|
763
758
|
var offset = 0;
|
|
764
759
|
var pointer_offset = 0;
|
|
765
760
|
var idx = index("gb18030-ranges");
|
|
@@ -1821,13 +1816,13 @@ var require_encoding = __commonJS({
|
|
|
1821
1816
|
EncodingIndexes: global["encoding-indexes"]
|
|
1822
1817
|
};
|
|
1823
1818
|
}
|
|
1824
|
-
})(
|
|
1819
|
+
})(exports2 || {});
|
|
1825
1820
|
}
|
|
1826
1821
|
});
|
|
1827
1822
|
|
|
1828
1823
|
// ../../node_modules/text-encoding/index.js
|
|
1829
1824
|
var require_text_encoding = __commonJS({
|
|
1830
|
-
"../../node_modules/text-encoding/index.js"(
|
|
1825
|
+
"../../node_modules/text-encoding/index.js"(exports2, module2) {
|
|
1831
1826
|
"use strict";
|
|
1832
1827
|
var encoding = require_encoding();
|
|
1833
1828
|
module2.exports = {
|
|
@@ -1981,12 +1976,12 @@ var AccountTokenAuthProvider = class {
|
|
|
1981
1976
|
var AccountTokenAuthProvider_default = AccountTokenAuthProvider;
|
|
1982
1977
|
|
|
1983
1978
|
// src/client.ts
|
|
1984
|
-
var
|
|
1979
|
+
var import_core28 = require("@lightsparkdev/core");
|
|
1985
1980
|
|
|
1986
1981
|
// package.json
|
|
1987
1982
|
var package_default = {
|
|
1988
1983
|
name: "@lightsparkdev/lightspark-sdk",
|
|
1989
|
-
version: "1.8.
|
|
1984
|
+
version: "1.8.3",
|
|
1990
1985
|
description: "Lightspark JS SDK",
|
|
1991
1986
|
author: "Lightspark Inc.",
|
|
1992
1987
|
keywords: [
|
|
@@ -2012,8 +2007,7 @@ var package_default = {
|
|
|
2012
2007
|
default: "./dist/index.js"
|
|
2013
2008
|
},
|
|
2014
2009
|
module: "./dist/index.js",
|
|
2015
|
-
require: "./dist/index.cjs"
|
|
2016
|
-
default: "./dist/index.cjs"
|
|
2010
|
+
require: "./dist/index.cjs"
|
|
2017
2011
|
},
|
|
2018
2012
|
"./objects": {
|
|
2019
2013
|
types: "./dist/objects/index.d.ts",
|
|
@@ -2022,8 +2016,7 @@ var package_default = {
|
|
|
2022
2016
|
default: "./dist/objects/index.js"
|
|
2023
2017
|
},
|
|
2024
2018
|
module: "./dist/objects/index.js",
|
|
2025
|
-
require: "./dist/objects/index.cjs"
|
|
2026
|
-
default: "./dist/objects/index.cjs"
|
|
2019
|
+
require: "./dist/objects/index.cjs"
|
|
2027
2020
|
},
|
|
2028
2021
|
"./env": {
|
|
2029
2022
|
types: "./dist/env.d.ts",
|
|
@@ -2032,8 +2025,7 @@ var package_default = {
|
|
|
2032
2025
|
default: "./dist/env.js"
|
|
2033
2026
|
},
|
|
2034
2027
|
module: "./dist/env.js",
|
|
2035
|
-
require: "./dist/env.cjs"
|
|
2036
|
-
default: "./dist/env.cjs"
|
|
2028
|
+
require: "./dist/env.cjs"
|
|
2037
2029
|
}
|
|
2038
2030
|
},
|
|
2039
2031
|
type: "module",
|
|
@@ -2053,7 +2045,7 @@ var package_default = {
|
|
|
2053
2045
|
scripts: {
|
|
2054
2046
|
build: "yarn tsc && tsup",
|
|
2055
2047
|
"build:watch": "yarn build --watch --clean=false",
|
|
2056
|
-
clean: "rm -rf
|
|
2048
|
+
clean: "rm -rf dist",
|
|
2057
2049
|
dev: "yarn build -- --watch",
|
|
2058
2050
|
docs: "typedoc src",
|
|
2059
2051
|
"format:fix": "prettier src --write",
|
|
@@ -2071,8 +2063,8 @@ var package_default = {
|
|
|
2071
2063
|
},
|
|
2072
2064
|
license: "Apache-2.0",
|
|
2073
2065
|
dependencies: {
|
|
2074
|
-
"@lightsparkdev/core": "1.2.
|
|
2075
|
-
"@lightsparkdev/crypto-wasm": "0.1.
|
|
2066
|
+
"@lightsparkdev/core": "1.2.2",
|
|
2067
|
+
"@lightsparkdev/crypto-wasm": "0.1.5",
|
|
2076
2068
|
"crypto-browserify": "^3.12.0",
|
|
2077
2069
|
dayjs: "^1.11.7",
|
|
2078
2070
|
dotenv: "^16.3.1",
|
|
@@ -2096,9 +2088,9 @@ var package_default = {
|
|
|
2096
2088
|
"prettier-plugin-organize-imports": "^3.2.4",
|
|
2097
2089
|
"ts-jest": "^29.1.1",
|
|
2098
2090
|
"tsc-absolute": "^1.0.1",
|
|
2099
|
-
tsup: "^
|
|
2091
|
+
tsup: "^8.2.4",
|
|
2100
2092
|
typedoc: "^0.24.7",
|
|
2101
|
-
typescript: "^5.
|
|
2093
|
+
typescript: "^5.6.2"
|
|
2102
2094
|
},
|
|
2103
2095
|
engines: {
|
|
2104
2096
|
node: ">=18"
|
|
@@ -5623,6 +5615,25 @@ var FundNode = `
|
|
|
5623
5615
|
${FRAGMENT}
|
|
5624
5616
|
`;
|
|
5625
5617
|
|
|
5618
|
+
// src/graphql/IncomingPaymentsForInvoice.ts
|
|
5619
|
+
var IncomingPaymentsForInvoice = `
|
|
5620
|
+
query IncomingPaymentsForInvoice(
|
|
5621
|
+
$invoice_id: Hash32!,
|
|
5622
|
+
$statuses: [TransactionStatus!]
|
|
5623
|
+
) {
|
|
5624
|
+
incoming_payments_for_invoice(input: {
|
|
5625
|
+
invoice_id: $invoice_id
|
|
5626
|
+
statuses: $statuses
|
|
5627
|
+
}) {
|
|
5628
|
+
payments {
|
|
5629
|
+
...IncomingPaymentFragment
|
|
5630
|
+
}
|
|
5631
|
+
}
|
|
5632
|
+
}
|
|
5633
|
+
|
|
5634
|
+
${FRAGMENT13}
|
|
5635
|
+
`;
|
|
5636
|
+
|
|
5626
5637
|
// src/graphql/InvoiceForPaymentHash.ts
|
|
5627
5638
|
var InvoiceForPaymentHash = `
|
|
5628
5639
|
query InvoiceForPaymentHash($payment_hash: Hash32!) {
|
|
@@ -6642,6 +6653,25 @@ fragment OutgoingPaymentFragment on OutgoingPayment {
|
|
|
6642
6653
|
}`;
|
|
6643
6654
|
var OutgoingPayment_default = OutgoingPayment;
|
|
6644
6655
|
|
|
6656
|
+
// src/graphql/OutgoingPaymentsForInvoice.ts
|
|
6657
|
+
var OutgoingPaymentsForInvoice = `
|
|
6658
|
+
query OutgoingPaymentsForInvoice(
|
|
6659
|
+
$encoded_invoice: Hash32!,
|
|
6660
|
+
$statuses: [TransactionStatus!]
|
|
6661
|
+
) {
|
|
6662
|
+
outgoing_payments_for_invoice(input: {
|
|
6663
|
+
encoded_invoice: $encoded_invoice
|
|
6664
|
+
statuses: $statuses
|
|
6665
|
+
}) {
|
|
6666
|
+
payments {
|
|
6667
|
+
...OutgoingPaymentFragment
|
|
6668
|
+
}
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6671
|
+
|
|
6672
|
+
${FRAGMENT17}
|
|
6673
|
+
`;
|
|
6674
|
+
|
|
6645
6675
|
// src/graphql/OutgoingPaymentsForPaymentHash.ts
|
|
6646
6676
|
var OutgoingPaymentsForPaymentHash = `
|
|
6647
6677
|
query OutgoingPaymentsForPaymentHash(
|
|
@@ -8743,8 +8773,12 @@ var WithdrawalFeeEstimate = `
|
|
|
8743
8773
|
${FRAGMENT25}
|
|
8744
8774
|
`;
|
|
8745
8775
|
|
|
8776
|
+
// src/logger.ts
|
|
8777
|
+
var import_core24 = require("@lightsparkdev/core");
|
|
8778
|
+
var logger = new import_core24.Logger("@lightsparkdev/lightspark-sdk");
|
|
8779
|
+
|
|
8746
8780
|
// src/objects/Account.ts
|
|
8747
|
-
var
|
|
8781
|
+
var import_core27 = require("@lightsparkdev/core");
|
|
8748
8782
|
|
|
8749
8783
|
// src/objects/AccountToApiTokensConnection.ts
|
|
8750
8784
|
var AccountToApiTokensConnectionFromJson = (obj) => {
|
|
@@ -8773,7 +8807,7 @@ var AccountToChannelsConnectionFromJson = (obj) => {
|
|
|
8773
8807
|
};
|
|
8774
8808
|
|
|
8775
8809
|
// src/objects/LightsparkNode.ts
|
|
8776
|
-
var
|
|
8810
|
+
var import_core25 = require("@lightsparkdev/core");
|
|
8777
8811
|
var LightsparkNodeFromJson = (obj) => {
|
|
8778
8812
|
if (obj["__typename"] == "LightsparkNodeWithOSK") {
|
|
8779
8813
|
return new LightsparkNodeWithOSK_default(
|
|
@@ -8844,7 +8878,7 @@ var LightsparkNodeFromJson = (obj) => {
|
|
|
8844
8878
|
!!obj["lightspark_node_with_remote_signing_balances"] ? BalancesFromJson(obj["lightspark_node_with_remote_signing_balances"]) : void 0
|
|
8845
8879
|
);
|
|
8846
8880
|
}
|
|
8847
|
-
throw new
|
|
8881
|
+
throw new import_core25.LightsparkException(
|
|
8848
8882
|
"DeserializationError",
|
|
8849
8883
|
`Couldn't find a concrete type for interface LightsparkNode corresponding to the typename=${obj["__typename"]}`
|
|
8850
8884
|
);
|
|
@@ -9126,7 +9160,7 @@ query GetLightsparkNode($id: ID!) {
|
|
|
9126
9160
|
${FRAGMENT26}
|
|
9127
9161
|
`,
|
|
9128
9162
|
variables: { id },
|
|
9129
|
-
constructObject: (data) => (0,
|
|
9163
|
+
constructObject: (data) => (0, import_core25.isObject)(data) && "entity" in data && (0, import_core25.isObject)(data.entity) ? LightsparkNodeFromJson(data.entity) : null
|
|
9130
9164
|
};
|
|
9131
9165
|
};
|
|
9132
9166
|
|
|
@@ -9180,7 +9214,7 @@ var AccountToTransactionsConnectionFromJson = (obj) => {
|
|
|
9180
9214
|
};
|
|
9181
9215
|
|
|
9182
9216
|
// src/objects/Wallet.ts
|
|
9183
|
-
var
|
|
9217
|
+
var import_core26 = require("@lightsparkdev/core");
|
|
9184
9218
|
|
|
9185
9219
|
// src/objects/WalletStatus.ts
|
|
9186
9220
|
var WalletStatus = /* @__PURE__ */ ((WalletStatus2) => {
|
|
@@ -10347,7 +10381,7 @@ query GetWallet($id: ID!) {
|
|
|
10347
10381
|
${FRAGMENT27}
|
|
10348
10382
|
`,
|
|
10349
10383
|
variables: { id },
|
|
10350
|
-
constructObject: (data) => (0,
|
|
10384
|
+
constructObject: (data) => (0, import_core26.isObject)(data) && "entity" in data && (0, import_core26.isObject)(data.entity) ? WalletFromJson(data.entity) : null
|
|
10351
10385
|
};
|
|
10352
10386
|
}
|
|
10353
10387
|
toJson() {
|
|
@@ -12207,7 +12241,7 @@ query GetAccount {
|
|
|
12207
12241
|
${FRAGMENT28}
|
|
12208
12242
|
`,
|
|
12209
12243
|
variables: {},
|
|
12210
|
-
constructObject: (data) => (0,
|
|
12244
|
+
constructObject: (data) => (0, import_core27.isObject)(data) && "current_account" in data && (0, import_core27.isObject)(data.current_account) ? AccountFromJson(data.current_account) : null
|
|
12211
12245
|
};
|
|
12212
12246
|
}
|
|
12213
12247
|
toJson() {
|
|
@@ -12262,16 +12296,16 @@ var LightsparkClient = class {
|
|
|
12262
12296
|
* For React Native, you should use the `ReactNativeCrypto`
|
|
12263
12297
|
* implementation from `@lightsparkdev/react-native`.
|
|
12264
12298
|
*/
|
|
12265
|
-
constructor(authProvider = new
|
|
12299
|
+
constructor(authProvider = new import_core28.StubAuthProvider(), serverUrl = "api.lightspark.com", cryptoImpl = import_core28.DefaultCrypto) {
|
|
12266
12300
|
this.authProvider = authProvider;
|
|
12267
12301
|
this.serverUrl = serverUrl;
|
|
12268
12302
|
this.cryptoImpl = cryptoImpl;
|
|
12269
|
-
this.nodeKeyCache = new
|
|
12303
|
+
this.nodeKeyCache = new import_core28.NodeKeyCache(this.cryptoImpl);
|
|
12270
12304
|
this.nodeKeyLoaderCache = new NodeKeyLoaderCache(
|
|
12271
12305
|
this.nodeKeyCache,
|
|
12272
12306
|
this.cryptoImpl
|
|
12273
12307
|
);
|
|
12274
|
-
this.requester = new
|
|
12308
|
+
this.requester = new import_core28.Requester(
|
|
12275
12309
|
this.nodeKeyCache,
|
|
12276
12310
|
this.LIGHTSPARK_SDK_ENDPOINT,
|
|
12277
12311
|
`js-lightspark-sdk/${sdkVersion}`,
|
|
@@ -12318,7 +12352,7 @@ var LightsparkClient = class {
|
|
|
12318
12352
|
* @param authProvider
|
|
12319
12353
|
*/
|
|
12320
12354
|
setAuthProvider(authProvider) {
|
|
12321
|
-
this.requester = new
|
|
12355
|
+
this.requester = new import_core28.Requester(
|
|
12322
12356
|
this.nodeKeyCache,
|
|
12323
12357
|
this.LIGHTSPARK_SDK_ENDPOINT,
|
|
12324
12358
|
`js-lightspark-sdk/${sdkVersion}`,
|
|
@@ -12423,10 +12457,10 @@ var LightsparkClient = class {
|
|
|
12423
12457
|
network: bitcoinNetwork
|
|
12424
12458
|
});
|
|
12425
12459
|
if (!response.current_account) {
|
|
12426
|
-
throw new
|
|
12460
|
+
throw new import_core28.LightsparkAuthException("No current account");
|
|
12427
12461
|
}
|
|
12428
12462
|
if (!response.current_account.dashboard_overview_nodes || response.current_account.dashboard_overview_nodes.entities.length === 0) {
|
|
12429
|
-
throw new
|
|
12463
|
+
throw new import_core28.LightsparkException(
|
|
12430
12464
|
"NO_NODES_FOUND",
|
|
12431
12465
|
`No nodes found for this dashboard request. This could mean one of a few things:
|
|
12432
12466
|
1. You are requesting MAINNET nodes, but you have no MAINNET nodes yet. In this case, request BitcoinNetwork.REGTEST instead.
|
|
@@ -12497,11 +12531,11 @@ var LightsparkClient = class {
|
|
|
12497
12531
|
}
|
|
12498
12532
|
);
|
|
12499
12533
|
if (!response.current_account) {
|
|
12500
|
-
throw new
|
|
12534
|
+
throw new import_core28.LightsparkAuthException("No current account");
|
|
12501
12535
|
}
|
|
12502
12536
|
const account = response.current_account;
|
|
12503
12537
|
if (!account.dashboard_overview_nodes || !account.dashboard_overview_nodes.entities || account.dashboard_overview_nodes.entities.length === 0) {
|
|
12504
|
-
throw new
|
|
12538
|
+
throw new import_core28.LightsparkException(
|
|
12505
12539
|
"InvalidOrMissingNode",
|
|
12506
12540
|
"No nodes found for node dashboard"
|
|
12507
12541
|
);
|
|
@@ -12595,7 +12629,7 @@ var LightsparkClient = class {
|
|
|
12595
12629
|
* @returns An Invoice object representing the generated invoice.
|
|
12596
12630
|
*/
|
|
12597
12631
|
async createLnurlInvoice(nodeId, amountMsats, metadata, expirySecs = void 0) {
|
|
12598
|
-
const metadataHash = await (0,
|
|
12632
|
+
const metadataHash = await (0, import_core28.createSha256Hash)(metadata, true);
|
|
12599
12633
|
const variables = {
|
|
12600
12634
|
node_id: nodeId,
|
|
12601
12635
|
amount_msats: amountMsats,
|
|
@@ -12634,11 +12668,11 @@ var LightsparkClient = class {
|
|
|
12634
12668
|
* @returns An Invoice object representing the generated invoice.
|
|
12635
12669
|
*/
|
|
12636
12670
|
async createUmaInvoice(nodeId, amountMsats, metadata, expirySecs = void 0, signingPrivateKey = void 0, receiverIdentifier = void 0) {
|
|
12637
|
-
const metadataHash = await (0,
|
|
12671
|
+
const metadataHash = await (0, import_core28.createSha256Hash)(metadata, true);
|
|
12638
12672
|
let receiverHash = void 0;
|
|
12639
12673
|
if (receiverIdentifier !== void 0) {
|
|
12640
12674
|
if (signingPrivateKey == void 0) {
|
|
12641
|
-
throw new
|
|
12675
|
+
throw new import_core28.LightsparkException(
|
|
12642
12676
|
"CreateUmaInvoiceError",
|
|
12643
12677
|
"Receiver identifier provided without signing private key"
|
|
12644
12678
|
);
|
|
@@ -12779,7 +12813,7 @@ var LightsparkClient = class {
|
|
|
12779
12813
|
}
|
|
12780
12814
|
});
|
|
12781
12815
|
if (!response) {
|
|
12782
|
-
throw new
|
|
12816
|
+
throw new import_core28.LightsparkException(
|
|
12783
12817
|
"WithdrawalFeeEstimateError",
|
|
12784
12818
|
"Null or invalid fee estimate response from server"
|
|
12785
12819
|
);
|
|
@@ -12796,7 +12830,7 @@ var LightsparkClient = class {
|
|
|
12796
12830
|
await this.nodeKeyCache.loadKey(
|
|
12797
12831
|
nodeId,
|
|
12798
12832
|
signingPrivateKeyOrAlias,
|
|
12799
|
-
|
|
12833
|
+
import_core28.SigningKeyType.RSASigningKey
|
|
12800
12834
|
);
|
|
12801
12835
|
}
|
|
12802
12836
|
/**
|
|
@@ -12820,7 +12854,7 @@ var LightsparkClient = class {
|
|
|
12820
12854
|
*/
|
|
12821
12855
|
async payInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0) {
|
|
12822
12856
|
if (!this.nodeKeyCache.hasKey(payerNodeId)) {
|
|
12823
|
-
throw new
|
|
12857
|
+
throw new import_core28.LightsparkSigningException("Paying node is not unlocked");
|
|
12824
12858
|
}
|
|
12825
12859
|
const variables = {
|
|
12826
12860
|
node_id: payerNodeId,
|
|
@@ -12837,7 +12871,7 @@ var LightsparkClient = class {
|
|
|
12837
12871
|
payerNodeId
|
|
12838
12872
|
);
|
|
12839
12873
|
if (response.pay_invoice?.payment.outgoing_payment_failure_message) {
|
|
12840
|
-
throw new
|
|
12874
|
+
throw new import_core28.LightsparkException(
|
|
12841
12875
|
"PaymentError",
|
|
12842
12876
|
response.pay_invoice?.payment.outgoing_payment_failure_message.rich_text_text
|
|
12843
12877
|
);
|
|
@@ -12869,12 +12903,12 @@ var LightsparkClient = class {
|
|
|
12869
12903
|
*/
|
|
12870
12904
|
async payUmaInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0, signingPrivateKey = void 0, senderIdentifier = void 0) {
|
|
12871
12905
|
if (!this.nodeKeyCache.hasKey(payerNodeId)) {
|
|
12872
|
-
throw new
|
|
12906
|
+
throw new import_core28.LightsparkSigningException("Paying node is not unlocked");
|
|
12873
12907
|
}
|
|
12874
12908
|
let senderHash = void 0;
|
|
12875
12909
|
if (senderIdentifier !== void 0) {
|
|
12876
12910
|
if (signingPrivateKey == void 0) {
|
|
12877
|
-
throw new
|
|
12911
|
+
throw new import_core28.LightsparkException(
|
|
12878
12912
|
"PayUmaInvoiceError",
|
|
12879
12913
|
"Sender identifier provided without signing private key"
|
|
12880
12914
|
);
|
|
@@ -12902,7 +12936,7 @@ var LightsparkClient = class {
|
|
|
12902
12936
|
payerNodeId
|
|
12903
12937
|
);
|
|
12904
12938
|
if (response.pay_uma_invoice?.payment.outgoing_payment_failure_message) {
|
|
12905
|
-
throw new
|
|
12939
|
+
throw new import_core28.LightsparkException(
|
|
12906
12940
|
"PaymentError",
|
|
12907
12941
|
response.pay_uma_invoice?.payment.outgoing_payment_failure_message.rich_text_text
|
|
12908
12942
|
);
|
|
@@ -12920,7 +12954,7 @@ var LightsparkClient = class {
|
|
|
12920
12954
|
const pollIntervalMs = 250;
|
|
12921
12955
|
const pollMaxTimeouts = pollTimeoutSecs * 1e3 / pollIntervalMs;
|
|
12922
12956
|
const pollIgnoreErrors = false;
|
|
12923
|
-
const transaction = await (0,
|
|
12957
|
+
const transaction = await (0, import_core28.pollUntil)(
|
|
12924
12958
|
() => {
|
|
12925
12959
|
return this.getTransaction(transactionId);
|
|
12926
12960
|
},
|
|
@@ -12940,7 +12974,7 @@ var LightsparkClient = class {
|
|
|
12940
12974
|
pollIntervalMs,
|
|
12941
12975
|
pollMaxTimeouts,
|
|
12942
12976
|
pollIgnoreErrors,
|
|
12943
|
-
() => new
|
|
12977
|
+
() => new import_core28.LightsparkException(
|
|
12944
12978
|
"Timeout",
|
|
12945
12979
|
"Timeout waiting for transaction to complete."
|
|
12946
12980
|
)
|
|
@@ -12964,7 +12998,7 @@ var LightsparkClient = class {
|
|
|
12964
12998
|
*/
|
|
12965
12999
|
async sendPayment(payerNodeId, destinationPublicKey, timeoutSecs = 60, amountMsats, maximumFeesMsats) {
|
|
12966
13000
|
if (!this.nodeKeyCache.hasKey(payerNodeId)) {
|
|
12967
|
-
throw new
|
|
13001
|
+
throw new import_core28.LightsparkSigningException("Paying node is not unlocked");
|
|
12968
13002
|
}
|
|
12969
13003
|
const response = await this.requester.makeRawRequest(
|
|
12970
13004
|
SendPayment,
|
|
@@ -12978,7 +13012,7 @@ var LightsparkClient = class {
|
|
|
12978
13012
|
payerNodeId
|
|
12979
13013
|
);
|
|
12980
13014
|
if (response.send_payment?.payment.outgoing_payment_failure_message) {
|
|
12981
|
-
throw new
|
|
13015
|
+
throw new import_core28.LightsparkException(
|
|
12982
13016
|
"PaymentError",
|
|
12983
13017
|
response.send_payment?.payment.outgoing_payment_failure_message.rich_text_text
|
|
12984
13018
|
);
|
|
@@ -13105,7 +13139,7 @@ var LightsparkClient = class {
|
|
|
13105
13139
|
constructObject: (responseJson) => {
|
|
13106
13140
|
const encodedPaymentRequest = responseJson.create_test_mode_invoice?.encoded_payment_request;
|
|
13107
13141
|
if (!encodedPaymentRequest) {
|
|
13108
|
-
throw new
|
|
13142
|
+
throw new import_core28.LightsparkException(
|
|
13109
13143
|
"CreateTestModeInvoiceError",
|
|
13110
13144
|
"Unable to create test mode invoice"
|
|
13111
13145
|
);
|
|
@@ -13156,7 +13190,7 @@ var LightsparkClient = class {
|
|
|
13156
13190
|
},
|
|
13157
13191
|
constructObject: (responseJson) => {
|
|
13158
13192
|
if (responseJson.screen_node?.rating === void 0) {
|
|
13159
|
-
throw new
|
|
13193
|
+
throw new import_core28.LightsparkException(
|
|
13160
13194
|
"ScreenNodeError",
|
|
13161
13195
|
"Unable to screen node"
|
|
13162
13196
|
);
|
|
@@ -13188,7 +13222,7 @@ var LightsparkClient = class {
|
|
|
13188
13222
|
},
|
|
13189
13223
|
constructObject: (responseJson) => {
|
|
13190
13224
|
if (!responseJson.register_payment?.payment?.id) {
|
|
13191
|
-
throw new
|
|
13225
|
+
throw new import_core28.LightsparkException(
|
|
13192
13226
|
"RegisterPaymentError",
|
|
13193
13227
|
"Unable to register payment"
|
|
13194
13228
|
);
|
|
@@ -13212,7 +13246,7 @@ var LightsparkClient = class {
|
|
|
13212
13246
|
},
|
|
13213
13247
|
constructObject: (responseJson) => {
|
|
13214
13248
|
if (!responseJson.create_uma_invitation?.invitation) {
|
|
13215
|
-
throw new
|
|
13249
|
+
throw new import_core28.LightsparkException(
|
|
13216
13250
|
"CreateUmaInvitationError",
|
|
13217
13251
|
"Unable to create UMA invitation"
|
|
13218
13252
|
);
|
|
@@ -13241,7 +13275,7 @@ var LightsparkClient = class {
|
|
|
13241
13275
|
},
|
|
13242
13276
|
constructObject: (responseJson) => {
|
|
13243
13277
|
if (!responseJson.create_uma_invitation_with_incentives?.invitation) {
|
|
13244
|
-
throw new
|
|
13278
|
+
throw new import_core28.LightsparkException(
|
|
13245
13279
|
"CreateUmaInvitationError",
|
|
13246
13280
|
"Unable to create UMA invitation"
|
|
13247
13281
|
);
|
|
@@ -13269,7 +13303,7 @@ var LightsparkClient = class {
|
|
|
13269
13303
|
},
|
|
13270
13304
|
constructObject: (responseJson) => {
|
|
13271
13305
|
if (!responseJson.claim_uma_invitation?.invitation) {
|
|
13272
|
-
throw new
|
|
13306
|
+
throw new import_core28.LightsparkException(
|
|
13273
13307
|
"ClaimUmaInvitationError",
|
|
13274
13308
|
"Unable to claim UMA invitation"
|
|
13275
13309
|
);
|
|
@@ -13301,7 +13335,7 @@ var LightsparkClient = class {
|
|
|
13301
13335
|
},
|
|
13302
13336
|
constructObject: (responseJson) => {
|
|
13303
13337
|
if (!responseJson.claim_uma_invitation_with_incentives?.invitation) {
|
|
13304
|
-
throw new
|
|
13338
|
+
throw new import_core28.LightsparkException(
|
|
13305
13339
|
"ClaimUmaInvitationError",
|
|
13306
13340
|
"Unable to claim UMA invitation"
|
|
13307
13341
|
);
|
|
@@ -13375,20 +13409,66 @@ var LightsparkClient = class {
|
|
|
13375
13409
|
}
|
|
13376
13410
|
});
|
|
13377
13411
|
}
|
|
13412
|
+
/**
|
|
13413
|
+
* Fetches Outgoing payments for a given invoice if there are any.
|
|
13414
|
+
*
|
|
13415
|
+
* @param encodedInvoice encoded invoice associated with outgoing payment
|
|
13416
|
+
* @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
|
|
13417
|
+
*/
|
|
13418
|
+
async outgoingPaymentsForInvoice(encodedInvoice, statuses = void 0) {
|
|
13419
|
+
return await this.executeRawQuery({
|
|
13420
|
+
queryPayload: OutgoingPaymentsForInvoice,
|
|
13421
|
+
variables: {
|
|
13422
|
+
encoded_invoice: encodedInvoice,
|
|
13423
|
+
statuses
|
|
13424
|
+
},
|
|
13425
|
+
constructObject: (responseJson) => {
|
|
13426
|
+
if (!responseJson.outgoing_payments_for_invoice || !responseJson.outgoing_payments_for_invoice.payments) {
|
|
13427
|
+
return [];
|
|
13428
|
+
}
|
|
13429
|
+
return responseJson.outgoing_payments_for_invoice.payments.map(
|
|
13430
|
+
(payment) => OutgoingPaymentFromJson(payment)
|
|
13431
|
+
);
|
|
13432
|
+
}
|
|
13433
|
+
});
|
|
13434
|
+
}
|
|
13435
|
+
/**
|
|
13436
|
+
* Fetches Incoming payments for a given invoice if there are any.
|
|
13437
|
+
*
|
|
13438
|
+
* @param invoiceId id of associated invoice
|
|
13439
|
+
* @param statuses Filter to only include payments with the given statuses. If not provided, all statuses are included.
|
|
13440
|
+
*/
|
|
13441
|
+
async incomingPaymentsForInvoice(invoiceId, statuses = void 0) {
|
|
13442
|
+
return await this.executeRawQuery({
|
|
13443
|
+
queryPayload: IncomingPaymentsForInvoice,
|
|
13444
|
+
variables: {
|
|
13445
|
+
invoice_id: invoiceId,
|
|
13446
|
+
statuses
|
|
13447
|
+
},
|
|
13448
|
+
constructObject: (responseJson) => {
|
|
13449
|
+
if (!responseJson.incoming_payments_for_invoice || !responseJson.incoming_payments_for_invoice.payments) {
|
|
13450
|
+
return [];
|
|
13451
|
+
}
|
|
13452
|
+
return responseJson.incoming_payments_for_invoice.payments.map(
|
|
13453
|
+
(payment) => IncomingPaymentFromJson(payment)
|
|
13454
|
+
);
|
|
13455
|
+
}
|
|
13456
|
+
});
|
|
13457
|
+
}
|
|
13378
13458
|
async hashPhoneNumber(e164PhoneNumber) {
|
|
13379
13459
|
const e164PhoneRegex = /^\+[1-9]\d{1,14}$/;
|
|
13380
13460
|
if (!e164PhoneRegex.test(e164PhoneNumber)) {
|
|
13381
|
-
throw new
|
|
13461
|
+
throw new import_core28.LightsparkException(
|
|
13382
13462
|
"InvalidPhoneNumber",
|
|
13383
13463
|
"Invalid phone number. Phone number must be in E164 format."
|
|
13384
13464
|
);
|
|
13385
13465
|
}
|
|
13386
|
-
return await (0,
|
|
13466
|
+
return await (0, import_core28.createSha256Hash)(e164PhoneNumber, true);
|
|
13387
13467
|
}
|
|
13388
13468
|
async hashUmaIdentifier(identifier, signingPrivateKey) {
|
|
13389
13469
|
const now = this.getUtcDateTime();
|
|
13390
|
-
const input = identifier + `${now.getUTCMonth() + 1}-${now.getUTCFullYear()}` + (0,
|
|
13391
|
-
return await (0,
|
|
13470
|
+
const input = identifier + `${now.getUTCMonth() + 1}-${now.getUTCFullYear()}` + (0, import_core28.bytesToHex)(signingPrivateKey);
|
|
13471
|
+
return await (0, import_core28.createSha256Hash)(input, true);
|
|
13392
13472
|
}
|
|
13393
13473
|
getUtcDateTime() {
|
|
13394
13474
|
return /* @__PURE__ */ new Date();
|
|
@@ -13406,6 +13486,16 @@ var LightsparkClient = class {
|
|
|
13406
13486
|
executeRawQuery(query) {
|
|
13407
13487
|
return this.requester.executeQuery(query);
|
|
13408
13488
|
}
|
|
13489
|
+
/**
|
|
13490
|
+
* Enable logging for debugging purposes
|
|
13491
|
+
*
|
|
13492
|
+
* @param enabled Whether logging should be enabled.
|
|
13493
|
+
* @param level The logging level to use.
|
|
13494
|
+
* */
|
|
13495
|
+
setLoggingEnabled(enabled, level = import_core28.LoggingLevel.Info) {
|
|
13496
|
+
import_core28.logger.setEnabled(enabled, level);
|
|
13497
|
+
logger.setEnabled(enabled, level);
|
|
13498
|
+
}
|
|
13409
13499
|
};
|
|
13410
13500
|
var client_default = LightsparkClient;
|
|
13411
13501
|
|
|
@@ -13434,7 +13524,7 @@ var getBitcoinNetworkOrThrow = (bitcoinNetwork) => {
|
|
|
13434
13524
|
};
|
|
13435
13525
|
|
|
13436
13526
|
// src/objects/AuditLogActor.ts
|
|
13437
|
-
var
|
|
13527
|
+
var import_core29 = require("@lightsparkdev/core");
|
|
13438
13528
|
var AuditLogActorFromJson = (obj) => {
|
|
13439
13529
|
if (obj["__typename"] == "ApiToken") {
|
|
13440
13530
|
return {
|
|
@@ -13448,7 +13538,7 @@ var AuditLogActorFromJson = (obj) => {
|
|
|
13448
13538
|
typename: "ApiToken"
|
|
13449
13539
|
};
|
|
13450
13540
|
}
|
|
13451
|
-
throw new
|
|
13541
|
+
throw new import_core29.LightsparkException(
|
|
13452
13542
|
"DeserializationError",
|
|
13453
13543
|
`Couldn't find a concrete type for interface AuditLogActor corresponding to the typename=${obj["__typename"]}`
|
|
13454
13544
|
);
|
|
@@ -13481,12 +13571,12 @@ query GetAuditLogActor($id: ID!) {
|
|
|
13481
13571
|
${FRAGMENT29}
|
|
13482
13572
|
`,
|
|
13483
13573
|
variables: { id },
|
|
13484
|
-
constructObject: (data) => (0,
|
|
13574
|
+
constructObject: (data) => (0, import_core29.isObject)(data) && "entity" in data && (0, import_core29.isObject)(data.entity) ? AuditLogActorFromJson(data.entity) : null
|
|
13485
13575
|
};
|
|
13486
13576
|
};
|
|
13487
13577
|
|
|
13488
13578
|
// src/objects/ChannelSnapshot.ts
|
|
13489
|
-
var
|
|
13579
|
+
var import_core30 = require("@lightsparkdev/core");
|
|
13490
13580
|
var ChannelSnapshotFromJson = (obj) => {
|
|
13491
13581
|
return {
|
|
13492
13582
|
id: obj["channel_snapshot_id"],
|
|
@@ -13569,7 +13659,7 @@ query GetChannelSnapshot($id: ID!) {
|
|
|
13569
13659
|
${FRAGMENT30}
|
|
13570
13660
|
`,
|
|
13571
13661
|
variables: { id },
|
|
13572
|
-
constructObject: (data) => (0,
|
|
13662
|
+
constructObject: (data) => (0, import_core30.isObject)(data) && "entity" in data && (0, import_core30.isObject)(data.entity) ? ChannelSnapshotFromJson(data.entity) : null
|
|
13573
13663
|
};
|
|
13574
13664
|
};
|
|
13575
13665
|
|
|
@@ -13839,10 +13929,10 @@ var ComplianceProvider = /* @__PURE__ */ ((ComplianceProvider2) => {
|
|
|
13839
13929
|
var ComplianceProvider_default = ComplianceProvider;
|
|
13840
13930
|
|
|
13841
13931
|
// src/objects/Connection.ts
|
|
13842
|
-
var
|
|
13932
|
+
var import_core31 = require("@lightsparkdev/core");
|
|
13843
13933
|
|
|
13844
13934
|
// src/objects/SignablePayload.ts
|
|
13845
|
-
var
|
|
13935
|
+
var import_core32 = require("@lightsparkdev/core");
|
|
13846
13936
|
|
|
13847
13937
|
// src/objects/SignablePayloadStatus.ts
|
|
13848
13938
|
var SignablePayloadStatus = /* @__PURE__ */ ((SignablePayloadStatus2) => {
|
|
@@ -13899,12 +13989,12 @@ query GetSignablePayload($id: ID!) {
|
|
|
13899
13989
|
${FRAGMENT31}
|
|
13900
13990
|
`,
|
|
13901
13991
|
variables: { id },
|
|
13902
|
-
constructObject: (data) => (0,
|
|
13992
|
+
constructObject: (data) => (0, import_core32.isObject)(data) && "entity" in data && (0, import_core32.isObject)(data.entity) ? SignablePayloadFromJson(data.entity) : null
|
|
13903
13993
|
};
|
|
13904
13994
|
};
|
|
13905
13995
|
|
|
13906
13996
|
// src/objects/Deposit.ts
|
|
13907
|
-
var
|
|
13997
|
+
var import_core33 = require("@lightsparkdev/core");
|
|
13908
13998
|
var DepositFromJson = (obj) => {
|
|
13909
13999
|
return {
|
|
13910
14000
|
id: obj["deposit_id"],
|
|
@@ -13970,12 +14060,12 @@ query GetDeposit($id: ID!) {
|
|
|
13970
14060
|
${FRAGMENT32}
|
|
13971
14061
|
`,
|
|
13972
14062
|
variables: { id },
|
|
13973
|
-
constructObject: (data) => (0,
|
|
14063
|
+
constructObject: (data) => (0, import_core33.isObject)(data) && "entity" in data && (0, import_core33.isObject)(data.entity) ? DepositFromJson(data.entity) : null
|
|
13974
14064
|
};
|
|
13975
14065
|
};
|
|
13976
14066
|
|
|
13977
14067
|
// src/objects/LightningTransaction.ts
|
|
13978
|
-
var
|
|
14068
|
+
var import_core34 = require("@lightsparkdev/core");
|
|
13979
14069
|
var LightningTransactionFromJson = (obj) => {
|
|
13980
14070
|
if (obj["__typename"] == "IncomingPayment") {
|
|
13981
14071
|
return new IncomingPayment_default(
|
|
@@ -14040,7 +14130,7 @@ var LightningTransactionFromJson = (obj) => {
|
|
|
14040
14130
|
failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
|
|
14041
14131
|
};
|
|
14042
14132
|
}
|
|
14043
|
-
throw new
|
|
14133
|
+
throw new import_core34.LightsparkException(
|
|
14044
14134
|
"DeserializationError",
|
|
14045
14135
|
`Couldn't find a concrete type for interface LightningTransaction corresponding to the typename=${obj["__typename"]}`
|
|
14046
14136
|
);
|
|
@@ -14482,12 +14572,12 @@ query GetLightningTransaction($id: ID!) {
|
|
|
14482
14572
|
${FRAGMENT33}
|
|
14483
14573
|
`,
|
|
14484
14574
|
variables: { id },
|
|
14485
|
-
constructObject: (data) => (0,
|
|
14575
|
+
constructObject: (data) => (0, import_core34.isObject)(data) && "entity" in data && (0, import_core34.isObject)(data.entity) ? LightningTransactionFromJson(data.entity) : null
|
|
14486
14576
|
};
|
|
14487
14577
|
};
|
|
14488
14578
|
|
|
14489
14579
|
// src/objects/LightsparkNodeOwner.ts
|
|
14490
|
-
var
|
|
14580
|
+
var import_core35 = require("@lightsparkdev/core");
|
|
14491
14581
|
var LightsparkNodeOwnerFromJson = (obj) => {
|
|
14492
14582
|
if (obj["__typename"] == "Account") {
|
|
14493
14583
|
return new Account_default(
|
|
@@ -14511,7 +14601,7 @@ var LightsparkNodeOwnerFromJson = (obj) => {
|
|
|
14511
14601
|
obj["wallet_account"]?.id ?? void 0
|
|
14512
14602
|
);
|
|
14513
14603
|
}
|
|
14514
|
-
throw new
|
|
14604
|
+
throw new import_core35.LightsparkException(
|
|
14515
14605
|
"DeserializationError",
|
|
14516
14606
|
`Couldn't find a concrete type for interface LightsparkNodeOwner corresponding to the typename=${obj["__typename"]}`
|
|
14517
14607
|
);
|
|
@@ -14580,7 +14670,7 @@ query GetLightsparkNodeOwner($id: ID!) {
|
|
|
14580
14670
|
${FRAGMENT34}
|
|
14581
14671
|
`,
|
|
14582
14672
|
variables: { id },
|
|
14583
|
-
constructObject: (data) => (0,
|
|
14673
|
+
constructObject: (data) => (0, import_core35.isObject)(data) && "entity" in data && (0, import_core35.isObject)(data.entity) ? LightsparkNodeOwnerFromJson(data.entity) : null
|
|
14584
14674
|
};
|
|
14585
14675
|
};
|
|
14586
14676
|
|
|
@@ -14596,7 +14686,7 @@ var OnChainFeeTarget = /* @__PURE__ */ ((OnChainFeeTarget2) => {
|
|
|
14596
14686
|
var OnChainFeeTarget_default = OnChainFeeTarget;
|
|
14597
14687
|
|
|
14598
14688
|
// src/objects/OnChainTransaction.ts
|
|
14599
|
-
var
|
|
14689
|
+
var import_core36 = require("@lightsparkdev/core");
|
|
14600
14690
|
var OnChainTransactionFromJson = (obj) => {
|
|
14601
14691
|
if (obj["__typename"] == "ChannelClosingTransaction") {
|
|
14602
14692
|
return {
|
|
@@ -14670,7 +14760,7 @@ var OnChainTransactionFromJson = (obj) => {
|
|
|
14670
14760
|
numConfirmations: obj["withdrawal_num_confirmations"]
|
|
14671
14761
|
};
|
|
14672
14762
|
}
|
|
14673
|
-
throw new
|
|
14763
|
+
throw new import_core36.LightsparkException(
|
|
14674
14764
|
"DeserializationError",
|
|
14675
14765
|
`Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`
|
|
14676
14766
|
);
|
|
@@ -14821,7 +14911,7 @@ query GetOnChainTransaction($id: ID!) {
|
|
|
14821
14911
|
${FRAGMENT35}
|
|
14822
14912
|
`,
|
|
14823
14913
|
variables: { id },
|
|
14824
|
-
constructObject: (data) => (0,
|
|
14914
|
+
constructObject: (data) => (0, import_core36.isObject)(data) && "entity" in data && (0, import_core36.isObject)(data.entity) ? OnChainTransactionFromJson(data.entity) : null
|
|
14825
14915
|
};
|
|
14826
14916
|
};
|
|
14827
14917
|
|
|
@@ -14861,7 +14951,7 @@ var RiskRating = /* @__PURE__ */ ((RiskRating2) => {
|
|
|
14861
14951
|
var RiskRating_default = RiskRating;
|
|
14862
14952
|
|
|
14863
14953
|
// src/objects/RoutingTransaction.ts
|
|
14864
|
-
var
|
|
14954
|
+
var import_core37 = require("@lightsparkdev/core");
|
|
14865
14955
|
var RoutingTransactionFromJson = (obj) => {
|
|
14866
14956
|
return {
|
|
14867
14957
|
id: obj["routing_transaction_id"],
|
|
@@ -14930,12 +15020,12 @@ query GetRoutingTransaction($id: ID!) {
|
|
|
14930
15020
|
${FRAGMENT36}
|
|
14931
15021
|
`,
|
|
14932
15022
|
variables: { id },
|
|
14933
|
-
constructObject: (data) => (0,
|
|
15023
|
+
constructObject: (data) => (0, import_core37.isObject)(data) && "entity" in data && (0, import_core37.isObject)(data.entity) ? RoutingTransactionFromJson(data.entity) : null
|
|
14934
15024
|
};
|
|
14935
15025
|
};
|
|
14936
15026
|
|
|
14937
15027
|
// src/objects/Signable.ts
|
|
14938
|
-
var
|
|
15028
|
+
var import_core38 = require("@lightsparkdev/core");
|
|
14939
15029
|
var SignableFromJson = (obj) => {
|
|
14940
15030
|
return {
|
|
14941
15031
|
id: obj["signable_id"],
|
|
@@ -14965,7 +15055,7 @@ query GetSignable($id: ID!) {
|
|
|
14965
15055
|
${FRAGMENT37}
|
|
14966
15056
|
`,
|
|
14967
15057
|
variables: { id },
|
|
14968
|
-
constructObject: (data) => (0,
|
|
15058
|
+
constructObject: (data) => (0, import_core38.isObject)(data) && "entity" in data && (0, import_core38.isObject)(data.entity) ? SignableFromJson(data.entity) : null
|
|
14969
15059
|
};
|
|
14970
15060
|
};
|
|
14971
15061
|
|
|
@@ -15003,12 +15093,13 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
|
|
|
15003
15093
|
WebhookEventType2["REMOTE_SIGNING"] = "REMOTE_SIGNING";
|
|
15004
15094
|
WebhookEventType2["LOW_BALANCE"] = "LOW_BALANCE";
|
|
15005
15095
|
WebhookEventType2["HIGH_BALANCE"] = "HIGH_BALANCE";
|
|
15096
|
+
WebhookEventType2["CHANNEL_OPENING_FEES"] = "CHANNEL_OPENING_FEES";
|
|
15006
15097
|
return WebhookEventType2;
|
|
15007
15098
|
})(WebhookEventType || {});
|
|
15008
15099
|
var WebhookEventType_default = WebhookEventType;
|
|
15009
15100
|
|
|
15010
15101
|
// src/webhooks.ts
|
|
15011
|
-
var
|
|
15102
|
+
var import_core39 = require("@lightsparkdev/core");
|
|
15012
15103
|
var WEBHOOKS_SIGNATURE_HEADER = "lightspark-signature";
|
|
15013
15104
|
var verifyAndParseWebhook = async (data, hexdigest, webhook_secret) => {
|
|
15014
15105
|
const { createHmac } = await import("crypto");
|
|
@@ -15044,8 +15135,8 @@ var RemoteSigningWebhookHandler = class {
|
|
|
15044
15135
|
this.validator = validator;
|
|
15045
15136
|
}
|
|
15046
15137
|
async handleWebhookRequest(data, webhookSignature, webhookSecret) {
|
|
15047
|
-
if (!
|
|
15048
|
-
throw new
|
|
15138
|
+
if (!import_core39.isNode) {
|
|
15139
|
+
throw new import_core39.LightsparkSigningException(
|
|
15049
15140
|
"Environment not supported for handling webhooks."
|
|
15050
15141
|
);
|
|
15051
15142
|
}
|