@@ -106,8 +106,23 @@ function emittedZkAppCommandsCTE(db_client: postgres.Sql) {
106
106
return db_client `
107
107
emitted_zkapp_commands AS (
108
108
SELECT
109
- blocks_accessed.*,
109
+ blocks_accessed.requesting_zkapp_account_identifier_id,
110
+ blocks_accessed.block_id,
111
+ blocks_accessed.account_identifier_id,
112
+ blocks_accessed.zkapp_id,
113
+ blocks_accessed.account_access_id,
114
+ blocks_accessed.state_hash,
115
+ blocks_accessed.parent_hash,
116
+ blocks_accessed.height,
117
+ blocks_accessed.global_slot_since_genesis,
118
+ blocks_accessed.global_slot_since_hard_fork,
119
+ blocks_accessed.timestamp,
120
+ blocks_accessed.chain_status,
121
+ blocks_accessed.ledger_hash,
122
+ blocks_accessed.distance_from_max_block_height,
123
+ blocks_accessed.last_vrf_output,
110
124
zkcu.id AS zkapp_account_update_id,
125
+ bzkc.sequence_no AS sequence_number,
111
126
zkapp_fee_payer_body_id,
112
127
zkapp_account_updates_ids,
113
128
authorization_kind,
@@ -133,13 +148,41 @@ function emittedEventsCTE(db_client: postgres.Sql) {
133
148
return db_client `
134
149
emitted_events AS (
135
150
SELECT
136
- *,
137
- zke.id AS zkapp_event_id,
138
- zke.element_ids AS zkapp_event_element_ids,
139
- zkfa.id AS zkapp_event_array_id
151
+ emitted_zkapp_commands.requesting_zkapp_account_identifier_id,
152
+ emitted_zkapp_commands.block_id,
153
+ emitted_zkapp_commands.account_identifier_id,
154
+ emitted_zkapp_commands.zkapp_id,
155
+ emitted_zkapp_commands.account_access_id,
156
+ emitted_zkapp_commands.state_hash,
157
+ emitted_zkapp_commands.parent_hash,
158
+ emitted_zkapp_commands.height,
159
+ emitted_zkapp_commands.global_slot_since_genesis,
160
+ emitted_zkapp_commands.global_slot_since_hard_fork,
161
+ emitted_zkapp_commands.timestamp,
162
+ emitted_zkapp_commands.chain_status,
163
+ emitted_zkapp_commands.ledger_hash,
164
+ emitted_zkapp_commands.distance_from_max_block_height,
165
+ emitted_zkapp_commands.last_vrf_output,
166
+ emitted_zkapp_commands.zkapp_account_update_id,
167
+ emitted_zkapp_commands.sequence_number,
168
+ emitted_zkapp_commands.zkapp_fee_payer_body_id,
169
+ emitted_zkapp_commands.zkapp_account_updates_ids,
170
+ emitted_zkapp_commands.authorization_kind,
171
+ emitted_zkapp_commands.status,
172
+ emitted_zkapp_commands.memo,
173
+ emitted_zkapp_commands.hash,
174
+ emitted_zkapp_commands.body_id,
175
+ emitted_zkapp_commands.events_id,
176
+ emitted_zkapp_commands.actions_id,
177
+ zke.id AS account_update_event_id,
178
+ zke.element_ids AS event_element_ids,
179
+ zkfa.element_ids AS event_field_element_ids,
180
+ zkfa.id AS event_field_elements_id,
181
+ zkf.id AS field_id,
182
+ zkf.field AS field_value
140
183
FROM
141
184
emitted_zkapp_commands
142
- INNER JOIN zkapp_events zke ON zke.id = events_id
185
+ INNER JOIN zkapp_events zke ON zke.id = emitted_zkapp_commands. events_id
143
186
INNER JOIN zkapp_field_array zkfa ON zkfa.id = ANY(zke.element_ids)
144
187
INNER JOIN zkapp_field zkf ON zkf.id = ANY(zkfa.element_ids)
145
188
)
@@ -150,13 +193,38 @@ function emittedActionsCTE(db_client: postgres.Sql) {
150
193
return db_client `
151
194
emitted_actions AS (
152
195
SELECT
153
- *,
154
- zke.id AS zkapp_event_id,
155
- zke.element_ids AS zkapp_event_element_ids,
156
- zkfa.id AS zkapp_event_array_id
196
+ emitted_zkapp_commands.block_id,
197
+ emitted_zkapp_commands.zkapp_id,
198
+ emitted_zkapp_commands.state_hash,
199
+ emitted_zkapp_commands.parent_hash,
200
+ emitted_zkapp_commands.height,
201
+ emitted_zkapp_commands.global_slot_since_genesis,
202
+ emitted_zkapp_commands.global_slot_since_hard_fork,
203
+ emitted_zkapp_commands.timestamp,
204
+ emitted_zkapp_commands.chain_status,
205
+ emitted_zkapp_commands.ledger_hash,
206
+ emitted_zkapp_commands.distance_from_max_block_height,
207
+ emitted_zkapp_commands.last_vrf_output,
208
+ emitted_zkapp_commands.zkapp_account_update_id,
209
+ emitted_zkapp_commands.sequence_number,
210
+ emitted_zkapp_commands.zkapp_fee_payer_body_id,
211
+ emitted_zkapp_commands.zkapp_account_updates_ids,
212
+ emitted_zkapp_commands.authorization_kind,
213
+ emitted_zkapp_commands.status,
214
+ emitted_zkapp_commands.memo,
215
+ emitted_zkapp_commands.hash,
216
+ emitted_zkapp_commands.body_id,
217
+ emitted_zkapp_commands.events_id,
218
+ emitted_zkapp_commands.actions_id,
219
+ zke.id AS account_update_event_id,
220
+ zke.element_ids AS event_element_ids,
221
+ zkfa.element_ids AS event_field_element_ids,
222
+ zkfa.id AS event_field_elements_id,
223
+ zkf.id AS field_id,
224
+ zkf.field AS field_value
157
225
FROM
158
226
emitted_zkapp_commands
159
- INNER JOIN zkapp_events zke ON zke.id = actions_id
227
+ INNER JOIN zkapp_events zke ON zke.id = emitted_zkapp_commands. actions_id
160
228
INNER JOIN zkapp_field_array zkfa ON zkfa.id = ANY(zke.element_ids)
161
229
INNER JOIN zkapp_field zkf ON zkf.id = ANY(zkfa.element_ids)
162
230
)
@@ -176,7 +244,36 @@ function emittedActionStateCTE(
176
244
zkf2.field AS action_state_value3,
177
245
zkf3.field AS action_state_value4,
178
246
zkf4.field AS action_state_value5,
179
- emitted_actions.*
247
+ emitted_actions.last_vrf_output,
248
+ emitted_actions.block_id,
249
+ emitted_actions.zkapp_id,
250
+ emitted_actions.state_hash,
251
+ emitted_actions.parent_hash,
252
+ emitted_actions.height,
253
+ emitted_actions.global_slot_since_genesis,
254
+ emitted_actions.global_slot_since_hard_fork,
255
+ emitted_actions.timestamp,
256
+ emitted_actions.chain_status,
257
+ emitted_actions.ledger_hash,
258
+ emitted_actions.distance_from_max_block_height,
259
+ emitted_actions.last_vrf_output,
260
+ emitted_actions.zkapp_account_update_id,
261
+ emitted_actions.sequence_number,
262
+ emitted_actions.zkapp_fee_payer_body_id,
263
+ emitted_actions.zkapp_account_updates_ids,
264
+ emitted_actions.authorization_kind,
265
+ emitted_actions.status,
266
+ emitted_actions.memo,
267
+ emitted_actions.hash,
268
+ emitted_actions.body_id,
269
+ emitted_actions.events_id,
270
+ emitted_actions.actions_id,
271
+ emitted_actions.account_update_event_id,
272
+ emitted_actions.event_element_ids,
273
+ emitted_actions.event_field_element_ids,
274
+ emitted_actions.event_field_elements_id,
275
+ emitted_actions.field_id,
276
+ emitted_actions.field_value
180
277
FROM
181
278
emitted_actions
182
279
INNER JOIN zkapp_accounts zkacc ON zkacc.id = emitted_actions.zkapp_id
@@ -216,7 +313,37 @@ export function getEventsQuery(
216
313
${ blocksAccessedCTE ( db_client , status , to , from ) } ,
217
314
${ emittedZkAppCommandsCTE ( db_client ) } ,
218
315
${ emittedEventsCTE ( db_client ) }
219
- SELECT *
316
+ SELECT
317
+ last_vrf_output,
318
+ block_id,
319
+ zkapp_id,
320
+ state_hash,
321
+ parent_hash,
322
+ height,
323
+ global_slot_since_genesis,
324
+ global_slot_since_hard_fork,
325
+ timestamp,
326
+ chain_status,
327
+ ledger_hash,
328
+ distance_from_max_block_height,
329
+ last_vrf_output,
330
+ zkapp_account_update_id,
331
+ sequence_number,
332
+ zkapp_fee_payer_body_id,
333
+ zkapp_account_updates_ids,
334
+ authorization_kind,
335
+ status,
336
+ memo,
337
+ hash,
338
+ body_id,
339
+ events_id,
340
+ actions_id,
341
+ account_update_event_id,
342
+ event_element_ids,
343
+ event_field_element_ids,
344
+ event_field_elements_id,
345
+ field_id,
346
+ field_value
220
347
FROM emitted_events
221
348
` ;
222
349
}
0 commit comments