@qubic.org/contracts 0.2.7 → 1.0.1
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/LICENSE +41 -0
- package/README.md +15 -18
- package/dist/__generated__/computorcontrolledfund.d.ts +1 -1
- package/dist/__generated__/computorcontrolledfund.d.ts.map +1 -1
- package/dist/__generated__/computorcontrolledfund.js +8 -8
- package/dist/__generated__/computorcontrolledfund.js.map +1 -1
- package/dist/__generated__/escrow.d.ts +1 -1
- package/dist/__generated__/escrow.d.ts.map +1 -1
- package/dist/__generated__/escrow.js +3 -3
- package/dist/__generated__/escrow.js.map +1 -1
- package/dist/__generated__/generalquorumproposal.d.ts +1 -1
- package/dist/__generated__/generalquorumproposal.d.ts.map +1 -1
- package/dist/__generated__/generalquorumproposal.js +6 -6
- package/dist/__generated__/generalquorumproposal.js.map +1 -1
- package/dist/__generated__/ggwp.d.ts +265 -0
- package/dist/__generated__/ggwp.d.ts.map +1 -0
- package/dist/__generated__/ggwp.js +825 -0
- package/dist/__generated__/ggwp.js.map +1 -0
- package/dist/__generated__/index.d.ts +1 -0
- package/dist/__generated__/index.d.ts.map +1 -1
- package/dist/__generated__/index.js +1 -0
- package/dist/__generated__/index.js.map +1 -1
- package/dist/__generated__/msvault.d.ts +1 -1
- package/dist/__generated__/msvault.d.ts.map +1 -1
- package/dist/__generated__/msvault.js +19 -19
- package/dist/__generated__/msvault.js.map +1 -1
- package/dist/__generated__/multisignvault.d.ts +25 -25
- package/dist/__generated__/multisignvault.d.ts.map +1 -1
- package/dist/__generated__/multisignvault.js +25 -25
- package/dist/__generated__/multisignvault.js.map +1 -1
- package/dist/__generated__/nostromo.d.ts +1 -1
- package/dist/__generated__/nostromo.d.ts.map +1 -1
- package/dist/__generated__/nostromo.js +15 -15
- package/dist/__generated__/nostromo.js.map +1 -1
- package/dist/__generated__/pulse.d.ts +1 -1
- package/dist/__generated__/pulse.d.ts.map +1 -1
- package/dist/__generated__/pulse.js +26 -26
- package/dist/__generated__/pulse.js.map +1 -1
- package/dist/__generated__/qbay.d.ts +1 -1
- package/dist/__generated__/qbay.d.ts.map +1 -1
- package/dist/__generated__/qbay.js +23 -23
- package/dist/__generated__/qbay.js.map +1 -1
- package/dist/__generated__/qbond.d.ts +1 -1
- package/dist/__generated__/qbond.d.ts.map +1 -1
- package/dist/__generated__/qbond.js +14 -14
- package/dist/__generated__/qbond.js.map +1 -1
- package/dist/__generated__/qdraw.d.ts +1 -1
- package/dist/__generated__/qdraw.d.ts.map +1 -1
- package/dist/__generated__/qdraw.js.map +1 -1
- package/dist/__generated__/qduel.d.ts +1 -1
- package/dist/__generated__/qduel.d.ts.map +1 -1
- package/dist/__generated__/qduel.js +11 -11
- package/dist/__generated__/qduel.js.map +1 -1
- package/dist/__generated__/qearn.d.ts +1 -1
- package/dist/__generated__/qearn.d.ts.map +1 -1
- package/dist/__generated__/qearn.js +10 -10
- package/dist/__generated__/qearn.js.map +1 -1
- package/dist/__generated__/qip.d.ts +18 -1
- package/dist/__generated__/qip.d.ts.map +1 -1
- package/dist/__generated__/qip.js +64 -3
- package/dist/__generated__/qip.js.map +1 -1
- package/dist/__generated__/qraffle.d.ts +1 -1
- package/dist/__generated__/qraffle.d.ts.map +1 -1
- package/dist/__generated__/qraffle.js +12 -12
- package/dist/__generated__/qraffle.js.map +1 -1
- package/dist/__generated__/qreservepool.d.ts +1 -1
- package/dist/__generated__/qreservepool.d.ts.map +1 -1
- package/dist/__generated__/qreservepool.js +5 -5
- package/dist/__generated__/qreservepool.js.map +1 -1
- package/dist/__generated__/qrwa.d.ts +1 -1
- package/dist/__generated__/qrwa.d.ts.map +1 -1
- package/dist/__generated__/qrwa.js +18 -18
- package/dist/__generated__/qrwa.js.map +1 -1
- package/dist/__generated__/qswap.d.ts +3 -1
- package/dist/__generated__/qswap.d.ts.map +1 -1
- package/dist/__generated__/qswap.js +30 -18
- package/dist/__generated__/qswap.js.map +1 -1
- package/dist/__generated__/qthirtyfour.d.ts +1 -1
- package/dist/__generated__/qthirtyfour.d.ts.map +1 -1
- package/dist/__generated__/qthirtyfour.js +19 -19
- package/dist/__generated__/qthirtyfour.js.map +1 -1
- package/dist/__generated__/qubicicoportal.d.ts +4 -4
- package/dist/__generated__/qubicicoportal.d.ts.map +1 -1
- package/dist/__generated__/qubicicoportal.js +4 -4
- package/dist/__generated__/qubicicoportal.js.map +1 -1
- package/dist/__generated__/quottery.d.ts +1 -1
- package/dist/__generated__/quottery.d.ts.map +1 -1
- package/dist/__generated__/quottery.js +14 -14
- package/dist/__generated__/quottery.js.map +1 -1
- package/dist/__generated__/qusino.d.ts +1 -1
- package/dist/__generated__/qusino.d.ts.map +1 -1
- package/dist/__generated__/qusino.js +13 -13
- package/dist/__generated__/qusino.js.map +1 -1
- package/dist/__generated__/qutil.d.ts +1 -1
- package/dist/__generated__/qutil.d.ts.map +1 -1
- package/dist/__generated__/qutil.js +22 -22
- package/dist/__generated__/qutil.js.map +1 -1
- package/dist/__generated__/qvault.d.ts +14 -2
- package/dist/__generated__/qvault.d.ts.map +1 -1
- package/dist/__generated__/qvault.js +70 -32
- package/dist/__generated__/qvault.js.map +1 -1
- package/dist/__generated__/qx.d.ts +1 -1
- package/dist/__generated__/qx.d.ts.map +1 -1
- package/dist/__generated__/qx.js +12 -12
- package/dist/__generated__/qx.js.map +1 -1
- package/dist/__generated__/random.d.ts +24 -1
- package/dist/__generated__/random.d.ts.map +1 -1
- package/dist/__generated__/random.js +68 -0
- package/dist/__generated__/random.js.map +1 -1
- package/dist/__generated__/randomlottery.d.ts +1 -1
- package/dist/__generated__/randomlottery.d.ts.map +1 -1
- package/dist/__generated__/randomlottery.js +12 -12
- package/dist/__generated__/randomlottery.js.map +1 -1
- package/dist/__generated__/vottunbridge.d.ts +1 -1
- package/dist/__generated__/vottunbridge.d.ts.map +1 -1
- package/dist/__generated__/vottunbridge.js +13 -13
- package/dist/__generated__/vottunbridge.js.map +1 -1
- package/dist/call-contract.d.ts.map +1 -1
- package/dist/call-contract.js +6 -1
- package/dist/call-contract.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
- package/src/__generated__/computorcontrolledfund.ts +1066 -0
- package/src/__generated__/escrow.ts +529 -0
- package/src/__generated__/generalquorumproposal.ts +691 -0
- package/src/__generated__/ggwp.ts +1241 -0
- package/src/__generated__/index.ts +28 -0
- package/src/__generated__/msvault.ts +1716 -0
- package/src/__generated__/multisignvault.ts +1511 -0
- package/src/__generated__/mylastmatch.ts +12 -0
- package/src/__generated__/nostromo.ts +1551 -0
- package/src/__generated__/pulse.ts +1512 -0
- package/src/__generated__/qbay.ts +2097 -0
- package/src/__generated__/qbond.ts +1016 -0
- package/src/__generated__/qdraw.ts +188 -0
- package/src/__generated__/qduel.ts +827 -0
- package/src/__generated__/qearn.ts +696 -0
- package/src/__generated__/qip.ts +501 -0
- package/src/__generated__/qraffle.ts +1162 -0
- package/src/__generated__/qreservepool.ts +281 -0
- package/src/__generated__/qrwa.ts +1491 -0
- package/src/__generated__/qswap.ts +1336 -0
- package/src/__generated__/qthirtyfour.ts +1131 -0
- package/src/__generated__/qubicicoportal.ts +386 -0
- package/src/__generated__/quottery.ts +1519 -0
- package/src/__generated__/qusino.ts +799 -0
- package/src/__generated__/qutil.ts +1506 -0
- package/src/__generated__/qvault.ts +2911 -0
- package/src/__generated__/qx.ts +861 -0
- package/src/__generated__/random.ts +145 -0
- package/src/__generated__/randomlottery.ts +653 -0
- package/src/__generated__/supplywatcher.ts +12 -0
- package/src/__generated__/vottunbridge.ts +1162 -0
- package/src/__tests__/contracts.test.ts +933 -0
- package/src/call-contract.ts +87 -0
- package/src/index.ts +9 -0
- package/dist/result.d.ts +0 -12
- package/dist/result.d.ts.map +0 -1
- package/dist/result.js +0 -7
- package/dist/result.js.map +0 -1
|
@@ -0,0 +1,691 @@
|
|
|
1
|
+
// @generated — do not edit by hand. Run `bun run generate` to regenerate.
|
|
2
|
+
import type { BinaryField, FieldValue, NamedStruct } from '@qubic.org/registry'
|
|
3
|
+
import { buildPayload, decodePayload } from '@qubic.org/registry'
|
|
4
|
+
import type { QubicRpcError } from '@qubic.org/rpc'
|
|
5
|
+
import type { Result } from '@qubic.org/types'
|
|
6
|
+
import { type ContractCall, type ContractCallOptions, type SmartContractCaller, callContractFunction } from '../call-contract.js'
|
|
7
|
+
|
|
8
|
+
export const GENERAL_QUORUM_PROPOSAL_CONTRACT_INDEX = 6
|
|
9
|
+
|
|
10
|
+
export interface GeneralQuorumProposalProposalDataTStruct {
|
|
11
|
+
url: Uint8Array
|
|
12
|
+
epoch: number
|
|
13
|
+
type: number
|
|
14
|
+
tick: number
|
|
15
|
+
data: Uint8Array
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface GeneralQuorumProposalProposalSingleVoteDataV1Struct {
|
|
19
|
+
proposalIndex: number
|
|
20
|
+
proposalType: number
|
|
21
|
+
proposalTick: number
|
|
22
|
+
voteValue: bigint
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GeneralQuorumProposalProposalSummarizedVotingDataV1Struct {
|
|
26
|
+
proposalIndex: number
|
|
27
|
+
optionCount: number
|
|
28
|
+
proposalTick: number
|
|
29
|
+
totalVotesAuthorized: number
|
|
30
|
+
totalVotesCasted: number
|
|
31
|
+
optionVoteCount: number[]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface GeneralQuorumProposalRevenueDonationEntryStruct {
|
|
35
|
+
destinationPublicKey: string
|
|
36
|
+
millionthAmount: bigint
|
|
37
|
+
firstEpoch: number
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const STRUCTS: Record<string, NamedStruct> = {
|
|
41
|
+
'ProposalDataT': {
|
|
42
|
+
name: 'ProposalDataT',
|
|
43
|
+
byteLength: 328,
|
|
44
|
+
fields: [
|
|
45
|
+
{
|
|
46
|
+
name: 'url',
|
|
47
|
+
type: 'bytes',
|
|
48
|
+
offset: 0,
|
|
49
|
+
byteLength: 256,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'epoch',
|
|
53
|
+
type: 'uint16',
|
|
54
|
+
offset: 256,
|
|
55
|
+
byteLength: 2,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'type',
|
|
59
|
+
type: 'uint16',
|
|
60
|
+
offset: 258,
|
|
61
|
+
byteLength: 2,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'tick',
|
|
65
|
+
type: 'uint32',
|
|
66
|
+
offset: 260,
|
|
67
|
+
byteLength: 4,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'data',
|
|
71
|
+
type: 'bytes',
|
|
72
|
+
offset: 264,
|
|
73
|
+
byteLength: 64,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
'ProposalSingleVoteDataV1': {
|
|
78
|
+
name: 'ProposalSingleVoteDataV1',
|
|
79
|
+
byteLength: 16,
|
|
80
|
+
fields: [
|
|
81
|
+
{
|
|
82
|
+
name: 'proposalIndex',
|
|
83
|
+
type: 'uint16',
|
|
84
|
+
offset: 0,
|
|
85
|
+
byteLength: 2,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'proposalType',
|
|
89
|
+
type: 'uint16',
|
|
90
|
+
offset: 2,
|
|
91
|
+
byteLength: 2,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'proposalTick',
|
|
95
|
+
type: 'uint32',
|
|
96
|
+
offset: 4,
|
|
97
|
+
byteLength: 4,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'voteValue',
|
|
101
|
+
type: 'sint64',
|
|
102
|
+
offset: 8,
|
|
103
|
+
byteLength: 8,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
'ProposalSummarizedVotingDataV1': {
|
|
108
|
+
name: 'ProposalSummarizedVotingDataV1',
|
|
109
|
+
byteLength: 48,
|
|
110
|
+
fields: [
|
|
111
|
+
{
|
|
112
|
+
name: 'proposalIndex',
|
|
113
|
+
type: 'uint16',
|
|
114
|
+
offset: 0,
|
|
115
|
+
byteLength: 2,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'optionCount',
|
|
119
|
+
type: 'uint16',
|
|
120
|
+
offset: 2,
|
|
121
|
+
byteLength: 2,
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'proposalTick',
|
|
125
|
+
type: 'uint32',
|
|
126
|
+
offset: 4,
|
|
127
|
+
byteLength: 4,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'totalVotesAuthorized',
|
|
131
|
+
type: 'uint32',
|
|
132
|
+
offset: 8,
|
|
133
|
+
byteLength: 4,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: 'totalVotesCasted',
|
|
137
|
+
type: 'uint32',
|
|
138
|
+
offset: 12,
|
|
139
|
+
byteLength: 4,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: 'optionVoteCount',
|
|
143
|
+
type: 'array',
|
|
144
|
+
offset: 16,
|
|
145
|
+
byteLength: 32,
|
|
146
|
+
arrayLength: 8,
|
|
147
|
+
arrayItemType: 'uint32',
|
|
148
|
+
arrayItemByteLength: 4,
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
'RevenueDonationEntry': {
|
|
153
|
+
name: 'RevenueDonationEntry',
|
|
154
|
+
byteLength: 42,
|
|
155
|
+
fields: [
|
|
156
|
+
{
|
|
157
|
+
name: 'destinationPublicKey',
|
|
158
|
+
type: 'id',
|
|
159
|
+
offset: 0,
|
|
160
|
+
byteLength: 32,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'millionthAmount',
|
|
164
|
+
type: 'sint64',
|
|
165
|
+
offset: 32,
|
|
166
|
+
byteLength: 8,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'firstEpoch',
|
|
170
|
+
type: 'uint16',
|
|
171
|
+
offset: 40,
|
|
172
|
+
byteLength: 2,
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export const GENERAL_QUORUM_PROPOSAL_SET_PROPOSAL_INPUT_TYPE = 1
|
|
179
|
+
|
|
180
|
+
export interface GeneralQuorumProposalSetProposalInput {
|
|
181
|
+
url: Uint8Array
|
|
182
|
+
epoch: number
|
|
183
|
+
type: number
|
|
184
|
+
tick: number
|
|
185
|
+
data: Uint8Array
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const GENERAL_QUORUM_PROPOSAL_SET_PROPOSAL_INPUT_FIELDS: BinaryField[] = [
|
|
189
|
+
{
|
|
190
|
+
name: 'url',
|
|
191
|
+
type: 'bytes',
|
|
192
|
+
offset: 0,
|
|
193
|
+
byteLength: 256,
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'epoch',
|
|
197
|
+
type: 'uint16',
|
|
198
|
+
offset: 256,
|
|
199
|
+
byteLength: 2,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: 'type',
|
|
203
|
+
type: 'uint16',
|
|
204
|
+
offset: 258,
|
|
205
|
+
byteLength: 2,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: 'tick',
|
|
209
|
+
type: 'uint32',
|
|
210
|
+
offset: 260,
|
|
211
|
+
byteLength: 4,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: 'data',
|
|
215
|
+
type: 'bytes',
|
|
216
|
+
offset: 264,
|
|
217
|
+
byteLength: 64,
|
|
218
|
+
},
|
|
219
|
+
]
|
|
220
|
+
|
|
221
|
+
export function buildGeneralQuorumProposalSetProposalInput(
|
|
222
|
+
input: GeneralQuorumProposalSetProposalInput,
|
|
223
|
+
): ContractCall {
|
|
224
|
+
return { contractIndex: GENERAL_QUORUM_PROPOSAL_CONTRACT_INDEX, inputType: GENERAL_QUORUM_PROPOSAL_SET_PROPOSAL_INPUT_TYPE, payload: buildPayload(GENERAL_QUORUM_PROPOSAL_SET_PROPOSAL_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface GeneralQuorumProposalSetProposalOutput {
|
|
228
|
+
proposalIndex: number
|
|
229
|
+
okay: number
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const GENERAL_QUORUM_PROPOSAL_SET_PROPOSAL_OUTPUT_FIELDS: BinaryField[] = [
|
|
233
|
+
{
|
|
234
|
+
name: 'proposalIndex',
|
|
235
|
+
type: 'uint16',
|
|
236
|
+
offset: 0,
|
|
237
|
+
byteLength: 2,
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: 'okay',
|
|
241
|
+
type: 'uint8',
|
|
242
|
+
offset: 2,
|
|
243
|
+
byteLength: 1,
|
|
244
|
+
},
|
|
245
|
+
]
|
|
246
|
+
|
|
247
|
+
export function decodeGeneralQuorumProposalSetProposalOutput(
|
|
248
|
+
data: Uint8Array,
|
|
249
|
+
): GeneralQuorumProposalSetProposalOutput {
|
|
250
|
+
return decodePayload(data, GENERAL_QUORUM_PROPOSAL_SET_PROPOSAL_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GeneralQuorumProposalSetProposalOutput
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export const GENERAL_QUORUM_PROPOSAL_VOTE_INPUT_TYPE = 2
|
|
254
|
+
|
|
255
|
+
export interface GeneralQuorumProposalVoteInput {
|
|
256
|
+
proposalIndex: number
|
|
257
|
+
proposalType: number
|
|
258
|
+
proposalTick: number
|
|
259
|
+
voteValue: bigint
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const GENERAL_QUORUM_PROPOSAL_VOTE_INPUT_FIELDS: BinaryField[] = [
|
|
263
|
+
{
|
|
264
|
+
name: 'proposalIndex',
|
|
265
|
+
type: 'uint16',
|
|
266
|
+
offset: 0,
|
|
267
|
+
byteLength: 2,
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: 'proposalType',
|
|
271
|
+
type: 'uint16',
|
|
272
|
+
offset: 2,
|
|
273
|
+
byteLength: 2,
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
name: 'proposalTick',
|
|
277
|
+
type: 'uint32',
|
|
278
|
+
offset: 4,
|
|
279
|
+
byteLength: 4,
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: 'voteValue',
|
|
283
|
+
type: 'sint64',
|
|
284
|
+
offset: 8,
|
|
285
|
+
byteLength: 8,
|
|
286
|
+
},
|
|
287
|
+
]
|
|
288
|
+
|
|
289
|
+
export function buildGeneralQuorumProposalVoteInput(
|
|
290
|
+
input: GeneralQuorumProposalVoteInput,
|
|
291
|
+
): ContractCall {
|
|
292
|
+
return { contractIndex: GENERAL_QUORUM_PROPOSAL_CONTRACT_INDEX, inputType: GENERAL_QUORUM_PROPOSAL_VOTE_INPUT_TYPE, payload: buildPayload(GENERAL_QUORUM_PROPOSAL_VOTE_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface GeneralQuorumProposalVoteOutput {
|
|
296
|
+
okay: number
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const GENERAL_QUORUM_PROPOSAL_VOTE_OUTPUT_FIELDS: BinaryField[] = [
|
|
300
|
+
{
|
|
301
|
+
name: 'okay',
|
|
302
|
+
type: 'uint8',
|
|
303
|
+
offset: 0,
|
|
304
|
+
byteLength: 1,
|
|
305
|
+
},
|
|
306
|
+
]
|
|
307
|
+
|
|
308
|
+
export function decodeGeneralQuorumProposalVoteOutput(
|
|
309
|
+
data: Uint8Array,
|
|
310
|
+
): GeneralQuorumProposalVoteOutput {
|
|
311
|
+
return decodePayload(data, GENERAL_QUORUM_PROPOSAL_VOTE_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GeneralQuorumProposalVoteOutput
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export const GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INDICES_INPUT_TYPE = 1
|
|
315
|
+
export const GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INDICES_INPUT_SIZE = 5
|
|
316
|
+
|
|
317
|
+
export interface GeneralQuorumProposalGetProposalIndicesInput {
|
|
318
|
+
activeProposals: number
|
|
319
|
+
prevProposalIndex: number
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INDICES_INPUT_FIELDS: BinaryField[] = [
|
|
323
|
+
{
|
|
324
|
+
name: 'activeProposals',
|
|
325
|
+
type: 'uint8',
|
|
326
|
+
offset: 0,
|
|
327
|
+
byteLength: 1,
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
name: 'prevProposalIndex',
|
|
331
|
+
type: 'sint32',
|
|
332
|
+
offset: 1,
|
|
333
|
+
byteLength: 4,
|
|
334
|
+
},
|
|
335
|
+
]
|
|
336
|
+
|
|
337
|
+
export function buildGeneralQuorumProposalGetProposalIndicesInput(
|
|
338
|
+
input: GeneralQuorumProposalGetProposalIndicesInput,
|
|
339
|
+
): Uint8Array {
|
|
340
|
+
return buildPayload(GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INDICES_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32))
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export interface GeneralQuorumProposalGetProposalIndicesOutput {
|
|
344
|
+
numOfIndices: number
|
|
345
|
+
indices: number[]
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
const GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INDICES_OUTPUT_FIELDS: BinaryField[] = [
|
|
349
|
+
{
|
|
350
|
+
name: 'numOfIndices',
|
|
351
|
+
type: 'uint16',
|
|
352
|
+
offset: 0,
|
|
353
|
+
byteLength: 2,
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: 'indices',
|
|
357
|
+
type: 'array',
|
|
358
|
+
offset: 2,
|
|
359
|
+
byteLength: 128,
|
|
360
|
+
arrayLength: 64,
|
|
361
|
+
arrayItemType: 'uint16',
|
|
362
|
+
arrayItemByteLength: 2,
|
|
363
|
+
},
|
|
364
|
+
]
|
|
365
|
+
|
|
366
|
+
export function decodeGeneralQuorumProposalGetProposalIndicesOutput(
|
|
367
|
+
data: Uint8Array,
|
|
368
|
+
): GeneralQuorumProposalGetProposalIndicesOutput {
|
|
369
|
+
return decodePayload(data, GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INDICES_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GeneralQuorumProposalGetProposalIndicesOutput
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export async function generalQuorumProposalGetProposalIndices(
|
|
373
|
+
live: SmartContractCaller,
|
|
374
|
+
input: GeneralQuorumProposalGetProposalIndicesInput,
|
|
375
|
+
options?: ContractCallOptions,
|
|
376
|
+
): Promise<Result<GeneralQuorumProposalGetProposalIndicesOutput, QubicRpcError>> {
|
|
377
|
+
return callContractFunction({
|
|
378
|
+
live,
|
|
379
|
+
contractIndex: GENERAL_QUORUM_PROPOSAL_CONTRACT_INDEX,
|
|
380
|
+
inputType: GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INDICES_INPUT_TYPE,
|
|
381
|
+
inputSize: GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INDICES_INPUT_SIZE,
|
|
382
|
+
inputFields: GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INDICES_INPUT_FIELDS,
|
|
383
|
+
outputFields: GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INDICES_OUTPUT_FIELDS,
|
|
384
|
+
structs: STRUCTS,
|
|
385
|
+
input: (input as unknown as Record<string, unknown>),
|
|
386
|
+
...options,
|
|
387
|
+
})
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export const GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INPUT_TYPE = 2
|
|
391
|
+
export const GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INPUT_SIZE = 2
|
|
392
|
+
|
|
393
|
+
export interface GeneralQuorumProposalGetProposalInput {
|
|
394
|
+
proposalIndex: number
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INPUT_FIELDS: BinaryField[] = [
|
|
398
|
+
{
|
|
399
|
+
name: 'proposalIndex',
|
|
400
|
+
type: 'uint16',
|
|
401
|
+
offset: 0,
|
|
402
|
+
byteLength: 2,
|
|
403
|
+
},
|
|
404
|
+
]
|
|
405
|
+
|
|
406
|
+
export function buildGeneralQuorumProposalGetProposalInput(
|
|
407
|
+
input: GeneralQuorumProposalGetProposalInput,
|
|
408
|
+
): Uint8Array {
|
|
409
|
+
return buildPayload(GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32))
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export interface GeneralQuorumProposalGetProposalOutput {
|
|
413
|
+
okay: number
|
|
414
|
+
_padding0: number[]
|
|
415
|
+
_padding1: number[]
|
|
416
|
+
_padding2: number[]
|
|
417
|
+
proposerPubicKey: string
|
|
418
|
+
proposal: GeneralQuorumProposalProposalDataTStruct
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_OUTPUT_FIELDS: BinaryField[] = [
|
|
422
|
+
{
|
|
423
|
+
name: 'okay',
|
|
424
|
+
type: 'uint8',
|
|
425
|
+
offset: 0,
|
|
426
|
+
byteLength: 1,
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
name: '_padding0',
|
|
430
|
+
type: 'array',
|
|
431
|
+
offset: 1,
|
|
432
|
+
byteLength: 4,
|
|
433
|
+
arrayLength: 4,
|
|
434
|
+
arrayItemType: 'uint8',
|
|
435
|
+
arrayItemByteLength: 1,
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
name: '_padding1',
|
|
439
|
+
type: 'array',
|
|
440
|
+
offset: 5,
|
|
441
|
+
byteLength: 2,
|
|
442
|
+
arrayLength: 2,
|
|
443
|
+
arrayItemType: 'uint8',
|
|
444
|
+
arrayItemByteLength: 1,
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
name: '_padding2',
|
|
448
|
+
type: 'array',
|
|
449
|
+
offset: 7,
|
|
450
|
+
byteLength: 1,
|
|
451
|
+
arrayLength: 1,
|
|
452
|
+
arrayItemType: 'uint8',
|
|
453
|
+
arrayItemByteLength: 1,
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
name: 'proposerPubicKey',
|
|
457
|
+
type: 'id',
|
|
458
|
+
offset: 8,
|
|
459
|
+
byteLength: 32,
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
name: 'proposal',
|
|
463
|
+
type: 'struct',
|
|
464
|
+
offset: 40,
|
|
465
|
+
byteLength: 328,
|
|
466
|
+
structRef: 'ProposalDataT',
|
|
467
|
+
},
|
|
468
|
+
]
|
|
469
|
+
|
|
470
|
+
export function decodeGeneralQuorumProposalGetProposalOutput(
|
|
471
|
+
data: Uint8Array,
|
|
472
|
+
publicKeyToIdentity: (pk: Uint8Array) => string,
|
|
473
|
+
): GeneralQuorumProposalGetProposalOutput {
|
|
474
|
+
return decodePayload(data, GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_OUTPUT_FIELDS, STRUCTS, publicKeyToIdentity) as unknown as GeneralQuorumProposalGetProposalOutput
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export async function generalQuorumProposalGetProposal(
|
|
478
|
+
live: SmartContractCaller,
|
|
479
|
+
input: GeneralQuorumProposalGetProposalInput,
|
|
480
|
+
options?: ContractCallOptions,
|
|
481
|
+
): Promise<Result<GeneralQuorumProposalGetProposalOutput, QubicRpcError>> {
|
|
482
|
+
return callContractFunction({
|
|
483
|
+
live,
|
|
484
|
+
contractIndex: GENERAL_QUORUM_PROPOSAL_CONTRACT_INDEX,
|
|
485
|
+
inputType: GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INPUT_TYPE,
|
|
486
|
+
inputSize: GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INPUT_SIZE,
|
|
487
|
+
inputFields: GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_INPUT_FIELDS,
|
|
488
|
+
outputFields: GENERAL_QUORUM_PROPOSAL_GET_PROPOSAL_OUTPUT_FIELDS,
|
|
489
|
+
structs: STRUCTS,
|
|
490
|
+
input: (input as unknown as Record<string, unknown>),
|
|
491
|
+
...options,
|
|
492
|
+
})
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export const GENERAL_QUORUM_PROPOSAL_GET_VOTE_INPUT_TYPE = 3
|
|
496
|
+
export const GENERAL_QUORUM_PROPOSAL_GET_VOTE_INPUT_SIZE = 34
|
|
497
|
+
|
|
498
|
+
export interface GeneralQuorumProposalGetVoteInput {
|
|
499
|
+
voter: string
|
|
500
|
+
proposalIndex: number
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
const GENERAL_QUORUM_PROPOSAL_GET_VOTE_INPUT_FIELDS: BinaryField[] = [
|
|
504
|
+
{
|
|
505
|
+
name: 'voter',
|
|
506
|
+
type: 'id',
|
|
507
|
+
offset: 0,
|
|
508
|
+
byteLength: 32,
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
name: 'proposalIndex',
|
|
512
|
+
type: 'uint16',
|
|
513
|
+
offset: 32,
|
|
514
|
+
byteLength: 2,
|
|
515
|
+
},
|
|
516
|
+
]
|
|
517
|
+
|
|
518
|
+
export function buildGeneralQuorumProposalGetVoteInput(
|
|
519
|
+
input: GeneralQuorumProposalGetVoteInput,
|
|
520
|
+
identityToPublicKey: (identity: string) => Uint8Array,
|
|
521
|
+
): Uint8Array {
|
|
522
|
+
return buildPayload(GENERAL_QUORUM_PROPOSAL_GET_VOTE_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey)
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export interface GeneralQuorumProposalGetVoteOutput {
|
|
526
|
+
okay: number
|
|
527
|
+
vote: GeneralQuorumProposalProposalSingleVoteDataV1Struct
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
const GENERAL_QUORUM_PROPOSAL_GET_VOTE_OUTPUT_FIELDS: BinaryField[] = [
|
|
531
|
+
{
|
|
532
|
+
name: 'okay',
|
|
533
|
+
type: 'uint8',
|
|
534
|
+
offset: 0,
|
|
535
|
+
byteLength: 1,
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
name: 'vote',
|
|
539
|
+
type: 'struct',
|
|
540
|
+
offset: 1,
|
|
541
|
+
byteLength: 16,
|
|
542
|
+
structRef: 'ProposalSingleVoteDataV1',
|
|
543
|
+
},
|
|
544
|
+
]
|
|
545
|
+
|
|
546
|
+
export function decodeGeneralQuorumProposalGetVoteOutput(
|
|
547
|
+
data: Uint8Array,
|
|
548
|
+
): GeneralQuorumProposalGetVoteOutput {
|
|
549
|
+
return decodePayload(data, GENERAL_QUORUM_PROPOSAL_GET_VOTE_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GeneralQuorumProposalGetVoteOutput
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export async function generalQuorumProposalGetVote(
|
|
553
|
+
live: SmartContractCaller,
|
|
554
|
+
input: GeneralQuorumProposalGetVoteInput,
|
|
555
|
+
options?: ContractCallOptions,
|
|
556
|
+
): Promise<Result<GeneralQuorumProposalGetVoteOutput, QubicRpcError>> {
|
|
557
|
+
return callContractFunction({
|
|
558
|
+
live,
|
|
559
|
+
contractIndex: GENERAL_QUORUM_PROPOSAL_CONTRACT_INDEX,
|
|
560
|
+
inputType: GENERAL_QUORUM_PROPOSAL_GET_VOTE_INPUT_TYPE,
|
|
561
|
+
inputSize: GENERAL_QUORUM_PROPOSAL_GET_VOTE_INPUT_SIZE,
|
|
562
|
+
inputFields: GENERAL_QUORUM_PROPOSAL_GET_VOTE_INPUT_FIELDS,
|
|
563
|
+
outputFields: GENERAL_QUORUM_PROPOSAL_GET_VOTE_OUTPUT_FIELDS,
|
|
564
|
+
structs: STRUCTS,
|
|
565
|
+
input: (input as unknown as Record<string, unknown>),
|
|
566
|
+
...options,
|
|
567
|
+
})
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
export const GENERAL_QUORUM_PROPOSAL_GET_VOTING_RESULTS_INPUT_TYPE = 4
|
|
571
|
+
export const GENERAL_QUORUM_PROPOSAL_GET_VOTING_RESULTS_INPUT_SIZE = 2
|
|
572
|
+
|
|
573
|
+
export interface GeneralQuorumProposalGetVotingResultsInput {
|
|
574
|
+
proposalIndex: number
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
const GENERAL_QUORUM_PROPOSAL_GET_VOTING_RESULTS_INPUT_FIELDS: BinaryField[] = [
|
|
578
|
+
{
|
|
579
|
+
name: 'proposalIndex',
|
|
580
|
+
type: 'uint16',
|
|
581
|
+
offset: 0,
|
|
582
|
+
byteLength: 2,
|
|
583
|
+
},
|
|
584
|
+
]
|
|
585
|
+
|
|
586
|
+
export function buildGeneralQuorumProposalGetVotingResultsInput(
|
|
587
|
+
input: GeneralQuorumProposalGetVotingResultsInput,
|
|
588
|
+
): Uint8Array {
|
|
589
|
+
return buildPayload(GENERAL_QUORUM_PROPOSAL_GET_VOTING_RESULTS_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32))
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
export interface GeneralQuorumProposalGetVotingResultsOutput {
|
|
593
|
+
okay: number
|
|
594
|
+
results: GeneralQuorumProposalProposalSummarizedVotingDataV1Struct
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
const GENERAL_QUORUM_PROPOSAL_GET_VOTING_RESULTS_OUTPUT_FIELDS: BinaryField[] = [
|
|
598
|
+
{
|
|
599
|
+
name: 'okay',
|
|
600
|
+
type: 'uint8',
|
|
601
|
+
offset: 0,
|
|
602
|
+
byteLength: 1,
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
name: 'results',
|
|
606
|
+
type: 'struct',
|
|
607
|
+
offset: 1,
|
|
608
|
+
byteLength: 48,
|
|
609
|
+
structRef: 'ProposalSummarizedVotingDataV1',
|
|
610
|
+
},
|
|
611
|
+
]
|
|
612
|
+
|
|
613
|
+
export function decodeGeneralQuorumProposalGetVotingResultsOutput(
|
|
614
|
+
data: Uint8Array,
|
|
615
|
+
): GeneralQuorumProposalGetVotingResultsOutput {
|
|
616
|
+
return decodePayload(data, GENERAL_QUORUM_PROPOSAL_GET_VOTING_RESULTS_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GeneralQuorumProposalGetVotingResultsOutput
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
export async function generalQuorumProposalGetVotingResults(
|
|
620
|
+
live: SmartContractCaller,
|
|
621
|
+
input: GeneralQuorumProposalGetVotingResultsInput,
|
|
622
|
+
options?: ContractCallOptions,
|
|
623
|
+
): Promise<Result<GeneralQuorumProposalGetVotingResultsOutput, QubicRpcError>> {
|
|
624
|
+
return callContractFunction({
|
|
625
|
+
live,
|
|
626
|
+
contractIndex: GENERAL_QUORUM_PROPOSAL_CONTRACT_INDEX,
|
|
627
|
+
inputType: GENERAL_QUORUM_PROPOSAL_GET_VOTING_RESULTS_INPUT_TYPE,
|
|
628
|
+
inputSize: GENERAL_QUORUM_PROPOSAL_GET_VOTING_RESULTS_INPUT_SIZE,
|
|
629
|
+
inputFields: GENERAL_QUORUM_PROPOSAL_GET_VOTING_RESULTS_INPUT_FIELDS,
|
|
630
|
+
outputFields: GENERAL_QUORUM_PROPOSAL_GET_VOTING_RESULTS_OUTPUT_FIELDS,
|
|
631
|
+
structs: STRUCTS,
|
|
632
|
+
input: (input as unknown as Record<string, unknown>),
|
|
633
|
+
...options,
|
|
634
|
+
})
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
export const GENERAL_QUORUM_PROPOSAL_GET_REVENUE_DONATION_INPUT_TYPE = 5
|
|
638
|
+
export const GENERAL_QUORUM_PROPOSAL_GET_REVENUE_DONATION_INPUT_SIZE = 0
|
|
639
|
+
|
|
640
|
+
export interface GeneralQuorumProposalGetRevenueDonationOutput {
|
|
641
|
+
data: number[]
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
const GENERAL_QUORUM_PROPOSAL_GET_REVENUE_DONATION_OUTPUT_FIELDS: BinaryField[] = [
|
|
645
|
+
{
|
|
646
|
+
name: 'data',
|
|
647
|
+
type: 'array',
|
|
648
|
+
offset: 0,
|
|
649
|
+
byteLength: 5376,
|
|
650
|
+
arrayLength: 128,
|
|
651
|
+
arrayItemByteLength: 42,
|
|
652
|
+
arrayItemStructRef: 'RevenueDonationEntry',
|
|
653
|
+
},
|
|
654
|
+
]
|
|
655
|
+
|
|
656
|
+
export function decodeGeneralQuorumProposalGetRevenueDonationOutput(
|
|
657
|
+
data: Uint8Array,
|
|
658
|
+
): GeneralQuorumProposalGetRevenueDonationOutput {
|
|
659
|
+
return decodePayload(data, GENERAL_QUORUM_PROPOSAL_GET_REVENUE_DONATION_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GeneralQuorumProposalGetRevenueDonationOutput
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export async function generalQuorumProposalGetRevenueDonation(
|
|
663
|
+
live: SmartContractCaller,
|
|
664
|
+
options?: ContractCallOptions,
|
|
665
|
+
): Promise<Result<GeneralQuorumProposalGetRevenueDonationOutput, QubicRpcError>> {
|
|
666
|
+
return callContractFunction({
|
|
667
|
+
live,
|
|
668
|
+
contractIndex: GENERAL_QUORUM_PROPOSAL_CONTRACT_INDEX,
|
|
669
|
+
inputType: GENERAL_QUORUM_PROPOSAL_GET_REVENUE_DONATION_INPUT_TYPE,
|
|
670
|
+
inputSize: GENERAL_QUORUM_PROPOSAL_GET_REVENUE_DONATION_INPUT_SIZE,
|
|
671
|
+
inputFields: [],
|
|
672
|
+
outputFields: GENERAL_QUORUM_PROPOSAL_GET_REVENUE_DONATION_OUTPUT_FIELDS,
|
|
673
|
+
structs: STRUCTS,
|
|
674
|
+
input: {},
|
|
675
|
+
...options,
|
|
676
|
+
})
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
export const generalQuorumProposal = {
|
|
680
|
+
contractIndex: GENERAL_QUORUM_PROPOSAL_CONTRACT_INDEX,
|
|
681
|
+
GetProposalIndices: generalQuorumProposalGetProposalIndices,
|
|
682
|
+
GetProposal: generalQuorumProposalGetProposal,
|
|
683
|
+
GetVote: generalQuorumProposalGetVote,
|
|
684
|
+
GetVotingResults: generalQuorumProposalGetVotingResults,
|
|
685
|
+
GetRevenueDonation: generalQuorumProposalGetRevenueDonation,
|
|
686
|
+
buildSetProposalInput: buildGeneralQuorumProposalSetProposalInput,
|
|
687
|
+
decodeSetProposalOutput: decodeGeneralQuorumProposalSetProposalOutput,
|
|
688
|
+
buildVoteInput: buildGeneralQuorumProposalVoteInput,
|
|
689
|
+
decodeVoteOutput: decodeGeneralQuorumProposalVoteOutput,
|
|
690
|
+
}
|
|
691
|
+
|