@ampvaleo/x402-hyperliquid-server
v0.1.0
Published
Verify, settle, and middleware for x402 on Hyperliquid HyperCore
Readme
@ampvaleo/x402-hyperliquid-server
Verify EIP-712 payments, optionally settle on Hyperliquid’s /exchange endpoint, and wire into Express or Next.js App Router handlers.
import express from "express";
import { InMemoryNonceStore, x402Hyperliquid } from "@ampvaleo/x402-hyperliquid-server";
const app = express();
app.get(
"/resource",
x402Hyperliquid({
price: "0.01",
payTo: "0x…",
chain: "testnet",
sourceDex: "spot",
destinationDex: "spot",
nonceStore: new InMemoryNonceStore(),
}),
(req, res) => res.json({ ok: true }),
);For App Router, use runX402HyperliquidGate(request, options) and short-circuit with the returned Response when ok is false.
Settlement: omit settle to default to posting to Hyperliquid. For local dev, X402_HL_DEV_VERIFY_ONLY=1 skips settlement (blocked in production unless X402_HL_ALLOW_VERIFY_ONLY_IN_PROD=1). See resolveSettlementMode / assertDevVerifyOnlyEnvAllowed.
See the root README.
