DF1ow4tspfHX9JwWJsAb9epbkA8hmpSEAtxXy1V27QBH.
Event Format
The program emits events with Anchor’semit_cpi!: it invokes itself, and the event is the data of that inner instruction. Events do not appear in the transaction logs.
To find events, read meta.innerInstructions[*].instructions[*] and keep the instructions whose program is the orchestrator and whose data starts with the event tag. The program signs the inner instruction with its event authority PDA, derived from the seed "__event_authority".
Each event’s data has this layout:
Event Discriminators
Order Event Types
Each transition of an escrow fill (order) emits exactly oneRfqOrderEvent. Its event_type field records the transition:
Every order has one Open event and, once a transaction closes it, one terminal event: Fill, Cancel, or Expire.
Order Event Byte Layout
RfqOrderEvent fields, with offsets after the 16-byte prefix. Add 16 for the offset in the instruction data.
The event fields are 259 bytes, so the full instruction data is 275 bytes.
Detecting Escrow Fill Outcomes
- Parse the Open event from the transaction the user signed. Read the
orderfield, the onchain address of the order. - Watch later transactions for an
RfqOrderEventwith the sameorderandevent_type=2(Fill). - Handle the other terminal types:
event_type=3(Cancel) or4(Expire) means the order did not fill.
Fill, Cancel, and Expire transactions include the order’s
refund_wallet, so the app can subscribe to transactions that mention it to detect closes.Escrow Fill Volume Calculation
In Fill events, use:input_mint/input_amountoutput_mint/output_amount
input_amount includes the fee, which refund_amount returns if the fee was skipped; when USDC is the output, output_amount is net of the fee.
A Fill transaction also emits a SwapEvent for the same amounts, with amm set to the orchestrator program id. Count either the RfqOrderEvent or the SwapEvent for an escrow fill, not both.
Escrow Fill Fee Calculation
Fill events carry:fee_mintfee_amount
fee_amount is the platform fee charged on the fill. The same transaction emits a FeeEvent when a fee was paid; its amount is the amount that reached the fee account. Sum fee_amount for fees charged. For fees received, sum FeeEvent.amount over the events whose account is the app’s fee account.
Direct Fill Events
A fill (executionMode: sync) does not emit RfqOrderEvent. Its transaction emits a SwapEvent for each leg of the route, with amm set to the orchestrator program id for the equity leg, and a FeeEvent for each transfer to the fee account: the platform fee and any positive-slippage capture. See Relevant IDL Fields for both layouts.
Relevant IDL Fields
SwapEvent fields, with offsets after the 16-byte prefix:
FeeEvent fields, with offsets after the 16-byte prefix:
RfqOrderEvent field meanings:
Decode the Events
This example fetches a transaction withjsonParsed encoding, which lists each inner instruction’s programId, and decodes its RfqOrderEvent and FeeEvent entries.