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

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/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
package/.eslintignore ADDED
@@ -0,0 +1,3 @@
1
+ /dist
2
+ /node_modules
3
+ .eslintrc.js
package/.eslintrc.cjs ADDED
@@ -0,0 +1,85 @@
1
+ module.exports = {
2
+ root: true,
3
+
4
+ parserOptions: {
5
+ ecmaVersion: 2022, // Allows for the parsing of modern ECMAScript features
6
+ },
7
+
8
+ env: {
9
+ node: true,
10
+ browser: true,
11
+ jest: true,
12
+ },
13
+
14
+ // Rules order is important, please avoid shuffling them
15
+ extends: [
16
+ // Base ESLint recommended rules
17
+ 'eslint:recommended',
18
+ 'plugin:import/recommended',
19
+ 'plugin:import/errors',
20
+ 'plugin:import/warnings',
21
+ 'prettier',
22
+ ],
23
+
24
+ plugins: [
25
+ 'import',
26
+ ],
27
+
28
+ globals: {
29
+ ga: 'readonly', // Google Analytics
30
+ __statics: 'readonly',
31
+ process: 'readonly',
32
+ chrome: 'readonly',
33
+ global: 'readonly',
34
+ Promise: 'readonly',
35
+ },
36
+
37
+ settings: {},
38
+
39
+ // add your custom rules here
40
+ rules: {
41
+ 'import/named': 'error',
42
+ 'import/namespace': 'error',
43
+ 'import/default': 'error',
44
+ 'import/export': 'error',
45
+ 'import/extensions': 'off',
46
+ 'import/prefer-default-export': 'off',
47
+ 'generator-star-spacing': 'off',
48
+ 'arrow-parens': 'off',
49
+ 'import/first': 'off',
50
+ 'import/no-unresolved': 'off',
51
+ 'import/no-extraneous-dependencies': 'off',
52
+ 'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],
53
+ 'no-underscore-dangle': 'off',
54
+ 'no-prototype-builtins': 'warn',
55
+ 'no-restricted-properties': 'off',
56
+ 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
57
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
58
+ indent: [
59
+ 'error',
60
+ 2,
61
+ {
62
+ SwitchCase: 1,
63
+ MemberExpression: 1,
64
+ ImportDeclaration: 1,
65
+ // VariableDeclarator: { var: 2, let: 2, const: 3 },
66
+ },
67
+ ],
68
+ 'brace-style': ['error', '1tbs', { allowSingleLine: true }],
69
+ 'padded-blocks': ['error', { blocks: 'never' }],
70
+ 'operator-linebreak': 'off',
71
+ 'one-var': ['error', { var: 'never' }],
72
+ 'lines-around-comment': 'off',
73
+ 'padding-line-between-statements': [
74
+ 'error',
75
+ { blankLine: 'always', prev: 'function', next: 'function' },
76
+ { blankLine: 'always', prev: 'function', next: 'block' },
77
+ { blankLine: 'always', prev: 'block', next: 'function' },
78
+ { blankLine: 'always', prev: 'var', next: '*' },
79
+ { blankLine: 'always', prev: 'const', next: '*' },
80
+ { blankLine: 'always', prev: 'let', next: '*' },
81
+ { blankLine: 'always', prev: '*', next: 'return' },
82
+ { blankLine: 'always', prev: '*', next: 'export' },
83
+ ],
84
+ },
85
+ }
package/.prettierrc ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "printWidth": 80,
3
+ "tabWidth": 2,
4
+ "useTabs": false,
5
+ "singleQuote": true,
6
+ "endOfLine": "lf",
7
+ "trailingComma": "all",
8
+ "semi": false,
9
+ "bracketSameLine": false,
10
+ "bracketSpacing": true,
11
+ "proseWrap": "preserve",
12
+ "arrowParens": "always",
13
+ "htmlWhitespaceSensitivity": "ignore",
14
+ "vueIndentScriptAndStyle": false,
15
+ "singleAttributePerLine": false
16
+ }
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # TCABCI Read Node Javascript WebSocket Client
2
2
 
3
- TransferChain Fastest Read Network WebSocket Client
4
- Read Node Address: [https://read-node-01.transferchain.io](https://read-node-01.transferchain.io)
3
+ TransferChain Fastest Read Network WebSocket Client
4
+ Read Node Address: [https://read-node-01.transferchain.io](https://read-node-01.transferchain.io)
5
5
  Read Node WebSocket Address: [wss://read-node-01.transferchain.io/ws](wss://read-node-01.transferchain.io/ws)
6
6
 
7
7
  ## Installation
@@ -15,25 +15,28 @@ $ npm i @tchain/tcabci-read-js-client
15
15
  **Subscribe, Listen and Unsubscribe Example**
16
16
 
17
17
  ```js
18
- const tcAbciClient = require("@tchain/tcabci-read-js-client")
18
+ import TCAbciClient from '@tchain/tcabci-read-js-client'
19
19
 
20
20
  const client = new tcAbciClient()
21
21
  // OR
22
- const client = new tcAbciClient(['https://read-node-01.transferchain.io',
23
- 'wss://read-node-01.transferchain.io/ws'])
22
+ const client = new tcAbciClient([
23
+ 'https://read-node-01.transferchain.io',
24
+ 'wss://read-node-01.transferchain.io/ws',
25
+ ])
24
26
 
25
27
  client.Start()
26
28
 
27
- client.Subscribe(["<your-public-address-one>", "<your-public-address-two>",])
29
+ client.Subscribe(['<your-public-address-one>', '<your-public-address-two>'])
28
30
 
29
- client.SetListen(() => {
30
- // If a transaction has been sent to your addresses, the callback you set here will be called.
31
+ client.SetListenCallback(() => {
32
+ // If a transaction has been sent to your addresses, the callback you set here will be called.
31
33
  })
32
34
 
33
35
  client.Unsubscribe()
34
36
  client.Stop()
35
37
  ```
38
+
36
39
  ## License
37
40
 
38
41
  tcabci-read-js-client is licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for the full license
39
- text.
42
+ text.
package/bytea.js CHANGED
@@ -1,16 +1,15 @@
1
- class Bytea {
2
- #bytes
3
- #status
4
- constructor(bytes, status) {
5
- this.#bytes = bytes
6
- this.#status = status
7
- }
1
+ export class Bytea {
2
+ #bytes
3
+ #status
4
+ constructor(bytes, status) {
5
+ this.#bytes = bytes
6
+ this.#status = status
7
+ }
8
8
 
9
- ToJSON() {
10
- return JSON.stringify({
11
- "bytes": this.#bytes,
12
- "status": this.#status
13
- })
14
- }
15
-
16
- }
9
+ ToJSON() {
10
+ return JSON.stringify({
11
+ bytes: this.#bytes,
12
+ status: this.#status,
13
+ })
14
+ }
15
+ }