CoreMesh Instant
JAVASCRIPT EXAMPLE

Call CoreMesh Instant from JavaScript

Use the official x402 fetch client to pay for a CoreMesh Instant result with a local Base wallet.

npm install @x402/fetch @x402/core @x402/evm viem

# Put a buyer wallet key with a small Base USDC balance in EVM_PRIVATE_KEY.
# Never send the key to CoreMesh Instant.

import { wrapFetchWithPayment, x402HTTPClient } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const signer = privateKeyToAccount(process.env.EVM_PRIVATE_KEY);
const client = new x402Client();
client.register("eip155:*", new ExactEvmScheme(signer));

const paidFetch = wrapFetchWithPayment(fetch, client);
const parser = new x402HTTPClient(client);
const response = await paidFetch(
  "https://instant.coremesh.online/v1/ssl-report?host=example.com",
);
const result = await parser.processResponse(response);
console.log(result.body);
console.log(result.paymentStatus, result.header);
Use a dedicated buyer wallet with a strict spending limit. CoreMesh Instant never asks for or stores the buyer's private key.