@lightsparkdev/lightspark-sdk 0.4.6 → 0.4.8
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 +16 -0
- package/dist/index.cjs +107 -104
- package/dist/index.d.ts +2 -2
- package/dist/index.js +108 -107
- package/package.json +13 -5
- package/src/auth/AccountTokenAuthProvider.ts +8 -3
- package/src/client.ts +51 -36
- package/src/graphql/MultiNodeDashboard.ts +6 -7
- package/src/objects/.eslintrc.cjs +5 -0
- package/src/objects/Account.ts +23 -29
- package/src/objects/AccountToApiTokensConnection.ts +4 -2
- package/src/objects/AccountToChannelsConnection.ts +2 -1
- package/src/objects/AccountToNodesConnection.ts +4 -2
- package/src/objects/AccountToPaymentRequestsConnection.ts +4 -2
- package/src/objects/AccountToTransactionsConnection.ts +6 -3
- package/src/objects/AccountToWalletsConnection.ts +4 -2
- package/src/objects/ApiToken.ts +2 -2
- package/src/objects/Balances.ts +2 -1
- package/src/objects/BlockchainBalance.ts +2 -1
- package/src/objects/Channel.ts +10 -9
- package/src/objects/ChannelClosingTransaction.ts +6 -5
- package/src/objects/ChannelFees.ts +2 -1
- package/src/objects/ChannelOpeningTransaction.ts +6 -5
- package/src/objects/ChannelToTransactionsConnection.ts +2 -1
- package/src/objects/CreateApiTokenOutput.ts +2 -1
- package/src/objects/Deposit.ts +6 -5
- package/src/objects/FeeEstimate.ts +2 -1
- package/src/objects/FundNodeOutput.ts +2 -1
- package/src/objects/GraphNode.ts +6 -7
- package/src/objects/Hop.ts +4 -3
- package/src/objects/IncomingPayment.ts +8 -8
- package/src/objects/IncomingPaymentAttempt.ts +4 -3
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +2 -3
- package/src/objects/Invoice.ts +7 -5
- package/src/objects/InvoiceData.ts +5 -3
- package/src/objects/LightningFeeEstimateOutput.ts +2 -1
- package/src/objects/LightningTransaction.ts +7 -5
- package/src/objects/LightsparkNode.ts +15 -16
- package/src/objects/LightsparkNodeOwner.ts +3 -2
- package/src/objects/LightsparkNodeToChannelsConnection.ts +4 -2
- package/src/objects/Node.ts +7 -7
- package/src/objects/NodeToAddressesConnection.ts +2 -1
- package/src/objects/OnChainTransaction.ts +10 -8
- package/src/objects/OutgoingPayment.ts +11 -11
- package/src/objects/OutgoingPaymentAttempt.ts +7 -7
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +2 -1
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +2 -3
- package/src/objects/PaymentRequest.ts +5 -4
- package/src/objects/PaymentRequestData.ts +1 -1
- package/src/objects/RoutingTransaction.ts +8 -6
- package/src/objects/SingleNodeDashboard.ts +6 -6
- package/src/objects/Transaction.ts +10 -8
- package/src/objects/TransactionUpdate.ts +2 -1
- package/src/objects/Wallet.ts +7 -5
- package/src/objects/Withdrawal.ts +6 -5
- package/src/objects/WithdrawalRequest.ts +9 -10
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +4 -4
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @lightsparkdev/lightspark-sdk
|
|
2
2
|
|
|
3
|
+
## 0.4.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 141d73a: Enable/fix consistent-type-imports lint rule
|
|
8
|
+
- Updated dependencies [141d73a]
|
|
9
|
+
- @lightsparkdev/core@0.3.10
|
|
10
|
+
|
|
11
|
+
## 0.4.7
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 19c8513: Add lint to js packages
|
|
16
|
+
- Updated dependencies [19c8513]
|
|
17
|
+
- @lightsparkdev/core@0.3.9
|
|
18
|
+
|
|
3
19
|
## 0.4.6
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -30,108 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// package.json
|
|
34
|
-
var require_package = __commonJS({
|
|
35
|
-
"package.json"(exports, module2) {
|
|
36
|
-
module2.exports = {
|
|
37
|
-
name: "@lightsparkdev/lightspark-sdk",
|
|
38
|
-
version: "0.4.6",
|
|
39
|
-
description: "Lightspark JS SDK",
|
|
40
|
-
author: "Lightspark Inc.",
|
|
41
|
-
keywords: [
|
|
42
|
-
"lightspark",
|
|
43
|
-
"bitcoin",
|
|
44
|
-
"lightning",
|
|
45
|
-
"payments",
|
|
46
|
-
"typescript"
|
|
47
|
-
],
|
|
48
|
-
homepage: "https://github.com/lightsparkdev/js-sdk",
|
|
49
|
-
repository: {
|
|
50
|
-
type: "git",
|
|
51
|
-
url: "https://github.com/lightsparkdev/js-sdk.git"
|
|
52
|
-
},
|
|
53
|
-
bugs: {
|
|
54
|
-
url: "https://github.com/lightsparkdev/js-sdk/issues"
|
|
55
|
-
},
|
|
56
|
-
engines: {
|
|
57
|
-
node: ">=14.16"
|
|
58
|
-
},
|
|
59
|
-
exports: {
|
|
60
|
-
".": {
|
|
61
|
-
types: "./dist/index.d.ts",
|
|
62
|
-
import: {
|
|
63
|
-
types: "./dist/index.d.ts",
|
|
64
|
-
default: "./dist/index.js"
|
|
65
|
-
},
|
|
66
|
-
module: "./dist/index.js",
|
|
67
|
-
require: "./dist/index.cjs",
|
|
68
|
-
default: "./dist/index.cjs"
|
|
69
|
-
},
|
|
70
|
-
"./objects": {
|
|
71
|
-
types: "./dist/objects/index.d.ts",
|
|
72
|
-
import: {
|
|
73
|
-
types: "./dist/objects/index.d.ts",
|
|
74
|
-
default: "./dist/objects/index.js"
|
|
75
|
-
},
|
|
76
|
-
module: "./dist/objects/index.js",
|
|
77
|
-
require: "./dist/objects/index.cjs",
|
|
78
|
-
default: "./dist/objects/index.cjs"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
type: "module",
|
|
82
|
-
types: "./dist/index.d.ts",
|
|
83
|
-
main: "./dist/index.js",
|
|
84
|
-
module: "./dist/index.js",
|
|
85
|
-
browser: {
|
|
86
|
-
crypto: false
|
|
87
|
-
},
|
|
88
|
-
files: [
|
|
89
|
-
"src/*",
|
|
90
|
-
"dist/*",
|
|
91
|
-
"CHANGELOG.md"
|
|
92
|
-
],
|
|
93
|
-
scripts: {
|
|
94
|
-
build: "tsup --entry src/index.ts --entry src/objects/index.ts --format cjs,esm --dts",
|
|
95
|
-
clean: "rm -rf .turbo && rm -rf dist",
|
|
96
|
-
dev: "yarn build -- --watch",
|
|
97
|
-
docs: "typedoc src",
|
|
98
|
-
format: "prettier src --check",
|
|
99
|
-
"format:fix": "prettier src --write",
|
|
100
|
-
lint: "prettier --check ./src",
|
|
101
|
-
postversion: "yarn build",
|
|
102
|
-
test: "jest --no-cache --runInBand --bail",
|
|
103
|
-
types: "tsc"
|
|
104
|
-
},
|
|
105
|
-
license: "Apache-2.0",
|
|
106
|
-
dependencies: {
|
|
107
|
-
"@lightsparkdev/core": "0.3.8",
|
|
108
|
-
"auto-bind": "^5.0.1",
|
|
109
|
-
crypto: "^1.0.1",
|
|
110
|
-
"crypto-browserify": "^3.12.0",
|
|
111
|
-
dayjs: "^1.11.7",
|
|
112
|
-
graphql: "^16.6.0",
|
|
113
|
-
"graphql-ws": "^5.11.3",
|
|
114
|
-
ws: "^8.12.1",
|
|
115
|
-
"zen-observable-ts": "^1.1.0"
|
|
116
|
-
},
|
|
117
|
-
devDependencies: {
|
|
118
|
-
"@types/crypto-js": "^4.1.1",
|
|
119
|
-
"@types/jest": "^29.5.2",
|
|
120
|
-
"@types/ws": "^8.5.4",
|
|
121
|
-
jest: "^29.4.1",
|
|
122
|
-
prettier: "2.8.7",
|
|
123
|
-
"prettier-plugin-organize-imports": "^3.2.2",
|
|
124
|
-
"ts-jest": "^29.0.5",
|
|
125
|
-
"ts-node": "^10.9.1",
|
|
126
|
-
tsconfig: "*",
|
|
127
|
-
tsup: "^6.7.0",
|
|
128
|
-
typedoc: "^0.24.7",
|
|
129
|
-
typescript: "^4.9.5"
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
33
|
// ../../node_modules/text-encoding/lib/encoding-indexes.js
|
|
136
34
|
var require_encoding_indexes = __commonJS({
|
|
137
35
|
"../../node_modules/text-encoding/lib/encoding-indexes.js"(exports, module2) {
|
|
@@ -2026,6 +1924,112 @@ var import_auto_bind13 = __toESM(require("auto-bind"), 1);
|
|
|
2026
1924
|
var import_core6 = require("@lightsparkdev/core");
|
|
2027
1925
|
var import_crypto = require("crypto");
|
|
2028
1926
|
|
|
1927
|
+
// package.json
|
|
1928
|
+
var package_default = {
|
|
1929
|
+
name: "@lightsparkdev/lightspark-sdk",
|
|
1930
|
+
version: "0.4.8",
|
|
1931
|
+
description: "Lightspark JS SDK",
|
|
1932
|
+
author: "Lightspark Inc.",
|
|
1933
|
+
keywords: [
|
|
1934
|
+
"lightspark",
|
|
1935
|
+
"bitcoin",
|
|
1936
|
+
"lightning",
|
|
1937
|
+
"payments",
|
|
1938
|
+
"typescript"
|
|
1939
|
+
],
|
|
1940
|
+
homepage: "https://github.com/lightsparkdev/js-sdk",
|
|
1941
|
+
repository: {
|
|
1942
|
+
type: "git",
|
|
1943
|
+
url: "https://github.com/lightsparkdev/js-sdk.git"
|
|
1944
|
+
},
|
|
1945
|
+
bugs: {
|
|
1946
|
+
url: "https://github.com/lightsparkdev/js-sdk/issues"
|
|
1947
|
+
},
|
|
1948
|
+
engines: {
|
|
1949
|
+
node: ">=14.16"
|
|
1950
|
+
},
|
|
1951
|
+
exports: {
|
|
1952
|
+
".": {
|
|
1953
|
+
types: "./dist/index.d.ts",
|
|
1954
|
+
import: {
|
|
1955
|
+
types: "./dist/index.d.ts",
|
|
1956
|
+
default: "./dist/index.js"
|
|
1957
|
+
},
|
|
1958
|
+
module: "./dist/index.js",
|
|
1959
|
+
require: "./dist/index.cjs",
|
|
1960
|
+
default: "./dist/index.cjs"
|
|
1961
|
+
},
|
|
1962
|
+
"./objects": {
|
|
1963
|
+
types: "./dist/objects/index.d.ts",
|
|
1964
|
+
import: {
|
|
1965
|
+
types: "./dist/objects/index.d.ts",
|
|
1966
|
+
default: "./dist/objects/index.js"
|
|
1967
|
+
},
|
|
1968
|
+
module: "./dist/objects/index.js",
|
|
1969
|
+
require: "./dist/objects/index.cjs",
|
|
1970
|
+
default: "./dist/objects/index.cjs"
|
|
1971
|
+
}
|
|
1972
|
+
},
|
|
1973
|
+
type: "module",
|
|
1974
|
+
types: "./dist/index.d.ts",
|
|
1975
|
+
main: "./dist/index.js",
|
|
1976
|
+
module: "./dist/index.js",
|
|
1977
|
+
browser: {
|
|
1978
|
+
crypto: false
|
|
1979
|
+
},
|
|
1980
|
+
files: [
|
|
1981
|
+
"src/*",
|
|
1982
|
+
"dist/*",
|
|
1983
|
+
"CHANGELOG.md"
|
|
1984
|
+
],
|
|
1985
|
+
scripts: {
|
|
1986
|
+
build: "tsup --entry src/index.ts --entry src/objects/index.ts --format cjs,esm --dts",
|
|
1987
|
+
clean: "rm -rf .turbo && rm -rf dist",
|
|
1988
|
+
dev: "yarn build -- --watch",
|
|
1989
|
+
docs: "typedoc src",
|
|
1990
|
+
"format:fix": "prettier src --write",
|
|
1991
|
+
format: "prettier src --check",
|
|
1992
|
+
"lint:fix": "eslint --fix .",
|
|
1993
|
+
"lint:watch": "esw ./src -w --ext .ts,.tsx,.js --color",
|
|
1994
|
+
lint: "eslint .",
|
|
1995
|
+
postversion: "yarn build",
|
|
1996
|
+
test: "jest --no-cache --runInBand --bail",
|
|
1997
|
+
"types:watch": "tsc-absolute --watch",
|
|
1998
|
+
types: "tsc"
|
|
1999
|
+
},
|
|
2000
|
+
license: "Apache-2.0",
|
|
2001
|
+
dependencies: {
|
|
2002
|
+
"@lightsparkdev/core": "0.3.10",
|
|
2003
|
+
"auto-bind": "^5.0.1",
|
|
2004
|
+
crypto: "^1.0.1",
|
|
2005
|
+
"crypto-browserify": "^3.12.0",
|
|
2006
|
+
dayjs: "^1.11.7",
|
|
2007
|
+
graphql: "^16.6.0",
|
|
2008
|
+
"graphql-ws": "^5.11.3",
|
|
2009
|
+
ws: "^8.12.1",
|
|
2010
|
+
"zen-observable-ts": "^1.1.0"
|
|
2011
|
+
},
|
|
2012
|
+
devDependencies: {
|
|
2013
|
+
"@lightsparkdev/eslint-config": "*",
|
|
2014
|
+
"@lightsparkdev/gql": "0.0.2",
|
|
2015
|
+
"@lightsparkdev/tsconfig": "0.0.0",
|
|
2016
|
+
"@types/crypto-js": "^4.1.1",
|
|
2017
|
+
"@types/jest": "^29.5.2",
|
|
2018
|
+
"@types/ws": "^8.5.4",
|
|
2019
|
+
eslint: "^8.3.0",
|
|
2020
|
+
"eslint-watch": "^8.0.0",
|
|
2021
|
+
jest: "^29.4.1",
|
|
2022
|
+
prettier: "2.8.7",
|
|
2023
|
+
"prettier-plugin-organize-imports": "^3.2.2",
|
|
2024
|
+
"ts-jest": "^29.0.5",
|
|
2025
|
+
"ts-node": "^10.9.1",
|
|
2026
|
+
"tsc-absolute": "^1.0.1",
|
|
2027
|
+
tsup: "^6.7.0",
|
|
2028
|
+
typedoc: "^0.24.7",
|
|
2029
|
+
typescript: "^4.9.5"
|
|
2030
|
+
}
|
|
2031
|
+
};
|
|
2032
|
+
|
|
2029
2033
|
// src/objects/CurrencyUnit.ts
|
|
2030
2034
|
var CurrencyUnit = /* @__PURE__ */ ((CurrencyUnit2) => {
|
|
2031
2035
|
CurrencyUnit2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
@@ -7510,6 +7514,7 @@ var InvoiceType = /* @__PURE__ */ ((InvoiceType2) => {
|
|
|
7510
7514
|
var InvoiceType_default = InvoiceType;
|
|
7511
7515
|
|
|
7512
7516
|
// src/client.ts
|
|
7517
|
+
var sdkVersion = package_default.version;
|
|
7513
7518
|
var LightsparkClient = class {
|
|
7514
7519
|
/**
|
|
7515
7520
|
* Constructs a new LightsparkClient.
|
|
@@ -7524,7 +7529,6 @@ var LightsparkClient = class {
|
|
|
7524
7529
|
this.authProvider = authProvider;
|
|
7525
7530
|
this.serverUrl = serverUrl;
|
|
7526
7531
|
this.cryptoImpl = cryptoImpl;
|
|
7527
|
-
const sdkVersion = require_package().version;
|
|
7528
7532
|
this.nodeKeyCache = new import_core6.NodeKeyCache(this.cryptoImpl);
|
|
7529
7533
|
this.requester = new import_core6.Requester(
|
|
7530
7534
|
this.nodeKeyCache,
|
|
@@ -7545,7 +7549,6 @@ var LightsparkClient = class {
|
|
|
7545
7549
|
* @param authProvider
|
|
7546
7550
|
*/
|
|
7547
7551
|
async setAuthProvider(authProvider) {
|
|
7548
|
-
const sdkVersion = require_package().version;
|
|
7549
7552
|
this.requester = new import_core6.Requester(
|
|
7550
7553
|
this.nodeKeyCache,
|
|
7551
7554
|
LIGHTSPARK_SDK_ENDPOINT,
|
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ declare class AccountTokenAuthProvider implements AuthProvider {
|
|
|
8
8
|
private readonly apiTokenClientSecret;
|
|
9
9
|
private readonly utf8AuthBytes;
|
|
10
10
|
constructor(apiTokenClientId: string, apiTokenClientSecret: string);
|
|
11
|
-
addWsConnectionParams(params:
|
|
12
|
-
addAuthHeaders(headers:
|
|
11
|
+
addWsConnectionParams(params: Record<string, string>): Promise<Record<string, string>>;
|
|
12
|
+
addAuthHeaders(headers: Record<string, string>): Promise<Record<string, string>>;
|
|
13
13
|
isAuthorized(): Promise<boolean>;
|
|
14
14
|
}
|
|
15
15
|
|
package/dist/index.js
CHANGED
|
@@ -65,111 +65,7 @@ import {
|
|
|
65
65
|
getTransactionQuery,
|
|
66
66
|
getWithdrawalQuery
|
|
67
67
|
} from "./chunk-YTXDF6SQ.js";
|
|
68
|
-
import
|
|
69
|
-
__commonJS
|
|
70
|
-
} from "./chunk-NIMBE7W3.js";
|
|
71
|
-
|
|
72
|
-
// package.json
|
|
73
|
-
var require_package = __commonJS({
|
|
74
|
-
"package.json"(exports, module) {
|
|
75
|
-
module.exports = {
|
|
76
|
-
name: "@lightsparkdev/lightspark-sdk",
|
|
77
|
-
version: "0.4.6",
|
|
78
|
-
description: "Lightspark JS SDK",
|
|
79
|
-
author: "Lightspark Inc.",
|
|
80
|
-
keywords: [
|
|
81
|
-
"lightspark",
|
|
82
|
-
"bitcoin",
|
|
83
|
-
"lightning",
|
|
84
|
-
"payments",
|
|
85
|
-
"typescript"
|
|
86
|
-
],
|
|
87
|
-
homepage: "https://github.com/lightsparkdev/js-sdk",
|
|
88
|
-
repository: {
|
|
89
|
-
type: "git",
|
|
90
|
-
url: "https://github.com/lightsparkdev/js-sdk.git"
|
|
91
|
-
},
|
|
92
|
-
bugs: {
|
|
93
|
-
url: "https://github.com/lightsparkdev/js-sdk/issues"
|
|
94
|
-
},
|
|
95
|
-
engines: {
|
|
96
|
-
node: ">=14.16"
|
|
97
|
-
},
|
|
98
|
-
exports: {
|
|
99
|
-
".": {
|
|
100
|
-
types: "./dist/index.d.ts",
|
|
101
|
-
import: {
|
|
102
|
-
types: "./dist/index.d.ts",
|
|
103
|
-
default: "./dist/index.js"
|
|
104
|
-
},
|
|
105
|
-
module: "./dist/index.js",
|
|
106
|
-
require: "./dist/index.cjs",
|
|
107
|
-
default: "./dist/index.cjs"
|
|
108
|
-
},
|
|
109
|
-
"./objects": {
|
|
110
|
-
types: "./dist/objects/index.d.ts",
|
|
111
|
-
import: {
|
|
112
|
-
types: "./dist/objects/index.d.ts",
|
|
113
|
-
default: "./dist/objects/index.js"
|
|
114
|
-
},
|
|
115
|
-
module: "./dist/objects/index.js",
|
|
116
|
-
require: "./dist/objects/index.cjs",
|
|
117
|
-
default: "./dist/objects/index.cjs"
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
type: "module",
|
|
121
|
-
types: "./dist/index.d.ts",
|
|
122
|
-
main: "./dist/index.js",
|
|
123
|
-
module: "./dist/index.js",
|
|
124
|
-
browser: {
|
|
125
|
-
crypto: false
|
|
126
|
-
},
|
|
127
|
-
files: [
|
|
128
|
-
"src/*",
|
|
129
|
-
"dist/*",
|
|
130
|
-
"CHANGELOG.md"
|
|
131
|
-
],
|
|
132
|
-
scripts: {
|
|
133
|
-
build: "tsup --entry src/index.ts --entry src/objects/index.ts --format cjs,esm --dts",
|
|
134
|
-
clean: "rm -rf .turbo && rm -rf dist",
|
|
135
|
-
dev: "yarn build -- --watch",
|
|
136
|
-
docs: "typedoc src",
|
|
137
|
-
format: "prettier src --check",
|
|
138
|
-
"format:fix": "prettier src --write",
|
|
139
|
-
lint: "prettier --check ./src",
|
|
140
|
-
postversion: "yarn build",
|
|
141
|
-
test: "jest --no-cache --runInBand --bail",
|
|
142
|
-
types: "tsc"
|
|
143
|
-
},
|
|
144
|
-
license: "Apache-2.0",
|
|
145
|
-
dependencies: {
|
|
146
|
-
"@lightsparkdev/core": "0.3.8",
|
|
147
|
-
"auto-bind": "^5.0.1",
|
|
148
|
-
crypto: "^1.0.1",
|
|
149
|
-
"crypto-browserify": "^3.12.0",
|
|
150
|
-
dayjs: "^1.11.7",
|
|
151
|
-
graphql: "^16.6.0",
|
|
152
|
-
"graphql-ws": "^5.11.3",
|
|
153
|
-
ws: "^8.12.1",
|
|
154
|
-
"zen-observable-ts": "^1.1.0"
|
|
155
|
-
},
|
|
156
|
-
devDependencies: {
|
|
157
|
-
"@types/crypto-js": "^4.1.1",
|
|
158
|
-
"@types/jest": "^29.5.2",
|
|
159
|
-
"@types/ws": "^8.5.4",
|
|
160
|
-
jest: "^29.4.1",
|
|
161
|
-
prettier: "2.8.7",
|
|
162
|
-
"prettier-plugin-organize-imports": "^3.2.2",
|
|
163
|
-
"ts-jest": "^29.0.5",
|
|
164
|
-
"ts-node": "^10.9.1",
|
|
165
|
-
tsconfig: "*",
|
|
166
|
-
tsup: "^6.7.0",
|
|
167
|
-
typedoc: "^0.24.7",
|
|
168
|
-
typescript: "^4.9.5"
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
});
|
|
68
|
+
import "./chunk-NIMBE7W3.js";
|
|
173
69
|
|
|
174
70
|
// src/auth/AccountTokenAuthProvider.ts
|
|
175
71
|
import { b64encode } from "@lightsparkdev/core";
|
|
@@ -216,6 +112,112 @@ import {
|
|
|
216
112
|
} from "@lightsparkdev/core";
|
|
217
113
|
import { createHash } from "crypto";
|
|
218
114
|
|
|
115
|
+
// package.json
|
|
116
|
+
var package_default = {
|
|
117
|
+
name: "@lightsparkdev/lightspark-sdk",
|
|
118
|
+
version: "0.4.8",
|
|
119
|
+
description: "Lightspark JS SDK",
|
|
120
|
+
author: "Lightspark Inc.",
|
|
121
|
+
keywords: [
|
|
122
|
+
"lightspark",
|
|
123
|
+
"bitcoin",
|
|
124
|
+
"lightning",
|
|
125
|
+
"payments",
|
|
126
|
+
"typescript"
|
|
127
|
+
],
|
|
128
|
+
homepage: "https://github.com/lightsparkdev/js-sdk",
|
|
129
|
+
repository: {
|
|
130
|
+
type: "git",
|
|
131
|
+
url: "https://github.com/lightsparkdev/js-sdk.git"
|
|
132
|
+
},
|
|
133
|
+
bugs: {
|
|
134
|
+
url: "https://github.com/lightsparkdev/js-sdk/issues"
|
|
135
|
+
},
|
|
136
|
+
engines: {
|
|
137
|
+
node: ">=14.16"
|
|
138
|
+
},
|
|
139
|
+
exports: {
|
|
140
|
+
".": {
|
|
141
|
+
types: "./dist/index.d.ts",
|
|
142
|
+
import: {
|
|
143
|
+
types: "./dist/index.d.ts",
|
|
144
|
+
default: "./dist/index.js"
|
|
145
|
+
},
|
|
146
|
+
module: "./dist/index.js",
|
|
147
|
+
require: "./dist/index.cjs",
|
|
148
|
+
default: "./dist/index.cjs"
|
|
149
|
+
},
|
|
150
|
+
"./objects": {
|
|
151
|
+
types: "./dist/objects/index.d.ts",
|
|
152
|
+
import: {
|
|
153
|
+
types: "./dist/objects/index.d.ts",
|
|
154
|
+
default: "./dist/objects/index.js"
|
|
155
|
+
},
|
|
156
|
+
module: "./dist/objects/index.js",
|
|
157
|
+
require: "./dist/objects/index.cjs",
|
|
158
|
+
default: "./dist/objects/index.cjs"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
type: "module",
|
|
162
|
+
types: "./dist/index.d.ts",
|
|
163
|
+
main: "./dist/index.js",
|
|
164
|
+
module: "./dist/index.js",
|
|
165
|
+
browser: {
|
|
166
|
+
crypto: false
|
|
167
|
+
},
|
|
168
|
+
files: [
|
|
169
|
+
"src/*",
|
|
170
|
+
"dist/*",
|
|
171
|
+
"CHANGELOG.md"
|
|
172
|
+
],
|
|
173
|
+
scripts: {
|
|
174
|
+
build: "tsup --entry src/index.ts --entry src/objects/index.ts --format cjs,esm --dts",
|
|
175
|
+
clean: "rm -rf .turbo && rm -rf dist",
|
|
176
|
+
dev: "yarn build -- --watch",
|
|
177
|
+
docs: "typedoc src",
|
|
178
|
+
"format:fix": "prettier src --write",
|
|
179
|
+
format: "prettier src --check",
|
|
180
|
+
"lint:fix": "eslint --fix .",
|
|
181
|
+
"lint:watch": "esw ./src -w --ext .ts,.tsx,.js --color",
|
|
182
|
+
lint: "eslint .",
|
|
183
|
+
postversion: "yarn build",
|
|
184
|
+
test: "jest --no-cache --runInBand --bail",
|
|
185
|
+
"types:watch": "tsc-absolute --watch",
|
|
186
|
+
types: "tsc"
|
|
187
|
+
},
|
|
188
|
+
license: "Apache-2.0",
|
|
189
|
+
dependencies: {
|
|
190
|
+
"@lightsparkdev/core": "0.3.10",
|
|
191
|
+
"auto-bind": "^5.0.1",
|
|
192
|
+
crypto: "^1.0.1",
|
|
193
|
+
"crypto-browserify": "^3.12.0",
|
|
194
|
+
dayjs: "^1.11.7",
|
|
195
|
+
graphql: "^16.6.0",
|
|
196
|
+
"graphql-ws": "^5.11.3",
|
|
197
|
+
ws: "^8.12.1",
|
|
198
|
+
"zen-observable-ts": "^1.1.0"
|
|
199
|
+
},
|
|
200
|
+
devDependencies: {
|
|
201
|
+
"@lightsparkdev/eslint-config": "*",
|
|
202
|
+
"@lightsparkdev/gql": "0.0.2",
|
|
203
|
+
"@lightsparkdev/tsconfig": "0.0.0",
|
|
204
|
+
"@types/crypto-js": "^4.1.1",
|
|
205
|
+
"@types/jest": "^29.5.2",
|
|
206
|
+
"@types/ws": "^8.5.4",
|
|
207
|
+
eslint: "^8.3.0",
|
|
208
|
+
"eslint-watch": "^8.0.0",
|
|
209
|
+
jest: "^29.4.1",
|
|
210
|
+
prettier: "2.8.7",
|
|
211
|
+
"prettier-plugin-organize-imports": "^3.2.2",
|
|
212
|
+
"ts-jest": "^29.0.5",
|
|
213
|
+
"ts-node": "^10.9.1",
|
|
214
|
+
"tsc-absolute": "^1.0.1",
|
|
215
|
+
tsup: "^6.7.0",
|
|
216
|
+
typedoc: "^0.24.7",
|
|
217
|
+
typescript: "^4.9.5"
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
219
221
|
// src/graphql/BitcoinFeeEstimate.ts
|
|
220
222
|
var BitcoinFeeEstimate = `
|
|
221
223
|
query BitcoinFeeEstimate($bitcoin_network: BitcoinNetwork!) {
|
|
@@ -754,6 +756,7 @@ ${FRAGMENT10}
|
|
|
754
756
|
`;
|
|
755
757
|
|
|
756
758
|
// src/client.ts
|
|
759
|
+
var sdkVersion = package_default.version;
|
|
757
760
|
var LightsparkClient = class {
|
|
758
761
|
/**
|
|
759
762
|
* Constructs a new LightsparkClient.
|
|
@@ -768,7 +771,6 @@ var LightsparkClient = class {
|
|
|
768
771
|
this.authProvider = authProvider;
|
|
769
772
|
this.serverUrl = serverUrl;
|
|
770
773
|
this.cryptoImpl = cryptoImpl;
|
|
771
|
-
const sdkVersion = require_package().version;
|
|
772
774
|
this.nodeKeyCache = new NodeKeyCache(this.cryptoImpl);
|
|
773
775
|
this.requester = new Requester(
|
|
774
776
|
this.nodeKeyCache,
|
|
@@ -789,7 +791,6 @@ var LightsparkClient = class {
|
|
|
789
791
|
* @param authProvider
|
|
790
792
|
*/
|
|
791
793
|
async setAuthProvider(authProvider) {
|
|
792
|
-
const sdkVersion = require_package().version;
|
|
793
794
|
this.requester = new Requester(
|
|
794
795
|
this.nodeKeyCache,
|
|
795
796
|
LIGHTSPARK_SDK_ENDPOINT,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightsparkdev/lightspark-sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "Lightspark JS SDK",
|
|
5
5
|
"author": "Lightspark Inc.",
|
|
6
6
|
"keywords": [
|
|
@@ -60,16 +60,19 @@
|
|
|
60
60
|
"clean": "rm -rf .turbo && rm -rf dist",
|
|
61
61
|
"dev": "yarn build -- --watch",
|
|
62
62
|
"docs": "typedoc src",
|
|
63
|
-
"format": "prettier src --check",
|
|
64
63
|
"format:fix": "prettier src --write",
|
|
65
|
-
"
|
|
64
|
+
"format": "prettier src --check",
|
|
65
|
+
"lint:fix": "eslint --fix .",
|
|
66
|
+
"lint:watch": "esw ./src -w --ext .ts,.tsx,.js --color",
|
|
67
|
+
"lint": "eslint .",
|
|
66
68
|
"postversion": "yarn build",
|
|
67
69
|
"test": "jest --no-cache --runInBand --bail",
|
|
70
|
+
"types:watch": "tsc-absolute --watch",
|
|
68
71
|
"types": "tsc"
|
|
69
72
|
},
|
|
70
73
|
"license": "Apache-2.0",
|
|
71
74
|
"dependencies": {
|
|
72
|
-
"@lightsparkdev/core": "0.3.
|
|
75
|
+
"@lightsparkdev/core": "0.3.10",
|
|
73
76
|
"auto-bind": "^5.0.1",
|
|
74
77
|
"crypto": "^1.0.1",
|
|
75
78
|
"crypto-browserify": "^3.12.0",
|
|
@@ -80,15 +83,20 @@
|
|
|
80
83
|
"zen-observable-ts": "^1.1.0"
|
|
81
84
|
},
|
|
82
85
|
"devDependencies": {
|
|
86
|
+
"@lightsparkdev/eslint-config": "*",
|
|
87
|
+
"@lightsparkdev/gql": "0.0.2",
|
|
88
|
+
"@lightsparkdev/tsconfig": "0.0.0",
|
|
83
89
|
"@types/crypto-js": "^4.1.1",
|
|
84
90
|
"@types/jest": "^29.5.2",
|
|
85
91
|
"@types/ws": "^8.5.4",
|
|
92
|
+
"eslint": "^8.3.0",
|
|
93
|
+
"eslint-watch": "^8.0.0",
|
|
86
94
|
"jest": "^29.4.1",
|
|
87
95
|
"prettier": "2.8.7",
|
|
88
96
|
"prettier-plugin-organize-imports": "^3.2.2",
|
|
89
97
|
"ts-jest": "^29.0.5",
|
|
90
98
|
"ts-node": "^10.9.1",
|
|
91
|
-
"
|
|
99
|
+
"tsc-absolute": "^1.0.1",
|
|
92
100
|
"tsup": "^6.7.0",
|
|
93
101
|
"typedoc": "^0.24.7",
|
|
94
102
|
"typescript": "^4.9.5"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import { AuthProvider
|
|
3
|
+
import type { AuthProvider } from "@lightsparkdev/core";
|
|
4
|
+
import { b64encode } from "@lightsparkdev/core";
|
|
4
5
|
import autoBind from "auto-bind";
|
|
5
6
|
|
|
6
7
|
class AccountTokenAuthProvider implements AuthProvider {
|
|
@@ -16,14 +17,18 @@ class AccountTokenAuthProvider implements AuthProvider {
|
|
|
16
17
|
autoBind(this);
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
async addWsConnectionParams(
|
|
20
|
+
async addWsConnectionParams(
|
|
21
|
+
params: Record<string, string>
|
|
22
|
+
): Promise<Record<string, string>> {
|
|
20
23
|
return Object.assign({}, params, {
|
|
21
24
|
client_id: this.apiTokenClientId,
|
|
22
25
|
client_secret: this.apiTokenClientSecret,
|
|
23
26
|
});
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
async addAuthHeaders(
|
|
29
|
+
async addAuthHeaders(
|
|
30
|
+
headers: Record<string, string>
|
|
31
|
+
): Promise<Record<string, string>> {
|
|
27
32
|
return Object.assign({}, headers, {
|
|
28
33
|
authorization: `Basic ${b64encode(this.utf8AuthBytes)}`,
|
|
29
34
|
});
|