@@ -4,7 +4,8 @@ import JSONRPCRequestEditor from "./JSONRPCRequestEditor";
4
4
import PlayCircle from "@material-ui/icons/PlayCircleFilled" ;
5
5
import CloseIcon from "@material-ui/icons/Close" ;
6
6
import PlusIcon from "@material-ui/icons/Add" ;
7
- import { IconButton , AppBar , Toolbar , Typography , Button , InputBase , Tab , Tabs } from "@material-ui/core" ;
7
+ import CheckCircle from "@material-ui/icons/CheckCircle" ;
8
+ import { IconButton , AppBar , Toolbar , Typography , Button , InputBase , Tab , Tabs , Tooltip } from "@material-ui/core" ;
8
9
import { Client , RequestManager , HTTPTransport , WebSocketTransport } from "@open-rpc/client-js" ;
9
10
import Brightness3Icon from "@material-ui/icons/Brightness3" ;
10
11
import WbSunnyIcon from "@material-ui/icons/WbSunny" ;
@@ -13,6 +14,7 @@ import { MethodObject } from "@open-rpc/meta-schema";
13
14
import MonacoEditor from "@etclabscore/react-monaco-editor" ;
14
15
import useTabs from "../hooks/useTabs" ;
15
16
import { useDebounce } from "use-debounce" ;
17
+ import { green } from "@material-ui/core/colors" ;
16
18
17
19
const errorToJSON = ( error : JSONRPCError | undefined ) : any => {
18
20
if ( ! error ) {
@@ -190,7 +192,7 @@ const Inspector: React.FC<IProps> = (props) => {
190
192
191
193
useEffect ( ( ) => {
192
194
refreshOpenRpcDocument ( ) ;
193
- // eslint-disable-next-line react-hooks/exhaustive-deps
195
+ // eslint-disable-next-line react-hooks/exhaustive-deps
194
196
} , [ debouncedUrl ] ) ;
195
197
196
198
useEffect ( ( ) => {
@@ -200,7 +202,7 @@ const Inspector: React.FC<IProps> = (props) => {
200
202
setOpenRpcDocument ( tabs [ tabIndex ] . openrpcDocument ) ;
201
203
setResults ( tabs [ tabIndex ] . results ) ;
202
204
}
203
- // eslint-disable-next-line react-hooks/exhaustive-deps
205
+ // eslint-disable-next-line react-hooks/exhaustive-deps
204
206
} , [ tabIndex ] ) ;
205
207
206
208
const handleTabIndexChange = ( event : React . ChangeEvent < { } > , newValue : number ) => {
@@ -267,6 +269,18 @@ const Inspector: React.FC<IProps> = (props) => {
267
269
< PlayCircle />
268
270
</ IconButton >
269
271
< InputBase
272
+ startAdornment = { openrpcDocument
273
+ ?
274
+ < Tooltip title = {
275
+ < div style = { { textAlign : "center" } } >
276
+ < Typography > Valid OpenRPC Endpoint.</ Typography >
277
+ < Typography variant = "caption" > The JSON-RPC endpoint responds to the rpc.discover method. This adds features like auto completion to the inspector.</ Typography >
278
+ </ div >
279
+ } onClick = { ( ) => window . open ( "https://spec.open-rpc.org/#service-discovery-method" ) } >
280
+ < CheckCircle style = { { color : green [ 500 ] , marginRight : "5px" , cursor : "pointer" } } scale = { 0.1 } />
281
+ </ Tooltip >
282
+ : null
283
+ }
270
284
value = { url }
271
285
placeholder = "Enter a JSON-RPC server URL"
272
286
onChange = {
0 commit comments