Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still want the array enforced for input here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, because the developer doesn't control that - it's just the input params to their function. From a JS perspective that'll always be a list, I think.

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