Agents & Automation / Somnia Reactivity
Somnia Reactivity
LiveContracts that react to events and schedules in the same block, no keepers. Subscriptions persist in chain state and validators run the handler.
Handler runs0.0/s0 since you opened the page
Failed0Reverted handler runs
Subscriptions created0.0/s0.0/s removed
Reaction timeSame blockHandlers run after user transactions
Connecting to Global…
Handler executions
Each run is a transaction validators add after the block's user transactions, in the same block as its trigger.
Waiting for a handler to run
Handler runs on Global appear here as validators execute them.
Since you opened the page
Busiest handlers
No runs yet
Handlers are ranked by runs as they arrive.
Look up
Find a subscription
By id, or every active subscription an address owns. Answered by the chain's somnia_reactivity RPC methods.
Connecting to Global…
Subscription changes
Created and removed at the reactivity precompile. Schedules are one-shot, so most churn is a scheduler re-arming itself.
No changes yet
New and removed subscriptions appear here as they happen.
Example
Handle an event
solidity
import { SomniaEventHandler } from "@somnia-chain/reactivity-contracts/contracts/SomniaEventHandler.sol";
contract MyHandler is SomniaEventHandler {
function _onEvent(
address emitter,
bytes32[] calldata eventTopics,
bytes calldata data
) internal override {
// Runs in the same block as the event it subscribed to
}
}