Matrix logo

Types

Shared request/response types, generic envelopes, error taxonomy, chain profiles, and artifact definitions used across REST, JSON-RPC, and MCP transports.

Source files: pkg/types/*.go

The types package holds the shared wire contracts for all tachyon transports. Every request and response type, the generic envelope, the error taxonomy, chain profiles, and artifact definitions live here.


Envelope

type Envelope[T any] struct {
    Ok    bool   `json:"ok"`
    Data  T      `json:"data,omitempty"`
    Error *Error `json:"error,omitempty"`
}

Constructors: types.OK(data) and types.Fail(err). Used by all three transports (REST, JSON-RPC, MCP).

Error

type Error struct {
    Code    string `json:"code"`
    Message string `json:"message"`
    Retry   bool   `json:"retry"`
    Details any    `json:"details,omitempty"`
}

Error implements the error interface. NewError(code, message, retry, details) is the constructor.

Stable error codes

CodeRetryWhen
COMPILER_FORGE_FAILEDyesforge build subprocess failed
COMPILER_SOLC_FAILEDyessolc mismatch or compile error
TEST_FORGE_FAILEDyesforge test subprocess failed
TEST_ASSERTION_FAILEDnoone or more tests failed
CHAIN_NOT_FOUNDnounknown chain_id
CHAIN_RPC_FAILEDyesRPC dial or transport error
SIMULATE_FAILEDnoeth_call reverted
DEPLOY_FAILEDvariesdeployment planning or broadcast failed
DEPLOY_IDEMPOTENT_HITno(reserved)
CALL_FAILEDyesbroadcast call failed
ARTIFACT_NOT_FOUNDnocompile first or wrong project_id
REGISTRY_NOT_FOUNDno(reserved)
WALLET_POLICY_DENIEDnospend cap or allow-list rejected
WALLET_NOT_CONFIGUREDnono signer configured
INVALID_REQUESTnomalformed input
INTERNAL_ERRORvariesunexpected server error

HealthData

type HealthData struct {
    Version string   `json:"version"`
    Forge   string   `json:"forge,omitempty"`
    Chains  []string `json:"chains"`
    Project string   `json:"project_root"`
}

Compile types

TypePurpose
CompileRequestproject_root, project_id, sources, targets, optimize, via_ir, evm_version
CompileResponseproject_id, artifacts[], warnings[]
Artifactname, path, abi, bytecode, deployedBytecode, compiler
CompilerSettingsversion, optimizer
OptimizerConfigenabled, runs

CompileRequest.Sources (map of path to content) makes the request self-contained. EVMVersion pins the solc target (default: "shanghai").


Test types

TypePurpose
TestRequestproject_root, sources, match_path, match_contract, filter, evm_version
TestResponsesuites[], passed, failed
TestSuiteResultfile, passed, failed, skipped, cases[]
TestCaseResultname, status, reason, gas, duration

Simulate types

TypePurpose
SimulateRequestchain_id, rpc_url, from, to, data, value, block, trace
SimulateResponseresult, gas_estimate, revert, trace

Deploy types

TypePurpose
DeployRequestintent, idempotency_key, chain_id, project_id, contract, constructor_args, create2, from, capability_token, spend_cap_wei, wallet_token
DeployResponseaddress, tx_hash, idempotency_key, chain_id, contract, existing
Create2Configsalt, deployer

Call types

TypePurpose
CallRequestchain_id, rpc_url, from, to, data, method, args, abi, contract, project_id, value, simulate_only, capability_token, spend_cap_wei, wallet_token
CallResponseresult, tx_hash, revert

Calldata is resolved two ways: Method + Args (ABI-encoded, with ABI from inline or registry) or pre-encoded hex Data.


Chain types

TypePurpose
ChainProfileid, name, rpc_url, rpc_url_env, chain_id, preset, explorer, features, active
ChainListResponsechains[], active_chain_id
ChainRegisterRequestid, name, rpc_url, chain_id, preset, explorer
ChainUseRequestchain_id

Artifact/Registry types

TypePurpose
ArtifactGetRequestproject_id, name
ArtifactGetResponseartifact
RegistryLookupRequestidempotency_key, chain_id
RegistryLookupResponsefound, address, tx_hash, contract, confirmed