@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / ExecutorSpec

Type Alias: ExecutorSpec

ExecutorSpec = { privateKey: Hex; } | { account: LocalAccount; } | { walletClient: WalletClient; account?: Account | Address; } | { sessionSeed: Hex; } | { safe: Address; inner: Executor; mode?: SafeExecutionMode; multiSend?: Address; detectFailure?: SafeFailureDetector; } | { smartAccount: Address; inner: Executor; through?: readonly Address[]; signer?: SmartAccountSigner; }

Defined in: packages/sdk/src/executor/create.ts:75

Which built-in executor to build, and the authority it acts with. One variant per actor kind; the engine supplies everything else.

  • { privateKey } / { account } — the SDK signs locally and sends via realtime_sendRawTransaction (the fast path).

  • { walletClient } — an injected browser / wagmi signer sends; the SDK confirms off the socket.

  • { sessionSeed } — a Somnia node-side session account; the node signs, submits and returns the receipt.

  • { safe, inner } — the safe is the actor; inner (any executor, usually a session key) sends the outer transaction. Add multiSend to pack several calls into one transaction.

  • { smartAccount, inner } — a factory account from @somnia-chain/accounts-sdk is the actor; inner sends the outer transaction. Batching needs no configuration (the accounts SDK resolves its own MultiSend batcher), and through reaches an account owned by other accounts, at any depth.

The safe variant needs an authorized inner. In the default "owner" mode the outer transaction carries only a pre-validated signature for inner.actor, so that actor must be an OWNER of the safe and the safe's threshold must be 1 — nothing else signs. In "module" mode inner.actor must be a module the safe has ENABLED. Any other inner actor builds an executor whose every send reverts on the safe.

The smart-account variant chooses its authority the same way. With no signer and no through, the outer transaction carries a pre-validated signature for inner.actor — a direct owner of a threshold-1 account that sends its own transaction signs nothing. A signer, or a through chain of parent accounts, switches to a real signature the accounts SDK nests level by level. The chain must be one the accounts SDK covers, or the spec is refused at construction.

A private key and a session seed are validated on construction: 32 bytes of hex, or InvalidInputError. A spec names exactly ONE actor: an object that carries the selectors of two variants (a spread that merged a privateKey into a safe spec, say) is refused with InvalidInputError rather than silently acting as one of them.