@somnia-chain/markets-sdk / index / TraderConfig
Interface: TraderConfig
Defined in: packages/sdk/src/trade.ts:72
Signer + defaults for client.createTrader — how a Trader signs and
sends. Provide one source of authority: an executor (any Executor,
built-in or your own), or the signer sugar that builds the matching built-in —
privateKey, a local account, or a walletClient.
Properties
executor?
optionalexecutor?:Executor
Defined in: packages/sdk/src/trade.ts:96
Who signs and sends: any Executor — the built-ins from
client.createExecutor(...) (a private key, a wallet, a session key, a
smart account) or your own. When set, privateKey / account / walletClient
are ignored for sending; the writer reads allowances and operator grants
for executor.actor. When unset, the three signer fields below build the
matching built-in executor, so existing callers change nothing.
Gotchas
Must send on this client's chain — a mismatch throws
InvalidInputError at createTrader. Verbs that SIGN rather than
send (signRedeemAuth) need an executor with signTypedData; a safe or a
session key has none, and those verbs throw SignerRequiredError.
Ownership. An executor supplies signing and submission ONLY. The
trader keeps its owner's chain, reads (allowances, operator grants and
revert replays all go through the owner's client), deployments and
lifecycle, and the built-ins from client.createExecutor are themselves
owner-derived. A custom executor owning its own submission path is the
point of the seam (a safe, a bundler, a relayer, custody); that deviation
from SDK-OWN-001 / SDK-OWN-002 is recorded in the seam's proposal.
walletClient?
optionalwalletClient?:object
Defined in: packages/sdk/src/trade.ts:103
A pre-built signer (e.g. a browser/wagmi wallet over an injected provider).
Only needed when the SDK can't sign locally — with privateKey / a local
account, the SDK signs itself and sends over the client's WebSocket via
eth_sendRawTransactionSync (send + confirm in one round-trip).
account?
optionalaccount?:`0x${string}`|Account
Defined in: packages/sdk/src/trade.ts:105
A local signing account (e.g. from viem's privateKeyToAccount).
privateKey?
optionalprivateKey?:`0x${string}`
Defined in: packages/sdk/src/trade.ts:107
Private key — the SDK derives the account.
publicClient?
optionalpublicClient?:object
Defined in: packages/sdk/src/trade.ts:109
Read client for allowance/receipts. Defaults to the client's WebSocket client.
decimals?
optionaldecimals?:number
Defined in: packages/sdk/src/trade.ts:111
Scale for the testnet faucet's default amount (6 if unset). Order inputs use raw units; convert them with the selected market's quoteDecimals.
gas?
optionalgas?:bigint
Defined in: packages/sdk/src/trade.ts:116
Default gas ceiling per tx (10,000,000 when unset); each write can override
per-call via its params' gas.