This project is a React Component that displays a list of JSON-RPC Requests and Responses.
- Displays Requests and Responses in a time-series format
- Supports JSON-RPC Notifications
npm install --save @open-rpc/logs-react
import JSONRPCLogger, {JSONRPCLog} from "@open-rpc/logs-react";
// Get these logs how ever you want
const logs: JSONRPCLog[] = [{
type: "request",
method: "test",
timestamp: new Date(),
payload: {
jsonrpc: "2.0",
method: "foo"
}
}];
<JSONRPCLogger logs={logs} />
Name | Type | Function |
---|---|---|
logs | JSONRPCLog | The list of JSON-RPC calls that logs-react will display |
openRecentPayload | boolean | Default: false. If true, the payload of the most recent response will be expanded automatically. |
sidebarAlign | "left" or "right" | Default: "left". Determines which side of the screen that the method filter sidebar will appear on. |
sidebarOpen | boolean | Default: true. If true, the filter sidebar will be opened by default, if false it will be closed. |
npx create-react-app <appname> --typescript
cd <appname>
npm install .
npm install @open-rpc/logs-react --save
import React from 'react';
import ReactDOM from 'react-dom';
import JSONRPCLogger, {JSONRPCLog} from "@open-rpc/logs-react";
const logs: JSONRPCLog[] = [{
type: "request",
method: "test",
timestamp: new Date(),
payload: {
jsonrpc: "2.0",
method: "foo"
}
}];
ReactDOM.render(<JSONRPCLogger logs={logs} />, document.getElementById("root"));
How to contribute, build and release are outlined in CONTRIBUTING.md, BUILDING.md and RELEASING.md respectively. Commits in this repository follow the CONVENTIONAL_COMMITS.md specification.