@lightsparkdev/lightspark-sdk 0.4.5 → 0.4.7

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @lightsparkdev/lightspark-sdk
2
2
 
3
+ ## 0.4.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 19c8513: Add lint to js packages
8
+ - Updated dependencies [19c8513]
9
+ - @lightsparkdev/core@0.3.9
10
+
11
+ ## 0.4.6
12
+
13
+ ### Patch Changes
14
+
15
+ - c1105d2: - Adding some remote signing capabilities to the react native crypto lib.
16
+
3
17
  ## 0.4.5
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -104,11 +104,10 @@ You'll need to set the following environment variables:
104
104
  ```bash
105
105
  $ export LIGHTSPARK_API_TOKEN_CLIENT_ID=<your api token id>
106
106
  $ export LIGHTSPARK_API_TOKEN_CLIENT_SECRET=<your api token secret>
107
- $ export LIGHTSPARK_WALLET_NODE_ID=<the node ID of a node you can use as your default wallet>
107
+ $ export LIGHTSPARK_TEST_NODE_PASSWORD=<the test node password (1234!@#$)>
108
108
 
109
- # If you want to run full_example.ts, you'll also need to set these:
109
+ # If you want to run internal_example.ts, you'll also need to set these:
110
110
  $ export LIGHTSPARK_EXAMPLE_NODE_1_NAME=<the display name of a node to use in the example>
111
- $ export LIGHTSPARK_EXAMPLE_NODE_1_PASSWORD=<the password used to unlock node 1>
112
111
  $ export LIGHTSPARK_EXAMPLE_NODE_2_NAME=<the display name of a node to use in the example>
113
112
  $ export LIGHTSPARK_EXAMPLE_NODE_2_PASSWORD=<the password used to unlock node 2>
114
113
  ```
@@ -118,7 +117,7 @@ Then, run the examples:
118
117
  ```bash
119
118
  $ cd examples/node-scripts
120
119
  $ npm install
121
- $ ts-node createInvoice.ts -a "100" -m "Whasssupppp"
120
+ $ npx ts-node createInvoice.ts -a "100" -m "Whasssupppp"
122
121
  ```
123
122
 
124
123
  ### Streaming Wallet Extension
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.5",
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.7",
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.9",
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.1",
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: any): Promise<any>;
12
- addAuthHeaders(headers: any): Promise<any>;
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.5",
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.7",
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.9",
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.1",
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.5",
3
+ "version": "0.4.7",
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
- "lint": "prettier --check ./src",
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.8",
75
+ "@lightsparkdev/core": "0.3.9",
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.1",
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
- "tsconfig": "*",
99
+ "tsc-absolute": "^1.0.1",
92
100
  "tsup": "^6.7.0",
93
101
  "typedoc": "^0.24.7",
94
102
  "typescript": "^4.9.5"
@@ -16,14 +16,18 @@ class AccountTokenAuthProvider implements AuthProvider {
16
16
  autoBind(this);
17
17
  }
18
18
 
19
- async addWsConnectionParams(params: any): Promise<any> {
19
+ async addWsConnectionParams(
20
+ params: Record<string, string>
21
+ ): Promise<Record<string, string>> {
20
22
  return Object.assign({}, params, {
21
23
  client_id: this.apiTokenClientId,
22
24
  client_secret: this.apiTokenClientSecret,
23
25
  });
24
26
  }
25
27
 
26
- async addAuthHeaders(headers: any): Promise<any> {
28
+ async addAuthHeaders(
29
+ headers: Record<string, string>
30
+ ): Promise<Record<string, string>> {
27
31
  return Object.assign({}, headers, {
28
32
  authorization: `Basic ${b64encode(this.utf8AuthBytes)}`,
29
33
  });
package/src/client.ts CHANGED
@@ -19,7 +19,12 @@ import {
19
19
  Requester,
20
20
  StubAuthProvider,
21
21
  } from "@lightsparkdev/core";
22
+ import {
23
+ type OutgoingPayment as GQLOutgoingPayment,
24
+ type Subscription as GQLSubscription,
25
+ } from "@lightsparkdev/gql/generated/graphql.js";
22
26
  import { createHash } from "crypto";
27
+ import packageJson from "../package.json";
23
28
  import { BitcoinFeeEstimate as BitcoinFeeEstimateQuery } from "./graphql/BitcoinFeeEstimate.js";
24
29
  import { CreateApiToken } from "./graphql/CreateApiToken.js";
25
30
  import { CreateInvoice } from "./graphql/CreateInvoice.js";
@@ -68,6 +73,8 @@ import WithdrawalRequest, {
68
73
  WithdrawalRequestFromJson,
69
74
  } from "./objects/WithdrawalRequest.js";
70
75
 
76
+ const sdkVersion = packageJson.version;
77
+
71
78
  /**
72
79
  * The LightsparkClient is the main entrypoint for interacting with the Lightspark API.
73
80
  *
@@ -109,7 +116,6 @@ class LightsparkClient {
109
116
  private readonly serverUrl: string = "api.lightspark.com",
110
117
  private readonly cryptoImpl: CryptoInterface = DefaultCrypto
111
118
  ) {
112
- const sdkVersion = require("../package.json").version;
113
119
  this.nodeKeyCache = new NodeKeyCache(this.cryptoImpl);
114
120
  this.requester = new Requester(
115
121
  this.nodeKeyCache,
@@ -130,7 +136,6 @@ class LightsparkClient {
130
136
  * @param authProvider
131
137
  */
132
138
  public async setAuthProvider(authProvider: AuthProvider) {
133
- const sdkVersion = require("../package.json").version;
134
139
  this.requester = new Requester(
135
140
  this.nodeKeyCache,
136
141
  LIGHTSPARK_SDK_ENDPOINT,
@@ -195,7 +200,9 @@ class LightsparkClient {
195
200
  public listenToTransactions(
196
201
  nodeIds: string[]
197
202
  ): Observable<TransactionUpdate | undefined> {
198
- const response = this.requester.subscribe(TransactionSubscription, {
203
+ const response = this.requester.subscribe<
204
+ Pick<GQLSubscription, "transactions">
205
+ >(TransactionSubscription, {
199
206
  nodeIds,
200
207
  });
201
208
  return response.map(
@@ -619,7 +626,7 @@ class LightsparkClient {
619
626
  if (!this.nodeKeyCache.hasKey(payerNodeId)) {
620
627
  throw new LightsparkSigningException("Paying node is not unlocked");
621
628
  }
622
- const variables: any = {
629
+ const variables: Record<string, string | number> = {
623
630
  node_id: payerNodeId,
624
631
  encoded_invoice: encodedInvoice,
625
632
  timeout_secs: timeoutSecs,
@@ -824,7 +831,11 @@ class LightsparkClient {
824
831
  memo,
825
832
  invoice_type: invoiceType,
826
833
  },
827
- constructObject: (responseJson: any) => {
834
+ constructObject: (responseJson: {
835
+ create_test_mode_invoice: {
836
+ encoded_payment_request: string;
837
+ } | null;
838
+ }) => {
828
839
  const encodedPaymentRequest =
829
840
  responseJson.create_test_mode_invoice?.encoded_payment_request;
830
841
  if (!encodedPaymentRequest) {
@@ -833,7 +844,7 @@ class LightsparkClient {
833
844
  "Unable to create test mode invoice"
834
845
  );
835
846
  }
836
- return encodedPaymentRequest as string;
847
+ return encodedPaymentRequest;
837
848
  },
838
849
  });
839
850
  }
@@ -859,7 +870,11 @@ class LightsparkClient {
859
870
  encoded_invoice: encodedInvoice,
860
871
  amount_msats: amountMsats,
861
872
  },
862
- constructObject: (responseJson: any) => {
873
+ constructObject: (responseJson: {
874
+ create_test_mode_payment: {
875
+ payment: GQLOutgoingPayment;
876
+ } | null;
877
+ }) => {
863
878
  return OutgoingPaymentFromJson(
864
879
  responseJson.create_test_mode_payment?.payment
865
880
  );
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ rules: {
3
+ "@typescript-eslint/no-explicit-any": "off",
4
+ },
5
+ };