Socket
Socket
Sign inDemoInstall

@walletconnect/jsonrpc-types

Package Overview
Dependencies
2
Maintainers
8
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@walletconnect/jsonrpc-types

Typings for JSON-RPC


Version published
Weekly downloads
431K
increased by1.89%
Maintainers
8
Install size
241 kB
Created
Weekly downloads
 

Package description

What is @walletconnect/jsonrpc-types?

@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.

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

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'
};

Other packages similar to @walletconnect/jsonrpc-types

Keywords

FAQs

Last updated on 07 May 2024

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc