Skip to content

Commit 58c9583

Browse files
committed
refactor: Touch up internal types, docs
1 parent 83bcd25 commit 58c9583

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/eth-json-rpc-provider/src/internal-provider.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,11 @@ export class InternalProvider<
145145
readonly #handle = async <Result extends Json>(
146146
jsonRpcRequest: JsonRpcRequest,
147147
): Promise<JsonRpcResponse<Result>> => {
148-
// @ts-expect-error - The signatures are incompatible between the legacy engine
149-
// and server, but this works at runtime.
150-
return await this.#server.handle(jsonRpcRequest);
148+
// This typecast is technicaly unsafe, but we need it to preserve the provider's
149+
// public interface, which allows you to typecast results.
150+
return (await this.#server.handle(
151+
jsonRpcRequest,
152+
)) as JsonRpcResponse<Result>;
151153
};
152154

153155
readonly #handleWithCallback = (

packages/eth-json-rpc-provider/src/provider-from-middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { InternalProvider } from './internal-provider';
1111
*
1212
* @param middleware - The middleware to construct a provider from.
1313
* @returns An Ethereum provider.
14-
* @deprecated Use {@link providerFromMiddlewareV2} instead.
14+
* @deprecated Use `JsonRpcEngineV2` middleware and {@link providerFromMiddlewareV2} instead.
1515
*/
1616
export function providerFromMiddleware<
1717
Params extends JsonRpcParams,

0 commit comments

Comments
 (0)