OpenPond
1Branch0Tags
GL
glucryptoMerge commit 'refs/tmp/prod-master'
typescript
import { z } from "zod"; import { store } from "opentool/store"; import { wallet } from "opentool/wallet"; import { recordHyperliquidTermsAcceptance, resolveHyperliquidChainConfig, } from "opentool/adapters/hyperliquid"; export const profile = { description: "Record a local acknowledgement of Hyperliquid API terms for the configured Turnkey wallet.", }; export const schema = z.object({ environment: z.enum(["mainnet", "testnet"]).default("testnet"), }); export async function POST(req: Request): Promise<Response> { const body = await req.json().catch(() => ({})); const { environment } = schema.parse(body); const chainConfig = resolveHyperliquidChainConfig(environment); const context = await wallet({ chain: chainConfig.chain, }); const walletAddress = context.address; await recordHyperliquidTermsAcceptance({ environment, walletAddress, }); await store({ source: "hyperliquid", ref: `${environment}-terms-${Date.now()}`, status: "submitted", walletAddress, action: "terms", network: environment === "mainnet" ? "hyperliquid" : "hyperliquid-testnet", metadata: { environment, note: "Hyperliquid does not expose a terms endpoint; this records local acknowledgement only.", }, }); return Response.json({ ok: true, environment, walletAddress, termsAccepted: true, note: "Hyperliquid does not expose a terms endpoint; this records local acknowledgement only.", }); }