contracts

Decompile the contract's WASM on demand (task 0465, refs #374).

The bytes come from wasm_programs.code, so a program archived on the ledger still decompiles (task 0620); Soroban RPC answers only for a program whose bytes are not indexed yet. The output is immutable per (wasm_hash, decompiler version), which justifies the LONG cache header even without a server-side cache.

get/v1/contracts/{contract_id}/decompiled

Request

  • The document declares no server URL.
  • Auth: one of:
    • API key in header x-api-key
    • HTTP bearer

Path parameters

contract_idstring required

Contract StrKey (C…, 56 chars)

Query parameters

formatstring nullable

Requested representation: rust (default) or wat. When rust is requested but emission fails, the response carries the WAT fallback with representation: "wat" and rust_error set — no second round-trip needed.

Response

Decompiled source (Rust, or WAT fallback)

contract_idstring required
functionsinteger nullable

pub fn count in the emitted Rust; null for WAT.

representationstring required

What source contains: rust or wat.

rust_errorstring nullable

Set when rust was requested but emission failed — source then carries the WAT fallback.

sdk_versionstring nullable

Soroban SDK version from the binary's contractmetav0, when present.

soroban_ret_versionstring required

Decompiler version that produced source.

sourcestring required
todo_holesinteger nullable

todo!() marker count (unrecovered values); null for WAT.

unknown_varsinteger nullable

Distinct var_N identifiers (unrecovered names); null for WAT.

wasm_hashstring required

Lowercase hex hash of the decompiled binary — the response is immutable per (wasm_hash, soroban_ret_version).

Changes

No recorded changes to this operation across all 50 revisions of this API.