Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Call (Private Routes)

The call action invokes another route on the same entity in-process. It is the usual way to run a private route — a route that external callers cannot invoke directly.

Syntax

call routeName(args)

Arguments must match the target route’s parameter list. There is no ~> or return capture: call runs the private route for side effects (member transforms and its action list) and continues with the caller route afterward.

Private routes

Declare a route with the private modifier:

entity Ledger {
    routes {
        publish(total: U256) => [
            call apply_total(total)
        ]

        private apply_total(total: U256) => []
    }

    m_total: U256 {
        in apply_total(total) => total
    }
}
TargetLowering (conceptual)
EVMprivate Solidity function; not in the public ABI
LeanInternal transition helper in generated modules

Private routes still participate in member transforms (in apply_total(...)).

Restrictions

Allowed in callerForbidden
Regular, init, phased routesview / pure routes calling private (V11)
call after sends, deploys, letcall with var capture (use ~> for return values)

pure routes cannot use call to private routes or any impure construct.

When to use

Use private route + call to split one public entry point into internal steps without exposing extra ABI surface — shared checks, multi-step setup, or helper routes that only make sense inside the entity.

For return values from another entity, use a typed send with var capture (see Send Messages). For events, use Emit Events.