import { ConfigurationPanelItem } from "@/components/config/ConfigurationPanelItem"; import { useState } from "react"; import { LoadingSVG } from "@/components/button/LoadingSVG"; import { Button } from "@/components/button/Button"; interface RpcPanelProps { config: any; rpcMethod: string; rpcPayload: string; setRpcMethod: (method: string) => void; setRpcPayload: (payload: string) => void; handleRpcCall: () => Promise; } export function RpcPanel({ config, rpcMethod, rpcPayload, setRpcMethod, setRpcPayload, handleRpcCall, }: RpcPanelProps) { const [rpcResult, setRpcResult] = useState<{ success: boolean; data: any; } | null>(null); const [isLoading, setIsLoading] = useState(false); const handleCall = async () => { setIsLoading(true); setRpcResult(null); try { const result = await handleRpcCall(); setRpcResult({ success: true, data: result }); } catch (error) { setRpcResult({ success: false, data: error instanceof Error ? error.message : String(error), }); } finally { setIsLoading(false); } }; return (
Method Name
setRpcMethod(e.target.value)} className="w-full text-white text-sm bg-transparent border border-gray-800 rounded-sm px-3 py-2" placeholder="my_method" />
Payload