Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@walletconnect/jsonrpc-types
Advanced tools
@walletconnect/jsonrpc-types is a TypeScript library that provides type definitions for JSON-RPC (Remote Procedure Call) methods and responses. It is primarily used in the context of WalletConnect, a protocol for connecting decentralized applications (dApps) to mobile wallets with QR code scanning or deep linking.
Type Definitions for JSON-RPC Methods
This feature provides type definitions for JSON-RPC requests, ensuring that the request object adheres to the expected structure.
import { IJsonRpcRequest } from '@walletconnect/jsonrpc-types';
const request: IJsonRpcRequest = {
id: 1,
jsonrpc: '2.0',
method: 'eth_sendTransaction',
params: [{
from: '0x1234567890abcdef1234567890abcdef12345678',
to: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef',
value: '0x1',
gas: '0x5208',
gasPrice: '0x3b9aca00',
nonce: '0x0',
data: '0x'
}]
};
Type Definitions for JSON-RPC Responses
This feature provides type definitions for JSON-RPC responses, including both success and error responses, ensuring that the response objects adhere to the expected structure.
import { IJsonRpcResponseSuccess, IJsonRpcResponseError } from '@walletconnect/jsonrpc-types';
const successResponse: IJsonRpcResponseSuccess = {
id: 1,
jsonrpc: '2.0',
result: '0x1'
};
const errorResponse: IJsonRpcResponseError = {
id: 1,
jsonrpc: '2.0',
error: {
code: -32600,
message: 'Invalid Request'
}
};
Type Definitions for JSON-RPC Errors
This feature provides type definitions for JSON-RPC errors, ensuring that error objects adhere to the expected structure.
import { IJsonRpcError } from '@walletconnect/jsonrpc-types';
const error: IJsonRpcError = {
code: -32601,
message: 'Method not found'
};
json-rpc-engine is a JavaScript library for building JSON-RPC middleware stacks. It provides a flexible and modular approach to handling JSON-RPC requests and responses. Unlike @walletconnect/jsonrpc-types, which focuses on type definitions, json-rpc-engine provides a full implementation for handling JSON-RPC communication.
jsonrpc-lite is a lightweight JavaScript library for JSON-RPC 2.0. It provides utilities for parsing, validating, and serializing JSON-RPC requests and responses. While @walletconnect/jsonrpc-types focuses on type definitions, jsonrpc-lite offers a more comprehensive set of tools for working with JSON-RPC.
FAQs
Typings for JSON-RPC
The npm package @walletconnect/jsonrpc-types receives a total of 381,399 weekly downloads. As such, @walletconnect/jsonrpc-types popularity was classified as popular.
We found that @walletconnect/jsonrpc-types demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.