Skip to content

Commit 87a67c1

Browse files
committed
Add Explicit Request Tracking
1 parent 1bbcee3 commit 87a67c1

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/rpc/caller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const makeRpcCaller =
88
const res = (await transport({
99
payload: {
1010
jsonrpc: "2.0",
11-
id: "helius-custom",
11+
id: "helius-sdk",
1212
method,
1313
params,
1414
},

src/rpc/index.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,23 @@ export const createHelius = ({
103103

104104
const solanaApi = createSolanaRpcApi(DEFAULT_RPC_CONFIG);
105105
const transport = createDefaultRpcTransport({ url });
106+
const customTransport = async <TResponse>(
107+
request: Parameters<typeof transport>[0]
108+
): Promise<TResponse> => {
109+
const payload = {
110+
...(request.payload as Record<string, unknown>),
111+
id: "helius-sdk",
112+
};
113+
114+
const modifiedRequest = {
115+
...request,
116+
payload,
117+
};
118+
119+
return transport(modifiedRequest) as Promise<TResponse>;
120+
};
106121

107-
const baseRpc = createRpc({ api: solanaApi, transport });
122+
const baseRpc = createRpc({ api: solanaApi, transport: customTransport });
108123
const raw: ResolvedHeliusRpcApi = wrapAutoSend(baseRpc);
109124

110125
const wsUrl = new URL(url);

0 commit comments

Comments
 (0)