@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,265 @@
1
+ /* eslint-disable */
2
+ /* This file is generated. Do not edit manually. */
3
+
4
+ export type QDUEL_ConnectToRoom_input = {
5
+ readonly roomId: string;
6
+ };
7
+ export type QDUEL_ConnectToRoom_output = {
8
+ readonly returnCode: number;
9
+ };
10
+ export type QDUEL_CreateRoom_input = {
11
+ readonly allowedPlayer: string;
12
+ readonly stake: bigint;
13
+ readonly raiseStep: bigint;
14
+ readonly maxStake: bigint;
15
+ };
16
+ export type QDUEL_CreateRoom_output = {
17
+ readonly returnCode: number;
18
+ };
19
+ export type QDUEL_DateAndTime = {
20
+ readonly value: bigint;
21
+ };
22
+ export type QDUEL_Deposit_input = Record<string, never>;
23
+ export type QDUEL_Deposit_output = {
24
+ readonly returnCode: number;
25
+ };
26
+ export type QDUEL_GetPercentFees_input = Record<string, never>;
27
+ export type QDUEL_GetPercentFees_output = {
28
+ readonly devFeePercentBps: number;
29
+ readonly burnFeePercentBps: number;
30
+ readonly shareholdersFeePercentBps: number;
31
+ readonly percentScale: number;
32
+ readonly returnCode: bigint;
33
+ };
34
+ export type QDUEL_GetRooms_input = Record<string, never>;
35
+ export type QDUEL_GetRooms_output = {
36
+ readonly rooms: ReadonlyArray<QDUEL_RoomInfo>;
37
+ readonly returnCode: number;
38
+ };
39
+ export type QDUEL_GetTTLHours_input = Record<string, never>;
40
+ export type QDUEL_GetTTLHours_output = {
41
+ readonly ttlHours: number;
42
+ readonly returnCode: number;
43
+ };
44
+ export type QDUEL_GetUserProfile_input = Record<string, never>;
45
+ export type QDUEL_GetUserProfile_output = {
46
+ readonly roomId: string;
47
+ readonly depositedAmount: bigint;
48
+ readonly locked: bigint;
49
+ readonly stake: bigint;
50
+ readonly raiseStep: bigint;
51
+ readonly maxStake: bigint;
52
+ readonly returnCode: number;
53
+ };
54
+ export type QDUEL_RoomInfo = {
55
+ readonly roomId: string;
56
+ readonly owner: string;
57
+ readonly allowedPlayer: string;
58
+ readonly amount: bigint;
59
+ readonly closeTimer: bigint;
60
+ readonly lastUpdate: QDUEL_DateAndTime;
61
+ };
62
+ export type QDUEL_SetPercentFees_input = {
63
+ readonly devFeePercentBps: number;
64
+ readonly burnFeePercentBps: number;
65
+ readonly shareholdersFeePercentBps: number;
66
+ };
67
+ export type QDUEL_SetPercentFees_output = {
68
+ readonly returnCode: number;
69
+ };
70
+ export type QDUEL_SetTTLHours_input = {
71
+ readonly ttlHours: number;
72
+ };
73
+ export type QDUEL_SetTTLHours_output = {
74
+ readonly returnCode: number;
75
+ };
76
+ export type QDUEL_Withdraw_input = {
77
+ readonly amount: bigint;
78
+ };
79
+ export type QDUEL_Withdraw_output = {
80
+ readonly returnCode: number;
81
+ };
82
+
83
+ export interface ContractTypeMap {
84
+ QDUEL: {
85
+ readonly contractIndex: 23;
86
+ readonly functions: {
87
+ GetPercentFees: {
88
+ readonly kind: "function";
89
+ readonly inputType: 1;
90
+ readonly inputTypeName: "GetPercentFees_input";
91
+ readonly outputTypeName: "GetPercentFees_output";
92
+ readonly input: QDUEL_GetPercentFees_input;
93
+ readonly output: QDUEL_GetPercentFees_output;
94
+ };
95
+ GetRooms: {
96
+ readonly kind: "function";
97
+ readonly inputType: 2;
98
+ readonly inputTypeName: "GetRooms_input";
99
+ readonly outputTypeName: "GetRooms_output";
100
+ readonly input: QDUEL_GetRooms_input;
101
+ readonly output: QDUEL_GetRooms_output;
102
+ };
103
+ GetTTLHours: {
104
+ readonly kind: "function";
105
+ readonly inputType: 3;
106
+ readonly inputTypeName: "GetTTLHours_input";
107
+ readonly outputTypeName: "GetTTLHours_output";
108
+ readonly input: QDUEL_GetTTLHours_input;
109
+ readonly output: QDUEL_GetTTLHours_output;
110
+ };
111
+ GetUserProfile: {
112
+ readonly kind: "function";
113
+ readonly inputType: 4;
114
+ readonly inputTypeName: "GetUserProfile_input";
115
+ readonly outputTypeName: "GetUserProfile_output";
116
+ readonly input: QDUEL_GetUserProfile_input;
117
+ readonly output: QDUEL_GetUserProfile_output;
118
+ };
119
+ };
120
+ readonly procedures: {
121
+ CreateRoom: {
122
+ readonly kind: "procedure";
123
+ readonly inputType: 1;
124
+ readonly inputTypeName: "CreateRoom_input";
125
+ readonly outputTypeName: "CreateRoom_output";
126
+ readonly input: QDUEL_CreateRoom_input;
127
+ readonly output: QDUEL_CreateRoom_output;
128
+ };
129
+ ConnectToRoom: {
130
+ readonly kind: "procedure";
131
+ readonly inputType: 2;
132
+ readonly inputTypeName: "ConnectToRoom_input";
133
+ readonly outputTypeName: "ConnectToRoom_output";
134
+ readonly input: QDUEL_ConnectToRoom_input;
135
+ readonly output: QDUEL_ConnectToRoom_output;
136
+ };
137
+ SetPercentFees: {
138
+ readonly kind: "procedure";
139
+ readonly inputType: 3;
140
+ readonly inputTypeName: "SetPercentFees_input";
141
+ readonly outputTypeName: "SetPercentFees_output";
142
+ readonly input: QDUEL_SetPercentFees_input;
143
+ readonly output: QDUEL_SetPercentFees_output;
144
+ };
145
+ SetTTLHours: {
146
+ readonly kind: "procedure";
147
+ readonly inputType: 4;
148
+ readonly inputTypeName: "SetTTLHours_input";
149
+ readonly outputTypeName: "SetTTLHours_output";
150
+ readonly input: QDUEL_SetTTLHours_input;
151
+ readonly output: QDUEL_SetTTLHours_output;
152
+ };
153
+ Deposit: {
154
+ readonly kind: "procedure";
155
+ readonly inputType: 5;
156
+ readonly inputTypeName: "Deposit_input";
157
+ readonly outputTypeName: "Deposit_output";
158
+ readonly input: QDUEL_Deposit_input;
159
+ readonly output: QDUEL_Deposit_output;
160
+ };
161
+ Withdraw: {
162
+ readonly kind: "procedure";
163
+ readonly inputType: 6;
164
+ readonly inputTypeName: "Withdraw_input";
165
+ readonly outputTypeName: "Withdraw_output";
166
+ readonly input: QDUEL_Withdraw_input;
167
+ readonly output: QDUEL_Withdraw_output;
168
+ };
169
+ };
170
+ };
171
+ }
172
+
173
+ export type ContractName = keyof ContractTypeMap & string;
174
+ export type FunctionName<C extends ContractName> = keyof ContractTypeMap[C]["functions"] & string;
175
+ export type ProcedureName<C extends ContractName> = keyof ContractTypeMap[C]["procedures"] & string;
176
+
177
+ export type FunctionInput<
178
+ C extends ContractName,
179
+ F extends FunctionName<C>,
180
+ > = ContractTypeMap[C]["functions"][F]["input"];
181
+ export type FunctionOutput<
182
+ C extends ContractName,
183
+ F extends FunctionName<C>,
184
+ > = ContractTypeMap[C]["functions"][F]["output"];
185
+
186
+ export type ProcedureInput<
187
+ C extends ContractName,
188
+ P extends ProcedureName<C>,
189
+ > = ContractTypeMap[C]["procedures"][P]["input"];
190
+ export type ProcedureOutput<
191
+ C extends ContractName,
192
+ P extends ProcedureName<C>,
193
+ > = ContractTypeMap[C]["procedures"][P]["output"];
194
+
195
+ export const contractCodecRegistry = {
196
+ QDUEL: {
197
+ contractIndex: 23,
198
+ functions: {
199
+ GetPercentFees: {
200
+ kind: "function",
201
+ inputType: 1,
202
+ inputTypeName: "GetPercentFees_input",
203
+ outputTypeName: "GetPercentFees_output",
204
+ },
205
+ GetRooms: {
206
+ kind: "function",
207
+ inputType: 2,
208
+ inputTypeName: "GetRooms_input",
209
+ outputTypeName: "GetRooms_output",
210
+ },
211
+ GetTTLHours: {
212
+ kind: "function",
213
+ inputType: 3,
214
+ inputTypeName: "GetTTLHours_input",
215
+ outputTypeName: "GetTTLHours_output",
216
+ },
217
+ GetUserProfile: {
218
+ kind: "function",
219
+ inputType: 4,
220
+ inputTypeName: "GetUserProfile_input",
221
+ outputTypeName: "GetUserProfile_output",
222
+ },
223
+ },
224
+ procedures: {
225
+ CreateRoom: {
226
+ kind: "procedure",
227
+ inputType: 1,
228
+ inputTypeName: "CreateRoom_input",
229
+ outputTypeName: "CreateRoom_output",
230
+ },
231
+ ConnectToRoom: {
232
+ kind: "procedure",
233
+ inputType: 2,
234
+ inputTypeName: "ConnectToRoom_input",
235
+ outputTypeName: "ConnectToRoom_output",
236
+ },
237
+ SetPercentFees: {
238
+ kind: "procedure",
239
+ inputType: 3,
240
+ inputTypeName: "SetPercentFees_input",
241
+ outputTypeName: "SetPercentFees_output",
242
+ },
243
+ SetTTLHours: {
244
+ kind: "procedure",
245
+ inputType: 4,
246
+ inputTypeName: "SetTTLHours_input",
247
+ outputTypeName: "SetTTLHours_output",
248
+ },
249
+ Deposit: {
250
+ kind: "procedure",
251
+ inputType: 5,
252
+ inputTypeName: "Deposit_input",
253
+ outputTypeName: "Deposit_output",
254
+ },
255
+ Withdraw: {
256
+ kind: "procedure",
257
+ inputType: 6,
258
+ inputTypeName: "Withdraw_input",
259
+ outputTypeName: "Withdraw_output",
260
+ },
261
+ },
262
+ },
263
+ } as const satisfies Readonly<Record<ContractName, unknown>>;
264
+
265
+ export type RuntimeContractCodecRegistry = typeof contractCodecRegistry;