@xandeum/web3.js 1.10.0 → 1.12.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 +15 -2
- package/package.json +1 -1
- package/src/webSocket.ts +16 -3
package/dist/webSocket.js
CHANGED
|
@@ -28,7 +28,14 @@ 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
|
|
31
|
+
var url = new URL(rpcEndpoint);
|
|
32
|
+
// url.port = '8900'; // Set the port to 8900
|
|
33
|
+
if (url.port) {
|
|
34
|
+
url.port = '8900';
|
|
35
|
+
}
|
|
36
|
+
url.protocol = url.protocol.replace('http', 'ws');
|
|
37
|
+
var wsEndpoint = url.toString();
|
|
38
|
+
var ws = new ws_1.default(wsEndpoint);
|
|
32
39
|
ws.addEventListener('open', function () {
|
|
33
40
|
var subscriptionMessage = {
|
|
34
41
|
jsonrpc: '2.0',
|
|
@@ -72,7 +79,13 @@ function subscribeResult(connection, tx, onResult, onError, onClose) {
|
|
|
72
79
|
*/
|
|
73
80
|
function unsubscribeResult(connection, subscriptionId) {
|
|
74
81
|
var rpcEndpoint = connection.rpcEndpoint;
|
|
75
|
-
var
|
|
82
|
+
var url = new URL(rpcEndpoint);
|
|
83
|
+
if (url.port) {
|
|
84
|
+
url.port = '8900';
|
|
85
|
+
}
|
|
86
|
+
url.protocol = url.protocol.replace('http', 'ws');
|
|
87
|
+
var wsEndpoint = url.toString();
|
|
88
|
+
var ws = new ws_1.default(wsEndpoint);
|
|
76
89
|
ws.addEventListener('open', function () {
|
|
77
90
|
var unsubscribeMessage = {
|
|
78
91
|
jsonrpc: '2.0',
|
package/package.json
CHANGED
package/src/webSocket.ts
CHANGED
|
@@ -45,7 +45,14 @@ export function subscribeResult (
|
|
|
45
45
|
onClose?: () => void
|
|
46
46
|
): void {
|
|
47
47
|
let rpcEndpoint = connection.rpcEndpoint;
|
|
48
|
-
const
|
|
48
|
+
const url = new URL(rpcEndpoint);
|
|
49
|
+
// url.port = '8900'; // Set the port to 8900
|
|
50
|
+
if (url.port) {
|
|
51
|
+
url.port = '8900';
|
|
52
|
+
}
|
|
53
|
+
url.protocol = url.protocol.replace('http', 'ws');
|
|
54
|
+
const wsEndpoint = url.toString();
|
|
55
|
+
const ws = new WebSocket(wsEndpoint);
|
|
49
56
|
|
|
50
57
|
ws.addEventListener('open', () => {
|
|
51
58
|
const subscriptionMessage = {
|
|
@@ -94,8 +101,14 @@ export function subscribeResult (
|
|
|
94
101
|
*/
|
|
95
102
|
|
|
96
103
|
export function unsubscribeResult(connection: Connection,subscriptionId: string): void {
|
|
97
|
-
|
|
98
|
-
|
|
104
|
+
let rpcEndpoint = connection.rpcEndpoint;
|
|
105
|
+
const url = new URL(rpcEndpoint);
|
|
106
|
+
if (url.port) {
|
|
107
|
+
url.port = '8900';
|
|
108
|
+
}
|
|
109
|
+
url.protocol = url.protocol.replace('http', 'ws');
|
|
110
|
+
const wsEndpoint = url.toString();
|
|
111
|
+
const ws = new WebSocket(wsEndpoint);
|
|
99
112
|
|
|
100
113
|
ws.addEventListener('open', () => {
|
|
101
114
|
const unsubscribeMessage = {
|