@somnia-chain/markets-sdk / index / ExchangeSmartAccounts
Interface: ExchangeSmartAccounts
Defined in: packages/sdk/src/unified/smartAccounts.ts:49
The exchange-level smart-accounts surface, reached as exchange.accounts.
Spans every configured chain the accounts SDK covers; a configured chain it
does not cover (a local anvil beside a testnet) is skipped where skipping
is safe and refused where it is not — each member says which.
Methods
addressOf()
addressOf(
accountId,index):`0x${string}`
Defined in: packages/sdk/src/unified/smartAccounts.ts:57
The address (accountId, index) derives to — the same on every covered
chain. Pure; no read.
- Throws InvalidInputError - no configured chain is covered by the accounts SDK.
Parameters
accountId
`0x${string}`
index
bigint
Returns
`0x${string}`
scan()
scan(
accountId,options?):Promise<CrossChainScan>
Defined in: packages/sdk/src/unified/smartAccounts.ts:66
Scan accountId's derived accounts on every covered configured chain at
once: which slots are deployed where, which are empty, and which reads
did not answer. Chain reads (current to head).
- Throws InvalidInputError - no configured chain is covered, or the range is empty or wider than the accounts SDK's scan cap.
Parameters
accountId
`0x${string}`
options?
maxIndex?
bigint
indices?
readonly bigint[]
Returns
Promise<CrossChainScan>
buildCreateAccounts()
buildCreateAccounts(
authorization,signature): readonlyUnsignedAccountCreation[]
Defined in: packages/sdk/src/unified/smartAccounts.ts:76
Turn one signed authorization (from
client.accounts.buildAccountAuthorization — its domain omits the chain
id for exactly this) into one creation call PER covered configured
chain. Each call needs its own funded sender; a chain that fails is
retried on its own, not rolled back.
- Throws InvalidInputError - no configured chain is covered.
Parameters
authorization
AccountAuthorization
signature
`0x${string}`
Returns
readonly UnsignedAccountCreation[]
accountFor()
accountFor(
accountId,index,inner):SomniaMarketsAccount
Defined in: packages/sdk/src/unified/smartAccounts.ts:98
The multi-chain account the exchange trades through, in one call: the
derived address plus a smart-account executor per covered configured
chain, each driving the account through inner on that chain. Hand the
result to the exchange config's account.
Gotchas
A configured chain the accounts SDK does not cover gets NO executor — writes routed there will be refused by the facade's own missing-executor handling, not silently sent as someone else.
A { sessionSeed } inner signs locally on every chain; no request
carries the seed. See SmartAccountInner.
- Throws InvalidInputError - no configured chain is covered, the
seed is not 32 bytes of hex, or a factory returns an executor for
another chain or a
createExecutor({ sessionSeed })executor. - Throws NotConfiguredError - a covered chain's engine has no chain transport.
Parameters
accountId
`0x${string}`
index
bigint