@xandeum/web3.js 1.10.0 → 1.11.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/dist/webSocket.js CHANGED
@@ -28,7 +28,11 @@ var ws_1 = __importDefault(require("ws"));
28
28
  */
29
29
  function subscribeResult(connection, tx, onResult, onError, onClose) {
30
30
  var rpcEndpoint = connection.rpcEndpoint;
31
- var ws = new ws_1.default(rpcEndpoint.replace('http', 'ws'));
31
+ var url = new URL(rpcEndpoint);
32
+ url.port = '8900'; // Set the port to 8900
33
+ url.protocol = url.protocol.replace('http', 'ws');
34
+ var wsEndpoint = url.toString();
35
+ var ws = new ws_1.default(wsEndpoint);
32
36
  ws.addEventListener('open', function () {
33
37
  var subscriptionMessage = {
34
38
  jsonrpc: '2.0',
@@ -72,7 +76,11 @@ function subscribeResult(connection, tx, onResult, onError, onClose) {
72
76
  */
73
77
  function unsubscribeResult(connection, subscriptionId) {
74
78
  var rpcEndpoint = connection.rpcEndpoint;
75
- var ws = new ws_1.default(rpcEndpoint.replace('http', 'ws'));
79
+ var url = new URL(rpcEndpoint);
80
+ url.port = '8900'; // Set the port to 8900
81
+ url.protocol = url.protocol.replace('http', 'ws');
82
+ var wsEndpoint = url.toString();
83
+ var ws = new ws_1.default(wsEndpoint);
76
84
  ws.addEventListener('open', function () {
77
85
  var unsubscribeMessage = {
78
86
  jsonrpc: '2.0',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xandeum/web3.js",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Xandeum javascript api",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/webSocket.ts CHANGED
@@ -45,7 +45,11 @@ export function subscribeResult (
45
45
  onClose?: () => void
46
46
  ): void {
47
47
  let rpcEndpoint = connection.rpcEndpoint;
48
- const ws = new WebSocket(rpcEndpoint.replace('http', 'ws'));
48
+ const url = new URL(rpcEndpoint);
49
+ url.port = '8900'; // Set the port to 8900
50
+ url.protocol = url.protocol.replace('http', 'ws');
51
+ const wsEndpoint = url.toString();
52
+ const ws = new WebSocket(wsEndpoint);
49
53
 
50
54
  ws.addEventListener('open', () => {
51
55
  const subscriptionMessage = {
@@ -94,8 +98,12 @@ export function subscribeResult (
94
98
  */
95
99
 
96
100
  export function unsubscribeResult(connection: Connection,subscriptionId: string): void {
97
- let rpcEndpoint = connection.rpcEndpoint;
98
- const ws = new WebSocket(rpcEndpoint.replace('http', 'ws'));
101
+ let rpcEndpoint = connection.rpcEndpoint;
102
+ const url = new URL(rpcEndpoint);
103
+ url.port = '8900'; // Set the port to 8900
104
+ url.protocol = url.protocol.replace('http', 'ws');
105
+ const wsEndpoint = url.toString();
106
+ const ws = new WebSocket(wsEndpoint);
99
107
 
100
108
  ws.addEventListener('open', () => {
101
109
  const unsubscribeMessage = {