@dashevo/dapi-client 0.21.2 → 0.21.6
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
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
## [0.21.2](https://github.com/dashevo/dapi-client/compare/v0.21.1...v0.21.2) (2021-10-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* DAPI addresses white list must not be applied in Regtest mode ([#289](https://github.com/dashevo/js-dapi-client/pull/289))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [0.21.1](https://github.com/dashevo/dapi-client/compare/v0.21.0...v0.21.1) (2021-10-21)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* DAPI addresses white list ([#288](https://github.com/dashevo/dapi-client/issues/288))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [0.21.0](https://github.com/dashevo/dapi-client/compare/v0.20.0...v0.21.0) (2021-10-12)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* improve error handling ([#268](https://github.com/dashevo/dapi-client/issues/268))
|
|
24
|
+
* convenient response errors ([#272](https://github.com/dashevo/dapi-client/issues/272), [#280](https://github.com/dashevo/dapi-client/issues/280), [#282](https://github.com/dashevo/dapi-client/issues/282), [#284](https://github.com/dashevo/dapi-client/issues/284), [#286](https://github.com/dashevo/dapi-client/issues/286))
|
|
25
|
+
* implement getConsensusParams method ([#261](https://github.com/dashevo/dapi-client/issues/261))
|
|
26
|
+
* support returning of a multiproof ([#257](https://github.com/dashevo/dapi-client/issues/257))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### BREAKING CHANGES
|
|
30
|
+
|
|
31
|
+
* `getBlockByHash` and `getBlockByHeight` will throw `NotFoundError` instead of `null` result
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## [0.20.1](https://github.com/dashevo/dapi-client/compare/v0.20.0...v0.20.1) (2021-05-26)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* crash when connecting to an older version of dapi ([#252](https://github.com/dashevo/dapi-client/issues/252), [#253](https://github.com/dashevo/dapi-client/issues/253))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# [0.20.0](https://github.com/dashevo/dapi-client/compare/v0.19.3...v0.20.0) (2021-07-09)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
* provide metadata in responses ([#243](https://github.com/dashevo/dapi-client/issues/243), [#246](https://github.com/dashevo/dapi-client/issues/246))
|
|
50
|
+
* throw `NotFoundError` if data is not found ([#247](https://github.com/dashevo/dapi-client/issues/247))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### BREAKING CHANGES
|
|
54
|
+
|
|
55
|
+
* platform methods respond with response classes instead of plain data
|
|
56
|
+
* Core method `getTransaction` responds with response class instead of plain data
|
|
57
|
+
* `getTransaction`, `getDataContract` and `getIdentity` methods throw `NotFoundError` if no data was found
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## [0.19.3](https://github.com/dashevo/dapi-client/compare/v0.19.2...v0.19.3) (2021-05-26)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Bug Fixes
|
|
65
|
+
|
|
66
|
+
* update cbor to fix serialization of queries with buffers ([178943b](https://github.com/dashevo/dapi-client/commit/178943b465b30ed838cb03a5a10c6f939db92a39))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## [0.19.2](https://github.com/dashevo/dapi-client/compare/v0.19.1...v0.19.2) (2021-05-20)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### Chores
|
|
74
|
+
|
|
75
|
+
* Update DPP to a 0.19.2 ([#237](https://github.com/dashevo/dapi-client/issues/237))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
## [0.19.1](https://github.com/dashevo/dapi-client/compare/v0.19.0...v0.19.1) (2021-05-04)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Bug Fixes
|
|
83
|
+
|
|
84
|
+
* `getStatus` reponse was returning buffers as Base64 encoded strings ([#235](https://github.com/dashevo/dapi-client/issues/235))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
# [0.19.0](https://github.com/dashevo/dapi-client/compare/v0.18.0...v0.19.0) (2021-05-03)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Features
|
|
92
|
+
|
|
93
|
+
* `getStatus` method handler response updated ([#229](https://github.com/dashevo/dapi-client/issues/229), [#230](https://github.com/dashevo/dapi-client/issues/230))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Bug Fixes
|
|
97
|
+
|
|
98
|
+
* critical security vulnerability in axios@0.19.2 ([#233](https://github.com/dashevo/dapi-client/issues/233))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### BREAKING CHANGES
|
|
102
|
+
|
|
103
|
+
* `getStatus` method handler response have changed
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
# [0.18.0](https://github.com/dashevo/dapi-client/compare/v0.17.2...v0.18.0) (2021-03-03)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### Bug Fixes
|
|
111
|
+
|
|
112
|
+
* BLS was throwing an error inside `uncaughtException` handler ([#226](https://github.com/dashevo/dapi-client/issues/226))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
### Features
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
* `waitForStateTransitionResult` method ([#221](https://github.com/dashevo/dapi-client/issues/221), ([#223](https://github.com/dashevo/dapi-client/issues/223))
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### Chores
|
|
122
|
+
|
|
123
|
+
* remove temporary `timeout` option from `broadcastStateTransition` ([2abdf5](https://github.com/dashevo/js-dapi-client/commit/2abdf5dc45859bc142dd0f293d9f071190f2a59d))
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
## [0.17.2](https://github.com/dashevo/dapi-client/compare/v0.17.1...v0.17.2) (2020-12-30)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### Bug Fixes
|
|
131
|
+
|
|
132
|
+
* broadcastStateTransitions is timing out on testnet ([#219](https://github.com/dashevo/dapi-client/issues/219))
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
## [0.17.1](https://github.com/dashevo/dapi-client/compare/v0.17.0...v0.17.1) (2020-12-30)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
### Bug Fixes
|
|
140
|
+
|
|
141
|
+
* merkleRootQuorums from the diff doesn’t match calculated quorum root after diff is applied ([#217](https://github.com/dashevo/dapi-client/issues/217))
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# [0.17.0](https://github.com/dashevo/dapi-client/compare/v0.16.0...v0.17.0) (2020-12-29)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
### Features
|
|
149
|
+
|
|
150
|
+
* introduce testnet network ([#214](https://github.com/dashevo/dapi-client/issues/214))
|
|
151
|
+
* update `dpp` and `dashcore-lib` ([#207](https://github.com/dashevo/dapi-client/issues/207), [#210](https://github.com/dashevo/dapi-client/issues/210), [#211](https://github.com/dashevo/dapi-client/issues/211), [#212](https://github.com/dashevo/dapi-client/issues/212))
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
### Bug Fixes
|
|
155
|
+
|
|
156
|
+
* SML unhandled error on blockchain reorg ([#215](https://github.com/dashevo/dapi-client/issues/215))
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
### BREAKING CHANGES
|
|
160
|
+
|
|
161
|
+
* DAPI client is now connecting to a testnet by default
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
# [0.16.0](https://github.com/dashevo/dapi-client/compare/v0.15.0...v0.16.0) (2020-10-27)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
### Features
|
|
169
|
+
|
|
170
|
+
* `getIdentitiesByPublicKeyHashes` and `getIdentityIdsByPublicKeyHashes` methods ([#191](https://github.com/dashevo/dapi-client/issues/191), [#196](https://github.com/dashevo/dapi-client/issues/196), [#205](https://github.com/dashevo/dapi-client/issues/205))
|
|
171
|
+
* `getDataContract`, `getDocuments`, `getIdentity` accept `Buffer` ([#201](https://github.com/dashevo/dapi-client/issues/201))
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
### Documentation
|
|
175
|
+
|
|
176
|
+
* fix URLs in README ([#193](https://github.com/dashevo/dapi-client/issues/193))
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
### BREAKING CHANGES
|
|
180
|
+
|
|
181
|
+
* `getIdentityByFirstPublicKey` and `getIdentityIdByFirstPublicKey` removed
|
|
182
|
+
* `getDataContract`, `getDocuments`, `getIdentity` accept `Buffer` or `TypedArray`
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
# [0.15.0](https://github.com/dashevo/dapi-client/compare/v0.14.0...v0.15.0) (2020-09-04)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
### Bug Fixes
|
|
190
|
+
|
|
191
|
+
* internal error when submitting `fromBlockHeight` as `0` to `subscribeToTransactionsWithProofs` ([#174](https://github.com/dashevo/js-dapi-client/pull/174))
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
### Features
|
|
195
|
+
|
|
196
|
+
* retry request on `UNIMPLEMENTED` error ([#185](https://github.com/dashevo/dapi-client/issues/185))
|
|
197
|
+
* update DAPI gRPC to 0.15 ([#179](https://github.com/dashevo/dapi-client/issues/179), [#186](https://github.com/dashevo/dapi-client/issues/186))
|
|
198
|
+
* remove `getUTXO` and `getAddressSummary` core methods ([#178](https://github.com/dashevo/js-dapi-client/pull/178))
|
|
199
|
+
* rename `sendTransaction` and `applyStateTransition` ([#175](https://github.com/dashevo/js-dapi-client/pull/175))
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
### BREAKING CHANGES
|
|
203
|
+
|
|
204
|
+
* `broadcastTransaction` and `broadcastStatTransition` gRPC method names are using instead of `sendTransaction` and `applyStateTransition`
|
|
205
|
+
* `getUTXO` and `getAddressSummary` core methods are removed
|
|
206
|
+
* see [DAPI gRPC breaking changes](https://github.com/dashevo/dapi-grpc/releases/tag/v0.15.0)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
# [0.14.0](https://github.com/dashevo/dapi-client/compare/v0.13.6...v0.14.0) (2020-07-23)
|
|
211
|
+
|
|
212
|
+
We completely rewrote DAPI Client to improve code quality, usability, and testability.
|
|
213
|
+
|
|
214
|
+
In the new version, you can specify not just seeds to connect but also specific DAPI addresses
|
|
215
|
+
and even inject own logic to obtain/select nodes. API methods accept the same options
|
|
216
|
+
as the `DAPIClient` constructor so you can specify different behavior for each API call.
|
|
217
|
+
|
|
218
|
+
Previously, faulty nodes were excluded for a specific API call. Now they are banning
|
|
219
|
+
for a period of time, and this time increments exponentially in the event of repeated faults.
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
### Bug Fixes
|
|
223
|
+
|
|
224
|
+
* cannot read property 'getHttpPort' of undefined ([#173](https://github.com/dashevo/dapi-client/issues/173))
|
|
225
|
+
* internal error when submitting `fromBlockHeight` as 0 to `subscribeToTransactionsWithProofs` ([#174](https://github.com/dashevo/dapi-client/issues/174))
|
|
226
|
+
* ambiguity in `addresses` option ([#170](https://github.com/dashevo/dapi-client/issues/170))
|
|
227
|
+
* JSON RPC does not retry on `ETIMEDOUT` ([#156](https://github.com/dashevo/dapi-client/issues/156))
|
|
228
|
+
* 2 seconds timeout not enough for some requests ([#151](https://github.com/dashevo/dapi-client/issues/151))
|
|
229
|
+
* construct DAPIClient with network option didn't work properly ([#150](https://github.com/dashevo/dapi-client/issues/150))
|
|
230
|
+
* global default timeout applies for streams ([#152](https://github.com/dashevo/dapi-client/issues/152))
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
### Features
|
|
234
|
+
|
|
235
|
+
* add ports to string representation of DAPIAddress ([#171](https://github.com/dashevo/dapi-client/issues/171)) ([1f4ffb7](https://github.com/dashevo/dapi-client/commit/1f4ffb7ed2cd8079eccf938ede2d43f37a5f80d3))
|
|
236
|
+
* allow to specify network with other connection options ([#160](https://github.com/dashevo/dapi-client/issues/160)) ([cfbc5cd](https://github.com/dashevo/dapi-client/commit/cfbc5cd649358420df99f76f1ca84b8c7ae826a4))
|
|
237
|
+
* update DAPI gRPC to 0.14.0-dev.1 ([#149](https://github.com/dashevo/dapi-client/issues/149)) ([4598def](https://github.com/dashevo/dapi-client/commit/4598def13dbdba9c9c1392c65e2c97ceb322c34c))
|
|
238
|
+
* timeout options for gRPC requests and simplified URL for gRPC client ([#146](https://github.com/dashevo/dapi-client/issues/146)) ([35685b9](https://github.com/dashevo/dapi-client/commit/35685b98fa05fc4436630f165113419b3f48833f))
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
### Documentation
|
|
242
|
+
|
|
243
|
+
* readme standard updates ([#167](https://github.com/dashevo/dapi-client/issues/147))
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
### Code Refactoring
|
|
247
|
+
|
|
248
|
+
* rewrite DAPI Client from scratch ([#140](https://github.com/dashevo/dapi-client/issues/140))
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
### BREAKING CHANGES
|
|
252
|
+
|
|
253
|
+
* DAPI Client options [are changed](https://github.com/dashevo/dapi-client/blob/1ec21652f1615ba95ea537c38632692f81deefa3/lib/DAPIClient.js#L42-L51)
|
|
254
|
+
* Core and Platform methods moved to specific namespaces (ie. `client.platform.getIdentity()`, `client.core.getStatus()`)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
## [0.13.6](https://github.com/dashevo/dapi-client/compare/v0.13.5...v0.13.6) (2020-06-30)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
### Features
|
|
262
|
+
|
|
263
|
+
* update dapi-client to `0.18.11` ([#163](https://github.com/dashevo/dapi-client/issues/163))
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
## [0.13.5](https://github.com/dashevo/dapi-client/compare/v0.13.4...v0.13.5) (2020-06-30)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
### Features
|
|
271
|
+
|
|
272
|
+
* update `dashcore-lib` to `0.18.10` ([#162](https://github.com/dashevo/dapi-client/issues/162))
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
## [0.13.4](https://github.com/dashevo/dapi-client/compare/v0.13.3...v0.13.4) (2020-06-30)
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
### Bug Fixes
|
|
280
|
+
|
|
281
|
+
* network is not set to `SimplifiedMNListDiff` ([#161](https://github.com/dashevo/dapi-client/issues/161))
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
## [0.13.3](https://github.com/dashevo/dapi-client/compare/v0.13.2...v0.13.3) (2020-06-18)
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
### Bug Fixes
|
|
289
|
+
|
|
290
|
+
* calling method `getIp` of `undefined` ([#159](https://github.com/dashevo/dapi-client/issues/159))
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
## [0.13.2](https://github.com/dashevo/dapi-client/compare/v0.13.1...v0.13.2) (2020-06-11)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
### Bug Fixes
|
|
298
|
+
|
|
299
|
+
* retries don't work for MN discovery ([#157](https://github.com/dashevo/dapi-client/issues/157))
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
## [0.13.1](https://github.com/dashevo/dapi-client/compare/v0.13.0...v0.13.1) (2020-06-11)
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
### Bug Fixes
|
|
307
|
+
|
|
308
|
+
* JSON RPC doesn't retry on `ETIMEDOUT ([#155](https://github.com/dashevo/dapi-client/issues/155))
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
# [0.13.0](https://github.com/dashevo/dapi-client/compare/v0.12.0...v0.13.0) (2020-06-08)
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
### Bug Fixes
|
|
316
|
+
|
|
317
|
+
* missed grpc-common peer dependency caused error ([#135](https://github.com/dashevo/dapi-client/pull/135))
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
## Features
|
|
321
|
+
|
|
322
|
+
* implement transports with retries ([#130](https://github.com/dashevo/dapi-client/pull/130), [#141](https://github.com/dashevo/dapi-client/pull/141))
|
|
323
|
+
* get identity by public key endpoints ([#133](https://github.com/dashevo/dapi-client/pull/133))
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
### Documentation
|
|
327
|
+
|
|
328
|
+
* add typing ([#143](https://github.com/dashevo/dapi-client/pull/143))
|
|
329
|
+
* JSDoc formatting ([#132](https://github.com/dashevo/dapi-client/pull/132))
|
|
330
|
+
* `subscribeToTransactionsWithProofs` ([#137](https://github.com/dashevo/dapi-client/pull/137))
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
# [0.12.0](https://github.com/dashevo/dapi-client/compare/v0.11.0...v0.12.0) (2020-04-20)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
### Code Refactoring
|
|
338
|
+
|
|
339
|
+
* remove `forceJsonRpc` option ([#126](https://github.com/dashevo/dapi-client/issues/126))
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
### BREAKING CHANGES
|
|
343
|
+
|
|
344
|
+
* platform methods no longer available through JSON RPC
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
# [0.11.0](https://github.com/dashevo/dapi-client/compare/v0.8.0...v0.11.0) (2020-03-01)
|
|
348
|
+
|
|
349
|
+
### Bug Fixes
|
|
350
|
+
|
|
351
|
+
* return null if get "Not Found" gRPC error ([86af3f7](https://github.com/dashevo/dapi-client/commit/86af3f78d26e45dbe9ae1d49b6c215f5af9d0cba))
|
|
352
|
+
* gRPC web connection url should contain protocol ([0c7ad1f](https://github.com/dashevo/dapi-client/commit/0c7ad1f13ac1ec75a319c97514f19671f48c2b66))
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
### Features
|
|
356
|
+
|
|
357
|
+
* introduce `generateToAddress` endpoint ([f8b446b](https://github.com/dashevo/dapi-client/commit/f8b446ba41b0794b2d2007b0ad79e29f4a561b8e))
|
|
358
|
+
* bring back `getAddressSummary` endpoint ([d6de22c](https://github.com/dashevo/dapi-client/commit/d6de22cf8cbeb0ac7bb55ec5ae9e09f9900e3028))
|
|
359
|
+
* implement basic Core gRPC endpoints ([6fe4d4a](https://github.com/dashevo/dapi-client/commit/6fe4d4a79bce750210672ee7f2df9cc14d4437fd))
|
|
360
|
+
* remove obsolete API endpoints and code ([982a514](https://github.com/dashevo/dapi-client/commit/982a51437b94b3cb6ae0ba1b9031daef0a468940))
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
### BREAKING CHANGES
|
|
364
|
+
|
|
365
|
+
* Removed unsupported `generate` endpoint
|
|
366
|
+
* Removed insecure endpoints
|
|
@@ -13,7 +13,7 @@ const RetriableResponseError = require('../errors/response/RetriableResponseErro
|
|
|
13
13
|
function createJsonTransportError(error, dapiAddress) {
|
|
14
14
|
if (error instanceof WrongHttpCodeError) {
|
|
15
15
|
return new ServerError(
|
|
16
|
-
error.
|
|
16
|
+
error.getCode(),
|
|
17
17
|
error.message,
|
|
18
18
|
{},
|
|
19
19
|
dapiAddress,
|
|
@@ -16,7 +16,7 @@ class WrongHttpCodeError extends DAPIClientError {
|
|
|
16
16
|
super(`DAPI JSON RPC wrong http code: ${statusMessage}`);
|
|
17
17
|
|
|
18
18
|
this.requestInfo = requestInfo;
|
|
19
|
-
this.
|
|
19
|
+
this.code = statusCode;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -30,8 +30,8 @@ class WrongHttpCodeError extends DAPIClientError {
|
|
|
30
30
|
*
|
|
31
31
|
* @returns {number}
|
|
32
32
|
*/
|
|
33
|
-
|
|
34
|
-
return this.
|
|
33
|
+
getCode() {
|
|
34
|
+
return this.code;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -29,12 +29,6 @@ async function requestJsonRpc(host, port, method, params, options = {}) {
|
|
|
29
29
|
postOptions.timeout = options.timeout;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const response = await axios.post(
|
|
33
|
-
url,
|
|
34
|
-
payload,
|
|
35
|
-
{ timeout: options.timeout },
|
|
36
|
-
);
|
|
37
|
-
|
|
38
32
|
const requestInfo = {
|
|
39
33
|
host,
|
|
40
34
|
port,
|
|
@@ -43,6 +37,22 @@ async function requestJsonRpc(host, port, method, params, options = {}) {
|
|
|
43
37
|
options,
|
|
44
38
|
};
|
|
45
39
|
|
|
40
|
+
let response;
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
response = await axios.post(
|
|
44
|
+
url,
|
|
45
|
+
payload,
|
|
46
|
+
{ timeout: options.timeout },
|
|
47
|
+
);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
if (error.response && error.response.status >= 500) {
|
|
50
|
+
throw new WrongHttpCodeError(requestInfo, error.response.status, error.response.statusText);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
|
|
46
56
|
if (response.status !== 200) {
|
|
47
57
|
throw new WrongHttpCodeError(requestInfo, response.status, response.statusMessage);
|
|
48
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/dapi-client",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.6",
|
|
4
4
|
"description": "Client library used to access Dash DAPI endpoints",
|
|
5
5
|
"main": "lib/DAPIClient.js",
|
|
6
6
|
"contributors": [
|
|
@@ -26,31 +26,33 @@
|
|
|
26
26
|
}
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@dashevo/dapi-grpc": "~0.21.
|
|
30
|
-
"@dashevo/dashcore-lib": "~0.19.
|
|
31
|
-
"@dashevo/dpp": "~0.21.
|
|
32
|
-
"@dashevo/grpc-common": "~0.
|
|
29
|
+
"@dashevo/dapi-grpc": "~0.21.6",
|
|
30
|
+
"@dashevo/dashcore-lib": "~0.19.28",
|
|
31
|
+
"@dashevo/dpp": "~0.21.6",
|
|
32
|
+
"@dashevo/grpc-common": "~0.21.6",
|
|
33
33
|
"@grpc/grpc-js": "^1.3.7",
|
|
34
34
|
"axios": "^0.21.1",
|
|
35
35
|
"bs58": "^4.0.1",
|
|
36
|
-
"cbor": "^
|
|
36
|
+
"cbor": "^8.0.0",
|
|
37
37
|
"lodash.sample": "^4.2.1",
|
|
38
|
-
"node-inspect-extracted": "^1.0.
|
|
38
|
+
"node-inspect-extracted": "^1.0.8"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@babel/core": "^7.
|
|
41
|
+
"@babel/core": "^7.15.5",
|
|
42
42
|
"assert-browserify": "^2.0.0",
|
|
43
|
-
"babel-loader": "^8.
|
|
43
|
+
"babel-loader": "^8.2.2",
|
|
44
44
|
"buffer": "^6.0.3",
|
|
45
|
-
"chai": "^4.
|
|
45
|
+
"chai": "^4.3.4",
|
|
46
46
|
"chai-as-promised": "^7.1.1",
|
|
47
|
-
"
|
|
47
|
+
"comment-parser": "^0.7.6",
|
|
48
|
+
"core-js": "^3.17.2",
|
|
48
49
|
"crypto-browserify": "^3.12.0",
|
|
49
50
|
"dirty-chai": "^2.0.1",
|
|
50
|
-
"eslint": "^
|
|
51
|
-
"eslint-config-airbnb-base": "^14.1
|
|
52
|
-
"eslint-plugin-import": "^2.
|
|
51
|
+
"eslint": "^7.32.0",
|
|
52
|
+
"eslint-config-airbnb-base": "^14.2.1",
|
|
53
|
+
"eslint-plugin-import": "^2.24.2",
|
|
53
54
|
"eslint-plugin-jsdoc": "^27.0.0",
|
|
55
|
+
"events": "^3.3.0",
|
|
54
56
|
"karma": "^6.3.4",
|
|
55
57
|
"karma-chai": "^0.1.0",
|
|
56
58
|
"karma-chrome-launcher": "^3.1.0",
|
|
@@ -58,31 +60,38 @@
|
|
|
58
60
|
"karma-mocha": "^2.0.1",
|
|
59
61
|
"karma-mocha-reporter": "^2.2.5",
|
|
60
62
|
"karma-webpack": "^5.0.0",
|
|
61
|
-
"mocha": "^9.1.
|
|
63
|
+
"mocha": "^9.1.2",
|
|
62
64
|
"nyc": "^15.1.0",
|
|
63
65
|
"path-browserify": "^1.0.1",
|
|
64
66
|
"process": "^0.11.10",
|
|
65
67
|
"sinon": "^11.1.2",
|
|
66
68
|
"sinon-chai": "^3.7.0",
|
|
67
69
|
"stream-browserify": "^3.0.0",
|
|
70
|
+
"string_decoder": "^1.3.0",
|
|
68
71
|
"url": "^0.11.0",
|
|
69
|
-
"
|
|
70
|
-
"webpack
|
|
72
|
+
"util": "^0.12.4",
|
|
73
|
+
"webpack": "^5.59.1",
|
|
74
|
+
"webpack-cli": "^4.9.1"
|
|
71
75
|
},
|
|
72
76
|
"files": [
|
|
73
77
|
"docs",
|
|
74
78
|
"lib"
|
|
75
79
|
],
|
|
76
80
|
"scripts": {
|
|
77
|
-
"build": "webpack",
|
|
81
|
+
"build:web": "webpack",
|
|
78
82
|
"lint": "eslint .",
|
|
79
|
-
"test": "
|
|
83
|
+
"test": "yarn run test:coverage && yarn run test:browsers",
|
|
80
84
|
"test:unit": "mocha './test/unit/**/*.spec.js'",
|
|
81
85
|
"test:integration": "mocha './test/integration/**/*.spec.js'",
|
|
82
86
|
"test:node": "NODE_ENV=test mocha",
|
|
83
87
|
"test:browsers": "karma start ./karma.conf.js --single-run",
|
|
84
|
-
"test:coverage": "NODE_ENV=test nyc --check-coverage --stmts=98 --branch=98 --funcs=98 --lines=95 mocha 'test/unit/**/*.spec.js' 'test/integration/**/*.spec.js'",
|
|
85
|
-
"prepublishOnly": "
|
|
88
|
+
"test:coverage": "NODE_ENV=test nyc --check-coverage --stmts=98 --branch=98 --funcs=98 --lines=95 yarn run mocha 'test/unit/**/*.spec.js' 'test/integration/**/*.spec.js'",
|
|
89
|
+
"prepublishOnly": "yarn run build:web"
|
|
90
|
+
},
|
|
91
|
+
"ultra": {
|
|
92
|
+
"concurrent": [
|
|
93
|
+
"clean"
|
|
94
|
+
]
|
|
86
95
|
},
|
|
87
96
|
"license": "MIT"
|
|
88
|
-
}
|
|
97
|
+
}
|