@effectstream/db 0.100.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/assets-config.json +28 -0
  2. package/migrations/assets.ts +35 -0
  3. package/migrations/readme.md +37 -0
  4. package/migrations/system-down-v-0.0.0.sql +2 -0
  5. package/migrations/system-down-v-0.0.1.sql +14 -0
  6. package/migrations/system-up-v-0.0.0.sql +40 -0
  7. package/migrations/system-up-v-0.0.1.sql +117 -0
  8. package/migrations/system-up-v-0.0.2.sql +22 -0
  9. package/migrations/system-up-v-0.8.1.sql +5 -0
  10. package/migrations/system-version.ts +147 -0
  11. package/package.json +33 -0
  12. package/pgtypedconfig.json +21 -0
  13. package/scripts/Dockerfile +13 -0
  14. package/scripts/apply-migrations.ts +49 -0
  15. package/scripts/pgtyped-internal.ts +43 -0
  16. package/scripts/pgtyped-update.ts +119 -0
  17. package/scripts/start-pglite.ts +71 -0
  18. package/scripts/wait-for-db.ts +43 -0
  19. package/src/dynamic-tables.ts +110 -0
  20. package/src/event-indexing.ts +31 -0
  21. package/src/migrations.ts +28 -0
  22. package/src/mod.ts +65 -0
  23. package/src/pg-connection.test.ts +99 -0
  24. package/src/pg-connection.ts +211 -0
  25. package/src/register-events.ts +40 -0
  26. package/src/scheduled-constructors.ts +117 -0
  27. package/src/snapshot-handler.ts +164 -0
  28. package/src/sql/accounts.queries.ts +350 -0
  29. package/src/sql/accounts.sql +77 -0
  30. package/src/sql/achievements.queries.ts +74 -0
  31. package/src/sql/achievements.sql +17 -0
  32. package/src/sql/block-heights.queries.ts +205 -0
  33. package/src/sql/block-heights.sql +45 -0
  34. package/src/sql/events.queries.ts +201 -0
  35. package/src/sql/events.sql +41 -0
  36. package/src/sql/nonces.queries.ts +85 -0
  37. package/src/sql/nonces.sql +11 -0
  38. package/src/sql/primitives.queries.ts +35 -0
  39. package/src/sql/primitives.sql +4 -0
  40. package/src/sql/rollup_inputs.queries.ts +654 -0
  41. package/src/sql/rollup_inputs.sql +227 -0
  42. package/src/sql/statistics.queries.ts +160 -0
  43. package/src/sql/statistics.sql +55 -0
  44. package/src/sql/sync-protocols/page.queries.ts +140 -0
  45. package/src/sql/sync-protocols/page.sql +39 -0
  46. package/src/sql/system.queries.ts +356 -0
  47. package/src/sql/system.sql +75 -0
  48. package/src/sql/tables.queries.ts +89 -0
  49. package/src/sql/tables.sql +17 -0
  50. package/src/system.ts +41 -0
@@ -0,0 +1,654 @@
1
+ /** Types generated for queries found in "src/sql/rollup_inputs.sql" */
2
+ import { PreparedQuery } from '@pgtyped/runtime';
3
+
4
+ import type { Buffer } from 'node:buffer';
5
+
6
+ export type DateOrString = Date | string;
7
+
8
+ /** 'NewScheduledHeightData' parameters type */
9
+ export interface INewScheduledHeightDataParams {
10
+ caip2?: string | null | void;
11
+ from_address: string;
12
+ from_address_type: number;
13
+ future_block_height: number;
14
+ input_data: string;
15
+ origin_contract_address?: string | null | void;
16
+ origin_tx_hash?: Buffer | null | void;
17
+ primitive_name?: string | null | void;
18
+ }
19
+
20
+ /** 'NewScheduledHeightData' return type */
21
+ export type INewScheduledHeightDataResult = void;
22
+
23
+ /** 'NewScheduledHeightData' query type */
24
+ export interface INewScheduledHeightDataQuery {
25
+ params: INewScheduledHeightDataParams;
26
+ result: INewScheduledHeightDataResult;
27
+ }
28
+
29
+ const newScheduledHeightDataIR: any = {"usedParamSet":{"from_address":true,"from_address_type":true,"input_data":true,"primitive_name":true,"caip2":true,"origin_tx_hash":true,"origin_contract_address":true,"future_block_height":true},"params":[{"name":"from_address","required":true,"transform":{"type":"scalar"},"locs":[{"a":120,"b":133}]},{"name":"from_address_type","required":true,"transform":{"type":"scalar"},"locs":[{"a":136,"b":154}]},{"name":"input_data","required":true,"transform":{"type":"scalar"},"locs":[{"a":157,"b":168}]},{"name":"primitive_name","required":false,"transform":{"type":"scalar"},"locs":[{"a":354,"b":368}]},{"name":"caip2","required":false,"transform":{"type":"scalar"},"locs":[{"a":371,"b":376}]},{"name":"origin_tx_hash","required":false,"transform":{"type":"scalar"},"locs":[{"a":379,"b":393}]},{"name":"origin_contract_address","required":false,"transform":{"type":"scalar"},"locs":[{"a":403,"b":426}]},{"name":"future_block_height","required":true,"transform":{"type":"scalar"},"locs":[{"a":541,"b":561}]}],"statement":"WITH\n new_row AS (\n INSERT INTO effectstream.rollup_inputs(from_address, from_address_type, input_data)\n VALUES (:from_address!, :from_address_type!, :input_data!)\n RETURNING id\n ),\n insert_origin AS (\n INSERT INTO effectstream.rollup_input_origin(id, primitive_name, caip2, tx_hash, contract_address)\n SELECT (SELECT id FROM new_row), :primitive_name, :caip2, :origin_tx_hash::BYTEA, :origin_contract_address\n )\nINSERT INTO effectstream.rollup_input_future_block(id, future_block_height)\nSELECT (SELECT id FROM new_row), :future_block_height!"};
30
+
31
+ /**
32
+ * Query generated from SQL:
33
+ * ```
34
+ * WITH
35
+ * new_row AS (
36
+ * INSERT INTO effectstream.rollup_inputs(from_address, from_address_type, input_data)
37
+ * VALUES (:from_address!, :from_address_type!, :input_data!)
38
+ * RETURNING id
39
+ * ),
40
+ * insert_origin AS (
41
+ * INSERT INTO effectstream.rollup_input_origin(id, primitive_name, caip2, tx_hash, contract_address)
42
+ * SELECT (SELECT id FROM new_row), :primitive_name, :caip2, :origin_tx_hash::BYTEA, :origin_contract_address
43
+ * )
44
+ * INSERT INTO effectstream.rollup_input_future_block(id, future_block_height)
45
+ * SELECT (SELECT id FROM new_row), :future_block_height!
46
+ * ```
47
+ */
48
+ export const newScheduledHeightData = new PreparedQuery<INewScheduledHeightDataParams,INewScheduledHeightDataResult>(newScheduledHeightDataIR);
49
+
50
+
51
+ /** 'NewScheduledTimestampData' parameters type */
52
+ export interface INewScheduledTimestampDataParams {
53
+ from_address: string;
54
+ from_address_type: number;
55
+ future_ms_timestamp: DateOrString;
56
+ input_data: string;
57
+ }
58
+
59
+ /** 'NewScheduledTimestampData' return type */
60
+ export type INewScheduledTimestampDataResult = void;
61
+
62
+ /** 'NewScheduledTimestampData' query type */
63
+ export interface INewScheduledTimestampDataQuery {
64
+ params: INewScheduledTimestampDataParams;
65
+ result: INewScheduledTimestampDataResult;
66
+ }
67
+
68
+ const newScheduledTimestampDataIR: any = {"usedParamSet":{"from_address":true,"from_address_type":true,"input_data":true,"future_ms_timestamp":true},"params":[{"name":"from_address","required":true,"transform":{"type":"scalar"},"locs":[{"a":120,"b":133}]},{"name":"from_address_type","required":true,"transform":{"type":"scalar"},"locs":[{"a":136,"b":154}]},{"name":"input_data","required":true,"transform":{"type":"scalar"},"locs":[{"a":157,"b":168}]},{"name":"future_ms_timestamp","required":true,"transform":{"type":"scalar"},"locs":[{"a":490,"b":510}]}],"statement":"WITH\n new_row AS (\n INSERT INTO effectstream.rollup_inputs(from_address, from_address_type, input_data)\n VALUES (:from_address!, :from_address_type!, :input_data!)\n RETURNING id\n ),\n insert_origin AS (\n INSERT INTO effectstream.rollup_input_origin(id, primitive_name, caip2, tx_hash, contract_address)\n SELECT (SELECT id FROM new_row),null,null,null,null\n )\nINSERT INTO effectstream.rollup_input_future_timestamp(id, future_ms_timestamp)\nSELECT (SELECT id FROM new_row), :future_ms_timestamp!"};
69
+
70
+ /**
71
+ * Query generated from SQL:
72
+ * ```
73
+ * WITH
74
+ * new_row AS (
75
+ * INSERT INTO effectstream.rollup_inputs(from_address, from_address_type, input_data)
76
+ * VALUES (:from_address!, :from_address_type!, :input_data!)
77
+ * RETURNING id
78
+ * ),
79
+ * insert_origin AS (
80
+ * INSERT INTO effectstream.rollup_input_origin(id, primitive_name, caip2, tx_hash, contract_address)
81
+ * SELECT (SELECT id FROM new_row),null,null,null,null
82
+ * )
83
+ * INSERT INTO effectstream.rollup_input_future_timestamp(id, future_ms_timestamp)
84
+ * SELECT (SELECT id FROM new_row), :future_ms_timestamp!
85
+ * ```
86
+ */
87
+ export const newScheduledTimestampData = new PreparedQuery<INewScheduledTimestampDataParams,INewScheduledTimestampDataResult>(newScheduledTimestampDataIR);
88
+
89
+
90
+ /** 'NewGameInput' parameters type */
91
+ export interface INewGameInputParams {
92
+ block_height: number;
93
+ caip2: string;
94
+ effectstream_tx_hash: Buffer;
95
+ from_address: string;
96
+ from_address_type: number;
97
+ index_in_block: number;
98
+ input_data: string;
99
+ origin_contract_address?: string | null | void;
100
+ origin_tx_hash: Buffer;
101
+ primitive_name: string;
102
+ success: boolean;
103
+ }
104
+
105
+ /** 'NewGameInput' return type */
106
+ export type INewGameInputResult = void;
107
+
108
+ /** 'NewGameInput' query type */
109
+ export interface INewGameInputQuery {
110
+ params: INewGameInputParams;
111
+ result: INewGameInputResult;
112
+ }
113
+
114
+ const newGameInputIR: any = {"usedParamSet":{"from_address":true,"from_address_type":true,"input_data":true,"primitive_name":true,"caip2":true,"origin_tx_hash":true,"origin_contract_address":true,"success":true,"effectstream_tx_hash":true,"index_in_block":true,"block_height":true},"params":[{"name":"from_address","required":true,"transform":{"type":"scalar"},"locs":[{"a":120,"b":133}]},{"name":"from_address_type","required":true,"transform":{"type":"scalar"},"locs":[{"a":136,"b":154}]},{"name":"input_data","required":true,"transform":{"type":"scalar"},"locs":[{"a":157,"b":168}]},{"name":"primitive_name","required":true,"transform":{"type":"scalar"},"locs":[{"a":354,"b":369}]},{"name":"caip2","required":true,"transform":{"type":"scalar"},"locs":[{"a":372,"b":378}]},{"name":"origin_tx_hash","required":true,"transform":{"type":"scalar"},"locs":[{"a":381,"b":396}]},{"name":"origin_contract_address","required":false,"transform":{"type":"scalar"},"locs":[{"a":406,"b":429}]},{"name":"success","required":true,"transform":{"type":"scalar"},"locs":[{"a":578,"b":586}]},{"name":"effectstream_tx_hash","required":true,"transform":{"type":"scalar"},"locs":[{"a":589,"b":610}]},{"name":"index_in_block","required":true,"transform":{"type":"scalar"},"locs":[{"a":620,"b":635}]},{"name":"block_height","required":true,"transform":{"type":"scalar"},"locs":[{"a":638,"b":651}]}],"statement":"WITH\n new_row AS (\n INSERT INTO effectstream.rollup_inputs(from_address, from_address_type, input_data)\n VALUES (:from_address!, :from_address_type!, :input_data!)\n RETURNING id\n ),\n insert_origin AS (\n INSERT INTO effectstream.rollup_input_origin(id, primitive_name, caip2, tx_hash, contract_address)\n SELECT (SELECT id FROM new_row), :primitive_name!, :caip2!, :origin_tx_hash!::BYTEA, :origin_contract_address\n )\nINSERT INTO effectstream.rollup_input_result(id, success, effectstream_tx_hash, index_in_block, block_height)\nSELECT (SELECT id FROM new_row), :success!, :effectstream_tx_hash!::BYTEA, :index_in_block!, :block_height!"};
115
+
116
+ /**
117
+ * Query generated from SQL:
118
+ * ```
119
+ * WITH
120
+ * new_row AS (
121
+ * INSERT INTO effectstream.rollup_inputs(from_address, from_address_type, input_data)
122
+ * VALUES (:from_address!, :from_address_type!, :input_data!)
123
+ * RETURNING id
124
+ * ),
125
+ * insert_origin AS (
126
+ * INSERT INTO effectstream.rollup_input_origin(id, primitive_name, caip2, tx_hash, contract_address)
127
+ * SELECT (SELECT id FROM new_row), :primitive_name!, :caip2!, :origin_tx_hash!::BYTEA, :origin_contract_address
128
+ * )
129
+ * INSERT INTO effectstream.rollup_input_result(id, success, effectstream_tx_hash, index_in_block, block_height)
130
+ * SELECT (SELECT id FROM new_row), :success!, :effectstream_tx_hash!::BYTEA, :index_in_block!, :block_height!
131
+ * ```
132
+ */
133
+ export const newGameInput = new PreparedQuery<INewGameInputParams,INewGameInputResult>(newGameInputIR);
134
+
135
+
136
+ /** 'InsertGameInputResult' parameters type */
137
+ export interface IInsertGameInputResultParams {
138
+ block_height: number;
139
+ effectstream_tx_hash: Buffer;
140
+ id: number;
141
+ index_in_block: number;
142
+ success: boolean;
143
+ }
144
+
145
+ /** 'InsertGameInputResult' return type */
146
+ export type IInsertGameInputResultResult = void;
147
+
148
+ /** 'InsertGameInputResult' query type */
149
+ export interface IInsertGameInputResultQuery {
150
+ params: IInsertGameInputResultParams;
151
+ result: IInsertGameInputResultResult;
152
+ }
153
+
154
+ const insertGameInputResultIR: any = {"usedParamSet":{"id":true,"success":true,"effectstream_tx_hash":true,"index_in_block":true,"block_height":true},"params":[{"name":"id","required":true,"transform":{"type":"scalar"},"locs":[{"a":118,"b":121}]},{"name":"success","required":true,"transform":{"type":"scalar"},"locs":[{"a":124,"b":132}]},{"name":"effectstream_tx_hash","required":true,"transform":{"type":"scalar"},"locs":[{"a":135,"b":156}]},{"name":"index_in_block","required":true,"transform":{"type":"scalar"},"locs":[{"a":166,"b":181}]},{"name":"block_height","required":true,"transform":{"type":"scalar"},"locs":[{"a":184,"b":197}]}],"statement":"INSERT INTO effectstream.rollup_input_result(id, success, effectstream_tx_hash, index_in_block, block_height)\nVALUES (:id!, :success!, :effectstream_tx_hash!::BYTEA, :index_in_block!, :block_height!)"};
155
+
156
+ /**
157
+ * Query generated from SQL:
158
+ * ```
159
+ * INSERT INTO effectstream.rollup_input_result(id, success, effectstream_tx_hash, index_in_block, block_height)
160
+ * VALUES (:id!, :success!, :effectstream_tx_hash!::BYTEA, :index_in_block!, :block_height!)
161
+ * ```
162
+ */
163
+ export const insertGameInputResult = new PreparedQuery<IInsertGameInputResultParams,IInsertGameInputResultResult>(insertGameInputResultIR);
164
+
165
+
166
+ /** 'GetAllScheduledData' parameters type */
167
+ export interface IGetAllScheduledDataParams {
168
+ after_id?: number | null | void;
169
+ limit?: number | null | void;
170
+ }
171
+
172
+ /** 'GetAllScheduledData' return type */
173
+ export interface IGetAllScheduledDataResult {
174
+ caip2: string | null;
175
+ contract_address: string | null;
176
+ from_address: string | null;
177
+ from_address_type: number | null;
178
+ future_block_height: number | null;
179
+ future_ms_timestamp: Date | null;
180
+ id: number | null;
181
+ input_data: string | null;
182
+ origin_tx_hash: Buffer | null;
183
+ primitive_name: string | null;
184
+ }
185
+
186
+ /** 'GetAllScheduledData' query type */
187
+ export interface IGetAllScheduledDataQuery {
188
+ params: IGetAllScheduledDataParams;
189
+ result: IGetAllScheduledDataResult;
190
+ }
191
+
192
+ const getAllScheduledDataIR: any = {"usedParamSet":{"after_id":true,"limit":true},"params":[{"name":"after_id","required":false,"transform":{"type":"scalar"},"locs":[{"a":646,"b":654},{"a":1553,"b":1561}]},{"name":"limit","required":false,"transform":{"type":"scalar"},"locs":[{"a":1664,"b":1669}]}],"statement":"(\nSELECT\n rollup_inputs.id,\n NULL AS future_ms_timestamp,\n rollup_input_future_block.future_block_height,\n rollup_inputs.input_data,\n rollup_inputs.from_address,\n rollup_inputs.from_address_type,\n rollup_input_origin.primitive_name,\n rollup_input_origin.contract_address,\n rollup_input_origin.caip2,\n rollup_input_origin.tx_hash as \"origin_tx_hash\"\nFROM effectstream.rollup_inputs\nJOIN effectstream.rollup_input_origin ON effectstream.rollup_inputs.id = effectstream.rollup_input_origin.id\nJOIN effectstream.rollup_input_future_block ON effectstream.rollup_input_future_block.id = effectstream.rollup_inputs.id\nWHERE rollup_inputs.id > :after_id::INT\nORDER BY rollup_inputs.id ASC\n)\n\tUNION ALL \n(\nSELECT\n rollup_inputs.id,\n rollup_input_future_timestamp.future_ms_timestamp,\n NULL AS \"future_block_height\",\n rollup_inputs.input_data,\n rollup_inputs.from_address,\n rollup_inputs.from_address_type,\n rollup_input_origin.primitive_name,\n rollup_input_origin.contract_address,\n rollup_input_origin.caip2,\n rollup_input_origin.tx_hash as \"origin_tx_hash\"\nFROM effectstream.rollup_inputs\nJOIN effectstream.rollup_input_origin ON effectstream.rollup_inputs.id = effectstream.rollup_input_origin.id\nJOIN effectstream.rollup_input_future_timestamp ON effectstream.rollup_inputs.id = effectstream.rollup_input_future_timestamp.id\nLEFT OUTER JOIN effectstream.rollup_input_result\n ON (effectstream.rollup_input_result.id = effectstream.rollup_inputs.id)\nWHERE \n effectstream.rollup_input_result.id IS NULL AND\n effectstream.rollup_inputs.id > :after_id::INT\nORDER BY rollup_input_future_timestamp.future_ms_timestamp ASC\n)\nORDER BY id ASC\nLIMIT COALESCE(:limit, 999999)"};
193
+
194
+ /**
195
+ * Query generated from SQL:
196
+ * ```
197
+ * (
198
+ * SELECT
199
+ * rollup_inputs.id,
200
+ * NULL AS future_ms_timestamp,
201
+ * rollup_input_future_block.future_block_height,
202
+ * rollup_inputs.input_data,
203
+ * rollup_inputs.from_address,
204
+ * rollup_inputs.from_address_type,
205
+ * rollup_input_origin.primitive_name,
206
+ * rollup_input_origin.contract_address,
207
+ * rollup_input_origin.caip2,
208
+ * rollup_input_origin.tx_hash as "origin_tx_hash"
209
+ * FROM effectstream.rollup_inputs
210
+ * JOIN effectstream.rollup_input_origin ON effectstream.rollup_inputs.id = effectstream.rollup_input_origin.id
211
+ * JOIN effectstream.rollup_input_future_block ON effectstream.rollup_input_future_block.id = effectstream.rollup_inputs.id
212
+ * WHERE rollup_inputs.id > :after_id::INT
213
+ * ORDER BY rollup_inputs.id ASC
214
+ * )
215
+ * UNION ALL
216
+ * (
217
+ * SELECT
218
+ * rollup_inputs.id,
219
+ * rollup_input_future_timestamp.future_ms_timestamp,
220
+ * NULL AS "future_block_height",
221
+ * rollup_inputs.input_data,
222
+ * rollup_inputs.from_address,
223
+ * rollup_inputs.from_address_type,
224
+ * rollup_input_origin.primitive_name,
225
+ * rollup_input_origin.contract_address,
226
+ * rollup_input_origin.caip2,
227
+ * rollup_input_origin.tx_hash as "origin_tx_hash"
228
+ * FROM effectstream.rollup_inputs
229
+ * JOIN effectstream.rollup_input_origin ON effectstream.rollup_inputs.id = effectstream.rollup_input_origin.id
230
+ * JOIN effectstream.rollup_input_future_timestamp ON effectstream.rollup_inputs.id = effectstream.rollup_input_future_timestamp.id
231
+ * LEFT OUTER JOIN effectstream.rollup_input_result
232
+ * ON (effectstream.rollup_input_result.id = effectstream.rollup_inputs.id)
233
+ * WHERE
234
+ * effectstream.rollup_input_result.id IS NULL AND
235
+ * effectstream.rollup_inputs.id > :after_id::INT
236
+ * ORDER BY rollup_input_future_timestamp.future_ms_timestamp ASC
237
+ * )
238
+ * ORDER BY id ASC
239
+ * LIMIT COALESCE(:limit, 999999)
240
+ * ```
241
+ */
242
+ export const getAllScheduledData = new PreparedQuery<IGetAllScheduledDataParams,IGetAllScheduledDataResult>(getAllScheduledDataIR);
243
+
244
+
245
+ /** 'GetAllScheduledDataCount' parameters type */
246
+ export type IGetAllScheduledDataCountParams = void;
247
+
248
+ /** 'GetAllScheduledDataCount' return type */
249
+ export interface IGetAllScheduledDataCountResult {
250
+ total: string | null;
251
+ }
252
+
253
+ /** 'GetAllScheduledDataCount' query type */
254
+ export interface IGetAllScheduledDataCountQuery {
255
+ params: IGetAllScheduledDataCountParams;
256
+ result: IGetAllScheduledDataCountResult;
257
+ }
258
+
259
+ const getAllScheduledDataCountIR: any = {"usedParamSet":{},"params":[],"statement":"SELECT COUNT(*) as total FROM (\n (\n SELECT rollup_inputs.id\n FROM effectstream.rollup_inputs\n JOIN effectstream.rollup_input_future_block ON effectstream.rollup_input_future_block.id = effectstream.rollup_inputs.id\n )\n UNION ALL \n (\n SELECT rollup_inputs.id\n FROM effectstream.rollup_inputs\n JOIN effectstream.rollup_input_future_timestamp ON effectstream.rollup_inputs.id = effectstream.rollup_input_future_timestamp.id\n LEFT OUTER JOIN effectstream.rollup_input_result\n ON (effectstream.rollup_input_result.id = effectstream.rollup_inputs.id)\n WHERE rollup_input_result.id IS NULL\n )\n) AS scheduled_data"};
260
+
261
+ /**
262
+ * Query generated from SQL:
263
+ * ```
264
+ * SELECT COUNT(*) as total FROM (
265
+ * (
266
+ * SELECT rollup_inputs.id
267
+ * FROM effectstream.rollup_inputs
268
+ * JOIN effectstream.rollup_input_future_block ON effectstream.rollup_input_future_block.id = effectstream.rollup_inputs.id
269
+ * )
270
+ * UNION ALL
271
+ * (
272
+ * SELECT rollup_inputs.id
273
+ * FROM effectstream.rollup_inputs
274
+ * JOIN effectstream.rollup_input_future_timestamp ON effectstream.rollup_inputs.id = effectstream.rollup_input_future_timestamp.id
275
+ * LEFT OUTER JOIN effectstream.rollup_input_result
276
+ * ON (effectstream.rollup_input_result.id = effectstream.rollup_inputs.id)
277
+ * WHERE rollup_input_result.id IS NULL
278
+ * )
279
+ * ) AS scheduled_data
280
+ * ```
281
+ */
282
+ export const getAllScheduledDataCount = new PreparedQuery<IGetAllScheduledDataCountParams,IGetAllScheduledDataCountResult>(getAllScheduledDataCountIR);
283
+
284
+
285
+ /** 'GetFutureGameInputByBlockHeight' parameters type */
286
+ export interface IGetFutureGameInputByBlockHeightParams {
287
+ block_height: number;
288
+ }
289
+
290
+ /** 'GetFutureGameInputByBlockHeight' return type */
291
+ export interface IGetFutureGameInputByBlockHeightResult {
292
+ caip2: string | null;
293
+ contract_address: string | null;
294
+ from_address: string;
295
+ from_address_type: number;
296
+ future_block_height: number;
297
+ id: number;
298
+ input_data: string;
299
+ origin_tx_hash: Buffer | null;
300
+ primitive_name: string | null;
301
+ }
302
+
303
+ /** 'GetFutureGameInputByBlockHeight' query type */
304
+ export interface IGetFutureGameInputByBlockHeightQuery {
305
+ params: IGetFutureGameInputByBlockHeightParams;
306
+ result: IGetFutureGameInputByBlockHeightResult;
307
+ }
308
+
309
+ const getFutureGameInputByBlockHeightIR: any = {"usedParamSet":{"block_height":true},"params":[{"name":"block_height","required":true,"transform":{"type":"scalar"},"locs":[{"a":642,"b":655}]}],"statement":"SELECT\n rollup_inputs.id,\n rollup_input_future_block.future_block_height,\n rollup_inputs.input_data,\n rollup_inputs.from_address,\n rollup_inputs.from_address_type,\n rollup_input_origin.primitive_name,\n rollup_input_origin.contract_address,\n rollup_input_origin.caip2,\n rollup_input_origin.tx_hash as \"origin_tx_hash\"\nFROM effectstream.rollup_inputs\nJOIN effectstream.rollup_input_origin ON effectstream.rollup_inputs.id = effectstream.rollup_input_origin.id\nJOIN effectstream.rollup_input_future_block ON effectstream.rollup_input_future_block.id = effectstream.rollup_inputs.id\nWHERE rollup_input_future_block.future_block_height = :block_height!\nORDER BY rollup_inputs.id ASC"};
310
+
311
+ /**
312
+ * Query generated from SQL:
313
+ * ```
314
+ * SELECT
315
+ * rollup_inputs.id,
316
+ * rollup_input_future_block.future_block_height,
317
+ * rollup_inputs.input_data,
318
+ * rollup_inputs.from_address,
319
+ * rollup_inputs.from_address_type,
320
+ * rollup_input_origin.primitive_name,
321
+ * rollup_input_origin.contract_address,
322
+ * rollup_input_origin.caip2,
323
+ * rollup_input_origin.tx_hash as "origin_tx_hash"
324
+ * FROM effectstream.rollup_inputs
325
+ * JOIN effectstream.rollup_input_origin ON effectstream.rollup_inputs.id = effectstream.rollup_input_origin.id
326
+ * JOIN effectstream.rollup_input_future_block ON effectstream.rollup_input_future_block.id = effectstream.rollup_inputs.id
327
+ * WHERE rollup_input_future_block.future_block_height = :block_height!
328
+ * ORDER BY rollup_inputs.id ASC
329
+ * ```
330
+ */
331
+ export const getFutureGameInputByBlockHeight = new PreparedQuery<IGetFutureGameInputByBlockHeightParams,IGetFutureGameInputByBlockHeightResult>(getFutureGameInputByBlockHeightIR);
332
+
333
+
334
+ /** 'GetFutureGameInputByMaxTimestamp' parameters type */
335
+ export interface IGetFutureGameInputByMaxTimestampParams {
336
+ max_timestamp: DateOrString;
337
+ }
338
+
339
+ /** 'GetFutureGameInputByMaxTimestamp' return type */
340
+ export interface IGetFutureGameInputByMaxTimestampResult {
341
+ caip2: string | null;
342
+ contract_address: string | null;
343
+ from_address: string;
344
+ from_address_type: number;
345
+ future_ms_timestamp: Date;
346
+ id: number;
347
+ input_data: string;
348
+ origin_tx_hash: Buffer | null;
349
+ primitive_name: string | null;
350
+ }
351
+
352
+ /** 'GetFutureGameInputByMaxTimestamp' query type */
353
+ export interface IGetFutureGameInputByMaxTimestampQuery {
354
+ params: IGetFutureGameInputByMaxTimestampParams;
355
+ result: IGetFutureGameInputByMaxTimestampResult;
356
+ }
357
+
358
+ const getFutureGameInputByMaxTimestampIR: any = {"usedParamSet":{"max_timestamp":true},"params":[{"name":"max_timestamp","required":true,"transform":{"type":"scalar"},"locs":[{"a":783,"b":797}]}],"statement":"SELECT\n rollup_inputs.id,\n rollup_input_future_timestamp.future_ms_timestamp,\n rollup_inputs.input_data,\n rollup_inputs.from_address,\n rollup_inputs.from_address_type,\n rollup_input_origin.primitive_name,\n rollup_input_origin.contract_address,\n rollup_input_origin.caip2,\n rollup_input_origin.tx_hash as \"origin_tx_hash\"\nFROM effectstream.rollup_inputs\nJOIN effectstream.rollup_input_origin ON effectstream.rollup_inputs.id = effectstream.rollup_input_origin.id\nJOIN effectstream.rollup_input_future_timestamp ON effectstream.rollup_inputs.id = effectstream.rollup_input_future_timestamp.id\nLEFT OUTER JOIN effectstream.rollup_input_result\n ON (effectstream.rollup_input_result.id = effectstream.rollup_inputs.id)\nWHERE rollup_input_future_timestamp.future_ms_timestamp <= :max_timestamp! AND\n effectstream.rollup_input_result.id IS NULL\nORDER BY rollup_input_future_timestamp.future_ms_timestamp ASC"};
359
+
360
+ /**
361
+ * Query generated from SQL:
362
+ * ```
363
+ * SELECT
364
+ * rollup_inputs.id,
365
+ * rollup_input_future_timestamp.future_ms_timestamp,
366
+ * rollup_inputs.input_data,
367
+ * rollup_inputs.from_address,
368
+ * rollup_inputs.from_address_type,
369
+ * rollup_input_origin.primitive_name,
370
+ * rollup_input_origin.contract_address,
371
+ * rollup_input_origin.caip2,
372
+ * rollup_input_origin.tx_hash as "origin_tx_hash"
373
+ * FROM effectstream.rollup_inputs
374
+ * JOIN effectstream.rollup_input_origin ON effectstream.rollup_inputs.id = effectstream.rollup_input_origin.id
375
+ * JOIN effectstream.rollup_input_future_timestamp ON effectstream.rollup_inputs.id = effectstream.rollup_input_future_timestamp.id
376
+ * LEFT OUTER JOIN effectstream.rollup_input_result
377
+ * ON (effectstream.rollup_input_result.id = effectstream.rollup_inputs.id)
378
+ * WHERE rollup_input_future_timestamp.future_ms_timestamp <= :max_timestamp! AND
379
+ * effectstream.rollup_input_result.id IS NULL
380
+ * ORDER BY rollup_input_future_timestamp.future_ms_timestamp ASC
381
+ * ```
382
+ */
383
+ export const getFutureGameInputByMaxTimestamp = new PreparedQuery<IGetFutureGameInputByMaxTimestampParams,IGetFutureGameInputByMaxTimestampResult>(getFutureGameInputByMaxTimestampIR);
384
+
385
+
386
+ /** 'GetGameInputResultByBlockHeight' parameters type */
387
+ export interface IGetGameInputResultByBlockHeightParams {
388
+ block_height: number;
389
+ }
390
+
391
+ /** 'GetGameInputResultByBlockHeight' return type */
392
+ export interface IGetGameInputResultByBlockHeightResult {
393
+ block_height: number;
394
+ contract_address: string | null;
395
+ effectstream_block_hash: Buffer | null;
396
+ effectstream_tx_hash: Buffer;
397
+ from_address: string;
398
+ from_address_type: number;
399
+ id: number;
400
+ index_in_block: number;
401
+ input_data: string;
402
+ success: boolean;
403
+ }
404
+
405
+ /** 'GetGameInputResultByBlockHeight' query type */
406
+ export interface IGetGameInputResultByBlockHeightQuery {
407
+ params: IGetGameInputResultByBlockHeightParams;
408
+ result: IGetGameInputResultByBlockHeightResult;
409
+ }
410
+
411
+ const getGameInputResultByBlockHeightIR: any = {"usedParamSet":{"block_height":true},"params":[{"name":"block_height","required":true,"transform":{"type":"scalar"},"locs":[{"a":781,"b":794}]}],"statement":"SELECT\n rollup_inputs.id,\n effectstream_blocks.block_height,\n rollup_inputs.input_data,\n rollup_inputs.from_address,\n rollup_inputs.from_address_type,\n effectstream_blocks.effectstream_block_hash,\n rollup_input_origin.contract_address,\n rollup_input_result.effectstream_tx_hash,\n rollup_input_result.index_in_block,\n rollup_input_result.success\nFROM effectstream.rollup_inputs\nJOIN effectstream.rollup_input_origin ON effectstream.rollup_inputs.id = effectstream.rollup_input_origin.id\nJOIN effectstream.rollup_input_result ON effectstream.rollup_inputs.id = effectstream.rollup_input_result.id\nJOIN effectstream.effectstream_blocks ON effectstream.rollup_input_result.block_height = effectstream.effectstream_blocks.block_height\nWHERE effectstream_blocks.block_height = :block_height!"};
412
+
413
+ /**
414
+ * Query generated from SQL:
415
+ * ```
416
+ * SELECT
417
+ * rollup_inputs.id,
418
+ * effectstream_blocks.block_height,
419
+ * rollup_inputs.input_data,
420
+ * rollup_inputs.from_address,
421
+ * rollup_inputs.from_address_type,
422
+ * effectstream_blocks.effectstream_block_hash,
423
+ * rollup_input_origin.contract_address,
424
+ * rollup_input_result.effectstream_tx_hash,
425
+ * rollup_input_result.index_in_block,
426
+ * rollup_input_result.success
427
+ * FROM effectstream.rollup_inputs
428
+ * JOIN effectstream.rollup_input_origin ON effectstream.rollup_inputs.id = effectstream.rollup_input_origin.id
429
+ * JOIN effectstream.rollup_input_result ON effectstream.rollup_inputs.id = effectstream.rollup_input_result.id
430
+ * JOIN effectstream.effectstream_blocks ON effectstream.rollup_input_result.block_height = effectstream.effectstream_blocks.block_height
431
+ * WHERE effectstream_blocks.block_height = :block_height!
432
+ * ```
433
+ */
434
+ export const getGameInputResultByBlockHeight = new PreparedQuery<IGetGameInputResultByBlockHeightParams,IGetGameInputResultByBlockHeightResult>(getGameInputResultByBlockHeightIR);
435
+
436
+
437
+ /** 'GetGameInputResultByTxHash' parameters type */
438
+ export interface IGetGameInputResultByTxHashParams {
439
+ tx_hash: Buffer;
440
+ }
441
+
442
+ /** 'GetGameInputResultByTxHash' return type */
443
+ export interface IGetGameInputResultByTxHashResult {
444
+ block_height: number;
445
+ effectstream_block_hash: Buffer | null;
446
+ effectstream_tx_hash: Buffer;
447
+ from_address: string;
448
+ from_address_type: number;
449
+ id: number;
450
+ index_in_block: number;
451
+ input_data: string;
452
+ success: boolean;
453
+ }
454
+
455
+ /** 'GetGameInputResultByTxHash' query type */
456
+ export interface IGetGameInputResultByTxHashQuery {
457
+ params: IGetGameInputResultByTxHashParams;
458
+ result: IGetGameInputResultByTxHashResult;
459
+ }
460
+
461
+ const getGameInputResultByTxHashIR: any = {"usedParamSet":{"tx_hash":true},"params":[{"name":"tx_hash","required":true,"transform":{"type":"scalar"},"locs":[{"a":640,"b":648}]}],"statement":"SELECT\n rollup_inputs.id,\n effectstream_blocks.block_height,\n rollup_inputs.input_data,\n rollup_inputs.from_address,\n rollup_inputs.from_address_type,\n effectstream_blocks.effectstream_block_hash,\n rollup_input_result.effectstream_tx_hash,\n rollup_input_result.index_in_block,\n rollup_input_result.success\nFROM effectstream.rollup_inputs\nJOIN effectstream.rollup_input_result ON effectstream.rollup_inputs.id = effectstream.rollup_input_result.id\nJOIN effectstream.effectstream_blocks ON effectstream.rollup_input_result.block_height = effectstream.effectstream_blocks.block_height\nWHERE rollup_input_result.effectstream_tx_hash = :tx_hash!"};
462
+
463
+ /**
464
+ * Query generated from SQL:
465
+ * ```
466
+ * SELECT
467
+ * rollup_inputs.id,
468
+ * effectstream_blocks.block_height,
469
+ * rollup_inputs.input_data,
470
+ * rollup_inputs.from_address,
471
+ * rollup_inputs.from_address_type,
472
+ * effectstream_blocks.effectstream_block_hash,
473
+ * rollup_input_result.effectstream_tx_hash,
474
+ * rollup_input_result.index_in_block,
475
+ * rollup_input_result.success
476
+ * FROM effectstream.rollup_inputs
477
+ * JOIN effectstream.rollup_input_result ON effectstream.rollup_inputs.id = effectstream.rollup_input_result.id
478
+ * JOIN effectstream.effectstream_blocks ON effectstream.rollup_input_result.block_height = effectstream.effectstream_blocks.block_height
479
+ * WHERE rollup_input_result.effectstream_tx_hash = :tx_hash!
480
+ * ```
481
+ */
482
+ export const getGameInputResultByTxHash = new PreparedQuery<IGetGameInputResultByTxHashParams,IGetGameInputResultByTxHashResult>(getGameInputResultByTxHashIR);
483
+
484
+
485
+ /** 'GetGameInputResultByAddress' parameters type */
486
+ export interface IGetGameInputResultByAddressParams {
487
+ block_height: number;
488
+ from_address: string;
489
+ }
490
+
491
+ /** 'GetGameInputResultByAddress' return type */
492
+ export interface IGetGameInputResultByAddressResult {
493
+ block_height: number;
494
+ effectstream_block_hash: Buffer | null;
495
+ effectstream_tx_hash: Buffer;
496
+ from_address: string;
497
+ from_address_type: number;
498
+ id: number;
499
+ index_in_block: number;
500
+ input_data: string;
501
+ success: boolean;
502
+ }
503
+
504
+ /** 'GetGameInputResultByAddress' query type */
505
+ export interface IGetGameInputResultByAddressQuery {
506
+ params: IGetGameInputResultByAddressParams;
507
+ result: IGetGameInputResultByAddressResult;
508
+ }
509
+
510
+ const getGameInputResultByAddressIR: any = {"usedParamSet":{"block_height":true,"from_address":true},"params":[{"name":"block_height","required":true,"transform":{"type":"scalar"},"locs":[{"a":634,"b":647}]},{"name":"from_address","required":true,"transform":{"type":"scalar"},"locs":[{"a":738,"b":751}]}],"statement":"SELECT\n rollup_inputs.id,\n effectstream_blocks.block_height,\n rollup_inputs.input_data,\n rollup_inputs.from_address,\n rollup_inputs.from_address_type,\n effectstream_blocks.effectstream_block_hash,\n rollup_input_result.effectstream_tx_hash,\n rollup_input_result.index_in_block,\n rollup_input_result.success\nFROM effectstream.rollup_inputs\nJOIN effectstream.rollup_input_result ON effectstream.rollup_inputs.id = effectstream.rollup_input_result.id\nJOIN effectstream.effectstream_blocks ON effectstream.rollup_input_result.block_height = effectstream.effectstream_blocks.block_height\nWHERE\n rollup_input_result.block_height = :block_height! AND\n rollup_input_result.success = TRUE AND\n lower(rollup_inputs.from_address) = lower(:from_address!)"};
511
+
512
+ /**
513
+ * Query generated from SQL:
514
+ * ```
515
+ * SELECT
516
+ * rollup_inputs.id,
517
+ * effectstream_blocks.block_height,
518
+ * rollup_inputs.input_data,
519
+ * rollup_inputs.from_address,
520
+ * rollup_inputs.from_address_type,
521
+ * effectstream_blocks.effectstream_block_hash,
522
+ * rollup_input_result.effectstream_tx_hash,
523
+ * rollup_input_result.index_in_block,
524
+ * rollup_input_result.success
525
+ * FROM effectstream.rollup_inputs
526
+ * JOIN effectstream.rollup_input_result ON effectstream.rollup_inputs.id = effectstream.rollup_input_result.id
527
+ * JOIN effectstream.effectstream_blocks ON effectstream.rollup_input_result.block_height = effectstream.effectstream_blocks.block_height
528
+ * WHERE
529
+ * rollup_input_result.block_height = :block_height! AND
530
+ * rollup_input_result.success = TRUE AND
531
+ * lower(rollup_inputs.from_address) = lower(:from_address!)
532
+ * ```
533
+ */
534
+ export const getGameInputResultByAddress = new PreparedQuery<IGetGameInputResultByAddressParams,IGetGameInputResultByAddressResult>(getGameInputResultByAddressIR);
535
+
536
+
537
+ /** 'RemoveScheduledBlockData' parameters type */
538
+ export interface IRemoveScheduledBlockDataParams {
539
+ block_height: number;
540
+ input_data: string;
541
+ }
542
+
543
+ /** 'RemoveScheduledBlockData' return type */
544
+ export type IRemoveScheduledBlockDataResult = void;
545
+
546
+ /** 'RemoveScheduledBlockData' query type */
547
+ export interface IRemoveScheduledBlockDataQuery {
548
+ params: IRemoveScheduledBlockDataParams;
549
+ result: IRemoveScheduledBlockDataResult;
550
+ }
551
+
552
+ const removeScheduledBlockDataIR: any = {"usedParamSet":{"input_data":true,"block_height":true},"params":[{"name":"input_data","required":true,"transform":{"type":"scalar"},"locs":[{"a":60,"b":71}]},{"name":"block_height","required":true,"transform":{"type":"scalar"},"locs":[{"a":260,"b":273}]}],"statement":"DELETE FROM effectstream.rollup_inputs\nWHERE\n input_data = :input_data! AND\n rollup_inputs.id IN (\n SELECT rollup_input_future_block.id\n FROM effectstream.rollup_input_future_block\n WHERE effectstream.rollup_input_future_block.future_block_height = :block_height!\n)"};
553
+
554
+ /**
555
+ * Query generated from SQL:
556
+ * ```
557
+ * DELETE FROM effectstream.rollup_inputs
558
+ * WHERE
559
+ * input_data = :input_data! AND
560
+ * rollup_inputs.id IN (
561
+ * SELECT rollup_input_future_block.id
562
+ * FROM effectstream.rollup_input_future_block
563
+ * WHERE effectstream.rollup_input_future_block.future_block_height = :block_height!
564
+ * )
565
+ * ```
566
+ */
567
+ export const removeScheduledBlockData = new PreparedQuery<IRemoveScheduledBlockDataParams,IRemoveScheduledBlockDataResult>(removeScheduledBlockDataIR);
568
+
569
+
570
+ /** 'RemoveScheduledTimestampData' parameters type */
571
+ export interface IRemoveScheduledTimestampDataParams {
572
+ input_data: string;
573
+ ms_timestamp: DateOrString;
574
+ }
575
+
576
+ /** 'RemoveScheduledTimestampData' return type */
577
+ export type IRemoveScheduledTimestampDataResult = void;
578
+
579
+ /** 'RemoveScheduledTimestampData' query type */
580
+ export interface IRemoveScheduledTimestampDataQuery {
581
+ params: IRemoveScheduledTimestampDataParams;
582
+ result: IRemoveScheduledTimestampDataResult;
583
+ }
584
+
585
+ const removeScheduledTimestampDataIR: any = {"usedParamSet":{"input_data":true,"ms_timestamp":true},"params":[{"name":"input_data","required":true,"transform":{"type":"scalar"},"locs":[{"a":60,"b":71}]},{"name":"ms_timestamp","required":true,"transform":{"type":"scalar"},"locs":[{"a":272,"b":285}]}],"statement":"DELETE FROM effectstream.rollup_inputs\nWHERE\n input_data = :input_data! AND\n rollup_inputs.id IN (\n SELECT rollup_input_future_timestamp.id\n FROM effectstream.rollup_input_future_timestamp\n WHERE effectstream.rollup_input_future_timestamp.future_ms_timestamp = :ms_timestamp!\n)"};
586
+
587
+ /**
588
+ * Query generated from SQL:
589
+ * ```
590
+ * DELETE FROM effectstream.rollup_inputs
591
+ * WHERE
592
+ * input_data = :input_data! AND
593
+ * rollup_inputs.id IN (
594
+ * SELECT rollup_input_future_timestamp.id
595
+ * FROM effectstream.rollup_input_future_timestamp
596
+ * WHERE effectstream.rollup_input_future_timestamp.future_ms_timestamp = :ms_timestamp!
597
+ * )
598
+ * ```
599
+ */
600
+ export const removeScheduledTimestampData = new PreparedQuery<IRemoveScheduledTimestampDataParams,IRemoveScheduledTimestampDataResult>(removeScheduledTimestampDataIR);
601
+
602
+
603
+ /** 'RemoveAllScheduledDataByInputData' parameters type */
604
+ export interface IRemoveAllScheduledDataByInputDataParams {
605
+ input_data: string;
606
+ }
607
+
608
+ /** 'RemoveAllScheduledDataByInputData' return type */
609
+ export type IRemoveAllScheduledDataByInputDataResult = void;
610
+
611
+ /** 'RemoveAllScheduledDataByInputData' query type */
612
+ export interface IRemoveAllScheduledDataByInputDataQuery {
613
+ params: IRemoveAllScheduledDataByInputDataParams;
614
+ result: IRemoveAllScheduledDataByInputDataResult;
615
+ }
616
+
617
+ const removeAllScheduledDataByInputDataIR: any = {"usedParamSet":{"input_data":true},"params":[{"name":"input_data","required":true,"transform":{"type":"scalar"},"locs":[{"a":58,"b":69}]}],"statement":"DELETE FROM effectstream.rollup_inputs\nWHERE input_data = :input_data!"};
618
+
619
+ /**
620
+ * Query generated from SQL:
621
+ * ```
622
+ * DELETE FROM effectstream.rollup_inputs
623
+ * WHERE input_data = :input_data!
624
+ * ```
625
+ */
626
+ export const removeAllScheduledDataByInputData = new PreparedQuery<IRemoveAllScheduledDataByInputDataParams,IRemoveAllScheduledDataByInputDataResult>(removeAllScheduledDataByInputDataIR);
627
+
628
+
629
+ /** 'DeleteScheduled' parameters type */
630
+ export interface IDeleteScheduledParams {
631
+ id: number;
632
+ }
633
+
634
+ /** 'DeleteScheduled' return type */
635
+ export type IDeleteScheduledResult = void;
636
+
637
+ /** 'DeleteScheduled' query type */
638
+ export interface IDeleteScheduledQuery {
639
+ params: IDeleteScheduledParams;
640
+ result: IDeleteScheduledResult;
641
+ }
642
+
643
+ const deleteScheduledIR: any = {"usedParamSet":{"id":true},"params":[{"name":"id","required":true,"transform":{"type":"scalar"},"locs":[{"a":50,"b":53}]}],"statement":"DELETE FROM effectstream.rollup_inputs\nWHERE id = :id!"};
644
+
645
+ /**
646
+ * Query generated from SQL:
647
+ * ```
648
+ * DELETE FROM effectstream.rollup_inputs
649
+ * WHERE id = :id!
650
+ * ```
651
+ */
652
+ export const deleteScheduled = new PreparedQuery<IDeleteScheduledParams,IDeleteScheduledResult>(deleteScheduledIR);
653
+
654
+