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:
- The message is decoded (legacy or v0), with address lookup tables resolved.
- It is simulated on two independent RPC nodes at the same slot.
- 83 checks run in four layers (below).
- The verdict is returned with a proof that makes a refusal as checkable as an allow.
The four layers
| Layer | What it checks | Refuses, for example |
|---|---|---|
| 1. Sanitize and decode | Sizes, account locks, compute budget, blockhash or durable nonce, address lookup table state | A stale blockhash, a lookup table that changed under you |
| 2. Semantics vs intent | Accounts, PDAs, associated token accounts, Token-2022 extensions, and the swap itself against what you said it does | intent.minOut above the instruction's own minimumAmountOut; an output mint that is not the one you expected |
| 3. Opcode denylist | Instructions that should never ride along with a swap | A hidden Approve, SetAuthority, MintTo, Burn, FreezeAccount, a CloseAccount on an account you do not own, a program upgrade, an address lookup table mutation |
| 4. Consistency | That the bytes you sign are the bytes that were verified | Any byte difference between transaction and candidateTransaction; a fresh dual-RPC re-simulation that drifts from the proof |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
transaction | string (base64) | yes | The transaction, unsigned or signed, legacy or v0. |
intent | object | yes | What the caller believes the transaction does. Checked against the decoded instructions, never trusted. |
intent.pool | string | yes | Raydium CPMM or Meteora DAMM V2 pool address. |
intent.taker | string | yes | The trader. Must be the fee payer and signer. |
intent.direction | exact_in | exact_out | yes | Swap direction. |
intent.outputMint | string | yes | The mint you expect to receive. |
intent.minOut | string | no | Minimum expected output, raw units. |
policy | object | yes | Your thresholds. See below. |
candidateTransaction | string (base64) | no | What will actually be sent, if it differs (e.g. now signed). Layer 4 refuses unless the message bytes are identical. |
jupiterQuote | object | no | For a transaction built by Jupiter /swap/v2/build: the quote Jupiter returned. Check 78 refuses if the route's bytes disagree with it. |
reverifyAmountOutDeltaBps | number | no | Tolerance 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.
| Field | Description |
|---|---|
maxPriceImpactBps | Required. There is no external floor to default to. |
maxNotional | Cap on amountIn, raw units of the input mint. |
allowedPrograms | Every program the transaction invokes must be listed. |
allowedMints, deniedMints | Token allow and deny lists. |
maxRiskScore | If 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. |
minLevel | Lowest level the simulation must reach: single_source or consensus. A not-yet-sent transaction cannot be anchored. |
maxSlotsStale | Default 2. |
Example
// 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:
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
maxPriceImpactBpsis not applied; yourminOutfloor 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
| Covered | Refused by name, not misread |
|---|---|
| Direct Raydium CPMM swaps | Any other Jupiter route shape |
| Direct Meteora DAMM V2 swaps | Meteora 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.