@somnia-chain/markets-sdk / index / ExecutorSpec
Type Alias: ExecutorSpec
ExecutorSpec = {
privateKey:Hex; } | {account:LocalAccount; } | {walletClient:WalletClient;account?:Account|Address; } | {sessionSeed:Hex; } | {smartAccount:Address;inner:Executor;through?: readonlyAddress[];signer?:SmartAccountSigner; }
Defined in: packages/sdk/src/executor/create.ts:74
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 viaeth_sendRawTransactionSync(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. The seed goes to the node with every write, so use it only for an account that holds gas dust. It cannot be theinnerof a smart account.{ smartAccount, inner }— a factory account from@somnia-chain/accounts-sdkis the actor;innersends the outer transaction. Batching needs no configuration (the accounts SDK resolves its own MultiSend batcher), andthroughreaches an account owned by other accounts, at any depth.
The smart-account variant needs an authorized inner. 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.
An account's inner signs locally. A smart-account spec whose inner
was built by { sessionSeed } is refused with
InvalidInputError: that executor sends the seed to the node on every
write, and behind an account the seed controls the account's funds. Build
the inner with { privateKey } instead. For a Somnia session seed, the key
is sessionPrivateKey(seed); across chains,
exchange.accounts.accountFor(accountId, index, { sessionSeed }) does this
for you. A hand-written Executor that calls the session RPC itself
is outside this check.
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 smartAccount spec, say) is refused with
InvalidInputError rather than silently acting as one of them.