@gnolang/tm2-js-client 1.1.2 → 1.1.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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uint8ArrayToBase64 = exports.base64ToUint8Array = exports.stringToBase64 = exports.parseABCI = exports.newResponse = exports.newRequest = void 0;
4
+ var uuid_1 = require("uuid");
4
5
  // The version of the supported JSON-RPC protocol
5
6
  var standardVersion = '2.0';
6
7
  /**
@@ -12,7 +13,7 @@ var newRequest = function (method, params) {
12
13
  return {
13
14
  // the ID of the request is not that relevant for this helper method;
14
15
  // for finer ID control, instantiate the request object directly
15
- id: Date.now(),
16
+ id: (0, uuid_1.v4)(),
16
17
  jsonrpc: standardVersion,
17
18
  method: method,
18
19
  params: params,
@@ -26,7 +27,7 @@ exports.newRequest = newRequest;
26
27
  */
27
28
  var newResponse = function (result, error) {
28
29
  return {
29
- id: Date.now(),
30
+ id: (0, uuid_1.v4)(),
30
31
  jsonrpc: standardVersion,
31
32
  result: result,
32
33
  error: error,
@@ -59,8 +59,8 @@ var WSProvider = /** @class */ (function () {
59
59
  */
60
60
  this.waitForOpenConnection = function () {
61
61
  return new Promise(function (resolve, reject) {
62
- var maxNumberOfAttempts = 10;
63
- var intervalTime = 200; //ms
62
+ var maxNumberOfAttempts = 20;
63
+ var intervalTime = 500; // ms
64
64
  var currentAttempt = 0;
65
65
  var interval = setInterval(function () {
66
66
  if (_this.ws.readyState === WebSocket.OPEN) {
@@ -68,9 +68,9 @@ var WSProvider = /** @class */ (function () {
68
68
  resolve(null);
69
69
  }
70
70
  currentAttempt++;
71
- if (currentAttempt > maxNumberOfAttempts - 1) {
71
+ if (currentAttempt >= maxNumberOfAttempts) {
72
72
  clearInterval(interval);
73
- reject(new Error('Maximum number of attempts exceeded'));
73
+ reject(new Error('Unable to establish WS connection'));
74
74
  }
75
75
  }, intervalTime);
76
76
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gnolang/tm2-js-client",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Tendermint2 JS / TS Client",
5
5
  "main": "./bin/index.js",
6
6
  "repository": {
@@ -47,9 +47,11 @@
47
47
  "@cosmjs/amino": "^0.31.0",
48
48
  "@cosmjs/crypto": "^0.31.0",
49
49
  "@cosmjs/ledger-amino": "^0.31.0",
50
+ "@types/uuid": "^9.0.4",
50
51
  "axios": "^1.4.0",
51
52
  "long": "^5.2.3",
52
53
  "protobufjs": "^7.2.3",
54
+ "uuid": "^9.0.1",
53
55
  "ws": "^8.13.0"
54
56
  },
55
57
  "scripts": {