Skip to content

Commit

Permalink
Allow RpcRequest params to be of any type, instead of requiring an ar…
Browse files Browse the repository at this point in the history
…ray (#2751)

This provides flexibility for APIs that do not use an array of params
  • Loading branch information
mcintyre94 authored May 31, 2024
1 parent 0ca5cc1 commit 6340744
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-pumpkins-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solana/rpc-spec": patch
---

Allow Rpc Request params to be any type, instead of requiring an array
2 changes: 1 addition & 1 deletion packages/rpc-spec/src/rpc-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Callable } from '@solana/rpc-spec-types';
import { RpcRequest } from './rpc-request';

export type RpcApiConfig = Readonly<{
parametersTransformer?: <T extends unknown[]>(params: T, methodName: string) => unknown[];
parametersTransformer?: <T extends unknown[]>(params: T, methodName: string) => unknown;
responseTransformer?: <T>(response: unknown, methodName: string) => T;
}>;

Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-spec/src/rpc-request.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type RpcRequest<TResponse> = {
methodName: string;
params: unknown[];
params: unknown;
responseTransformer?: (response: unknown, methodName: string) => TResponse;
};

Expand Down

0 comments on commit 6340744

Please sign in to comment.