@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,304 @@
1
+ /* eslint-disable */
2
+ /* This file is generated. Do not edit manually. */
3
+
4
+ export type RL_BuyTicket_input = Record<string, never>;
5
+ export type RL_BuyTicket_output = {
6
+ readonly returnCode: number;
7
+ };
8
+ export type RL_GetBalance_input = Record<string, never>;
9
+ export type RL_GetBalance_output = {
10
+ readonly balance: bigint;
11
+ };
12
+ export type RL_GetDrawHour_input = Record<string, never>;
13
+ export type RL_GetDrawHour_output = {
14
+ readonly drawHour: number;
15
+ };
16
+ export type RL_GetFees_input = Record<string, never>;
17
+ export type RL_GetFees_output = {
18
+ readonly teamFeePercent: number;
19
+ readonly distributionFeePercent: number;
20
+ readonly winnerFeePercent: number;
21
+ readonly burnPercent: number;
22
+ readonly returnCode: number;
23
+ };
24
+ export type RL_GetMaxNumberOfPlayers_input = Record<string, never>;
25
+ export type RL_GetMaxNumberOfPlayers_output = {
26
+ readonly numberOfPlayers: bigint;
27
+ };
28
+ export type RL_GetNextEpochData_input = Record<string, never>;
29
+ export type RL_GetNextEpochData_output = {
30
+ readonly nextEpochData: RL_NextEpochData;
31
+ };
32
+ export type RL_GetPlayers_input = Record<string, never>;
33
+ export type RL_GetPlayers_output = {
34
+ readonly players: ReadonlyArray<string>;
35
+ readonly playerCounter: bigint;
36
+ readonly returnCode: number;
37
+ };
38
+ export type RL_GetSchedule_input = Record<string, never>;
39
+ export type RL_GetSchedule_output = {
40
+ readonly schedule: number;
41
+ };
42
+ export type RL_GetState_input = Record<string, never>;
43
+ export type RL_GetState_output = {
44
+ readonly currentState: number;
45
+ };
46
+ export type RL_GetTicketPrice_input = Record<string, never>;
47
+ export type RL_GetTicketPrice_output = {
48
+ readonly ticketPrice: bigint;
49
+ };
50
+ export type RL_GetWinners_input = Record<string, never>;
51
+ export type RL_GetWinners_output = {
52
+ readonly winners: ReadonlyArray<RL_WinnerInfo>;
53
+ readonly winnersCounter: bigint;
54
+ readonly returnCode: number;
55
+ };
56
+ export type RL_NextEpochData = {
57
+ readonly newPrice: bigint;
58
+ readonly schedule: number;
59
+ };
60
+ export type RL_SetPrice_input = {
61
+ readonly newPrice: bigint;
62
+ };
63
+ export type RL_SetPrice_output = {
64
+ readonly returnCode: number;
65
+ };
66
+ export type RL_SetSchedule_input = {
67
+ readonly newSchedule: number;
68
+ };
69
+ export type RL_SetSchedule_output = {
70
+ readonly returnCode: number;
71
+ };
72
+ export type RL_WinnerInfo = {
73
+ readonly winnerAddress: string;
74
+ readonly revenue: bigint;
75
+ readonly tick: number;
76
+ readonly epoch: number;
77
+ readonly dayOfWeek: number;
78
+ };
79
+
80
+ export interface ContractTypeMap {
81
+ RL: {
82
+ readonly contractIndex: 16;
83
+ readonly functions: {
84
+ GetFees: {
85
+ readonly kind: "function";
86
+ readonly inputType: 1;
87
+ readonly inputTypeName: "GetFees_input";
88
+ readonly outputTypeName: "GetFees_output";
89
+ readonly input: RL_GetFees_input;
90
+ readonly output: RL_GetFees_output;
91
+ };
92
+ GetPlayers: {
93
+ readonly kind: "function";
94
+ readonly inputType: 2;
95
+ readonly inputTypeName: "GetPlayers_input";
96
+ readonly outputTypeName: "GetPlayers_output";
97
+ readonly input: RL_GetPlayers_input;
98
+ readonly output: RL_GetPlayers_output;
99
+ };
100
+ GetWinners: {
101
+ readonly kind: "function";
102
+ readonly inputType: 3;
103
+ readonly inputTypeName: "GetWinners_input";
104
+ readonly outputTypeName: "GetWinners_output";
105
+ readonly input: RL_GetWinners_input;
106
+ readonly output: RL_GetWinners_output;
107
+ };
108
+ GetTicketPrice: {
109
+ readonly kind: "function";
110
+ readonly inputType: 4;
111
+ readonly inputTypeName: "GetTicketPrice_input";
112
+ readonly outputTypeName: "GetTicketPrice_output";
113
+ readonly input: RL_GetTicketPrice_input;
114
+ readonly output: RL_GetTicketPrice_output;
115
+ };
116
+ GetMaxNumberOfPlayers: {
117
+ readonly kind: "function";
118
+ readonly inputType: 5;
119
+ readonly inputTypeName: "GetMaxNumberOfPlayers_input";
120
+ readonly outputTypeName: "GetMaxNumberOfPlayers_output";
121
+ readonly input: RL_GetMaxNumberOfPlayers_input;
122
+ readonly output: RL_GetMaxNumberOfPlayers_output;
123
+ };
124
+ GetState: {
125
+ readonly kind: "function";
126
+ readonly inputType: 6;
127
+ readonly inputTypeName: "GetState_input";
128
+ readonly outputTypeName: "GetState_output";
129
+ readonly input: RL_GetState_input;
130
+ readonly output: RL_GetState_output;
131
+ };
132
+ GetBalance: {
133
+ readonly kind: "function";
134
+ readonly inputType: 7;
135
+ readonly inputTypeName: "GetBalance_input";
136
+ readonly outputTypeName: "GetBalance_output";
137
+ readonly input: RL_GetBalance_input;
138
+ readonly output: RL_GetBalance_output;
139
+ };
140
+ GetNextEpochData: {
141
+ readonly kind: "function";
142
+ readonly inputType: 8;
143
+ readonly inputTypeName: "GetNextEpochData_input";
144
+ readonly outputTypeName: "GetNextEpochData_output";
145
+ readonly input: RL_GetNextEpochData_input;
146
+ readonly output: RL_GetNextEpochData_output;
147
+ };
148
+ GetDrawHour: {
149
+ readonly kind: "function";
150
+ readonly inputType: 9;
151
+ readonly inputTypeName: "GetDrawHour_input";
152
+ readonly outputTypeName: "GetDrawHour_output";
153
+ readonly input: RL_GetDrawHour_input;
154
+ readonly output: RL_GetDrawHour_output;
155
+ };
156
+ GetSchedule: {
157
+ readonly kind: "function";
158
+ readonly inputType: 10;
159
+ readonly inputTypeName: "GetSchedule_input";
160
+ readonly outputTypeName: "GetSchedule_output";
161
+ readonly input: RL_GetSchedule_input;
162
+ readonly output: RL_GetSchedule_output;
163
+ };
164
+ };
165
+ readonly procedures: {
166
+ BuyTicket: {
167
+ readonly kind: "procedure";
168
+ readonly inputType: 1;
169
+ readonly inputTypeName: "BuyTicket_input";
170
+ readonly outputTypeName: "BuyTicket_output";
171
+ readonly input: RL_BuyTicket_input;
172
+ readonly output: RL_BuyTicket_output;
173
+ };
174
+ SetPrice: {
175
+ readonly kind: "procedure";
176
+ readonly inputType: 2;
177
+ readonly inputTypeName: "SetPrice_input";
178
+ readonly outputTypeName: "SetPrice_output";
179
+ readonly input: RL_SetPrice_input;
180
+ readonly output: RL_SetPrice_output;
181
+ };
182
+ SetSchedule: {
183
+ readonly kind: "procedure";
184
+ readonly inputType: 3;
185
+ readonly inputTypeName: "SetSchedule_input";
186
+ readonly outputTypeName: "SetSchedule_output";
187
+ readonly input: RL_SetSchedule_input;
188
+ readonly output: RL_SetSchedule_output;
189
+ };
190
+ };
191
+ };
192
+ }
193
+
194
+ export type ContractName = keyof ContractTypeMap & string;
195
+ export type FunctionName<C extends ContractName> = keyof ContractTypeMap[C]["functions"] & string;
196
+ export type ProcedureName<C extends ContractName> = keyof ContractTypeMap[C]["procedures"] & string;
197
+
198
+ export type FunctionInput<
199
+ C extends ContractName,
200
+ F extends FunctionName<C>,
201
+ > = ContractTypeMap[C]["functions"][F]["input"];
202
+ export type FunctionOutput<
203
+ C extends ContractName,
204
+ F extends FunctionName<C>,
205
+ > = ContractTypeMap[C]["functions"][F]["output"];
206
+
207
+ export type ProcedureInput<
208
+ C extends ContractName,
209
+ P extends ProcedureName<C>,
210
+ > = ContractTypeMap[C]["procedures"][P]["input"];
211
+ export type ProcedureOutput<
212
+ C extends ContractName,
213
+ P extends ProcedureName<C>,
214
+ > = ContractTypeMap[C]["procedures"][P]["output"];
215
+
216
+ export const contractCodecRegistry = {
217
+ RL: {
218
+ contractIndex: 16,
219
+ functions: {
220
+ GetFees: {
221
+ kind: "function",
222
+ inputType: 1,
223
+ inputTypeName: "GetFees_input",
224
+ outputTypeName: "GetFees_output",
225
+ },
226
+ GetPlayers: {
227
+ kind: "function",
228
+ inputType: 2,
229
+ inputTypeName: "GetPlayers_input",
230
+ outputTypeName: "GetPlayers_output",
231
+ },
232
+ GetWinners: {
233
+ kind: "function",
234
+ inputType: 3,
235
+ inputTypeName: "GetWinners_input",
236
+ outputTypeName: "GetWinners_output",
237
+ },
238
+ GetTicketPrice: {
239
+ kind: "function",
240
+ inputType: 4,
241
+ inputTypeName: "GetTicketPrice_input",
242
+ outputTypeName: "GetTicketPrice_output",
243
+ },
244
+ GetMaxNumberOfPlayers: {
245
+ kind: "function",
246
+ inputType: 5,
247
+ inputTypeName: "GetMaxNumberOfPlayers_input",
248
+ outputTypeName: "GetMaxNumberOfPlayers_output",
249
+ },
250
+ GetState: {
251
+ kind: "function",
252
+ inputType: 6,
253
+ inputTypeName: "GetState_input",
254
+ outputTypeName: "GetState_output",
255
+ },
256
+ GetBalance: {
257
+ kind: "function",
258
+ inputType: 7,
259
+ inputTypeName: "GetBalance_input",
260
+ outputTypeName: "GetBalance_output",
261
+ },
262
+ GetNextEpochData: {
263
+ kind: "function",
264
+ inputType: 8,
265
+ inputTypeName: "GetNextEpochData_input",
266
+ outputTypeName: "GetNextEpochData_output",
267
+ },
268
+ GetDrawHour: {
269
+ kind: "function",
270
+ inputType: 9,
271
+ inputTypeName: "GetDrawHour_input",
272
+ outputTypeName: "GetDrawHour_output",
273
+ },
274
+ GetSchedule: {
275
+ kind: "function",
276
+ inputType: 10,
277
+ inputTypeName: "GetSchedule_input",
278
+ outputTypeName: "GetSchedule_output",
279
+ },
280
+ },
281
+ procedures: {
282
+ BuyTicket: {
283
+ kind: "procedure",
284
+ inputType: 1,
285
+ inputTypeName: "BuyTicket_input",
286
+ outputTypeName: "BuyTicket_output",
287
+ },
288
+ SetPrice: {
289
+ kind: "procedure",
290
+ inputType: 2,
291
+ inputTypeName: "SetPrice_input",
292
+ outputTypeName: "SetPrice_output",
293
+ },
294
+ SetSchedule: {
295
+ kind: "procedure",
296
+ inputType: 3,
297
+ inputTypeName: "SetSchedule_input",
298
+ outputTypeName: "SetSchedule_output",
299
+ },
300
+ },
301
+ },
302
+ } as const satisfies Readonly<Record<ContractName, unknown>>;
303
+
304
+ export type RuntimeContractCodecRegistry = typeof contractCodecRegistry;
@@ -0,0 +1,8 @@
1
+ {
2
+ "contractName": "SWATCH",
3
+ "contractIndex": 7,
4
+ "filename": "SupplyWatcher.h",
5
+ "address": "HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHYCM",
6
+ "entries": [],
7
+ "ioTypes": []
8
+ }
@@ -0,0 +1,42 @@
1
+ /* eslint-disable */
2
+ /* This file is generated. Do not edit manually. */
3
+
4
+ export interface ContractTypeMap {
5
+ SWATCH: {
6
+ readonly contractIndex: 7;
7
+ readonly functions: Record<never, never>;
8
+ readonly procedures: Record<never, never>;
9
+ };
10
+ }
11
+
12
+ export type ContractName = keyof ContractTypeMap & string;
13
+ export type FunctionName<C extends ContractName> = keyof ContractTypeMap[C]["functions"] & string;
14
+ export type ProcedureName<C extends ContractName> = keyof ContractTypeMap[C]["procedures"] & string;
15
+
16
+ export type FunctionInput<
17
+ C extends ContractName,
18
+ F extends FunctionName<C>,
19
+ > = ContractTypeMap[C]["functions"][F]["input"];
20
+ export type FunctionOutput<
21
+ C extends ContractName,
22
+ F extends FunctionName<C>,
23
+ > = ContractTypeMap[C]["functions"][F]["output"];
24
+
25
+ export type ProcedureInput<
26
+ C extends ContractName,
27
+ P extends ProcedureName<C>,
28
+ > = ContractTypeMap[C]["procedures"][P]["input"];
29
+ export type ProcedureOutput<
30
+ C extends ContractName,
31
+ P extends ProcedureName<C>,
32
+ > = ContractTypeMap[C]["procedures"][P]["output"];
33
+
34
+ export const contractCodecRegistry = {
35
+ SWATCH: {
36
+ contractIndex: 7,
37
+ functions: {},
38
+ procedures: {},
39
+ },
40
+ } as const satisfies Readonly<Record<ContractName, unknown>>;
41
+
42
+ export type RuntimeContractCodecRegistry = typeof contractCodecRegistry;