@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,238 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* This file is generated. Do not edit manually. */
|
|
3
|
+
|
|
4
|
+
export type GQMPROP_GetProposal_input = {
|
|
5
|
+
readonly proposalIndex: number;
|
|
6
|
+
};
|
|
7
|
+
export type GQMPROP_GetProposal_output = {
|
|
8
|
+
readonly okay: boolean;
|
|
9
|
+
readonly _padding0: ReadonlyArray<number>;
|
|
10
|
+
readonly _padding1: ReadonlyArray<number>;
|
|
11
|
+
readonly _padding2: ReadonlyArray<number>;
|
|
12
|
+
readonly proposerPubicKey: string;
|
|
13
|
+
readonly proposal: GQMPROP_ProposalDataT;
|
|
14
|
+
};
|
|
15
|
+
export type GQMPROP_GetProposalIndices_input = {
|
|
16
|
+
readonly activeProposals: boolean;
|
|
17
|
+
readonly prevProposalIndex: number;
|
|
18
|
+
};
|
|
19
|
+
export type GQMPROP_GetProposalIndices_output = {
|
|
20
|
+
readonly numOfIndices: number;
|
|
21
|
+
readonly indices: ReadonlyArray<number>;
|
|
22
|
+
};
|
|
23
|
+
export type GQMPROP_GetVote_input = {
|
|
24
|
+
readonly voter: string;
|
|
25
|
+
readonly proposalIndex: number;
|
|
26
|
+
};
|
|
27
|
+
export type GQMPROP_GetVote_output = {
|
|
28
|
+
readonly okay: boolean;
|
|
29
|
+
readonly vote: GQMPROP_ProposalSingleVoteDataV1;
|
|
30
|
+
};
|
|
31
|
+
export type GQMPROP_GetVotingResults_input = {
|
|
32
|
+
readonly proposalIndex: number;
|
|
33
|
+
};
|
|
34
|
+
export type GQMPROP_GetVotingResults_output = {
|
|
35
|
+
readonly okay: boolean;
|
|
36
|
+
readonly results: GQMPROP_ProposalSummarizedVotingDataV1;
|
|
37
|
+
};
|
|
38
|
+
export type GQMPROP_ProposalDataV1_false_ = {
|
|
39
|
+
readonly url: ReadonlyArray<number>;
|
|
40
|
+
readonly epoch: number;
|
|
41
|
+
readonly type: number;
|
|
42
|
+
readonly tick: number;
|
|
43
|
+
readonly data: GQMPROP_Data;
|
|
44
|
+
};
|
|
45
|
+
export type GQMPROP_ProposalSingleVoteDataV1 = {
|
|
46
|
+
readonly proposalIndex: number;
|
|
47
|
+
readonly proposalType: number;
|
|
48
|
+
readonly proposalTick: number;
|
|
49
|
+
readonly voteValue: bigint;
|
|
50
|
+
};
|
|
51
|
+
export type GQMPROP_ProposalSummarizedVotingDataV1 = {
|
|
52
|
+
readonly proposalIndex: number;
|
|
53
|
+
readonly optionCount: number;
|
|
54
|
+
readonly proposalTick: number;
|
|
55
|
+
readonly totalVotesAuthorized: number;
|
|
56
|
+
readonly totalVotesCasted: number;
|
|
57
|
+
};
|
|
58
|
+
export type GQMPROP_RevenueDonationEntry = {
|
|
59
|
+
readonly destinationPublicKey: string;
|
|
60
|
+
readonly millionthAmount: bigint;
|
|
61
|
+
readonly firstEpoch: number;
|
|
62
|
+
};
|
|
63
|
+
export type GQMPROP_SetProposal_output = {
|
|
64
|
+
readonly proposalIndex: number;
|
|
65
|
+
readonly okay: boolean;
|
|
66
|
+
};
|
|
67
|
+
export type GQMPROP_Success_output = {
|
|
68
|
+
readonly okay: boolean;
|
|
69
|
+
};
|
|
70
|
+
export type GQMPROP_Transfer = {
|
|
71
|
+
readonly destination: string;
|
|
72
|
+
readonly amounts: ReadonlyArray<bigint>;
|
|
73
|
+
};
|
|
74
|
+
export type GQMPROP_TransferInEpoch = {
|
|
75
|
+
readonly destination: string;
|
|
76
|
+
readonly amount: bigint;
|
|
77
|
+
readonly targetEpoch: number;
|
|
78
|
+
};
|
|
79
|
+
export type GQMPROP_VariableOptions = {
|
|
80
|
+
readonly variable: bigint;
|
|
81
|
+
readonly values: ReadonlyArray<bigint>;
|
|
82
|
+
};
|
|
83
|
+
export type GQMPROP_VariableScalar = {
|
|
84
|
+
readonly variable: bigint;
|
|
85
|
+
readonly minValue: bigint;
|
|
86
|
+
readonly maxValue: bigint;
|
|
87
|
+
readonly proposedValue: bigint;
|
|
88
|
+
};
|
|
89
|
+
export type GQMPROP_Data = ReadonlyArray<number>;
|
|
90
|
+
export type GQMPROP_GetRevenueDonation_input = Record<string, never>;
|
|
91
|
+
export type GQMPROP_GetRevenueDonation_output = GQMPROP_RevenueDonationT;
|
|
92
|
+
export type GQMPROP_ProposalDataT = GQMPROP_ProposalDataV1_false_;
|
|
93
|
+
export type GQMPROP_RevenueDonationT = ReadonlyArray<GQMPROP_RevenueDonationEntry>;
|
|
94
|
+
export type GQMPROP_SetProposal_input = GQMPROP_ProposalDataT;
|
|
95
|
+
export type GQMPROP_Vote_input = GQMPROP_ProposalSingleVoteDataV1;
|
|
96
|
+
export type GQMPROP_Vote_output = GQMPROP_Success_output;
|
|
97
|
+
|
|
98
|
+
export interface ContractTypeMap {
|
|
99
|
+
GQMPROP: {
|
|
100
|
+
readonly contractIndex: 6;
|
|
101
|
+
readonly functions: {
|
|
102
|
+
GetProposalIndices: {
|
|
103
|
+
readonly kind: "function";
|
|
104
|
+
readonly inputType: 1;
|
|
105
|
+
readonly inputTypeName: "GetProposalIndices_input";
|
|
106
|
+
readonly outputTypeName: "GetProposalIndices_output";
|
|
107
|
+
readonly input: GQMPROP_GetProposalIndices_input;
|
|
108
|
+
readonly output: GQMPROP_GetProposalIndices_output;
|
|
109
|
+
};
|
|
110
|
+
GetProposal: {
|
|
111
|
+
readonly kind: "function";
|
|
112
|
+
readonly inputType: 2;
|
|
113
|
+
readonly inputTypeName: "GetProposal_input";
|
|
114
|
+
readonly outputTypeName: "GetProposal_output";
|
|
115
|
+
readonly input: GQMPROP_GetProposal_input;
|
|
116
|
+
readonly output: GQMPROP_GetProposal_output;
|
|
117
|
+
};
|
|
118
|
+
GetVote: {
|
|
119
|
+
readonly kind: "function";
|
|
120
|
+
readonly inputType: 3;
|
|
121
|
+
readonly inputTypeName: "GetVote_input";
|
|
122
|
+
readonly outputTypeName: "GetVote_output";
|
|
123
|
+
readonly input: GQMPROP_GetVote_input;
|
|
124
|
+
readonly output: GQMPROP_GetVote_output;
|
|
125
|
+
};
|
|
126
|
+
GetVotingResults: {
|
|
127
|
+
readonly kind: "function";
|
|
128
|
+
readonly inputType: 4;
|
|
129
|
+
readonly inputTypeName: "GetVotingResults_input";
|
|
130
|
+
readonly outputTypeName: "GetVotingResults_output";
|
|
131
|
+
readonly input: GQMPROP_GetVotingResults_input;
|
|
132
|
+
readonly output: GQMPROP_GetVotingResults_output;
|
|
133
|
+
};
|
|
134
|
+
GetRevenueDonation: {
|
|
135
|
+
readonly kind: "function";
|
|
136
|
+
readonly inputType: 5;
|
|
137
|
+
readonly inputTypeName: "GetRevenueDonation_input";
|
|
138
|
+
readonly outputTypeName: "GetRevenueDonation_output";
|
|
139
|
+
readonly input: GQMPROP_GetRevenueDonation_input;
|
|
140
|
+
readonly output: GQMPROP_GetRevenueDonation_output;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
readonly procedures: {
|
|
144
|
+
SetProposal: {
|
|
145
|
+
readonly kind: "procedure";
|
|
146
|
+
readonly inputType: 1;
|
|
147
|
+
readonly inputTypeName: "SetProposal_input";
|
|
148
|
+
readonly outputTypeName: "SetProposal_output";
|
|
149
|
+
readonly input: GQMPROP_SetProposal_input;
|
|
150
|
+
readonly output: GQMPROP_SetProposal_output;
|
|
151
|
+
};
|
|
152
|
+
Vote: {
|
|
153
|
+
readonly kind: "procedure";
|
|
154
|
+
readonly inputType: 2;
|
|
155
|
+
readonly inputTypeName: "Vote_input";
|
|
156
|
+
readonly outputTypeName: "Vote_output";
|
|
157
|
+
readonly input: GQMPROP_Vote_input;
|
|
158
|
+
readonly output: GQMPROP_Vote_output;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export type ContractName = keyof ContractTypeMap & string;
|
|
165
|
+
export type FunctionName<C extends ContractName> = keyof ContractTypeMap[C]["functions"] & string;
|
|
166
|
+
export type ProcedureName<C extends ContractName> = keyof ContractTypeMap[C]["procedures"] & string;
|
|
167
|
+
|
|
168
|
+
export type FunctionInput<
|
|
169
|
+
C extends ContractName,
|
|
170
|
+
F extends FunctionName<C>,
|
|
171
|
+
> = ContractTypeMap[C]["functions"][F]["input"];
|
|
172
|
+
export type FunctionOutput<
|
|
173
|
+
C extends ContractName,
|
|
174
|
+
F extends FunctionName<C>,
|
|
175
|
+
> = ContractTypeMap[C]["functions"][F]["output"];
|
|
176
|
+
|
|
177
|
+
export type ProcedureInput<
|
|
178
|
+
C extends ContractName,
|
|
179
|
+
P extends ProcedureName<C>,
|
|
180
|
+
> = ContractTypeMap[C]["procedures"][P]["input"];
|
|
181
|
+
export type ProcedureOutput<
|
|
182
|
+
C extends ContractName,
|
|
183
|
+
P extends ProcedureName<C>,
|
|
184
|
+
> = ContractTypeMap[C]["procedures"][P]["output"];
|
|
185
|
+
|
|
186
|
+
export const contractCodecRegistry = {
|
|
187
|
+
GQMPROP: {
|
|
188
|
+
contractIndex: 6,
|
|
189
|
+
functions: {
|
|
190
|
+
GetProposalIndices: {
|
|
191
|
+
kind: "function",
|
|
192
|
+
inputType: 1,
|
|
193
|
+
inputTypeName: "GetProposalIndices_input",
|
|
194
|
+
outputTypeName: "GetProposalIndices_output",
|
|
195
|
+
},
|
|
196
|
+
GetProposal: {
|
|
197
|
+
kind: "function",
|
|
198
|
+
inputType: 2,
|
|
199
|
+
inputTypeName: "GetProposal_input",
|
|
200
|
+
outputTypeName: "GetProposal_output",
|
|
201
|
+
},
|
|
202
|
+
GetVote: {
|
|
203
|
+
kind: "function",
|
|
204
|
+
inputType: 3,
|
|
205
|
+
inputTypeName: "GetVote_input",
|
|
206
|
+
outputTypeName: "GetVote_output",
|
|
207
|
+
},
|
|
208
|
+
GetVotingResults: {
|
|
209
|
+
kind: "function",
|
|
210
|
+
inputType: 4,
|
|
211
|
+
inputTypeName: "GetVotingResults_input",
|
|
212
|
+
outputTypeName: "GetVotingResults_output",
|
|
213
|
+
},
|
|
214
|
+
GetRevenueDonation: {
|
|
215
|
+
kind: "function",
|
|
216
|
+
inputType: 5,
|
|
217
|
+
inputTypeName: "GetRevenueDonation_input",
|
|
218
|
+
outputTypeName: "GetRevenueDonation_output",
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
procedures: {
|
|
222
|
+
SetProposal: {
|
|
223
|
+
kind: "procedure",
|
|
224
|
+
inputType: 1,
|
|
225
|
+
inputTypeName: "SetProposal_input",
|
|
226
|
+
outputTypeName: "SetProposal_output",
|
|
227
|
+
},
|
|
228
|
+
Vote: {
|
|
229
|
+
kind: "procedure",
|
|
230
|
+
inputType: 2,
|
|
231
|
+
inputTypeName: "Vote_input",
|
|
232
|
+
outputTypeName: "Vote_output",
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
} as const satisfies Readonly<Record<ContractName, unknown>>;
|
|
237
|
+
|
|
238
|
+
export type RuntimeContractCodecRegistry = typeof contractCodecRegistry;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* This file is generated. Do not edit manually. */
|
|
3
|
+
|
|
4
|
+
export interface ContractTypeMap {
|
|
5
|
+
MLM: {
|
|
6
|
+
readonly contractIndex: 5;
|
|
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
|
+
MLM: {
|
|
36
|
+
contractIndex: 5,
|
|
37
|
+
functions: {},
|
|
38
|
+
procedures: {},
|
|
39
|
+
},
|
|
40
|
+
} as const satisfies Readonly<Record<ContractName, unknown>>;
|
|
41
|
+
|
|
42
|
+
export type RuntimeContractCodecRegistry = typeof contractCodecRegistry;
|