@somnia-chain/markets-sdk / index / SomniaMarketsAccount
Interface: SomniaMarketsAccount
Defined in: packages/sdk/src/account.ts:47
An account for a multi-chain SomniaMarkets: one address, and the executor that acts as it on each configured chain.
Details
Pass it as account in SomniaMarketsConfig. Portfolio reads
(fetchBalance, fetchPositions, …) use address on every chain; a write
for a market on chain N goes through executors[N]. A chain with no
executor is read-only: a write there throws NotConfiguredError
naming the chain.
Gotchas
Every executor's actor must equal address, or the SDK would read
allowances for one account and send as another. The facade checks this at
construction and throws InvalidInputError on a mismatch.
Example (One safe on two chains)
const exchange = new SomniaMarkets({
chains: [l1, hideki],
account: {
address: SAFE,
executors: {
[l1.chain.id]: l1Engine.createExecutor({ safe: SAFE, inner: l1Engine.createExecutor({ sessionSeed }) }),
[hideki.chain.id]: l2Engine.createExecutor({ safe: SAFE, inner: l2Engine.createExecutor({ sessionSeed }) }),
},
},
});
Properties
address
address:
`0x${string}`
Defined in: packages/sdk/src/account.ts:49
The account's address — the same on every chain.
executors
executors:
Partial<Record<number,Executor>>
Defined in: packages/sdk/src/account.ts:51
The executor that acts as address on each chain, keyed by chain id.