Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@walletconnect/jsonrpc-http-connection
Advanced tools
@walletconnect/jsonrpc-http-connection is a package that provides a JSON-RPC connection over HTTP. It is part of the WalletConnect suite of tools and is used to facilitate communication between clients and servers using the JSON-RPC protocol over HTTP.
Create a JSON-RPC HTTP Connection
This feature allows you to create a JSON-RPC HTTP connection to a specified URL. The code sample demonstrates how to create a connection and make a request to get the current block number from an Ethereum node.
const { JSONRPC } = require('@walletconnect/jsonrpc-http-connection');
const connection = new JSONRPC('https://example.com/jsonrpc');
connection.request({
method: 'eth_blockNumber',
params: []
}).then(response => {
console.log(response);
}).catch(error => {
console.error(error);
});
Handle JSON-RPC Responses
This feature allows you to handle JSON-RPC responses, including error handling. The code sample demonstrates how to check for errors in the response and handle them appropriately.
const { JSONRPC } = require('@walletconnect/jsonrpc-http-connection');
const connection = new JSONRPC('https://example.com/jsonrpc');
connection.request({
method: 'eth_blockNumber',
params: []
}).then(response => {
if (response.error) {
console.error('Error:', response.error);
} else {
console.log('Result:', response.result);
}
}).catch(error => {
console.error('Request failed:', error);
});
json-rpc-engine is a modular JSON-RPC middleware engine for Node.js. It allows you to create a JSON-RPC server with custom middleware. Compared to @walletconnect/jsonrpc-http-connection, json-rpc-engine provides more flexibility in terms of middleware customization and server-side handling.
jayson is a JSON-RPC 2.0/1.0 client and server library for Node.js. It supports both HTTP and WebSocket transports. Compared to @walletconnect/jsonrpc-http-connection, jayson offers a more comprehensive solution for both client and server implementations of JSON-RPC.
node-json-rpc is a simple JSON-RPC 2.0 server and client library for Node.js. It provides basic functionalities for creating JSON-RPC servers and clients. Compared to @walletconnect/jsonrpc-http-connection, node-json-rpc is more lightweight and straightforward, making it suitable for simpler use cases.
FAQs
HTTP Connection for JSON-RPC
We found that @walletconnect/jsonrpc-http-connection 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.