@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,262 @@
1
+ /* eslint-disable */
2
+ /* This file is generated. Do not edit manually. */
3
+
4
+ export type QUOTTERY_basicInfo_input = Record<string, never>;
5
+ export type QUOTTERY_basicInfo_output = {
6
+ readonly feePerSlotPerHour: bigint;
7
+ readonly gameOperatorFee: bigint;
8
+ readonly shareholderFee: bigint;
9
+ readonly minBetSlotAmount: bigint;
10
+ readonly burnFee: bigint;
11
+ readonly nIssuedBet: number;
12
+ readonly moneyFlow: bigint;
13
+ readonly moneyFlowThroughIssueBet: bigint;
14
+ readonly moneyFlowThroughJoinBet: bigint;
15
+ readonly moneyFlowThroughFinalizeBet: bigint;
16
+ readonly earnedAmountForShareHolder: bigint;
17
+ readonly paidAmountForShareHolder: bigint;
18
+ readonly earnedAmountForBetWinner: bigint;
19
+ readonly distributedAmount: bigint;
20
+ readonly burnedAmount: bigint;
21
+ readonly gameOperator: string;
22
+ };
23
+ export type QUOTTERY_cancelBet_input = {
24
+ readonly betId: number;
25
+ };
26
+ export type QUOTTERY_cancelBet_output = Record<string, never>;
27
+ export type QUOTTERY_getActiveBet_input = Record<string, never>;
28
+ export type QUOTTERY_getActiveBet_output = {
29
+ readonly count: number;
30
+ readonly activeBetId: ReadonlyArray<number>;
31
+ };
32
+ export type QUOTTERY_getBetByCreator_input = {
33
+ readonly creator: string;
34
+ };
35
+ export type QUOTTERY_getBetByCreator_output = {
36
+ readonly count: number;
37
+ readonly betId: ReadonlyArray<number>;
38
+ };
39
+ export type QUOTTERY_getBetInfo_input = {
40
+ readonly betId: number;
41
+ };
42
+ export type QUOTTERY_getBetInfo_output = {
43
+ readonly betId: number;
44
+ readonly nOption: number;
45
+ readonly creator: string;
46
+ readonly betDesc: string;
47
+ readonly optionDesc: QUOTTERY_id_8;
48
+ readonly oracleProviderId: QUOTTERY_id_8;
49
+ readonly oracleFees: QUOTTERY_uint32_8;
50
+ readonly openDate: number;
51
+ readonly closeDate: number;
52
+ readonly endDate: number;
53
+ readonly minBetAmount: bigint;
54
+ readonly maxBetSlotPerOption: number;
55
+ readonly currentBetState: QUOTTERY_uint32_8;
56
+ readonly betResultWonOption: QUOTTERY_sint8_8;
57
+ readonly betResultOPId: QUOTTERY_sint8_8;
58
+ };
59
+ export type QUOTTERY_getBetOptionDetail_input = {
60
+ readonly betId: number;
61
+ readonly betOption: number;
62
+ };
63
+ export type QUOTTERY_getBetOptionDetail_output = {
64
+ readonly bettor: ReadonlyArray<string>;
65
+ };
66
+ export type QUOTTERY_issueBet_input = {
67
+ readonly betDesc: string;
68
+ readonly optionDesc: QUOTTERY_id_8;
69
+ readonly oracleProviderId: QUOTTERY_id_8;
70
+ readonly oracleFees: QUOTTERY_uint32_8;
71
+ readonly closeDate: number;
72
+ readonly endDate: number;
73
+ readonly amountPerSlot: bigint;
74
+ readonly maxBetSlotPerOption: number;
75
+ readonly numberOfOption: number;
76
+ };
77
+ export type QUOTTERY_issueBet_output = Record<string, never>;
78
+ export type QUOTTERY_joinBet_input = {
79
+ readonly betId: number;
80
+ readonly numberOfSlot: number;
81
+ readonly option: number;
82
+ readonly _placeHolder: number;
83
+ };
84
+ export type QUOTTERY_joinBet_output = Record<string, never>;
85
+ export type QUOTTERY_publishResult_input = {
86
+ readonly betId: number;
87
+ readonly option: number;
88
+ };
89
+ export type QUOTTERY_publishResult_output = Record<string, never>;
90
+ export type QUOTTERY_id_8 = ReadonlyArray<string>;
91
+ export type QUOTTERY_sint8_8 = ReadonlyArray<number>;
92
+ export type QUOTTERY_uint32_8 = ReadonlyArray<number>;
93
+
94
+ export interface ContractTypeMap {
95
+ QUOTTERY: {
96
+ readonly contractIndex: 2;
97
+ readonly functions: {
98
+ basicInfo: {
99
+ readonly kind: "function";
100
+ readonly inputType: 1;
101
+ readonly inputTypeName: "basicInfo_input";
102
+ readonly outputTypeName: "basicInfo_output";
103
+ readonly input: QUOTTERY_basicInfo_input;
104
+ readonly output: QUOTTERY_basicInfo_output;
105
+ };
106
+ getBetInfo: {
107
+ readonly kind: "function";
108
+ readonly inputType: 2;
109
+ readonly inputTypeName: "getBetInfo_input";
110
+ readonly outputTypeName: "getBetInfo_output";
111
+ readonly input: QUOTTERY_getBetInfo_input;
112
+ readonly output: QUOTTERY_getBetInfo_output;
113
+ };
114
+ getBetOptionDetail: {
115
+ readonly kind: "function";
116
+ readonly inputType: 3;
117
+ readonly inputTypeName: "getBetOptionDetail_input";
118
+ readonly outputTypeName: "getBetOptionDetail_output";
119
+ readonly input: QUOTTERY_getBetOptionDetail_input;
120
+ readonly output: QUOTTERY_getBetOptionDetail_output;
121
+ };
122
+ getActiveBet: {
123
+ readonly kind: "function";
124
+ readonly inputType: 4;
125
+ readonly inputTypeName: "getActiveBet_input";
126
+ readonly outputTypeName: "getActiveBet_output";
127
+ readonly input: QUOTTERY_getActiveBet_input;
128
+ readonly output: QUOTTERY_getActiveBet_output;
129
+ };
130
+ getBetByCreator: {
131
+ readonly kind: "function";
132
+ readonly inputType: 5;
133
+ readonly inputTypeName: "getBetByCreator_input";
134
+ readonly outputTypeName: "getBetByCreator_output";
135
+ readonly input: QUOTTERY_getBetByCreator_input;
136
+ readonly output: QUOTTERY_getBetByCreator_output;
137
+ };
138
+ };
139
+ readonly procedures: {
140
+ issueBet: {
141
+ readonly kind: "procedure";
142
+ readonly inputType: 1;
143
+ readonly inputTypeName: "issueBet_input";
144
+ readonly outputTypeName: "issueBet_output";
145
+ readonly input: QUOTTERY_issueBet_input;
146
+ readonly output: QUOTTERY_issueBet_output;
147
+ };
148
+ joinBet: {
149
+ readonly kind: "procedure";
150
+ readonly inputType: 2;
151
+ readonly inputTypeName: "joinBet_input";
152
+ readonly outputTypeName: "joinBet_output";
153
+ readonly input: QUOTTERY_joinBet_input;
154
+ readonly output: QUOTTERY_joinBet_output;
155
+ };
156
+ cancelBet: {
157
+ readonly kind: "procedure";
158
+ readonly inputType: 3;
159
+ readonly inputTypeName: "cancelBet_input";
160
+ readonly outputTypeName: "cancelBet_output";
161
+ readonly input: QUOTTERY_cancelBet_input;
162
+ readonly output: QUOTTERY_cancelBet_output;
163
+ };
164
+ publishResult: {
165
+ readonly kind: "procedure";
166
+ readonly inputType: 4;
167
+ readonly inputTypeName: "publishResult_input";
168
+ readonly outputTypeName: "publishResult_output";
169
+ readonly input: QUOTTERY_publishResult_input;
170
+ readonly output: QUOTTERY_publishResult_output;
171
+ };
172
+ };
173
+ };
174
+ }
175
+
176
+ export type ContractName = keyof ContractTypeMap & string;
177
+ export type FunctionName<C extends ContractName> = keyof ContractTypeMap[C]["functions"] & string;
178
+ export type ProcedureName<C extends ContractName> = keyof ContractTypeMap[C]["procedures"] & string;
179
+
180
+ export type FunctionInput<
181
+ C extends ContractName,
182
+ F extends FunctionName<C>,
183
+ > = ContractTypeMap[C]["functions"][F]["input"];
184
+ export type FunctionOutput<
185
+ C extends ContractName,
186
+ F extends FunctionName<C>,
187
+ > = ContractTypeMap[C]["functions"][F]["output"];
188
+
189
+ export type ProcedureInput<
190
+ C extends ContractName,
191
+ P extends ProcedureName<C>,
192
+ > = ContractTypeMap[C]["procedures"][P]["input"];
193
+ export type ProcedureOutput<
194
+ C extends ContractName,
195
+ P extends ProcedureName<C>,
196
+ > = ContractTypeMap[C]["procedures"][P]["output"];
197
+
198
+ export const contractCodecRegistry = {
199
+ QUOTTERY: {
200
+ contractIndex: 2,
201
+ functions: {
202
+ basicInfo: {
203
+ kind: "function",
204
+ inputType: 1,
205
+ inputTypeName: "basicInfo_input",
206
+ outputTypeName: "basicInfo_output",
207
+ },
208
+ getBetInfo: {
209
+ kind: "function",
210
+ inputType: 2,
211
+ inputTypeName: "getBetInfo_input",
212
+ outputTypeName: "getBetInfo_output",
213
+ },
214
+ getBetOptionDetail: {
215
+ kind: "function",
216
+ inputType: 3,
217
+ inputTypeName: "getBetOptionDetail_input",
218
+ outputTypeName: "getBetOptionDetail_output",
219
+ },
220
+ getActiveBet: {
221
+ kind: "function",
222
+ inputType: 4,
223
+ inputTypeName: "getActiveBet_input",
224
+ outputTypeName: "getActiveBet_output",
225
+ },
226
+ getBetByCreator: {
227
+ kind: "function",
228
+ inputType: 5,
229
+ inputTypeName: "getBetByCreator_input",
230
+ outputTypeName: "getBetByCreator_output",
231
+ },
232
+ },
233
+ procedures: {
234
+ issueBet: {
235
+ kind: "procedure",
236
+ inputType: 1,
237
+ inputTypeName: "issueBet_input",
238
+ outputTypeName: "issueBet_output",
239
+ },
240
+ joinBet: {
241
+ kind: "procedure",
242
+ inputType: 2,
243
+ inputTypeName: "joinBet_input",
244
+ outputTypeName: "joinBet_output",
245
+ },
246
+ cancelBet: {
247
+ kind: "procedure",
248
+ inputType: 3,
249
+ inputTypeName: "cancelBet_input",
250
+ outputTypeName: "cancelBet_output",
251
+ },
252
+ publishResult: {
253
+ kind: "procedure",
254
+ inputType: 4,
255
+ inputTypeName: "publishResult_input",
256
+ outputTypeName: "publishResult_output",
257
+ },
258
+ },
259
+ },
260
+ } as const satisfies Readonly<Record<ContractName, unknown>>;
261
+
262
+ export type RuntimeContractCodecRegistry = typeof contractCodecRegistry;