Compile transaction

Transaction · Acts onchain

Compiles a draft action sequence into coil options, output manifests, and simulated slot values without persisting anything. This is the preview step the composer runs on every edit. It is not bound to a wallet, it never submits, and nothing it computes outlives the response: it exists so a draft can be checked against the compiler that will eventually execute it, every keystroke, for free. Reach for it to validate a sequence as it is being written, to learn what each step will output before anything is signed, or to build composer-grade tooling of your own on the same contract the app uses.

Send a request

Response

{
links: {
self: string
prev: string | undefined
next: string | undefined
} | undefined
headers: unknown | undefined
data: {
options: (Record<string, ({
name: string
type: string
ref: string
})[]>)[] | null
outputs: any[] | null
parameters: ({
step: number
name: string
type: string
})[] | null
graph: {
nodes: ({
step: number
protocol: string
action: string
outputs: any[] | null
ir: ({
index: number
kind: string
label: string | null
dead: boolean | null
reads: number[] | null
writes: number[] | null
})[] | null
})[]
edges: ({
kind: string
source: number
source_slot: number
source_name: string | null
source_tags: any | null
fields: number[] | null
target: number
target_input: string
ref: string
})[]
} | null
simulation: {
verdict: string | null
reason: string | null
failing_step: number | null
gas_used: number | null
block_number: number | null
outputs: ({
action_index: number
action: string
assumed: boolean | null
slots: ({
name: string
type: any
slot: number
path: string
tags: ({
kind: string
value: string | undefined
qualifiers: string[] | undefined
dynamic: boolean | undefined
reference: number | undefined
})[] | null
value: string | null
})[]
})[] | null
exclusions: ({
step: number
cause: string
})[] | null
} | null
calls: ({
to: string
value: string
data: string
})[] | null
program: {
socket: string
salt: string
deadline: number
typed_data: {
types: Record<string, ({
name: string
type: string
})[]>
primaryType: string
domain: Record<string, any>
message: Record<string, any>
}
} | null
} | null
}

Code samples

Language

Claude

Prompt

Call the Plug API endpoint "Compile transaction".
## Endpoint
PUT /transaction/
Base URL: https://api.plug.to
## Description
Compiles a draft action sequence into coil options, output manifests, and simulated slot values without persisting anything.
This is the preview step the composer runs on every edit. It is not bound to a wallet, it never submits, and nothing it computes outlives the response: it exists so a draft can be checked against the compiler that will eventually execute it, every keystroke, for free.
Reach for it to validate a sequence as it is being written, to learn what each step will output before anything is signed, or to build composer-grade tooling of your own on the same contract the app uses.
## Query Parameters
- input[chain_id] (integer, required) — The chain to compile the transaction for.
- input[owner] (string, optional) — The simulation subject: drafts compile and simulate at this address's counterfactual socket, so user-specific reads observe its real chain state. Absent, drafts simulate on the synthetic account.
- input[steps] (string, required) — The steps/actions to compile.
- input[overrides] (string, optional) — Debugger hypotheses: step.path keys naming read outputs, 0x-hex raw slot values. The program re-executes with each read pinned to its stated value; a draft carrying overrides projects fully and is never signable.
- input[signature] (string, optional) — The owner's EIP-712 signature over the lowered program. Present on the second lowering pass: with it the response carries the complete wallet_sendCalls batch including the factory createAndExecute call, simulated as the exact batch that will execute. Without it the response carries the typed data to sign.
- input[deadline] (integer, optional) — Unix seconds for the program deadline. The deadline is part of the signed typed data, so a signed re-simulation must echo the value that was signed; a different deadline is a different program. Absent or zero, the server stamps its default TTL.
## Headers
- Accept (string, required) — For a typical single-time JSON response, set this to application/json. To receive realtime updates through a stream, set this to text/event-stream. (default: application/json) [application/json, text/event-stream]
Current value: application/json
## Response Schema
- links (object, optional)
- self (string, required)
- prev (string, optional)
- next (string, optional)
- headers (unknown, optional)
- data (object, optional)
- options (array of Record<string, array>, optional)
- outputs (array of any, optional)
- parameters (array
- step (integer, required)
- name (string, required)
- type (string, required), optional) — Inputs the draft leaves unbound for execution time.
- graph (object, optional)
- nodes (array
- step (integer, required)
- protocol (string, required)
- action (string, required)
- outputs (array of any, optional)
- ir (array
- index (integer, required)
- kind (string, required)
- label (string, optional)
- dead (boolean, optional)
- reads (array of integer, optional)
- writes (array of integer, optional), optional), required)
- edges (array
- kind (string, required)
- source (integer, required)
- source_slot (integer, required)
- source_name (string, optional)
- source_tags (any, optional)
- fields (array of integer, optional)
- target (integer, required)
- target_input (string, required)
- ref (string, required), required)
- simulation (object, optional)
- verdict (string, optional)
- reason (string, optional)
- failing_step (integer, optional)
- gas_used (integer, optional)
- block_number (integer, optional)
- outputs (array
- action_index (integer, required)
- action (string, required)
- assumed (boolean, optional)
- slots (array
- name (string, required)
- type (any, required)
- slot (integer, required)
- path (string, required)
- tags (array
- kind (string, required)
- value (string, optional)
- qualifiers (array of string, optional)
- dynamic (boolean, optional)
- reference (integer, optional), optional)
- value (string, optional), required), optional)
- exclusions (array
- step (integer, required)
- cause (string, required), optional)
- calls (array
- to (string, required)
- value (string, required)
- data (string, required), optional) — The executable wallet_sendCalls batch. Present only when the request carried the owner's signature and the simulation verdict is executable.
- program (object, optional) — The typed data to sign and the account it executes on. Present when the draft is complete and an owner was given; absent once a signature is supplied.
- socket (string, required)
- salt (string, required)
- deadline (integer, required)
- typed_data (object, required)
- types (Record<string, array>, required)
- primaryType (string, required)
- domain (Record<string, any>, required)
- message (Record<string, any>, required)
## Example Request
PUT https://api.plug.to/transaction/