add test button to sol push so you can mass test all RPC endpoints at once.

This commit is contained in:
KingKDot
2026-07-14 10:36:13 -05:00
parent 73700177df
commit f23fe2ff56
5 changed files with 214 additions and 2 deletions
@@ -9,6 +9,7 @@ import {
normalizeSolRpcUrl,
saveSolRpcEndpointUrls,
} from "../../sol-rpc-endpoints";
import { testSolRpcEndpoint } from "../../sol-rpc-test";
let _solana: typeof import("@solana/web3.js") | null = null;
async function getSolana() {
@@ -73,6 +74,20 @@ export async function handleSolRoutes(
try { requirePermission(user, "system:configure"); }
catch (error) { return error instanceof Response ? error : new Response("Forbidden", { status: 403 }); }
if (req.method === "POST" && url.pathname === "/api/sol/rpc-endpoints/test") {
const records = getSolRpcEndpoints();
const results = await Promise.all(records.map(async (record) => ({
...record,
...await testSolRpcEndpoint(record.url),
})));
return Response.json({
tested: results.length,
passed: results.filter((result) => result.ok).length,
failed: results.filter((result) => !result.ok).length,
results,
});
}
if (req.method === "POST" && url.pathname === "/api/sol/rpc-endpoints") {
const body = await req.json();
const current = getSolRpcEndpoints().map((item) => item.url);