@qubic.ts/contracts 0.1.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 (83) hide show
  1. package/package.json +17 -0
  2. package/scripts/generate-artifacts.ts +178 -0
  3. package/src/codec/entry-input.test.ts +198 -0
  4. package/src/codec/entry-input.ts +959 -0
  5. package/src/codec/index.ts +8 -0
  6. package/src/generated/contracts/CCF.registry.json +741 -0
  7. package/src/generated/contracts/CCF.types.ts +307 -0
  8. package/src/generated/contracts/GQMPROP.registry.json +518 -0
  9. package/src/generated/contracts/GQMPROP.types.ts +238 -0
  10. package/src/generated/contracts/MLM.registry.json +8 -0
  11. package/src/generated/contracts/MLM.types.ts +42 -0
  12. package/src/generated/contracts/MSVAULT.registry.json +1162 -0
  13. package/src/generated/contracts/MSVAULT.types.ts +598 -0
  14. package/src/generated/contracts/NOST.registry.json +1131 -0
  15. package/src/generated/contracts/NOST.types.ts +515 -0
  16. package/src/generated/contracts/QBAY.registry.json +1492 -0
  17. package/src/generated/contracts/QBAY.types.ts +681 -0
  18. package/src/generated/contracts/QBOND.registry.json +734 -0
  19. package/src/generated/contracts/QBOND.types.ts +397 -0
  20. package/src/generated/contracts/QDRAW.registry.json +112 -0
  21. package/src/generated/contracts/QDRAW.types.ts +110 -0
  22. package/src/generated/contracts/QDUEL.registry.json +466 -0
  23. package/src/generated/contracts/QDUEL.types.ts +265 -0
  24. package/src/generated/contracts/QEARN.registry.json +458 -0
  25. package/src/generated/contracts/QEARN.types.ts +265 -0
  26. package/src/generated/contracts/QIP.registry.json +483 -0
  27. package/src/generated/contracts/QIP.types.ts +194 -0
  28. package/src/generated/contracts/QRAFFLE.registry.json +916 -0
  29. package/src/generated/contracts/QRAFFLE.types.ts +446 -0
  30. package/src/generated/contracts/QRP.registry.json +139 -0
  31. package/src/generated/contracts/QRP.types.ts +144 -0
  32. package/src/generated/contracts/QRWA.registry.json +765 -0
  33. package/src/generated/contracts/QRWA.types.ts +402 -0
  34. package/src/generated/contracts/QSWAP.registry.json +941 -0
  35. package/src/generated/contracts/QSWAP.types.ts +479 -0
  36. package/src/generated/contracts/QTF.registry.json +480 -0
  37. package/src/generated/contracts/QTF.types.ts +346 -0
  38. package/src/generated/contracts/QUOTTERY.registry.json +530 -0
  39. package/src/generated/contracts/QUOTTERY.types.ts +262 -0
  40. package/src/generated/contracts/QUTIL.registry.json +1378 -0
  41. package/src/generated/contracts/QUTIL.types.ts +612 -0
  42. package/src/generated/contracts/QVAULT.registry.json +527 -0
  43. package/src/generated/contracts/QVAULT.types.ts +309 -0
  44. package/src/generated/contracts/QX.registry.json +610 -0
  45. package/src/generated/contracts/QX.types.ts +323 -0
  46. package/src/generated/contracts/RANDOM.registry.json +51 -0
  47. package/src/generated/contracts/RANDOM.types.ts +65 -0
  48. package/src/generated/contracts/RL.registry.json +490 -0
  49. package/src/generated/contracts/RL.types.ts +304 -0
  50. package/src/generated/contracts/SWATCH.registry.json +8 -0
  51. package/src/generated/contracts/SWATCH.types.ts +42 -0
  52. package/src/generated/core-registry.codecs.ts +6622 -0
  53. package/src/generated/core-registry.source.json +14342 -0
  54. package/src/generated/core-registry.ts +14349 -0
  55. package/src/generated/core-registry.types.ts +100 -0
  56. package/src/generator/contract-codecs.fixture.test.ts +17 -0
  57. package/src/generator/contract-codecs.test.ts +115 -0
  58. package/src/generator/contract-codecs.ts +416 -0
  59. package/src/generator/index.ts +14 -0
  60. package/src/generator/per-contract-files.test.ts +70 -0
  61. package/src/generator/per-contract-files.ts +122 -0
  62. package/src/generator/registry-runtime.fixture.test.ts +17 -0
  63. package/src/generator/registry-runtime.test.ts +55 -0
  64. package/src/generator/registry-runtime.ts +28 -0
  65. package/src/generator/registry-types.fixture.test.ts +17 -0
  66. package/src/generator/registry-types.test.ts +55 -0
  67. package/src/generator/registry-types.ts +75 -0
  68. package/src/index.test.ts +29 -0
  69. package/src/index.ts +49 -0
  70. package/src/registry/index.ts +17 -0
  71. package/src/registry/io-layout.fixture.test.ts +24 -0
  72. package/src/registry/io-layout.test.ts +93 -0
  73. package/src/registry/io-layout.ts +57 -0
  74. package/src/registry/normalize.ts +61 -0
  75. package/src/registry/schema.fixture.test.ts +21 -0
  76. package/src/registry/schema.ts +97 -0
  77. package/src/registry/types.ts +98 -0
  78. package/test/fixtures/io-layout.contracts.json +32 -0
  79. package/test/fixtures/io-layout.layouts.json +14 -0
  80. package/test/fixtures/registry.sample.codecs.ts +100 -0
  81. package/test/fixtures/registry.sample.json +27 -0
  82. package/test/fixtures/registry.sample.runtime.ts +54 -0
  83. package/test/fixtures/registry.sample.types.ts +16 -0
@@ -0,0 +1,346 @@
1
+ /* eslint-disable */
2
+ /* This file is generated. Do not edit manually. */
3
+
4
+ export type QTF_BuyTicket_input = {
5
+ readonly randomValues: ReadonlyArray<number>;
6
+ };
7
+ export type QTF_BuyTicket_output = {
8
+ readonly returnCode: number;
9
+ };
10
+ export type QTF_EstimatePrizePayouts_input = {
11
+ readonly k2WinnerCount: bigint;
12
+ readonly k3WinnerCount: bigint;
13
+ };
14
+ export type QTF_EstimatePrizePayouts_output = {
15
+ readonly k2PayoutPerWinner: bigint;
16
+ readonly k3PayoutPerWinner: bigint;
17
+ readonly k2MinFloor: bigint;
18
+ readonly k3MinFloor: bigint;
19
+ readonly perWinnerCap: bigint;
20
+ readonly totalRevenue: bigint;
21
+ readonly k2Pool: bigint;
22
+ readonly k3Pool: bigint;
23
+ };
24
+ export type QTF_GetDrawHour_input = Record<string, never>;
25
+ export type QTF_GetDrawHour_output = {
26
+ readonly drawHour: number;
27
+ };
28
+ export type QTF_GetFees_input = Record<string, never>;
29
+ export type QTF_GetFees_output = {
30
+ readonly teamFeePercent: number;
31
+ readonly distributionFeePercent: number;
32
+ readonly winnerFeePercent: number;
33
+ readonly burnPercent: number;
34
+ readonly returnCode: number;
35
+ };
36
+ export type QTF_GetNextEpochData_input = Record<string, never>;
37
+ export type QTF_GetNextEpochData_output = {
38
+ readonly nextEpochData: QTF_NextEpochData;
39
+ };
40
+ export type QTF_GetPools_input = Record<string, never>;
41
+ export type QTF_GetPools_output = {
42
+ readonly pools: QTF_PoolsSnapshot;
43
+ };
44
+ export type QTF_GetSchedule_input = Record<string, never>;
45
+ export type QTF_GetSchedule_output = {
46
+ readonly schedule: number;
47
+ };
48
+ export type QTF_GetState_input = Record<string, never>;
49
+ export type QTF_GetState_output = {
50
+ readonly currentState: number;
51
+ };
52
+ export type QTF_GetTicketPrice_input = Record<string, never>;
53
+ export type QTF_GetTicketPrice_output = {
54
+ readonly ticketPrice: bigint;
55
+ };
56
+ export type QTF_GetWinnerData_input = Record<string, never>;
57
+ export type QTF_GetWinnerData_output = {
58
+ readonly winnerData: QTF_WinnerData;
59
+ };
60
+ export type QTF_NextEpochData = {
61
+ readonly newTicketPrice: bigint;
62
+ readonly newTargetJackpot: bigint;
63
+ readonly newSchedule: number;
64
+ readonly newDrawHour: number;
65
+ };
66
+ export type QTF_PlayerData = {
67
+ readonly player: string;
68
+ readonly randomValues: ReadonlyArray<number>;
69
+ };
70
+ export type QTF_PoolsSnapshot = {
71
+ readonly jackpot: bigint;
72
+ readonly reserve: bigint;
73
+ readonly targetJackpot: bigint;
74
+ readonly frActive: number;
75
+ readonly roundsSinceK4: number;
76
+ };
77
+ export type QTF_SetDrawHour_input = {
78
+ readonly newDrawHour: number;
79
+ };
80
+ export type QTF_SetDrawHour_output = {
81
+ readonly returnCode: number;
82
+ };
83
+ export type QTF_SetPrice_input = {
84
+ readonly newPrice: bigint;
85
+ };
86
+ export type QTF_SetPrice_output = {
87
+ readonly returnCode: number;
88
+ };
89
+ export type QTF_SetSchedule_input = {
90
+ readonly newSchedule: number;
91
+ };
92
+ export type QTF_SetSchedule_output = {
93
+ readonly returnCode: number;
94
+ };
95
+ export type QTF_SetTargetJackpot_input = {
96
+ readonly newTargetJackpot: bigint;
97
+ };
98
+ export type QTF_SetTargetJackpot_output = {
99
+ readonly returnCode: number;
100
+ };
101
+ export type QTF_WinnerData = {
102
+ readonly winners: ReadonlyArray<QTF_PlayerData>;
103
+ readonly winnerValues: ReadonlyArray<number>;
104
+ readonly winnerCounter: bigint;
105
+ readonly epoch: number;
106
+ };
107
+
108
+ export interface ContractTypeMap {
109
+ QTF: {
110
+ readonly contractIndex: 22;
111
+ readonly functions: {
112
+ GetTicketPrice: {
113
+ readonly kind: "function";
114
+ readonly inputType: 1;
115
+ readonly inputTypeName: "GetTicketPrice_input";
116
+ readonly outputTypeName: "GetTicketPrice_output";
117
+ readonly input: QTF_GetTicketPrice_input;
118
+ readonly output: QTF_GetTicketPrice_output;
119
+ };
120
+ GetNextEpochData: {
121
+ readonly kind: "function";
122
+ readonly inputType: 2;
123
+ readonly inputTypeName: "GetNextEpochData_input";
124
+ readonly outputTypeName: "GetNextEpochData_output";
125
+ readonly input: QTF_GetNextEpochData_input;
126
+ readonly output: QTF_GetNextEpochData_output;
127
+ };
128
+ GetWinnerData: {
129
+ readonly kind: "function";
130
+ readonly inputType: 3;
131
+ readonly inputTypeName: "GetWinnerData_input";
132
+ readonly outputTypeName: "GetWinnerData_output";
133
+ readonly input: QTF_GetWinnerData_input;
134
+ readonly output: QTF_GetWinnerData_output;
135
+ };
136
+ GetPools: {
137
+ readonly kind: "function";
138
+ readonly inputType: 4;
139
+ readonly inputTypeName: "GetPools_input";
140
+ readonly outputTypeName: "GetPools_output";
141
+ readonly input: QTF_GetPools_input;
142
+ readonly output: QTF_GetPools_output;
143
+ };
144
+ GetSchedule: {
145
+ readonly kind: "function";
146
+ readonly inputType: 5;
147
+ readonly inputTypeName: "GetSchedule_input";
148
+ readonly outputTypeName: "GetSchedule_output";
149
+ readonly input: QTF_GetSchedule_input;
150
+ readonly output: QTF_GetSchedule_output;
151
+ };
152
+ GetDrawHour: {
153
+ readonly kind: "function";
154
+ readonly inputType: 6;
155
+ readonly inputTypeName: "GetDrawHour_input";
156
+ readonly outputTypeName: "GetDrawHour_output";
157
+ readonly input: QTF_GetDrawHour_input;
158
+ readonly output: QTF_GetDrawHour_output;
159
+ };
160
+ GetState: {
161
+ readonly kind: "function";
162
+ readonly inputType: 7;
163
+ readonly inputTypeName: "GetState_input";
164
+ readonly outputTypeName: "GetState_output";
165
+ readonly input: QTF_GetState_input;
166
+ readonly output: QTF_GetState_output;
167
+ };
168
+ GetFees: {
169
+ readonly kind: "function";
170
+ readonly inputType: 8;
171
+ readonly inputTypeName: "GetFees_input";
172
+ readonly outputTypeName: "GetFees_output";
173
+ readonly input: QTF_GetFees_input;
174
+ readonly output: QTF_GetFees_output;
175
+ };
176
+ EstimatePrizePayouts: {
177
+ readonly kind: "function";
178
+ readonly inputType: 9;
179
+ readonly inputTypeName: "EstimatePrizePayouts_input";
180
+ readonly outputTypeName: "EstimatePrizePayouts_output";
181
+ readonly input: QTF_EstimatePrizePayouts_input;
182
+ readonly output: QTF_EstimatePrizePayouts_output;
183
+ };
184
+ };
185
+ readonly procedures: {
186
+ BuyTicket: {
187
+ readonly kind: "procedure";
188
+ readonly inputType: 1;
189
+ readonly inputTypeName: "BuyTicket_input";
190
+ readonly outputTypeName: "BuyTicket_output";
191
+ readonly input: QTF_BuyTicket_input;
192
+ readonly output: QTF_BuyTicket_output;
193
+ };
194
+ SetPrice: {
195
+ readonly kind: "procedure";
196
+ readonly inputType: 2;
197
+ readonly inputTypeName: "SetPrice_input";
198
+ readonly outputTypeName: "SetPrice_output";
199
+ readonly input: QTF_SetPrice_input;
200
+ readonly output: QTF_SetPrice_output;
201
+ };
202
+ SetSchedule: {
203
+ readonly kind: "procedure";
204
+ readonly inputType: 3;
205
+ readonly inputTypeName: "SetSchedule_input";
206
+ readonly outputTypeName: "SetSchedule_output";
207
+ readonly input: QTF_SetSchedule_input;
208
+ readonly output: QTF_SetSchedule_output;
209
+ };
210
+ SetTargetJackpot: {
211
+ readonly kind: "procedure";
212
+ readonly inputType: 4;
213
+ readonly inputTypeName: "SetTargetJackpot_input";
214
+ readonly outputTypeName: "SetTargetJackpot_output";
215
+ readonly input: QTF_SetTargetJackpot_input;
216
+ readonly output: QTF_SetTargetJackpot_output;
217
+ };
218
+ SetDrawHour: {
219
+ readonly kind: "procedure";
220
+ readonly inputType: 5;
221
+ readonly inputTypeName: "SetDrawHour_input";
222
+ readonly outputTypeName: "SetDrawHour_output";
223
+ readonly input: QTF_SetDrawHour_input;
224
+ readonly output: QTF_SetDrawHour_output;
225
+ };
226
+ };
227
+ };
228
+ }
229
+
230
+ export type ContractName = keyof ContractTypeMap & string;
231
+ export type FunctionName<C extends ContractName> = keyof ContractTypeMap[C]["functions"] & string;
232
+ export type ProcedureName<C extends ContractName> = keyof ContractTypeMap[C]["procedures"] & string;
233
+
234
+ export type FunctionInput<
235
+ C extends ContractName,
236
+ F extends FunctionName<C>,
237
+ > = ContractTypeMap[C]["functions"][F]["input"];
238
+ export type FunctionOutput<
239
+ C extends ContractName,
240
+ F extends FunctionName<C>,
241
+ > = ContractTypeMap[C]["functions"][F]["output"];
242
+
243
+ export type ProcedureInput<
244
+ C extends ContractName,
245
+ P extends ProcedureName<C>,
246
+ > = ContractTypeMap[C]["procedures"][P]["input"];
247
+ export type ProcedureOutput<
248
+ C extends ContractName,
249
+ P extends ProcedureName<C>,
250
+ > = ContractTypeMap[C]["procedures"][P]["output"];
251
+
252
+ export const contractCodecRegistry = {
253
+ QTF: {
254
+ contractIndex: 22,
255
+ functions: {
256
+ GetTicketPrice: {
257
+ kind: "function",
258
+ inputType: 1,
259
+ inputTypeName: "GetTicketPrice_input",
260
+ outputTypeName: "GetTicketPrice_output",
261
+ },
262
+ GetNextEpochData: {
263
+ kind: "function",
264
+ inputType: 2,
265
+ inputTypeName: "GetNextEpochData_input",
266
+ outputTypeName: "GetNextEpochData_output",
267
+ },
268
+ GetWinnerData: {
269
+ kind: "function",
270
+ inputType: 3,
271
+ inputTypeName: "GetWinnerData_input",
272
+ outputTypeName: "GetWinnerData_output",
273
+ },
274
+ GetPools: {
275
+ kind: "function",
276
+ inputType: 4,
277
+ inputTypeName: "GetPools_input",
278
+ outputTypeName: "GetPools_output",
279
+ },
280
+ GetSchedule: {
281
+ kind: "function",
282
+ inputType: 5,
283
+ inputTypeName: "GetSchedule_input",
284
+ outputTypeName: "GetSchedule_output",
285
+ },
286
+ GetDrawHour: {
287
+ kind: "function",
288
+ inputType: 6,
289
+ inputTypeName: "GetDrawHour_input",
290
+ outputTypeName: "GetDrawHour_output",
291
+ },
292
+ GetState: {
293
+ kind: "function",
294
+ inputType: 7,
295
+ inputTypeName: "GetState_input",
296
+ outputTypeName: "GetState_output",
297
+ },
298
+ GetFees: {
299
+ kind: "function",
300
+ inputType: 8,
301
+ inputTypeName: "GetFees_input",
302
+ outputTypeName: "GetFees_output",
303
+ },
304
+ EstimatePrizePayouts: {
305
+ kind: "function",
306
+ inputType: 9,
307
+ inputTypeName: "EstimatePrizePayouts_input",
308
+ outputTypeName: "EstimatePrizePayouts_output",
309
+ },
310
+ },
311
+ procedures: {
312
+ BuyTicket: {
313
+ kind: "procedure",
314
+ inputType: 1,
315
+ inputTypeName: "BuyTicket_input",
316
+ outputTypeName: "BuyTicket_output",
317
+ },
318
+ SetPrice: {
319
+ kind: "procedure",
320
+ inputType: 2,
321
+ inputTypeName: "SetPrice_input",
322
+ outputTypeName: "SetPrice_output",
323
+ },
324
+ SetSchedule: {
325
+ kind: "procedure",
326
+ inputType: 3,
327
+ inputTypeName: "SetSchedule_input",
328
+ outputTypeName: "SetSchedule_output",
329
+ },
330
+ SetTargetJackpot: {
331
+ kind: "procedure",
332
+ inputType: 4,
333
+ inputTypeName: "SetTargetJackpot_input",
334
+ outputTypeName: "SetTargetJackpot_output",
335
+ },
336
+ SetDrawHour: {
337
+ kind: "procedure",
338
+ inputType: 5,
339
+ inputTypeName: "SetDrawHour_input",
340
+ outputTypeName: "SetDrawHour_output",
341
+ },
342
+ },
343
+ },
344
+ } as const satisfies Readonly<Record<ContractName, unknown>>;
345
+
346
+ export type RuntimeContractCodecRegistry = typeof contractCodecRegistry;