Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@walletconnect/jsonrpc-provider

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@walletconnect/jsonrpc-provider

Provider for JSON-RPC

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @walletconnect/jsonrpc-provider?

@walletconnect/jsonrpc-provider is a JavaScript library that provides a JSON-RPC provider for WalletConnect. It allows developers to interact with blockchain networks using the JSON-RPC protocol, facilitating communication between decentralized applications (dApps) and blockchain nodes.

What are @walletconnect/jsonrpc-provider's main functionalities?

Initialize JSON-RPC Provider

This feature allows you to initialize a JSON-RPC provider with a given URL, such as an Infura endpoint. This is the first step to start interacting with a blockchain network.

const { JsonRpcProvider } = require('@walletconnect/jsonrpc-provider');
const provider = new JsonRpcProvider('https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID');

Send JSON-RPC Request

This feature allows you to send a JSON-RPC request to the blockchain network. In this example, it requests the current block number using the 'eth_blockNumber' method.

const { JsonRpcProvider } = require('@walletconnect/jsonrpc-provider');
const provider = new JsonRpcProvider('https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID');

async function getBlockNumber() {
  const blockNumber = await provider.request({ method: 'eth_blockNumber', params: [] });
  console.log('Current block number:', blockNumber);
}

getBlockNumber();

Handle JSON-RPC Responses

This feature demonstrates how to handle JSON-RPC responses. In this example, it requests the balance of a specific Ethereum address using the 'eth_getBalance' method.

const { JsonRpcProvider } = require('@walletconnect/jsonrpc-provider');
const provider = new JsonRpcProvider('https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID');

async function getBalance(address) {
  const balance = await provider.request({ method: 'eth_getBalance', params: [address, 'latest'] });
  console.log('Balance:', balance);
}

getBalance('0x742d35Cc6634C0532925a3b844Bc454e4438f44e');

Other packages similar to @walletconnect/jsonrpc-provider

Keywords

FAQs

Package last updated on 28 Jul 2021

Did you know?

Socket

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.

Install

Related posts

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