Socket
Socket
Sign inDemoInstall

@solana/rpc-spec

Package Overview
Dependencies
Maintainers
14
Versions
723
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/rpc-spec - npm Package Compare versions

Comparing version 2.0.0-canary-20240910080214 to 2.0.0-canary-20240910080602

6

dist/types/rpc-shared.d.ts

@@ -5,6 +5,3 @@ export type RpcRequest<TParams = unknown> = {

};
export type RpcResponse<TResponse = unknown> = {
readonly json: () => Promise<TResponse>;
readonly text: () => Promise<string>;
};
export type RpcResponse<TResponse = unknown> = TResponse;
export type RpcRequestTransformer = {

@@ -16,3 +13,2 @@ <TParams>(request: RpcRequest<TParams>): RpcRequest;

};
export declare function createJsonRpcResponseTransformer<TResponse = unknown>(jsonTransformer: (json: unknown, request: RpcRequest) => TResponse): RpcResponseTransformer<TResponse>;
//# sourceMappingURL=rpc-shared.d.ts.map

4

package.json
{
"name": "@solana/rpc-spec",
"version": "2.0.0-canary-20240910080214",
"version": "2.0.0-canary-20240910080602",
"description": "A generic implementation of JSON RPCs using proxies",

@@ -57,3 +57,3 @@ "exports": {

"dependencies": {
"@solana/rpc-spec-types": "2.0.0-canary-20240910080214"
"@solana/rpc-spec-types": "2.0.0-canary-20240910080602"
},

@@ -60,0 +60,0 @@ "peerDependencies": {

@@ -57,9 +57,4 @@ [![npm][npm-image]][npm-url]

An object that represents the response from a JSON RPC server. It contains two asynchronous methods that can be used to access the response data:
A type that represents the response from a JSON RPC server. This could be any sort of data which is why `RpcResponse` defaults to `unknown`. You may use a type parameter to specify the shape of the response — e.g. `RpcResponse<{ result: number }>`.
- `await response.json()`: Returns the data as a JSON object.
- `await response.text()`: Returns the data, unparsed, as a JSON string.
This allows the `RpcApi` to decide whether they want the parsed JSON object or the raw JSON string. Ultimately, the `json` method will be used by the `Rpc` to provide the final response to the caller.
### `RpcResponseTransformer`

@@ -144,15 +139,1 @@

- `responseTransformer<T>(response: RpcResponse, request: RpcRequest): RpcResponse<T>`: An optional function that transforms the `RpcResponse` before it is returned to the caller.
### `createJsonRpcResponseTransformer(jsonTransformer)`
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): unknown => {
return (json as { result: unknown }).result;
});
```
#### Arguments
- `jsonTransformer: (json: unknown, request: RpcRequest) => T`: A function that transforms an unknown JSON value to a value of type `T`.

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc