@solana/rpc-spec
Advanced tools
Comparing version 2.0.0-canary-20240901184654 to 2.0.0-canary-20240901184943
import { Callable } from '@solana/rpc-spec-types'; | ||
import { RpcRequest, RpcRequestTransformer, RpcResponseTransformer, RpcResponseTransformerFor } from './rpc-shared'; | ||
import { RpcRequest, RpcRequestTransformer, RpcResponseTransformer } from './rpc-shared'; | ||
export type RpcApiConfig = Readonly<{ | ||
@@ -8,3 +8,3 @@ requestTransformer?: RpcRequestTransformer; | ||
export type RpcApiRequestPlan<TResponse> = RpcRequest & { | ||
responseTransformer?: RpcResponseTransformerFor<TResponse>; | ||
responseTransformer?: RpcResponseTransformer<TResponse>; | ||
}; | ||
@@ -11,0 +11,0 @@ export type RpcApi<TRpcMethods> = { |
@@ -12,9 +12,6 @@ export type RpcRequest<TParams = unknown> = { | ||
}; | ||
export type RpcResponseTransformer = { | ||
<TResponse>(response: RpcResponse, request: RpcRequest): RpcResponse<TResponse>; | ||
}; | ||
export type RpcResponseTransformerFor<TResponse> = { | ||
export type RpcResponseTransformer<TResponse = unknown> = { | ||
(response: RpcResponse, request: RpcRequest): RpcResponse<TResponse>; | ||
}; | ||
export declare function createJsonRpcResponseTransformer<TResponse>(jsonTransformer: (json: unknown, request: RpcRequest) => TResponse): RpcResponseTransformerFor<TResponse>; | ||
export declare function createJsonRpcResponseTransformer<TResponse = unknown>(jsonTransformer: (json: unknown, request: RpcRequest) => TResponse): RpcResponseTransformer<TResponse>; | ||
//# sourceMappingURL=rpc-shared.d.ts.map |
{ | ||
"name": "@solana/rpc-spec", | ||
"version": "2.0.0-canary-20240901184654", | ||
"version": "2.0.0-canary-20240901184943", | ||
"description": "A generic implementation of JSON RPCs using proxies", | ||
@@ -57,3 +57,3 @@ "exports": { | ||
"dependencies": { | ||
"@solana/rpc-spec-types": "2.0.0-canary-20240901184654" | ||
"@solana/rpc-spec-types": "2.0.0-canary-20240901184943" | ||
}, | ||
@@ -60,0 +60,0 @@ "peerDependencies": { |
@@ -68,4 +68,2 @@ [![npm][npm-image]][npm-url] | ||
Note that a `RpcResponseTransformerFor<T>` generic function type is also available to ensure the response data returned by the transformer matches the expected type `T`. | ||
### `RpcApi<TRpcMethods>` | ||
@@ -147,9 +145,9 @@ | ||
### `createJsonRpcResponseTransformer<T>(jsonTransformer)` | ||
### `createJsonRpcResponseTransformer(jsonTransformer)` | ||
Creates an `RpcResponseTransformerFor<T>` function from a function that transforms any JSON value to a value of type `T` by wrapping it in a `json` async function. | ||
Creates an `RpcResponseTransformer<T>` function from a function that transforms any JSON value to a value of type `T` by wrapping it in a `json` async function. | ||
```ts | ||
const getResultTransformer = createJsonRpcResponseTransformer((json: unknown) => { | ||
return (json as { result: TResponse }).result; | ||
const getResultTransformer = createJsonRpcResponseTransformer((json: unknown): unknown => { | ||
return (json as { result: unknown }).result; | ||
}); | ||
@@ -156,0 +154,0 @@ ``` |
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
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
455
76142
157
+ Added@solana/rpc-spec-types@2.0.0-canary-20240901184943(transitive)
- Removed@solana/rpc-spec-types@2.0.0-canary-20240901184654(transitive)