@tchain/tcabci-read-js-client 2.0.0 → 2.0.2

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
@@ -20,20 +20,11 @@ import {
20
20
  import Message from './message.js'
21
21
  import { toJSON } from './util.js'
22
22
 
23
- let fetch
24
-
25
- if (typeof window !== 'undefined') {
26
- fetch = window.fetch
27
- } else {
28
- fetch = (...args) =>
29
- import('node-fetch').then(({ default: fetch }) => fetch(...args))
30
- }
31
-
32
23
  export default class TCAbciClient {
33
24
  subscribed = false
34
25
  subscribedAddresses = []
35
26
  connected = false
36
- version = 'v2.0.0'
27
+ version = 'v2.0.2'
37
28
  errorCb = null
38
29
  listenCb = null
39
30
  ws = null
package/errors.js CHANGED
@@ -17,12 +17,13 @@ export class FetchError extends Error {
17
17
  code = -1
18
18
  response = {}
19
19
 
20
- constructor(props, code = -1) {
21
- super(props)
20
+ constructor(message, code = -1) {
21
+ super(message)
22
+ this.message = message
22
23
  this.code = code
23
24
  this.response = {
24
25
  status: code,
25
- statusText: Array.isArray(props) ? props[0] : props,
26
+ statusText: message,
26
27
  }
27
28
  }
28
29
  }
package/errors_test.js ADDED
@@ -0,0 +1,11 @@
1
+ import { FetchError } from './errors.js'
2
+ import unitJS from 'unit.js'
3
+
4
+ describe('Errors', () => {
5
+ it('FetchError', () => {
6
+ const err = new FetchError('err1', 1)
7
+
8
+ unitJS.assert.equal(err.message, 'err1')
9
+ unitJS.assert.equal(err.code, 1)
10
+ })
11
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tchain/tcabci-read-js-client",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "TransferChain Fastest Read Network WebSocket Client",
5
5
  "main": "client.js",
6
6
  "type": "module",
@@ -34,7 +34,6 @@
34
34
  "prettier": "^3.2.4"
35
35
  },
36
36
  "dependencies": {
37
- "node-fetch": "^3.3.2",
38
37
  "reconnecting-websocket": "^4.4.0",
39
38
  "ws": "^8.18.0"
40
39
  }