Route NEAR receipt logs to a versioned event decoder
A receipt may contain free-form diagnostics and structured NEP-297 events in the same log array. An indexer needs to identify the emitter and event schema before using a value as application data.
Parse only the event envelope
Read the logs for a specific execution outcome. For a line starting with the event marker, remove the prefix and parse the rest as JSON. This example uses a private application standard; its data layout is defined by the application.
EVENT_JSON:{"standard":"example_shop","version":"1.0.0","event":"order_ready","data":{"order_id":"42"}}
Preserve the emitter and log position
Route by executor account plus the standard, version and event fields. When order_ready arrives from an unrelated contract, its identical JSON shape does not make it an event from your shop. Save the outcome ID and log index for deduplication, including when the log contains no data field.
An unknown version should retain its raw payload for later decoding. Check the execution result separately before treating an emitted line as evidence that a business change committed.