@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.
- package/package.json +17 -0
- package/scripts/generate-artifacts.ts +178 -0
- package/src/codec/entry-input.test.ts +198 -0
- package/src/codec/entry-input.ts +959 -0
- package/src/codec/index.ts +8 -0
- package/src/generated/contracts/CCF.registry.json +741 -0
- package/src/generated/contracts/CCF.types.ts +307 -0
- package/src/generated/contracts/GQMPROP.registry.json +518 -0
- package/src/generated/contracts/GQMPROP.types.ts +238 -0
- package/src/generated/contracts/MLM.registry.json +8 -0
- package/src/generated/contracts/MLM.types.ts +42 -0
- package/src/generated/contracts/MSVAULT.registry.json +1162 -0
- package/src/generated/contracts/MSVAULT.types.ts +598 -0
- package/src/generated/contracts/NOST.registry.json +1131 -0
- package/src/generated/contracts/NOST.types.ts +515 -0
- package/src/generated/contracts/QBAY.registry.json +1492 -0
- package/src/generated/contracts/QBAY.types.ts +681 -0
- package/src/generated/contracts/QBOND.registry.json +734 -0
- package/src/generated/contracts/QBOND.types.ts +397 -0
- package/src/generated/contracts/QDRAW.registry.json +112 -0
- package/src/generated/contracts/QDRAW.types.ts +110 -0
- package/src/generated/contracts/QDUEL.registry.json +466 -0
- package/src/generated/contracts/QDUEL.types.ts +265 -0
- package/src/generated/contracts/QEARN.registry.json +458 -0
- package/src/generated/contracts/QEARN.types.ts +265 -0
- package/src/generated/contracts/QIP.registry.json +483 -0
- package/src/generated/contracts/QIP.types.ts +194 -0
- package/src/generated/contracts/QRAFFLE.registry.json +916 -0
- package/src/generated/contracts/QRAFFLE.types.ts +446 -0
- package/src/generated/contracts/QRP.registry.json +139 -0
- package/src/generated/contracts/QRP.types.ts +144 -0
- package/src/generated/contracts/QRWA.registry.json +765 -0
- package/src/generated/contracts/QRWA.types.ts +402 -0
- package/src/generated/contracts/QSWAP.registry.json +941 -0
- package/src/generated/contracts/QSWAP.types.ts +479 -0
- package/src/generated/contracts/QTF.registry.json +480 -0
- package/src/generated/contracts/QTF.types.ts +346 -0
- package/src/generated/contracts/QUOTTERY.registry.json +530 -0
- package/src/generated/contracts/QUOTTERY.types.ts +262 -0
- package/src/generated/contracts/QUTIL.registry.json +1378 -0
- package/src/generated/contracts/QUTIL.types.ts +612 -0
- package/src/generated/contracts/QVAULT.registry.json +527 -0
- package/src/generated/contracts/QVAULT.types.ts +309 -0
- package/src/generated/contracts/QX.registry.json +610 -0
- package/src/generated/contracts/QX.types.ts +323 -0
- package/src/generated/contracts/RANDOM.registry.json +51 -0
- package/src/generated/contracts/RANDOM.types.ts +65 -0
- package/src/generated/contracts/RL.registry.json +490 -0
- package/src/generated/contracts/RL.types.ts +304 -0
- package/src/generated/contracts/SWATCH.registry.json +8 -0
- package/src/generated/contracts/SWATCH.types.ts +42 -0
- package/src/generated/core-registry.codecs.ts +6622 -0
- package/src/generated/core-registry.source.json +14342 -0
- package/src/generated/core-registry.ts +14349 -0
- package/src/generated/core-registry.types.ts +100 -0
- package/src/generator/contract-codecs.fixture.test.ts +17 -0
- package/src/generator/contract-codecs.test.ts +115 -0
- package/src/generator/contract-codecs.ts +416 -0
- package/src/generator/index.ts +14 -0
- package/src/generator/per-contract-files.test.ts +70 -0
- package/src/generator/per-contract-files.ts +122 -0
- package/src/generator/registry-runtime.fixture.test.ts +17 -0
- package/src/generator/registry-runtime.test.ts +55 -0
- package/src/generator/registry-runtime.ts +28 -0
- package/src/generator/registry-types.fixture.test.ts +17 -0
- package/src/generator/registry-types.test.ts +55 -0
- package/src/generator/registry-types.ts +75 -0
- package/src/index.test.ts +29 -0
- package/src/index.ts +49 -0
- package/src/registry/index.ts +17 -0
- package/src/registry/io-layout.fixture.test.ts +24 -0
- package/src/registry/io-layout.test.ts +93 -0
- package/src/registry/io-layout.ts +57 -0
- package/src/registry/normalize.ts +61 -0
- package/src/registry/schema.fixture.test.ts +21 -0
- package/src/registry/schema.ts +97 -0
- package/src/registry/types.ts +98 -0
- package/test/fixtures/io-layout.contracts.json +32 -0
- package/test/fixtures/io-layout.layouts.json +14 -0
- package/test/fixtures/registry.sample.codecs.ts +100 -0
- package/test/fixtures/registry.sample.json +27 -0
- package/test/fixtures/registry.sample.runtime.ts +54 -0
- package/test/fixtures/registry.sample.types.ts +16 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* This file is generated. Do not edit manually. */
|
|
3
|
+
|
|
4
|
+
export type CCF_GetProposal_input = {
|
|
5
|
+
readonly subscriptionDestination: string;
|
|
6
|
+
readonly proposalIndex: number;
|
|
7
|
+
};
|
|
8
|
+
export type CCF_GetProposal_output = {
|
|
9
|
+
readonly okay: boolean;
|
|
10
|
+
readonly hasSubscriptionProposal: boolean;
|
|
11
|
+
readonly hasActiveSubscription: boolean;
|
|
12
|
+
readonly _padding0: ReadonlyArray<number>;
|
|
13
|
+
readonly _padding1: ReadonlyArray<number>;
|
|
14
|
+
readonly proposerPublicKey: string;
|
|
15
|
+
readonly proposal: CCF_ProposalDataT;
|
|
16
|
+
readonly subscription: CCF_SubscriptionData;
|
|
17
|
+
readonly subscriptionProposal: CCF_SubscriptionProposalData;
|
|
18
|
+
};
|
|
19
|
+
export type CCF_GetProposalFee_output = {
|
|
20
|
+
readonly proposalFee: number;
|
|
21
|
+
};
|
|
22
|
+
export type CCF_GetProposalIndices_input = {
|
|
23
|
+
readonly activeProposals: boolean;
|
|
24
|
+
readonly prevProposalIndex: number;
|
|
25
|
+
};
|
|
26
|
+
export type CCF_GetProposalIndices_output = {
|
|
27
|
+
readonly numOfIndices: number;
|
|
28
|
+
readonly indices: ReadonlyArray<number>;
|
|
29
|
+
};
|
|
30
|
+
export type CCF_GetVote_input = {
|
|
31
|
+
readonly voter: string;
|
|
32
|
+
readonly proposalIndex: number;
|
|
33
|
+
};
|
|
34
|
+
export type CCF_GetVote_output = {
|
|
35
|
+
readonly okay: boolean;
|
|
36
|
+
readonly vote: CCF_ProposalSingleVoteDataV1;
|
|
37
|
+
};
|
|
38
|
+
export type CCF_GetVotingResults_input = {
|
|
39
|
+
readonly proposalIndex: number;
|
|
40
|
+
};
|
|
41
|
+
export type CCF_GetVotingResults_output = {
|
|
42
|
+
readonly okay: boolean;
|
|
43
|
+
readonly results: CCF_ProposalSummarizedVotingDataV1;
|
|
44
|
+
};
|
|
45
|
+
export type CCF_LatestTransfersEntry = {
|
|
46
|
+
readonly destination: string;
|
|
47
|
+
readonly url: ReadonlyArray<number>;
|
|
48
|
+
readonly amount: bigint;
|
|
49
|
+
readonly tick: number;
|
|
50
|
+
readonly success: boolean;
|
|
51
|
+
};
|
|
52
|
+
export type CCF_ProposalDataYesNo = {
|
|
53
|
+
readonly url: ReadonlyArray<number>;
|
|
54
|
+
readonly epoch: number;
|
|
55
|
+
readonly type: number;
|
|
56
|
+
readonly tick: number;
|
|
57
|
+
readonly data: CCF_Data;
|
|
58
|
+
};
|
|
59
|
+
export type CCF_ProposalSingleVoteDataV1 = {
|
|
60
|
+
readonly proposalIndex: number;
|
|
61
|
+
readonly proposalType: number;
|
|
62
|
+
readonly proposalTick: number;
|
|
63
|
+
readonly voteValue: bigint;
|
|
64
|
+
};
|
|
65
|
+
export type CCF_ProposalSummarizedVotingDataV1 = {
|
|
66
|
+
readonly proposalIndex: number;
|
|
67
|
+
readonly optionCount: number;
|
|
68
|
+
readonly proposalTick: number;
|
|
69
|
+
readonly totalVotesAuthorized: number;
|
|
70
|
+
readonly totalVotesCasted: number;
|
|
71
|
+
};
|
|
72
|
+
export type CCF_RegularPaymentEntry = {
|
|
73
|
+
readonly destination: string;
|
|
74
|
+
readonly url: ReadonlyArray<number>;
|
|
75
|
+
readonly amount: bigint;
|
|
76
|
+
readonly tick: number;
|
|
77
|
+
readonly periodIndex: number;
|
|
78
|
+
readonly success: boolean;
|
|
79
|
+
readonly _padding0: ReadonlyArray<number>;
|
|
80
|
+
readonly _padding1: ReadonlyArray<number>;
|
|
81
|
+
};
|
|
82
|
+
export type CCF_SetProposal_input = {
|
|
83
|
+
readonly proposal: CCF_ProposalDataT;
|
|
84
|
+
readonly isSubscription: boolean;
|
|
85
|
+
readonly weeksPerPeriod: number;
|
|
86
|
+
readonly _padding0: ReadonlyArray<number>;
|
|
87
|
+
readonly startEpoch: number;
|
|
88
|
+
readonly amountPerPeriod: bigint;
|
|
89
|
+
readonly numberOfPeriods: number;
|
|
90
|
+
};
|
|
91
|
+
export type CCF_SetProposal_output = {
|
|
92
|
+
readonly proposalIndex: number;
|
|
93
|
+
};
|
|
94
|
+
export type CCF_SubscriptionData = {
|
|
95
|
+
readonly destination: string;
|
|
96
|
+
readonly url: ReadonlyArray<number>;
|
|
97
|
+
readonly weeksPerPeriod: number;
|
|
98
|
+
readonly _padding1: ReadonlyArray<number>;
|
|
99
|
+
readonly _padding2: ReadonlyArray<number>;
|
|
100
|
+
readonly numberOfPeriods: number;
|
|
101
|
+
readonly amountPerPeriod: bigint;
|
|
102
|
+
readonly startEpoch: number;
|
|
103
|
+
readonly currentPeriod: number;
|
|
104
|
+
};
|
|
105
|
+
export type CCF_SubscriptionProposalData = {
|
|
106
|
+
readonly proposerId: string;
|
|
107
|
+
readonly destination: string;
|
|
108
|
+
readonly url: ReadonlyArray<number>;
|
|
109
|
+
readonly weeksPerPeriod: number;
|
|
110
|
+
readonly _padding0: ReadonlyArray<number>;
|
|
111
|
+
readonly _padding1: ReadonlyArray<number>;
|
|
112
|
+
readonly numberOfPeriods: number;
|
|
113
|
+
readonly amountPerPeriod: bigint;
|
|
114
|
+
readonly startEpoch: number;
|
|
115
|
+
};
|
|
116
|
+
export type CCF_Success_output = {
|
|
117
|
+
readonly okay: boolean;
|
|
118
|
+
};
|
|
119
|
+
export type CCF_Transfer = {
|
|
120
|
+
readonly destination: string;
|
|
121
|
+
readonly amount: bigint;
|
|
122
|
+
};
|
|
123
|
+
export type CCF_VariableOptions = {
|
|
124
|
+
readonly variable: bigint;
|
|
125
|
+
readonly value: bigint;
|
|
126
|
+
};
|
|
127
|
+
export type CCF_Data = ReadonlyArray<number>;
|
|
128
|
+
export type CCF_GetLatestTransfers_input = Record<string, never>;
|
|
129
|
+
export type CCF_GetLatestTransfers_output = CCF_LatestTransfersT;
|
|
130
|
+
export type CCF_GetProposalFee_input = Record<string, never>;
|
|
131
|
+
export type CCF_GetRegularPayments_input = Record<string, never>;
|
|
132
|
+
export type CCF_GetRegularPayments_output = CCF_RegularPaymentsT;
|
|
133
|
+
export type CCF_LatestTransfersT = ReadonlyArray<CCF_LatestTransfersEntry>;
|
|
134
|
+
export type CCF_ProposalDataT = CCF_ProposalDataYesNo;
|
|
135
|
+
export type CCF_RegularPaymentsT = ReadonlyArray<CCF_RegularPaymentEntry>;
|
|
136
|
+
export type CCF_Vote_input = CCF_ProposalSingleVoteDataV1;
|
|
137
|
+
export type CCF_Vote_output = CCF_Success_output;
|
|
138
|
+
|
|
139
|
+
export interface ContractTypeMap {
|
|
140
|
+
CCF: {
|
|
141
|
+
readonly contractIndex: 8;
|
|
142
|
+
readonly functions: {
|
|
143
|
+
GetProposalIndices: {
|
|
144
|
+
readonly kind: "function";
|
|
145
|
+
readonly inputType: 1;
|
|
146
|
+
readonly inputTypeName: "GetProposalIndices_input";
|
|
147
|
+
readonly outputTypeName: "GetProposalIndices_output";
|
|
148
|
+
readonly input: CCF_GetProposalIndices_input;
|
|
149
|
+
readonly output: CCF_GetProposalIndices_output;
|
|
150
|
+
};
|
|
151
|
+
GetProposal: {
|
|
152
|
+
readonly kind: "function";
|
|
153
|
+
readonly inputType: 2;
|
|
154
|
+
readonly inputTypeName: "GetProposal_input";
|
|
155
|
+
readonly outputTypeName: "GetProposal_output";
|
|
156
|
+
readonly input: CCF_GetProposal_input;
|
|
157
|
+
readonly output: CCF_GetProposal_output;
|
|
158
|
+
};
|
|
159
|
+
GetVote: {
|
|
160
|
+
readonly kind: "function";
|
|
161
|
+
readonly inputType: 3;
|
|
162
|
+
readonly inputTypeName: "GetVote_input";
|
|
163
|
+
readonly outputTypeName: "GetVote_output";
|
|
164
|
+
readonly input: CCF_GetVote_input;
|
|
165
|
+
readonly output: CCF_GetVote_output;
|
|
166
|
+
};
|
|
167
|
+
GetVotingResults: {
|
|
168
|
+
readonly kind: "function";
|
|
169
|
+
readonly inputType: 4;
|
|
170
|
+
readonly inputTypeName: "GetVotingResults_input";
|
|
171
|
+
readonly outputTypeName: "GetVotingResults_output";
|
|
172
|
+
readonly input: CCF_GetVotingResults_input;
|
|
173
|
+
readonly output: CCF_GetVotingResults_output;
|
|
174
|
+
};
|
|
175
|
+
GetLatestTransfers: {
|
|
176
|
+
readonly kind: "function";
|
|
177
|
+
readonly inputType: 5;
|
|
178
|
+
readonly inputTypeName: "GetLatestTransfers_input";
|
|
179
|
+
readonly outputTypeName: "GetLatestTransfers_output";
|
|
180
|
+
readonly input: CCF_GetLatestTransfers_input;
|
|
181
|
+
readonly output: CCF_GetLatestTransfers_output;
|
|
182
|
+
};
|
|
183
|
+
GetProposalFee: {
|
|
184
|
+
readonly kind: "function";
|
|
185
|
+
readonly inputType: 6;
|
|
186
|
+
readonly inputTypeName: "GetProposalFee_input";
|
|
187
|
+
readonly outputTypeName: "GetProposalFee_output";
|
|
188
|
+
readonly input: CCF_GetProposalFee_input;
|
|
189
|
+
readonly output: CCF_GetProposalFee_output;
|
|
190
|
+
};
|
|
191
|
+
GetRegularPayments: {
|
|
192
|
+
readonly kind: "function";
|
|
193
|
+
readonly inputType: 7;
|
|
194
|
+
readonly inputTypeName: "GetRegularPayments_input";
|
|
195
|
+
readonly outputTypeName: "GetRegularPayments_output";
|
|
196
|
+
readonly input: CCF_GetRegularPayments_input;
|
|
197
|
+
readonly output: CCF_GetRegularPayments_output;
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
readonly procedures: {
|
|
201
|
+
SetProposal: {
|
|
202
|
+
readonly kind: "procedure";
|
|
203
|
+
readonly inputType: 1;
|
|
204
|
+
readonly inputTypeName: "SetProposal_input";
|
|
205
|
+
readonly outputTypeName: "SetProposal_output";
|
|
206
|
+
readonly input: CCF_SetProposal_input;
|
|
207
|
+
readonly output: CCF_SetProposal_output;
|
|
208
|
+
};
|
|
209
|
+
Vote: {
|
|
210
|
+
readonly kind: "procedure";
|
|
211
|
+
readonly inputType: 2;
|
|
212
|
+
readonly inputTypeName: "Vote_input";
|
|
213
|
+
readonly outputTypeName: "Vote_output";
|
|
214
|
+
readonly input: CCF_Vote_input;
|
|
215
|
+
readonly output: CCF_Vote_output;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export type ContractName = keyof ContractTypeMap & string;
|
|
222
|
+
export type FunctionName<C extends ContractName> = keyof ContractTypeMap[C]["functions"] & string;
|
|
223
|
+
export type ProcedureName<C extends ContractName> = keyof ContractTypeMap[C]["procedures"] & string;
|
|
224
|
+
|
|
225
|
+
export type FunctionInput<
|
|
226
|
+
C extends ContractName,
|
|
227
|
+
F extends FunctionName<C>,
|
|
228
|
+
> = ContractTypeMap[C]["functions"][F]["input"];
|
|
229
|
+
export type FunctionOutput<
|
|
230
|
+
C extends ContractName,
|
|
231
|
+
F extends FunctionName<C>,
|
|
232
|
+
> = ContractTypeMap[C]["functions"][F]["output"];
|
|
233
|
+
|
|
234
|
+
export type ProcedureInput<
|
|
235
|
+
C extends ContractName,
|
|
236
|
+
P extends ProcedureName<C>,
|
|
237
|
+
> = ContractTypeMap[C]["procedures"][P]["input"];
|
|
238
|
+
export type ProcedureOutput<
|
|
239
|
+
C extends ContractName,
|
|
240
|
+
P extends ProcedureName<C>,
|
|
241
|
+
> = ContractTypeMap[C]["procedures"][P]["output"];
|
|
242
|
+
|
|
243
|
+
export const contractCodecRegistry = {
|
|
244
|
+
CCF: {
|
|
245
|
+
contractIndex: 8,
|
|
246
|
+
functions: {
|
|
247
|
+
GetProposalIndices: {
|
|
248
|
+
kind: "function",
|
|
249
|
+
inputType: 1,
|
|
250
|
+
inputTypeName: "GetProposalIndices_input",
|
|
251
|
+
outputTypeName: "GetProposalIndices_output",
|
|
252
|
+
},
|
|
253
|
+
GetProposal: {
|
|
254
|
+
kind: "function",
|
|
255
|
+
inputType: 2,
|
|
256
|
+
inputTypeName: "GetProposal_input",
|
|
257
|
+
outputTypeName: "GetProposal_output",
|
|
258
|
+
},
|
|
259
|
+
GetVote: {
|
|
260
|
+
kind: "function",
|
|
261
|
+
inputType: 3,
|
|
262
|
+
inputTypeName: "GetVote_input",
|
|
263
|
+
outputTypeName: "GetVote_output",
|
|
264
|
+
},
|
|
265
|
+
GetVotingResults: {
|
|
266
|
+
kind: "function",
|
|
267
|
+
inputType: 4,
|
|
268
|
+
inputTypeName: "GetVotingResults_input",
|
|
269
|
+
outputTypeName: "GetVotingResults_output",
|
|
270
|
+
},
|
|
271
|
+
GetLatestTransfers: {
|
|
272
|
+
kind: "function",
|
|
273
|
+
inputType: 5,
|
|
274
|
+
inputTypeName: "GetLatestTransfers_input",
|
|
275
|
+
outputTypeName: "GetLatestTransfers_output",
|
|
276
|
+
},
|
|
277
|
+
GetProposalFee: {
|
|
278
|
+
kind: "function",
|
|
279
|
+
inputType: 6,
|
|
280
|
+
inputTypeName: "GetProposalFee_input",
|
|
281
|
+
outputTypeName: "GetProposalFee_output",
|
|
282
|
+
},
|
|
283
|
+
GetRegularPayments: {
|
|
284
|
+
kind: "function",
|
|
285
|
+
inputType: 7,
|
|
286
|
+
inputTypeName: "GetRegularPayments_input",
|
|
287
|
+
outputTypeName: "GetRegularPayments_output",
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
procedures: {
|
|
291
|
+
SetProposal: {
|
|
292
|
+
kind: "procedure",
|
|
293
|
+
inputType: 1,
|
|
294
|
+
inputTypeName: "SetProposal_input",
|
|
295
|
+
outputTypeName: "SetProposal_output",
|
|
296
|
+
},
|
|
297
|
+
Vote: {
|
|
298
|
+
kind: "procedure",
|
|
299
|
+
inputType: 2,
|
|
300
|
+
inputTypeName: "Vote_input",
|
|
301
|
+
outputTypeName: "Vote_output",
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
} as const satisfies Readonly<Record<ContractName, unknown>>;
|
|
306
|
+
|
|
307
|
+
export type RuntimeContractCodecRegistry = typeof contractCodecRegistry;
|