@somnia-chain/markets-sdk / index / TradeContext
Type Alias: TradeContext
TradeContext =
object
Defined in: packages/sdk/src/fills.ts:456
Everything the indexer knows about ONE fill: the trade itself, the market it executed in, both sides' orders, the fees it paid, and the other fills its transaction produced.
The shape of a trade detail view. Each piece may be absent on its own terms — see the field docs — and absence is normal rather than an error.
Distinct from FillDetail, which is the one-query lookup behind
SomniaMarketsClient.getFill: that names the fill and its market, this
adds the surrounding CONTEXT — both orders resolved, the fees, the rest of the
transaction — at the cost of a second round-trip. A caller that only needs to
render the trade wants getFill.
Properties
fill
fill:
OrderFillRow
Defined in: packages/sdk/src/fills.ts:458
The fill, with its block position and post-fill remainders.
market
market:
Market|null
Defined in: packages/sdk/src/fills.ts:463
The market the fill executed in; null only when the indexer has no market row for it (an unregistered pool).
makerOrder
makerOrder:
FillOrder|null
Defined in: packages/sdk/src/fills.ts:468
The resting order that was filled; null until the indexer has that order's row.
takerOrder
takerOrder:
FillOrder|null
Defined in: packages/sdk/src/fills.ts:470
The aggressing order that crossed the book; null until its row is indexed.
siblings
siblings:
OrderFillRow[]
Defined in: packages/sdk/src/fills.ts:475
The OTHER fills of the same transaction, newest first — the rest of a taker's sweep. Empty when this fill was the whole trade. Excludes this fill.
protocolFees
protocolFees:
ProtocolFeeRecord[]
Defined in: packages/sdk/src/fills.ts:485
Protocol fees charged in the same transaction. BINARY only, and empty when no fee was skimmed.
Transaction-scoped, not fill-scoped: a fee record names the ORDER it was
charged on, not the fill, so a multi-fill sweep cannot be split into
per-fill fees. Match orderId against the fill's makerOrder/takerOrder
to attribute what can be attributed.
builderFees
builderFees:
BuilderFeeRecord[]
Defined in: packages/sdk/src/fills.ts:487
Builder fees charged in the same transaction, on the same terms as TradeContext.protocolFees.