TypeScript type definitions and interfaces for the WalletConnect Protocol v2, enabling type-safe development across the WalletConnect ecosystem
70
A utility module for managing JSON-RPC messages in a WalletConnect-based application, with support for tracking message history and preventing duplicate processing.
@generates
/**
* Manages JSON-RPC message history and correlation
*/
export interface MessageHistory {
/**
* Records a JSON-RPC request
* @param topic - The topic associated with the request
* @param request - The JSON-RPC request object with id, method, and params
* @param chainId - Optional chain identifier (e.g., "eip155:1")
* @param expiry - Optional expiration timestamp
*/
set(topic: string, request: any, chainId?: string, expiry?: number): Promise<void>;
/**
* Retrieves a record by request ID
* @param id - The request ID
* @returns The stored record or undefined if not found
*/
get(id: number): Promise<any | undefined>;
/**
* Retrieves all pending requests (requests without responses)
* @returns Array of pending request records
*/
getPending(): Promise<any[]>;
/**
* Records a JSON-RPC response and matches it to the request
* @param topic - The topic associated with the response
* @param response - The JSON-RPC response object with id and result or error
*/
resolve(topic: string, response: any): Promise<void>;
}
/**
* Manages message deduplication through hash tracking
*/
export interface MessageTracker {
/**
* Records a message hash to track it
* @param hash - The unique message hash
*/
set(hash: string): Promise<void>;
/**
* Checks if a message hash has been tracked
* @param hash - The message hash to check
* @returns true if the hash exists, false otherwise
*/
get(hash: string): Promise<boolean>;
/**
* Removes a tracked message hash
* @param hash - The message hash to remove
*/
delete(hash: string): Promise<void>;
}
/**
* Creates a new MessageHistory instance
*/
export function createMessageHistory(): MessageHistory;
/**
* Creates a new MessageTracker instance
*/
export function createMessageTracker(): MessageTracker;Provides TypeScript type definitions for WalletConnect Protocol v2, including interfaces for message history tracking and deduplication.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-walletconnect--typesevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10