@blackglory/geyser-js 0.10.0 → 0.10.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/lib/geyser-client.js +2 -2
- package/lib/geyser-client.js.map +1 -1
- package/lib/utils/rpc-client.browser.d.ts +1 -1
- package/lib/utils/rpc-client.browser.js +6 -3
- package/lib/utils/rpc-client.browser.js.map +1 -1
- package/lib/utils/rpc-client.d.ts +1 -1
- package/lib/utils/rpc-client.js +6 -3
- package/lib/utils/rpc-client.js.map +1 -1
- package/package.json +12 -12
- package/src/geyser-client.ts +2 -1
- package/src/utils/rpc-client.browser.ts +12 -2
- package/src/utils/rpc-client.ts +12 -2
package/lib/geyser-client.js
CHANGED
|
@@ -4,7 +4,7 @@ import { isntUndefined } from '@blackglory/prelude';
|
|
|
4
4
|
export { RateLimiterNotFound } from './contract.js';
|
|
5
5
|
export class GeyserClient {
|
|
6
6
|
static async create(options) {
|
|
7
|
-
const { client, close } = await createRPCClient(options.server, options.retryIntervalForReconnection);
|
|
7
|
+
const { client, close } = await createRPCClient(options.server, options.retryIntervalForReconnection, options.timeout);
|
|
8
8
|
return new GeyserClient(client, close, options.timeout);
|
|
9
9
|
}
|
|
10
10
|
constructor(client, closeClients, timeout) {
|
|
@@ -28,7 +28,7 @@ export class GeyserClient {
|
|
|
28
28
|
await this.client.removeRateLimiter(rateLimiterId, this.withTimeout(signal));
|
|
29
29
|
}
|
|
30
30
|
async resetRateLimiter(rateLimiterId, signal) {
|
|
31
|
-
await this.client.
|
|
31
|
+
await this.client.resetRateLimiter(rateLimiterId, this.withTimeout(signal));
|
|
32
32
|
}
|
|
33
33
|
async acquireToken(rateLimiterId, signal) {
|
|
34
34
|
await this.client.acquireToken(rateLimiterId, this.withTimeout(signal));
|
package/lib/geyser-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geyser-client.js","sourceRoot":"","sources":["../src/geyser-client.ts"],"names":[],"mappings":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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAPI } from "../contract.js";
|
|
2
2
|
import { ClientProxy } from 'delight-rpc';
|
|
3
|
-
export declare function createRPCClient(url: string, retryIntervalForReconnection?: number): Promise<{
|
|
3
|
+
export declare function createRPCClient(url: string, retryIntervalForReconnection?: number, timeoutForConnection?: number): Promise<{
|
|
4
4
|
client: ClientProxy<IAPI>;
|
|
5
5
|
close: () => Promise<void>;
|
|
6
6
|
}>;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { expectedVersion } from "../contract.js";
|
|
2
2
|
import { createClient } from '@delight-rpc/extra-native-websocket';
|
|
3
3
|
import { ExtraNativeWebSocket, autoReconnect } from 'extra-native-websocket';
|
|
4
|
-
|
|
4
|
+
import { timeoutSignal } from 'extra-abort';
|
|
5
|
+
export async function createRPCClient(url, retryIntervalForReconnection, timeoutForConnection) {
|
|
5
6
|
const ws = new ExtraNativeWebSocket(() => new WebSocket(url));
|
|
6
|
-
const cancelAutoReconnect = autoReconnect(ws, retryIntervalForReconnection);
|
|
7
|
-
await ws.connect(
|
|
7
|
+
const cancelAutoReconnect = autoReconnect(ws, retryIntervalForReconnection, timeoutForConnection);
|
|
8
|
+
await ws.connect(timeoutForConnection
|
|
9
|
+
? timeoutSignal(timeoutForConnection)
|
|
10
|
+
: undefined);
|
|
8
11
|
const [client, closeClient] = createClient(ws, { expectedVersion });
|
|
9
12
|
return {
|
|
10
13
|
client,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-client.browser.js","sourceRoot":"","sources":["../../src/utils/rpc-client.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,eAAe,EAAE,uBAAwB;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"rpc-client.browser.js","sourceRoot":"","sources":["../../src/utils/rpc-client.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,eAAe,EAAE,uBAAwB;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAW,EACX,4BAAqC,EACrC,oBAA6B;IAK7B,MAAM,EAAE,GAAG,IAAI,oBAAoB,CAAC,GAAG,EAAE,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;IAC7D,MAAM,mBAAmB,GAAG,aAAa,CACvC,EAAE,EACF,4BAA4B,EAC5B,oBAAoB,CACrB,CAAA;IACD,MAAM,EAAE,CAAC,OAAO,CACd,oBAAoB;QACtB,CAAC,CAAC,aAAa,CAAC,oBAAoB,CAAC;QACrC,CAAC,CAAC,SAAS,CACV,CAAA;IAED,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,YAAY,CAAO,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,CAAA;IAEzE,OAAO;QACL,MAAM;QACN,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,WAAW,EAAE,CAAA;YACb,mBAAmB,EAAE,CAAA;YACrB,MAAM,EAAE,CAAC,KAAK,EAAE,CAAA;QAClB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAPI } from "../contract.js";
|
|
2
2
|
import { ClientProxy } from 'delight-rpc';
|
|
3
|
-
export declare function createRPCClient(url: string, retryIntervalForReconnection?: number): Promise<{
|
|
3
|
+
export declare function createRPCClient(url: string, retryIntervalForReconnection?: number, timeoutForConnection?: number): Promise<{
|
|
4
4
|
client: ClientProxy<IAPI>;
|
|
5
5
|
close: () => Promise<void>;
|
|
6
6
|
}>;
|
package/lib/utils/rpc-client.js
CHANGED
|
@@ -2,10 +2,13 @@ import { expectedVersion } from "../contract.js";
|
|
|
2
2
|
import { createClient } from '@delight-rpc/extra-websocket';
|
|
3
3
|
import { WebSocket } from 'ws';
|
|
4
4
|
import { ExtraWebSocket, autoReconnect } from 'extra-websocket';
|
|
5
|
-
|
|
5
|
+
import { timeoutSignal } from 'extra-abort';
|
|
6
|
+
export async function createRPCClient(url, retryIntervalForReconnection, timeoutForConnection) {
|
|
6
7
|
const ws = new ExtraWebSocket(() => new WebSocket(url));
|
|
7
|
-
const cancelAutoReconnect = autoReconnect(ws, retryIntervalForReconnection);
|
|
8
|
-
await ws.connect(
|
|
8
|
+
const cancelAutoReconnect = autoReconnect(ws, retryIntervalForReconnection, timeoutForConnection);
|
|
9
|
+
await ws.connect(timeoutForConnection
|
|
10
|
+
? timeoutSignal(timeoutForConnection)
|
|
11
|
+
: undefined);
|
|
9
12
|
const [client, closeClient] = createClient(ws, { expectedVersion });
|
|
10
13
|
return {
|
|
11
14
|
client,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-client.js","sourceRoot":"","sources":["../../src/utils/rpc-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,eAAe,EAAE,uBAAwB;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"rpc-client.js","sourceRoot":"","sources":["../../src/utils/rpc-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,eAAe,EAAE,uBAAwB;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAW,EACX,4BAAqC,EACrC,oBAA6B;IAK7B,MAAM,EAAE,GAAG,IAAI,cAAc,CAAC,GAAG,EAAE,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;IACvD,MAAM,mBAAmB,GAAG,aAAa,CACvC,EAAE,EACF,4BAA4B,EAC5B,oBAAoB,CACrB,CAAA;IACD,MAAM,EAAE,CAAC,OAAO,CACd,oBAAoB;QACtB,CAAC,CAAC,aAAa,CAAC,oBAAoB,CAAC;QACrC,CAAC,CAAC,SAAS,CACV,CAAA;IAED,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,YAAY,CAAO,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,CAAA;IAEzE,OAAO;QACL,MAAM;QACN,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,WAAW,EAAE,CAAA;YACb,mBAAmB,EAAE,CAAA;YACrB,MAAM,EAAE,CAAC,KAAK,EAAE,CAAA;QAClB,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blackglory/geyser-js",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"files": [
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@commitlint/cli": "^19.8.1",
|
|
45
45
|
"@commitlint/config-conventional": "^19.8.1",
|
|
46
|
-
"@eslint/js": "^9.
|
|
46
|
+
"@eslint/js": "^9.31.0",
|
|
47
47
|
"@types/ws": "^8.18.1",
|
|
48
48
|
"cross-env": "^7.0.3",
|
|
49
|
-
"eslint": "^9.
|
|
49
|
+
"eslint": "^9.31.0",
|
|
50
50
|
"husky": "4",
|
|
51
|
-
"msw": "^2.
|
|
51
|
+
"msw": "^2.10.4",
|
|
52
52
|
"npm-run-all": "^4.1.5",
|
|
53
53
|
"return-style": "^3.0.1",
|
|
54
54
|
"rimraf": "^6.0.1",
|
|
@@ -56,22 +56,22 @@
|
|
|
56
56
|
"ts-patch": "^3.3.0",
|
|
57
57
|
"tslib": "^2.8.1",
|
|
58
58
|
"typescript": "5.8.3",
|
|
59
|
-
"typescript-eslint": "^8.
|
|
59
|
+
"typescript-eslint": "^8.38.0",
|
|
60
60
|
"typescript-transform-paths": "^3.5.5",
|
|
61
|
-
"vite": "^
|
|
61
|
+
"vite": "^7.0.5",
|
|
62
62
|
"vite-tsconfig-paths": "^5.1.4",
|
|
63
|
-
"vitest": "^3.
|
|
63
|
+
"vitest": "^3.2.4"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@blackglory/errors": "^3.0.3",
|
|
67
67
|
"@blackglory/prelude": "^0.4.0",
|
|
68
|
-
"@delight-rpc/extra-native-websocket": "^0.6.
|
|
69
|
-
"@delight-rpc/extra-websocket": "^0.7.
|
|
68
|
+
"@delight-rpc/extra-native-websocket": "^0.6.1",
|
|
69
|
+
"@delight-rpc/extra-websocket": "^0.7.1",
|
|
70
70
|
"delight-rpc": "^6.1.2",
|
|
71
71
|
"extra-abort": "^0.4.0",
|
|
72
|
-
"extra-native-websocket": "^0.
|
|
73
|
-
"extra-websocket": "^0.
|
|
72
|
+
"extra-native-websocket": "^0.5.0",
|
|
73
|
+
"extra-websocket": "^0.5.0",
|
|
74
74
|
"justypes": "^4.4.1",
|
|
75
|
-
"ws": "^8.18.
|
|
75
|
+
"ws": "^8.18.3"
|
|
76
76
|
}
|
|
77
77
|
}
|
package/src/geyser-client.ts
CHANGED
|
@@ -16,6 +16,7 @@ export class GeyserClient {
|
|
|
16
16
|
const { client, close } = await createRPCClient(
|
|
17
17
|
options.server
|
|
18
18
|
, options.retryIntervalForReconnection
|
|
19
|
+
, options.timeout
|
|
19
20
|
)
|
|
20
21
|
return new GeyserClient(client, close, options.timeout)
|
|
21
22
|
}
|
|
@@ -72,7 +73,7 @@ export class GeyserClient {
|
|
|
72
73
|
rateLimiterId: string
|
|
73
74
|
, signal?: AbortSignal
|
|
74
75
|
): Promise<void> {
|
|
75
|
-
await this.client.
|
|
76
|
+
await this.client.resetRateLimiter(rateLimiterId, this.withTimeout(signal))
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
/**
|
|
@@ -2,17 +2,27 @@ import { IAPI, expectedVersion } from '@src/contract.js'
|
|
|
2
2
|
import { ClientProxy } from 'delight-rpc'
|
|
3
3
|
import { createClient } from '@delight-rpc/extra-native-websocket'
|
|
4
4
|
import { ExtraNativeWebSocket, autoReconnect } from 'extra-native-websocket'
|
|
5
|
+
import { timeoutSignal } from 'extra-abort'
|
|
5
6
|
|
|
6
7
|
export async function createRPCClient(
|
|
7
8
|
url: string
|
|
8
9
|
, retryIntervalForReconnection?: number
|
|
10
|
+
, timeoutForConnection?: number
|
|
9
11
|
): Promise<{
|
|
10
12
|
client: ClientProxy<IAPI>
|
|
11
13
|
close: () => Promise<void>
|
|
12
14
|
}> {
|
|
13
15
|
const ws = new ExtraNativeWebSocket(() => new WebSocket(url))
|
|
14
|
-
const cancelAutoReconnect = autoReconnect(
|
|
15
|
-
|
|
16
|
+
const cancelAutoReconnect = autoReconnect(
|
|
17
|
+
ws
|
|
18
|
+
, retryIntervalForReconnection
|
|
19
|
+
, timeoutForConnection
|
|
20
|
+
)
|
|
21
|
+
await ws.connect(
|
|
22
|
+
timeoutForConnection
|
|
23
|
+
? timeoutSignal(timeoutForConnection)
|
|
24
|
+
: undefined
|
|
25
|
+
)
|
|
16
26
|
|
|
17
27
|
const [client, closeClient] = createClient<IAPI>(ws, { expectedVersion })
|
|
18
28
|
|
package/src/utils/rpc-client.ts
CHANGED
|
@@ -3,17 +3,27 @@ import { ClientProxy } from 'delight-rpc'
|
|
|
3
3
|
import { createClient } from '@delight-rpc/extra-websocket'
|
|
4
4
|
import { WebSocket } from 'ws'
|
|
5
5
|
import { ExtraWebSocket, autoReconnect } from 'extra-websocket'
|
|
6
|
+
import { timeoutSignal } from 'extra-abort'
|
|
6
7
|
|
|
7
8
|
export async function createRPCClient(
|
|
8
9
|
url: string
|
|
9
10
|
, retryIntervalForReconnection?: number
|
|
11
|
+
, timeoutForConnection?: number
|
|
10
12
|
): Promise<{
|
|
11
13
|
client: ClientProxy<IAPI>
|
|
12
14
|
close: () => Promise<void>
|
|
13
15
|
}> {
|
|
14
16
|
const ws = new ExtraWebSocket(() => new WebSocket(url))
|
|
15
|
-
const cancelAutoReconnect = autoReconnect(
|
|
16
|
-
|
|
17
|
+
const cancelAutoReconnect = autoReconnect(
|
|
18
|
+
ws
|
|
19
|
+
, retryIntervalForReconnection
|
|
20
|
+
, timeoutForConnection
|
|
21
|
+
)
|
|
22
|
+
await ws.connect(
|
|
23
|
+
timeoutForConnection
|
|
24
|
+
? timeoutSignal(timeoutForConnection)
|
|
25
|
+
: undefined
|
|
26
|
+
)
|
|
17
27
|
|
|
18
28
|
const [client, closeClient] = createClient<IAPI>(ws, { expectedVersion })
|
|
19
29
|
|