@solana/rpc-spec
Advanced tools
Comparing version 2.0.0-canary-20240901183156 to 2.0.0-canary-20240901183511
import { Callable } from '@solana/rpc-spec-types'; | ||
import { RpcRequest, RpcRequestTransformer, RpcResponseTransformer, RpcResponseTransformerFor } from './rpc-shared'; | ||
export type RpcApiConfig = Readonly<{ | ||
parametersTransformer?: <T extends unknown[]>(params: T, methodName: string) => unknown; | ||
responseTransformer?: <T>(response: unknown, methodName?: string) => T; | ||
requestTransformer?: RpcRequestTransformer; | ||
responseTransformer?: RpcResponseTransformer; | ||
}>; | ||
export type RpcApiRequestPlan<TResponse> = { | ||
methodName: string; | ||
params: unknown; | ||
responseTransformer?: (response: unknown, methodName: string) => TResponse; | ||
export type RpcApiRequestPlan<TResponse> = RpcRequest & { | ||
responseTransformer?: RpcResponseTransformerFor<TResponse>; | ||
}; | ||
@@ -11,0 +10,0 @@ export type RpcApi<TRpcMethods> = { |
{ | ||
"name": "@solana/rpc-spec", | ||
"version": "2.0.0-canary-20240901183156", | ||
"version": "2.0.0-canary-20240901183511", | ||
"description": "A generic implementation of JSON RPCs using proxies", | ||
@@ -57,3 +57,3 @@ "exports": { | ||
"dependencies": { | ||
"@solana/rpc-spec-types": "2.0.0-canary-20240901183156" | ||
"@solana/rpc-spec-types": "2.0.0-canary-20240901183511" | ||
}, | ||
@@ -60,0 +60,0 @@ "peerDependencies": { |
@@ -116,5 +116,5 @@ [![npm][npm-image]][npm-url] | ||
- setting `methodName` to the name of the function called | ||
- setting `params` to the arguments supplied to that function, optionally transformed by `config.parametersTransformer` | ||
- setting `responseTransformer` to `config.responseTransformer` or the identity function if no such config exists | ||
- setting `methodName` to the name of the function called, optionally transformed by `config.requestTransformer`. | ||
- setting `params` to the arguments supplied to that function, optionally transformed by `config.requestTransformer`. | ||
- setting `responseTransformer` to `config.responseTransformer`, if provided. | ||
@@ -124,3 +124,3 @@ ```ts | ||
const rpcApi = createRpcApi({ | ||
paramsTransformer: (...rawParams) => rawParams.reverse(), | ||
requestTransformer: (...rawParams) => rawParams.reverse(), | ||
responseTransformer: response => response.result, | ||
@@ -145,4 +145,4 @@ }); | ||
- `parametersTransformer<T>(params: T, methodName): unknown`: An optional function that maps between the shape of the arguments an RPC method was called with and the shape of the params expected by the JSON RPC server. | ||
- `responseTransformer<T>(response, methodName): T`: An optional function that maps between the shape of the JSON RPC server response for a given method and the shape of the response expected by the `RpcApi`. | ||
- `requestTransformer<T>(request: RpcRequest<T>): RpcRequest`: An optional function that transforms the `RpcRequest` before it is sent to the JSON RPC server. | ||
- `responseTransformer<T>(response: RpcResponse, request: RpcRequest): RpcResponse<T>`: An optional function that transforms the `RpcResponse` before it is returned to the caller. | ||
@@ -149,0 +149,0 @@ ### `createJsonRpcResponseTransformer<T>(jsonTransformer)` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76731
448
+ Added@solana/rpc-spec-types@2.0.0-canary-20240901183511(transitive)
- Removed@solana/rpc-spec-types@2.0.0-canary-20240901183156(transitive)