MeteraDOCS
Request access

Live todayLive

Preflight

Preflight decides allow, allow_with_caveat or refuse on the exact transaction bytes you are about to sign. The decision comes from the chain and from a policy you supply. Metera never embeds its own idea of “too risky”.

preflight_transaction

What happens on every call:

  1. The message is decoded (legacy or v0), with address lookup tables resolved.
  2. It is simulated on two independent RPC nodes at the same slot.
  3. 83 checks run in four layers (below).
  4. The verdict is returned with a proof that makes a refusal as checkable as an allow.

The four layers

LayerWhat it checksRefuses, for example
1. Sanitize and decodeSizes, account locks, compute budget, blockhash or durable nonce, address lookup table stateA stale blockhash, a lookup table that changed under you
2. Semantics vs intentAccounts, PDAs, associated token accounts, Token-2022 extensions, and the swap itself against what you said it doesintent.minOut above the instruction's own minimumAmountOut; an output mint that is not the one you expected
3. Opcode denylistInstructions that should never ride along with a swapA hidden Approve, SetAuthority, MintTo, Burn, FreezeAccount, a CloseAccount on an account you do not own, a program upgrade, an address lookup table mutation
4. ConsistencyThat the bytes you sign are the bytes that were verifiedAny byte difference between transaction and candidateTransaction; a fresh dual-RPC re-simulation that drifts from the proof

Parameters

ParameterTypeRequiredDescription
transactionstring (base64)yesThe transaction, unsigned or signed, legacy or v0.
intentobjectyesWhat the caller believes the transaction does. Checked against the decoded instructions, never trusted.
intent.poolstringyesRaydium CPMM or Meteora DAMM V2 pool address.
intent.takerstringyesThe trader. Must be the fee payer and signer.
intent.directionexact_in | exact_outyesSwap direction.
intent.outputMintstringyesThe mint you expect to receive.
intent.minOutstringnoMinimum expected output, raw units.
policyobjectyesYour thresholds. See below.
candidateTransactionstring (base64)noWhat will actually be sent, if it differs (e.g. now signed). Layer 4 refuses unless the message bytes are identical.
jupiterQuoteobjectnoFor a transaction built by Jupiter /swap/v2/build: the quote Jupiter returned. Check 78 refuses if the route's bytes disagree with it.
reverifyAmountOutDeltaBpsnumbernoTolerance for simulated_out drift between the proof and the Layer 4 re-simulation. Default 0 (exact).

Policy

Nothing defaults on the server except maxSlotsStale (2). Any threshold crossed means refuse.

FieldDescription
maxPriceImpactBpsRequired. There is no external floor to default to.
maxNotionalCap on amountIn, raw units of the input mint.
allowedProgramsEvery program the transaction invokes must be listed.
allowedMints, deniedMintsToken allow and deny lists.
maxRiskScoreIf set, solana.token_risk runs on the mint the decoded swap actually outputs (never one you typed) and is billed as that one check. Omit it to not evaluate token risk at all, which is not the same as assuming it is fine.
minLevelLowest level the simulation must reach: single_source or consensus. A not-yet-sent transaction cannot be anchored.
maxSlotsStaleDefault 2.

Example

json
// tool: preflight_transaction
{
  "transaction": "<base64 v0 transaction>",
  "intent": {
    "pool": "<RAYDIUM_CPMM_POOL>",
    "taker": "<YOUR_WALLET>",
    "direction": "exact_in",
    "outputMint": "So11111111111111111111111111111111111111112",
    "minOut": "6950000000"
  },
  "policy": {
    "maxPriceImpactBps": 100,
    "maxNotional": "500000000",
    "allowedMints": [
      "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "So11111111111111111111111111111111111111112"
    ],
    "allowedPrograms": ["<RAYDIUM_CPMM_PROGRAM>", "ComputeBudget111111111111111111111111111111"],
    "maxRiskScore": 40,
    "minLevel": "single_source"
  }
}

Here maxNotional is 500 USDC (6 decimals) and minOut is 6.95 SOL (9 decimals), about 1% under 500 USDC at the SOL price of 71.29 from the Quickstart.

The same call over HTTP, from TypeScript:

ts
const res = await fetch("https://api.metera.xyz/v1/preflight", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.METERA_API_KEY}`,
  },
  body: JSON.stringify({ transaction, intent, policy }),
});

const { decision, proof } = await res.json();

if (decision !== "allow") {
  // allow_with_caveat: read the caveats before deciding.
  // refuse: do not sign. Read consensus_reasons and policy_reasons.
  throw new Error(`Preflight ${decision}`);
}
// Sign exactly these bytes. Changing them fails Layer 4.

Verdict

  • allow: every check passed and every threshold held.
  • allow_with_caveat: nothing refused, but something could not be fully evaluated. Example: on a DAMM V2 pool price impact is not computed (concentrated liquidity) and maxPriceImpactBps is not applied; your minOut floor bounds the price.
  • refuse: do not sign.

Reasons are never mixed. Facts from the chain that refuse are in consensus_reasons[]. Your thresholds and the layers' flags are in policy_reasons[], each with tripped: true when it fired.

Every verdict carries proof: message_hash, slot, simulated_out, decision and reasons, plus the dual-RPC simulation record.

Coverage today

CoveredRefused by name, not misread
Direct Raydium CPMM swapsAny other Jupiter route shape
Direct Meteora DAMM V2 swapsMeteora swap2 ExactOut
A Jupiter route_v2 with a single 100% step through one of the two above (the AMM call is read from the simulation's CPI trace and checked like a direct one)A transaction with no swap this tool can verify; a Transaction v1

Preflight needs live keys. There is no fixture for it.

Billing: charged only for a delivered allow or allow_with_caveat. A refuse is free.