@tchain/tcabci-read-js-client 2.5.5 → 2.5.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/client.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import {
2
- ADDRESSES_IS_EMPTY,
2
+ FetchError,
3
3
  ALREADY_CONNECTED,
4
4
  BLOCK_NOT_FOUND,
5
5
  ERR_NETWORK,
6
- FetchError,
7
6
  INVALID_ARGUMENT_WITH_CS,
8
7
  INVALID_ARGUMENTS,
9
8
  NOT_CONNECTED,
@@ -21,6 +20,7 @@ import { isJSON, toJSON } from './util.js'
21
20
  import { Options } from './websocketOptions.js'
22
21
  import { TWebSocket } from './websocket.js'
23
22
  import { TX_TYPE, TX_TYPE_LIST } from './transaction.js'
23
+ let https
24
24
 
25
25
  /**
26
26
  * @callback successCallback
@@ -49,7 +49,7 @@ export default class TCaBCIClient {
49
49
  _connected = false
50
50
  _chainName = 'transferchain'
51
51
  _chainVersion = 'v1'
52
- _version = `v2.5.5`
52
+ _version = `v2.5.6`
53
53
  /**
54
54
  * @type {?successCallback}
55
55
  */
@@ -67,6 +67,11 @@ export default class TCaBCIClient {
67
67
  */
68
68
  _listenCb = null
69
69
  _wsLibrary = null
70
+ /**
71
+ * @type {Options}
72
+ * @private
73
+ */
74
+ _options
70
75
  /**
71
76
  * @type {TWebSocket}
72
77
  */
@@ -90,15 +95,18 @@ export default class TCaBCIClient {
90
95
  this._wsLibrary = wsLibrary
91
96
 
92
97
  if (Array.isArray(readNodeAddresses) && readNodeAddresses.length === 2) {
93
- this._readNodeAddress = readNodeAddresses[0]
94
- this._readNodeWSAddress = readNodeAddresses[1]
95
-
96
98
  if (!readNodeAddresses[0].startsWith('http'))
97
99
  throw new Error(INVALID_ARGUMENTS)
98
100
  if (!readNodeAddresses[1].startsWith('ws'))
99
101
  throw new Error(INVALID_ARGUMENTS)
102
+
103
+ this._readNodeAddress = readNodeAddresses[0]
104
+ this._readNodeWSAddress = readNodeAddresses[1]
100
105
  }
101
106
 
107
+ this._options = new Options(this._readNodeWSAddress)
108
+ this._options.setCustomWS(this._wsLibrary)
109
+
102
110
  if (chainName) this._chainName = chainName
103
111
  if (chainVersion) this._chainVersion = chainVersion
104
112
  }
@@ -120,6 +128,10 @@ export default class TCaBCIClient {
120
128
  )
121
129
  }
122
130
 
131
+ SetDebug(debug) {
132
+ this._options.setDebug(debug)
133
+ }
134
+
123
135
  Socket() {
124
136
  return this._ws
125
137
  }
@@ -639,10 +651,7 @@ export default class TCaBCIClient {
639
651
  return Promise.reject(new Error(ALREADY_CONNECTED))
640
652
  }
641
653
 
642
- const options = new Options(this._readNodeWSAddress)
643
- options.setCustomWS(this._wsLibrary)
644
-
645
- this._ws = new TWebSocket(options)
654
+ this._ws = new TWebSocket(this._options)
646
655
 
647
656
  this._ws.addErrorListener((e) => {
648
657
  this.setConnected(false)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tchain/tcabci-read-js-client",
3
- "version": "2.5.5",
3
+ "version": "2.5.6",
4
4
  "description": "TransferChain Fastest Read Network WebSocket Client",
5
5
  "main": "client.js",
6
6
  "type": "module",
@@ -20,13 +20,14 @@
20
20
  "url": "https://github.com/TransferChain/tcabci-read-js-client/issues"
21
21
  },
22
22
  "homepage": "https://github.com/TransferChain/tcabci-read-js-client#readme",
23
+ "packageManager": "pnpm@10.18.2",
23
24
  "devDependencies": {
24
- "@eslint/js": "^9.34.0",
25
- "chai": "^6.0.1",
26
- "esm": "*",
25
+ "@eslint/js": "^9.37.0",
26
+ "chai": "^6.2.0",
27
+ "esm": "^3.2.25",
27
28
  "express": "^5.1.0",
28
- "globals": "^16.3.0",
29
- "mocha": "^11.7.1",
29
+ "globals": "^16.4.0",
30
+ "mocha": "^11.7.4",
30
31
  "nyc": "^17.1.0",
31
32
  "prettier": "^3.6.2",
32
33
  "unit.js": "^2.1.1",
@@ -13,7 +13,7 @@ export class Options {
13
13
  _protocols = []
14
14
  _customWS
15
15
  _endpoints = ['ws', 'longpoll']
16
- _version = `v2.5.5`
16
+ _version = `v2.5.6`
17
17
 
18
18
  _maxConnectionDelay = 10000
19
19
  _minReconnectionDelay = 1000 + Math.random() * 4000