@dashevo/dapi-client 0.24.0-dev.19 → 0.24.0-dev.20

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.
@@ -83,7 +83,7 @@ class GrpcTransport {
83
83
  throw error;
84
84
  }
85
85
 
86
- const responseError = this.createGrpcTransportError(error, address);
86
+ const responseError = await this.createGrpcTransportError(error, address);
87
87
 
88
88
  if (!(responseError instanceof RetriableResponseError)) {
89
89
  throw responseError;
@@ -1,9 +1,12 @@
1
1
  const cbor = require('cbor');
2
2
 
3
- const createConsensusError = require('@dashevo/dpp/lib/errors/consensus/createConsensusError');
4
3
  const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes');
5
4
  const { parseMetadata } = require('@dashevo/dapi-grpc');
6
5
 
6
+ const {
7
+ deserializeConsensusError,
8
+ } = require('@dashevo/wasm-dpp');
9
+ const { default: loadWasmDpp } = require('@dashevo/wasm-dpp');
7
10
  const NotFoundError = require('./errors/NotFoundError');
8
11
  const TimeoutError = require('./errors/TimeoutError');
9
12
  const ResponseError = require('../errors/response/ResponseError');
@@ -43,7 +46,9 @@ const errorClasses = {
43
46
  * @param {DAPIAddress} dapiAddress
44
47
  * @returns {ResponseError}
45
48
  */
46
- function createGrpcTransportError(grpcError, dapiAddress) {
49
+ async function createGrpcTransportError(grpcError, dapiAddress) {
50
+ await loadWasmDpp();
51
+
47
52
  // Extract error code and data
48
53
  let data = {};
49
54
  let { code } = grpcError;
@@ -114,9 +119,9 @@ function createGrpcTransportError(grpcError, dapiAddress) {
114
119
 
115
120
  // DPP consensus errors
116
121
  if (code >= 1000 && code < 5000) {
117
- const consensusError = createConsensusError(code, data.arguments || []);
122
+ const consensusError = deserializeConsensusError(data.serializedError || []);
118
123
 
119
- delete data.arguments;
124
+ delete data.serializedError;
120
125
 
121
126
  return new InvalidRequestDPPError(consensusError, data, dapiAddress);
122
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dapi-client",
3
- "version": "0.24.0-dev.19",
3
+ "version": "0.24.0-dev.20",
4
4
  "description": "Client library used to access Dash DAPI endpoints",
5
5
  "main": "lib/index.js",
6
6
  "contributors": [
@@ -26,11 +26,12 @@
26
26
  }
27
27
  ],
28
28
  "dependencies": {
29
- "@dashevo/dapi-grpc": "0.24.0-dev.19",
30
- "@dashevo/dash-spv": "0.24.0-dev.19",
31
- "@dashevo/dashcore-lib": "~0.20.0",
32
- "@dashevo/dpp": "0.24.0-dev.19",
33
- "@dashevo/grpc-common": "0.24.0-dev.19",
29
+ "@dashevo/dapi-grpc": "0.24.0-dev.20",
30
+ "@dashevo/dash-spv": "0.24.0-dev.20",
31
+ "@dashevo/dashcore-lib": "~0.20.3",
32
+ "@dashevo/dpp": "0.24.0-dev.20",
33
+ "@dashevo/grpc-common": "0.24.0-dev.20",
34
+ "@dashevo/wasm-dpp": "0.24.0-dev.20",
34
35
  "bs58": "^4.0.1",
35
36
  "cbor": "^8.0.0",
36
37
  "lodash": "^4.17.21",