@dashevo/dapi-client 0.21.4 → 0.22.0-dev.4

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
package/docs/_sidebar.md CHANGED
@@ -1,18 +1,24 @@
1
1
  - Getting started
2
2
  - [Quick start](getting-started/quickstart.md)
3
3
  - Usage
4
- - Application
5
- - [`.applyStateTransition()`](usage/application/applyStateTransition.md)
6
- - [`.getDataContract()`](usage/application/getDataContract.md)
7
- - [`.getDocuments()`](usage/application/getDocuments.md)
8
- - [`.getIdentity()`](usage/application/getIdentity.md)
9
- - [`.getIdentityByFirstPublicKey()`](usage/application/getIdentityByFirstPublicKey.md)
10
- - [`.getIdentityIdByFirstPublicKey()`](usage/application/getIdentityIdByFirstPublicKey.md)
11
- - Payment
12
- - [`.getBestBlockHash()`](usage/payment/getBestBlockHash.md)
13
- - [`.getBlockHash()`](usage/payment/getBlockHash.md)
14
- - [`.getUTXO()`](usage/payment/getUTXO.md)
15
- - Utilities
16
- - [`.getMnListDiff()`](usage/utils/getMnListDiff.md)
17
- - [`.subscribeToTransactionsWithProofs()`](usage/utils/subscribeToTransactionsWithProofs.md)
4
+ - DAPIClient
5
+ - [new DAPIClient()](usage/application/DAPIClient.md)
6
+ - Core
7
+ - [.broadcastTransaction()](usage/application/core/broadcastTransaction.md)
8
+ - [.generateToAddress()](usage/application/core/generateToAddress.md)
9
+ - [.getBestBlockHash()](usage/application/core/getBestBlockHash.md)
10
+ - [.getBlockByHash()](usage/application/core/getBlockByHash.md)
11
+ - [.getBlockByHeight()](usage/application/core/getBlockByHeight.md)
12
+ - [.getBlockHash()](usage/application/core/getBlockHash.md)
13
+ - [.getMnListDiff()](usage/application/core/getMnListDiff.md)
14
+ - [.getStatus()](usage/application/core/getStatus.md)
15
+ - [.getTransaction()](usage/application/core/getTransaction.md)
16
+ - [.subscribeToTransactionsWithProofs()](usage/application/core/subscribeToTransactionsWithProofs.md)
17
+ - Platform
18
+ - [.broadcastStateTransition()](usage/application/platform/broadcastStateTransition.md)
19
+ - [.getDataContract()](usage/application/platform/getDataContract.md)
20
+ - [.getDocuments()](usage/application/platform/getDocuments.md)
21
+ - [.getIdentityByFirstPublicKey()](usage/application/platform/getIdentityByFirstPublicKey.md)
22
+ - [.getIdentity()](usage/application/platform/getIdentity.md)
23
+ - [.getIdentityIdByFirstPublicKey()](usage/application/platform/getIdentityIdByFirstPublicKey.md)
18
24
  - [License](https://github.com/dashevo/dapi-client/blob/master/LICENSE)
@@ -1,6 +1,6 @@
1
1
  # Quick start
2
2
 
3
- ### ES5/ES6 via NPM
3
+ ## ES5/ES6 via NPM
4
4
 
5
5
  In order to use this library in Node, you will need to add it to your project as a dependency.
6
6
 
@@ -10,7 +10,7 @@ Having [NodeJS](https://nodejs.org/) installed, just type in your terminal :
10
10
  npm install @dashevo/dapi-client
11
11
  ```
12
12
 
13
- ### CDN Standalone
13
+ ## CDN Standalone
14
14
 
15
15
  For browser usage, you can also directly rely on unpkg :
16
16
 
@@ -18,6 +18,8 @@ For browser usage, you can also directly rely on unpkg :
18
18
  <script src="https://unpkg.com/@dashevo/dapi-client"></script>
19
19
  ```
20
20
 
21
+ You can see an [example usage here](https://github.com/dashevo/js-dapi-client/blob/master/examples/web/web.usage.html)
22
+
21
23
  ## Initialization
22
24
 
23
25
  ```js
@@ -0,0 +1,29 @@
1
+ **Usage**: `new DAPIClient(options)`
2
+ **Description**: This method creates a new DAPIClient instance.
3
+
4
+ Parameters:
5
+
6
+ | parameters | type | required[def value] | Description |
7
+ |-------------------------------------------|---------------------|-----------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
8
+ | **options** | Object | | |
9
+ | **options.dapiAddressProvider** | DAPIAddressProvider | no[ListDAPIAddressProvider] | Allow to override the default dapiAddressProvider (do not allow seeds or dapiAddresses params) |
10
+ | **options.seeds** | string[] | no[seeds] | Allow to override default seeds (to connect to specific node) |
11
+ | **options.network** | string|Network | no[=evonet] | Allow to setup the network to be used (livenet, testnet, evonet,..) |
12
+ | **options.timeout** | number | no[=2000] | Used to specify the timeout time in milliseconds. |
13
+ | **options.retries** | number | no[=3] | Used to specify the number of retries before aborting and erroring a request. |
14
+ | **options.baseBanTime** | number | no[=6000] | |
15
+
16
+ Returns : DAPIClient instance.
17
+
18
+ ```js
19
+ const DAPIClient = require('@dashevo/dapi-client');
20
+ const client = new DAPIClient({
21
+ timeout: 5000,
22
+ retries: 3,
23
+ network: 'livenet'
24
+ });
25
+ ```
26
+
27
+ **Notes**:
28
+ - Accessing the SimplifiedMasternodeListDAPIAddressProvider (or its overwrote instance), can be accessed via `client.dapiAddressProvider`.
29
+
@@ -0,0 +1,15 @@
1
+ **Usage**: `await client.core.broadcastTransaction(transaction)`
2
+ **Description**: Allow to broadcast a valid **signed** transaction to the network.
3
+
4
+ Parameters:
5
+
6
+ | parameters | type | required | Description |
7
+ |---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
+ | **transaction** | Buffer | yes | A valid Buffer representation of a transaction |
9
+ | **options** | Object | | |
10
+ | **options.allowHighFees** | Boolean | no[=false] | As safety measure, "absurd" fees are rejected when considered to high. This allow to overwrite that comportement |
11
+ | **options.bypassLimits** | Boolean | no[=false] | Allow to bypass default transaction policy rules limitation |
12
+
13
+ Returns : transactionId (string).
14
+
15
+ N.B : The TransactionID provided is subject to [transaction malleability](https://dashcore.readme.io/docs/core-guide-transactions-transaction-malleability), and is not a source of truth (the transaction might be included in a block with a different txid).
@@ -0,0 +1,13 @@
1
+ **Usage**: `await client.core.generateToAddress(blockMumber, address, options)`
2
+ **Description**: Allow to broadcast a valid **signed** transaction to the network.
3
+ **Notes**: Will only works on regtest.
4
+
5
+ Parameters:
6
+
7
+ | parameters | type | required | Description |
8
+ |---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ |
9
+ | **blocksNumber** | Number | yes | A number of block to see generated on the regtest network |
10
+ | **address** | String | yes | The address that will receive the newly generated Dash |
11
+ | **options** | DAPIClientOptions | no | |
12
+
13
+ Returns : {Promise<string[]>} - a set of generated blockhashes.
@@ -0,0 +1,10 @@
1
+ **Usage**: `await client.core.getBestBlockHash(options)`
2
+ **Description**: Allow to fetch the best (highest/latest block hash) from the network
3
+
4
+ Parameters:
5
+
6
+ | parameters | type | required | Description |
7
+ |---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
+ | **options** | DAPIClientOptions | no | |
9
+
10
+ Returns : {Promise<string>} - The best block hash
@@ -0,0 +1,11 @@
1
+ **Usage**: `await client.core.getBlockByHash(hash, options)`
2
+ **Description**: Allow to fetch a specific block by its hash
3
+
4
+ Parameters:
5
+
6
+ | parameters | type | required | Description |
7
+ |---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
+ | **hash** | String | yes | A valid block hash |
9
+ | **options** | DAPIClientOptions | no | |
10
+
11
+ Returns : {Promise<null|Buffer>} - The specified bufferized block
@@ -0,0 +1,11 @@
1
+ **Usage**: `await client.core.getBlockByHeight(height, options)`
2
+ **Description**: Allow to fetch a specific block by its height
3
+
4
+ Parameters:
5
+
6
+ | parameters | type | required | Description |
7
+ |---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
+ | **height** | Number | yes | A valid block height |
9
+ | **options** | DAPIClientOptions | no | |
10
+
11
+ Returns : {Promise<null|Buffer>} - The specified bufferized block
@@ -0,0 +1,11 @@
1
+ **Usage**: `await client.core.getBlockHash(height, options)`
2
+ **Description**: Allow to fetch a specific block hash from its height
3
+
4
+ Parameters:
5
+
6
+ | parameters | type | required | Description |
7
+ |---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
+ | **height** | Number | yes | A valid block height |
9
+ | **options** | DAPIClientOptions | no | |
10
+
11
+ Returns : {Promise<null|string>} - the corresponding block hash
@@ -0,0 +1,12 @@
1
+ **Usage**: `await client.core.getMnListDiff(baseBlockHash, blockHash, options)`
2
+ **Description**: Allow to fetch a specific block hash from its height
3
+
4
+ Parameters:
5
+
6
+ | parameters | type | required | Description |
7
+ |---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
+ | **baseBlockHash** | String | yes | hash or height of start block |
9
+ | **blockHash** | String | yes | hash or height of end block |
10
+ | **options** | DAPIClientOptions | no | |
11
+
12
+ Returns : {Promise<object>} - The Masternode List Diff of the specified period
@@ -0,0 +1,29 @@
1
+ **Usage**: `await client.core.getStatus(options)`
2
+ **Description**: Allow to fetch a specific block hash from its height
3
+
4
+ Parameters:
5
+
6
+ | parameters | type | required | Description |
7
+ |---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
+ | **options** | DAPIClientOptions | no | |
9
+
10
+ Returns : {Promise<object>} - Status object
11
+
12
+ ```js
13
+ const status = await client.core.getStatus()
14
+ /**
15
+ {
16
+ coreVersion: 150000,
17
+ protocolVersion: 70216,
18
+ blocks: 10630,
19
+ timeOffset: 0,
20
+ connections: 58,
21
+ proxy: '',
22
+ difficulty: 0.001745769130443678,
23
+ testnet: false,
24
+ relayFee: 0.00001,
25
+ errors: '',
26
+ network: 'testnet'
27
+ }
28
+ **/
29
+ ```
@@ -0,0 +1,11 @@
1
+ **Usage**: `await client.core.getTransaction(id, options)`
2
+ **Description**: Allow to fetch a transaction by ID
3
+
4
+ Parameters:
5
+
6
+ | parameters | type | required | Description |
7
+ |---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
+ | **id** | string | yes | A valid transaction id to fetch |
9
+ | **options** | DAPIClientOptions | no | |
10
+
11
+ Returns : {Promise<null|Buffer>} - The bufferized transaction
@@ -0,0 +1,11 @@
1
+ **Usage**: `async client.platform.broadcastStateTransition(stateTransition, options)`
2
+ **Description**: Send State Transition to machine
3
+
4
+ Parameters:
5
+
6
+ | parameters | type | required | Description |
7
+ |------------------------|-------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
+ | **stateTransition** | Buffer | yes | A valid bufferized state transition |
9
+ | **options** | DAPIClientOptions | no | A valid state transition |
10
+
11
+ Returns : Promise<!BroadcastStateTransitionResponse>
@@ -1,4 +1,4 @@
1
- **Usage**: `async client.core.subscribeToTransactionsWithProofs(bloomFilter, options = { count: 0 })`\
1
+ **Usage**: `await client.core.subscribeToTransactionsWithProofs(bloomFilter, options = { count: 0 })`\
2
2
  **Description**: For any provided bloomfilter, it will return a ClientReadableStream streaming the transaction matching the filter.
3
3
 
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dapi-client",
3
- "version": "0.21.4",
3
+ "version": "0.22.0-dev.4",
4
4
  "description": "Client library used to access Dash DAPI endpoints",
5
5
  "main": "lib/DAPIClient.js",
6
6
  "contributors": [
@@ -26,10 +26,10 @@
26
26
  }
27
27
  ],
28
28
  "dependencies": {
29
- "@dashevo/dapi-grpc": "~0.21.4",
30
- "@dashevo/dashcore-lib": "~0.19.27",
31
- "@dashevo/dpp": "~0.21.4",
32
- "@dashevo/grpc-common": "~0.21.4",
29
+ "@dashevo/dapi-grpc": "~0.22.0-dev.4",
30
+ "@dashevo/dashcore-lib": "~0.19.28",
31
+ "@dashevo/dpp": "~0.22.0-dev.4",
32
+ "@dashevo/grpc-common": "~0.22.0-dev.4",
33
33
  "@grpc/grpc-js": "^1.3.7",
34
34
  "axios": "^0.21.1",
35
35
  "bs58": "^4.0.1",
@@ -52,6 +52,7 @@
52
52
  "eslint-config-airbnb-base": "^14.2.1",
53
53
  "eslint-plugin-import": "^2.24.2",
54
54
  "eslint-plugin-jsdoc": "^27.0.0",
55
+ "events": "^3.3.0",
55
56
  "karma": "^6.3.4",
56
57
  "karma-chai": "^0.1.0",
57
58
  "karma-chrome-launcher": "^3.1.0",
@@ -66,7 +67,9 @@
66
67
  "sinon": "^11.1.2",
67
68
  "sinon-chai": "^3.7.0",
68
69
  "stream-browserify": "^3.0.0",
70
+ "string_decoder": "^1.3.0",
69
71
  "url": "^0.11.0",
72
+ "util": "^0.12.4",
70
73
  "webpack": "^5.59.1",
71
74
  "webpack-cli": "^4.9.1"
72
75
  },
@@ -77,13 +80,13 @@
77
80
  "scripts": {
78
81
  "build:web": "webpack",
79
82
  "lint": "eslint .",
80
- "test": "npm run test:coverage && npm run test:browsers",
83
+ "test": "yarn run test:coverage && yarn run test:browsers",
81
84
  "test:unit": "mocha './test/unit/**/*.spec.js'",
82
85
  "test:integration": "mocha './test/integration/**/*.spec.js'",
83
86
  "test:node": "NODE_ENV=test mocha",
84
87
  "test:browsers": "karma start ./karma.conf.js --single-run",
85
- "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'",
86
- "prepublishOnly": "npm run build:web"
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"
87
90
  },
88
91
  "ultra": {
89
92
  "concurrent": [
@@ -91,4 +94,4 @@
91
94
  ]
92
95
  },
93
96
  "license": "MIT"
94
- }
97
+ }
@@ -1,11 +0,0 @@
1
- **Usage**: `async client.platform.applyStateTransition(stateTransition)`
2
- **Description**: Send State Transition to machine
3
-
4
- Parameters:
5
-
6
- | parameters | type | required | Description |
7
- |------------------------|------------------------------------------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
- | **stateTransition** | DataContractStateTransition/DocumentsStateTransition | yes | A valid state transition |
9
-
10
- Returns : Promise<!ApplyStateTransitionResponse>
11
-
@@ -1,10 +0,0 @@
1
- **Usage**: `async client.core.getBestBlockHash()`
2
- **Description**: Returns block hash of chaintip
3
-
4
- Parameters:
5
-
6
- | parameters | type | required | Description |
7
- |------------------------|--------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
-
9
- Returns : Promise<string>
10
-
@@ -1,11 +0,0 @@
1
- **Usage**: `client.core.getBlockHash(height)`
2
- **Description**: Returns block hash for the given height
3
-
4
- Parameters:
5
-
6
- | parameters | type | required | Description |
7
- |------------------------|--------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
- | **height** | Number | yes | Any valid height value |
9
-
10
- Returns : Promise<string>
11
-
@@ -1,15 +0,0 @@
1
- **Usage**: `async client.core.getUTXO(address, from, to, fromHeight, toHeight)`
2
- **Description**: Returns UTXO for a given address or multiple addresses (max result 1000)
3
-
4
- Parameters:
5
-
6
- | parameters | type | required | Description |
7
- |------------------------|--------------------|----------------| ------------------------------------------------------------------------------------------------ |
8
- | **address** | String/[String] | yes | address or array of addresses |
9
- | **from** | Number | no | start of range in the ordered list of latest UTXO |
10
- | **to** | Number | no | end of range in the ordered list of latest UTXO |
11
- | **fromHeight** | Number | no | which height to start from (optional, overriding from/to) |
12
- | **toHeight** | Number | no | on which height to end (optional, overriding from/to) |
13
-
14
- Returns : Promise<object> - Object with pagination info and array of unspent outputs
15
-
@@ -1,12 +0,0 @@
1
- **Usage**: `async client.core.getMnListDiff(baseBlockHash, blockHash)`
2
- **Description**: Get deterministic masternodelist diff
3
-
4
- Parameters:
5
-
6
- | parameters | type | required | Description |
7
- |------------------------|--------|----------------| ------------------------------------------------------------------------------------------------ |
8
- | **baseBlockHash** | String | yes | Hash or height of start block |
9
- | **blockHash** | String | yes | Hash or height of end block |
10
-
11
- Returns : Promise<object>
12
-