@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.
Files changed (163) hide show
  1. package/LICENSE +41 -0
  2. package/README.md +15 -18
  3. package/dist/__generated__/computorcontrolledfund.d.ts +1 -1
  4. package/dist/__generated__/computorcontrolledfund.d.ts.map +1 -1
  5. package/dist/__generated__/computorcontrolledfund.js +8 -8
  6. package/dist/__generated__/computorcontrolledfund.js.map +1 -1
  7. package/dist/__generated__/escrow.d.ts +1 -1
  8. package/dist/__generated__/escrow.d.ts.map +1 -1
  9. package/dist/__generated__/escrow.js +3 -3
  10. package/dist/__generated__/escrow.js.map +1 -1
  11. package/dist/__generated__/generalquorumproposal.d.ts +1 -1
  12. package/dist/__generated__/generalquorumproposal.d.ts.map +1 -1
  13. package/dist/__generated__/generalquorumproposal.js +6 -6
  14. package/dist/__generated__/generalquorumproposal.js.map +1 -1
  15. package/dist/__generated__/ggwp.d.ts +265 -0
  16. package/dist/__generated__/ggwp.d.ts.map +1 -0
  17. package/dist/__generated__/ggwp.js +825 -0
  18. package/dist/__generated__/ggwp.js.map +1 -0
  19. package/dist/__generated__/index.d.ts +1 -0
  20. package/dist/__generated__/index.d.ts.map +1 -1
  21. package/dist/__generated__/index.js +1 -0
  22. package/dist/__generated__/index.js.map +1 -1
  23. package/dist/__generated__/msvault.d.ts +1 -1
  24. package/dist/__generated__/msvault.d.ts.map +1 -1
  25. package/dist/__generated__/msvault.js +19 -19
  26. package/dist/__generated__/msvault.js.map +1 -1
  27. package/dist/__generated__/multisignvault.d.ts +25 -25
  28. package/dist/__generated__/multisignvault.d.ts.map +1 -1
  29. package/dist/__generated__/multisignvault.js +25 -25
  30. package/dist/__generated__/multisignvault.js.map +1 -1
  31. package/dist/__generated__/nostromo.d.ts +1 -1
  32. package/dist/__generated__/nostromo.d.ts.map +1 -1
  33. package/dist/__generated__/nostromo.js +15 -15
  34. package/dist/__generated__/nostromo.js.map +1 -1
  35. package/dist/__generated__/pulse.d.ts +1 -1
  36. package/dist/__generated__/pulse.d.ts.map +1 -1
  37. package/dist/__generated__/pulse.js +26 -26
  38. package/dist/__generated__/pulse.js.map +1 -1
  39. package/dist/__generated__/qbay.d.ts +1 -1
  40. package/dist/__generated__/qbay.d.ts.map +1 -1
  41. package/dist/__generated__/qbay.js +23 -23
  42. package/dist/__generated__/qbay.js.map +1 -1
  43. package/dist/__generated__/qbond.d.ts +1 -1
  44. package/dist/__generated__/qbond.d.ts.map +1 -1
  45. package/dist/__generated__/qbond.js +14 -14
  46. package/dist/__generated__/qbond.js.map +1 -1
  47. package/dist/__generated__/qdraw.d.ts +1 -1
  48. package/dist/__generated__/qdraw.d.ts.map +1 -1
  49. package/dist/__generated__/qdraw.js.map +1 -1
  50. package/dist/__generated__/qduel.d.ts +1 -1
  51. package/dist/__generated__/qduel.d.ts.map +1 -1
  52. package/dist/__generated__/qduel.js +11 -11
  53. package/dist/__generated__/qduel.js.map +1 -1
  54. package/dist/__generated__/qearn.d.ts +1 -1
  55. package/dist/__generated__/qearn.d.ts.map +1 -1
  56. package/dist/__generated__/qearn.js +10 -10
  57. package/dist/__generated__/qearn.js.map +1 -1
  58. package/dist/__generated__/qip.d.ts +18 -1
  59. package/dist/__generated__/qip.d.ts.map +1 -1
  60. package/dist/__generated__/qip.js +64 -3
  61. package/dist/__generated__/qip.js.map +1 -1
  62. package/dist/__generated__/qraffle.d.ts +1 -1
  63. package/dist/__generated__/qraffle.d.ts.map +1 -1
  64. package/dist/__generated__/qraffle.js +12 -12
  65. package/dist/__generated__/qraffle.js.map +1 -1
  66. package/dist/__generated__/qreservepool.d.ts +1 -1
  67. package/dist/__generated__/qreservepool.d.ts.map +1 -1
  68. package/dist/__generated__/qreservepool.js +5 -5
  69. package/dist/__generated__/qreservepool.js.map +1 -1
  70. package/dist/__generated__/qrwa.d.ts +1 -1
  71. package/dist/__generated__/qrwa.d.ts.map +1 -1
  72. package/dist/__generated__/qrwa.js +18 -18
  73. package/dist/__generated__/qrwa.js.map +1 -1
  74. package/dist/__generated__/qswap.d.ts +3 -1
  75. package/dist/__generated__/qswap.d.ts.map +1 -1
  76. package/dist/__generated__/qswap.js +30 -18
  77. package/dist/__generated__/qswap.js.map +1 -1
  78. package/dist/__generated__/qthirtyfour.d.ts +1 -1
  79. package/dist/__generated__/qthirtyfour.d.ts.map +1 -1
  80. package/dist/__generated__/qthirtyfour.js +19 -19
  81. package/dist/__generated__/qthirtyfour.js.map +1 -1
  82. package/dist/__generated__/qubicicoportal.d.ts +4 -4
  83. package/dist/__generated__/qubicicoportal.d.ts.map +1 -1
  84. package/dist/__generated__/qubicicoportal.js +4 -4
  85. package/dist/__generated__/qubicicoportal.js.map +1 -1
  86. package/dist/__generated__/quottery.d.ts +1 -1
  87. package/dist/__generated__/quottery.d.ts.map +1 -1
  88. package/dist/__generated__/quottery.js +14 -14
  89. package/dist/__generated__/quottery.js.map +1 -1
  90. package/dist/__generated__/qusino.d.ts +1 -1
  91. package/dist/__generated__/qusino.d.ts.map +1 -1
  92. package/dist/__generated__/qusino.js +13 -13
  93. package/dist/__generated__/qusino.js.map +1 -1
  94. package/dist/__generated__/qutil.d.ts +1 -1
  95. package/dist/__generated__/qutil.d.ts.map +1 -1
  96. package/dist/__generated__/qutil.js +22 -22
  97. package/dist/__generated__/qutil.js.map +1 -1
  98. package/dist/__generated__/qvault.d.ts +14 -2
  99. package/dist/__generated__/qvault.d.ts.map +1 -1
  100. package/dist/__generated__/qvault.js +70 -32
  101. package/dist/__generated__/qvault.js.map +1 -1
  102. package/dist/__generated__/qx.d.ts +1 -1
  103. package/dist/__generated__/qx.d.ts.map +1 -1
  104. package/dist/__generated__/qx.js +12 -12
  105. package/dist/__generated__/qx.js.map +1 -1
  106. package/dist/__generated__/random.d.ts +24 -1
  107. package/dist/__generated__/random.d.ts.map +1 -1
  108. package/dist/__generated__/random.js +68 -0
  109. package/dist/__generated__/random.js.map +1 -1
  110. package/dist/__generated__/randomlottery.d.ts +1 -1
  111. package/dist/__generated__/randomlottery.d.ts.map +1 -1
  112. package/dist/__generated__/randomlottery.js +12 -12
  113. package/dist/__generated__/randomlottery.js.map +1 -1
  114. package/dist/__generated__/vottunbridge.d.ts +1 -1
  115. package/dist/__generated__/vottunbridge.d.ts.map +1 -1
  116. package/dist/__generated__/vottunbridge.js +13 -13
  117. package/dist/__generated__/vottunbridge.js.map +1 -1
  118. package/dist/call-contract.d.ts.map +1 -1
  119. package/dist/call-contract.js +6 -1
  120. package/dist/call-contract.js.map +1 -1
  121. package/dist/index.d.ts +2 -2
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +1 -1
  124. package/dist/index.js.map +1 -1
  125. package/package.json +8 -7
  126. package/src/__generated__/computorcontrolledfund.ts +1066 -0
  127. package/src/__generated__/escrow.ts +529 -0
  128. package/src/__generated__/generalquorumproposal.ts +691 -0
  129. package/src/__generated__/ggwp.ts +1241 -0
  130. package/src/__generated__/index.ts +28 -0
  131. package/src/__generated__/msvault.ts +1716 -0
  132. package/src/__generated__/multisignvault.ts +1511 -0
  133. package/src/__generated__/mylastmatch.ts +12 -0
  134. package/src/__generated__/nostromo.ts +1551 -0
  135. package/src/__generated__/pulse.ts +1512 -0
  136. package/src/__generated__/qbay.ts +2097 -0
  137. package/src/__generated__/qbond.ts +1016 -0
  138. package/src/__generated__/qdraw.ts +188 -0
  139. package/src/__generated__/qduel.ts +827 -0
  140. package/src/__generated__/qearn.ts +696 -0
  141. package/src/__generated__/qip.ts +501 -0
  142. package/src/__generated__/qraffle.ts +1162 -0
  143. package/src/__generated__/qreservepool.ts +281 -0
  144. package/src/__generated__/qrwa.ts +1491 -0
  145. package/src/__generated__/qswap.ts +1336 -0
  146. package/src/__generated__/qthirtyfour.ts +1131 -0
  147. package/src/__generated__/qubicicoportal.ts +386 -0
  148. package/src/__generated__/quottery.ts +1519 -0
  149. package/src/__generated__/qusino.ts +799 -0
  150. package/src/__generated__/qutil.ts +1506 -0
  151. package/src/__generated__/qvault.ts +2911 -0
  152. package/src/__generated__/qx.ts +861 -0
  153. package/src/__generated__/random.ts +145 -0
  154. package/src/__generated__/randomlottery.ts +653 -0
  155. package/src/__generated__/supplywatcher.ts +12 -0
  156. package/src/__generated__/vottunbridge.ts +1162 -0
  157. package/src/__tests__/contracts.test.ts +933 -0
  158. package/src/call-contract.ts +87 -0
  159. package/src/index.ts +9 -0
  160. package/dist/result.d.ts +0 -12
  161. package/dist/result.d.ts.map +0 -1
  162. package/dist/result.js +0 -7
  163. package/dist/result.js.map +0 -1
@@ -0,0 +1,827 @@
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 Q_DUEL_CONTRACT_INDEX = 23
9
+
10
+ export interface QDuelRoomInfoStruct {
11
+ roomId: string
12
+ owner: string
13
+ allowedPlayer: string
14
+ amount: bigint
15
+ closeTimer: bigint
16
+ lastUpdate: QDuelDateAndTimeStruct
17
+ }
18
+
19
+ export interface QDuelWinnerDataStruct {
20
+ player1: string
21
+ player2: string
22
+ winner: string
23
+ revenue: bigint
24
+ }
25
+
26
+ export interface QDuelDateAndTimeStruct {
27
+ value: bigint
28
+ }
29
+
30
+ const STRUCTS: Record<string, NamedStruct> = {
31
+ 'RoomInfo': {
32
+ name: 'RoomInfo',
33
+ byteLength: 120,
34
+ fields: [
35
+ {
36
+ name: 'roomId',
37
+ type: 'id',
38
+ offset: 0,
39
+ byteLength: 32,
40
+ },
41
+ {
42
+ name: 'owner',
43
+ type: 'id',
44
+ offset: 32,
45
+ byteLength: 32,
46
+ },
47
+ {
48
+ name: 'allowedPlayer',
49
+ type: 'id',
50
+ offset: 64,
51
+ byteLength: 32,
52
+ },
53
+ {
54
+ name: 'amount',
55
+ type: 'sint64',
56
+ offset: 96,
57
+ byteLength: 8,
58
+ },
59
+ {
60
+ name: 'closeTimer',
61
+ type: 'uint64',
62
+ offset: 104,
63
+ byteLength: 8,
64
+ },
65
+ {
66
+ name: 'lastUpdate',
67
+ type: 'struct',
68
+ offset: 112,
69
+ byteLength: 8,
70
+ structRef: 'DateAndTime',
71
+ },
72
+ ],
73
+ },
74
+ 'WinnerData': {
75
+ name: 'WinnerData',
76
+ byteLength: 104,
77
+ fields: [
78
+ {
79
+ name: 'player1',
80
+ type: 'id',
81
+ offset: 0,
82
+ byteLength: 32,
83
+ },
84
+ {
85
+ name: 'player2',
86
+ type: 'id',
87
+ offset: 32,
88
+ byteLength: 32,
89
+ },
90
+ {
91
+ name: 'winner',
92
+ type: 'id',
93
+ offset: 64,
94
+ byteLength: 32,
95
+ },
96
+ {
97
+ name: 'revenue',
98
+ type: 'uint64',
99
+ offset: 96,
100
+ byteLength: 8,
101
+ },
102
+ ],
103
+ },
104
+ 'DateAndTime': {
105
+ name: 'DateAndTime',
106
+ byteLength: 8,
107
+ fields: [
108
+ {
109
+ name: 'value',
110
+ type: 'uint64',
111
+ offset: 0,
112
+ byteLength: 8,
113
+ },
114
+ ],
115
+ },
116
+ }
117
+
118
+ export const Q_DUEL_CREATE_ROOM_INPUT_TYPE = 1
119
+
120
+ export interface QDuelCreateRoomInput {
121
+ allowedPlayer: string
122
+ stake: bigint
123
+ raiseStep: bigint
124
+ maxStake: bigint
125
+ }
126
+
127
+ const Q_DUEL_CREATE_ROOM_INPUT_FIELDS: BinaryField[] = [
128
+ {
129
+ name: 'allowedPlayer',
130
+ type: 'id',
131
+ offset: 0,
132
+ byteLength: 32,
133
+ },
134
+ {
135
+ name: 'stake',
136
+ type: 'sint64',
137
+ offset: 32,
138
+ byteLength: 8,
139
+ },
140
+ {
141
+ name: 'raiseStep',
142
+ type: 'sint64',
143
+ offset: 40,
144
+ byteLength: 8,
145
+ },
146
+ {
147
+ name: 'maxStake',
148
+ type: 'sint64',
149
+ offset: 48,
150
+ byteLength: 8,
151
+ },
152
+ ]
153
+
154
+ export function buildQDuelCreateRoomInput(
155
+ input: QDuelCreateRoomInput,
156
+ identityToPublicKey: (identity: string) => Uint8Array,
157
+ ): ContractCall {
158
+ return { contractIndex: Q_DUEL_CONTRACT_INDEX, inputType: Q_DUEL_CREATE_ROOM_INPUT_TYPE, payload: buildPayload(Q_DUEL_CREATE_ROOM_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey) }
159
+ }
160
+
161
+ export interface QDuelCreateRoomOutput {
162
+ returnCode: number
163
+ }
164
+
165
+ const Q_DUEL_CREATE_ROOM_OUTPUT_FIELDS: BinaryField[] = [
166
+ {
167
+ name: 'returnCode',
168
+ type: 'uint8',
169
+ offset: 0,
170
+ byteLength: 1,
171
+ },
172
+ ]
173
+
174
+ export function decodeQDuelCreateRoomOutput(
175
+ data: Uint8Array,
176
+ ): QDuelCreateRoomOutput {
177
+ return decodePayload(data, Q_DUEL_CREATE_ROOM_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as QDuelCreateRoomOutput
178
+ }
179
+
180
+ export const Q_DUEL_CONNECT_TO_ROOM_INPUT_TYPE = 2
181
+
182
+ export interface QDuelConnectToRoomInput {
183
+ roomId: string
184
+ }
185
+
186
+ const Q_DUEL_CONNECT_TO_ROOM_INPUT_FIELDS: BinaryField[] = [
187
+ {
188
+ name: 'roomId',
189
+ type: 'id',
190
+ offset: 0,
191
+ byteLength: 32,
192
+ },
193
+ ]
194
+
195
+ export function buildQDuelConnectToRoomInput(
196
+ input: QDuelConnectToRoomInput,
197
+ identityToPublicKey: (identity: string) => Uint8Array,
198
+ ): ContractCall {
199
+ return { contractIndex: Q_DUEL_CONTRACT_INDEX, inputType: Q_DUEL_CONNECT_TO_ROOM_INPUT_TYPE, payload: buildPayload(Q_DUEL_CONNECT_TO_ROOM_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey) }
200
+ }
201
+
202
+ export interface QDuelConnectToRoomOutput {
203
+ winner: string
204
+ returnCode: number
205
+ }
206
+
207
+ const Q_DUEL_CONNECT_TO_ROOM_OUTPUT_FIELDS: BinaryField[] = [
208
+ {
209
+ name: 'winner',
210
+ type: 'id',
211
+ offset: 0,
212
+ byteLength: 32,
213
+ },
214
+ {
215
+ name: 'returnCode',
216
+ type: 'uint8',
217
+ offset: 32,
218
+ byteLength: 1,
219
+ },
220
+ ]
221
+
222
+ export function decodeQDuelConnectToRoomOutput(
223
+ data: Uint8Array,
224
+ publicKeyToIdentity: (pk: Uint8Array) => string,
225
+ ): QDuelConnectToRoomOutput {
226
+ return decodePayload(data, Q_DUEL_CONNECT_TO_ROOM_OUTPUT_FIELDS, STRUCTS, publicKeyToIdentity) as unknown as QDuelConnectToRoomOutput
227
+ }
228
+
229
+ export const Q_DUEL_SET_PERCENT_FEES_INPUT_TYPE = 3
230
+
231
+ export interface QDuelSetPercentFeesInput {
232
+ devFeePercentBps: number
233
+ burnFeePercentBps: number
234
+ shareholdersFeePercentBps: number
235
+ percentScale: number
236
+ }
237
+
238
+ const Q_DUEL_SET_PERCENT_FEES_INPUT_FIELDS: BinaryField[] = [
239
+ {
240
+ name: 'devFeePercentBps',
241
+ type: 'uint8',
242
+ offset: 0,
243
+ byteLength: 1,
244
+ },
245
+ {
246
+ name: 'burnFeePercentBps',
247
+ type: 'uint8',
248
+ offset: 1,
249
+ byteLength: 1,
250
+ },
251
+ {
252
+ name: 'shareholdersFeePercentBps',
253
+ type: 'uint8',
254
+ offset: 2,
255
+ byteLength: 1,
256
+ },
257
+ {
258
+ name: 'percentScale',
259
+ type: 'uint16',
260
+ offset: 3,
261
+ byteLength: 2,
262
+ },
263
+ ]
264
+
265
+ export function buildQDuelSetPercentFeesInput(
266
+ input: QDuelSetPercentFeesInput,
267
+ ): ContractCall {
268
+ return { contractIndex: Q_DUEL_CONTRACT_INDEX, inputType: Q_DUEL_SET_PERCENT_FEES_INPUT_TYPE, payload: buildPayload(Q_DUEL_SET_PERCENT_FEES_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
269
+ }
270
+
271
+ export interface QDuelSetPercentFeesOutput {
272
+ returnCode: number
273
+ }
274
+
275
+ const Q_DUEL_SET_PERCENT_FEES_OUTPUT_FIELDS: BinaryField[] = [
276
+ {
277
+ name: 'returnCode',
278
+ type: 'uint8',
279
+ offset: 0,
280
+ byteLength: 1,
281
+ },
282
+ ]
283
+
284
+ export function decodeQDuelSetPercentFeesOutput(
285
+ data: Uint8Array,
286
+ ): QDuelSetPercentFeesOutput {
287
+ return decodePayload(data, Q_DUEL_SET_PERCENT_FEES_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as QDuelSetPercentFeesOutput
288
+ }
289
+
290
+ export const Q_DUEL_SET_TTL_HOURS_INPUT_TYPE = 4
291
+
292
+ export interface QDuelSetTTLHoursInput {
293
+ ttlHours: number
294
+ }
295
+
296
+ const Q_DUEL_SET_TTL_HOURS_INPUT_FIELDS: BinaryField[] = [
297
+ {
298
+ name: 'ttlHours',
299
+ type: 'uint8',
300
+ offset: 0,
301
+ byteLength: 1,
302
+ },
303
+ ]
304
+
305
+ export function buildQDuelSetTTLHoursInput(
306
+ input: QDuelSetTTLHoursInput,
307
+ ): ContractCall {
308
+ return { contractIndex: Q_DUEL_CONTRACT_INDEX, inputType: Q_DUEL_SET_TTL_HOURS_INPUT_TYPE, payload: buildPayload(Q_DUEL_SET_TTL_HOURS_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
309
+ }
310
+
311
+ export interface QDuelSetTTLHoursOutput {
312
+ returnCode: number
313
+ }
314
+
315
+ const Q_DUEL_SET_TTL_HOURS_OUTPUT_FIELDS: BinaryField[] = [
316
+ {
317
+ name: 'returnCode',
318
+ type: 'uint8',
319
+ offset: 0,
320
+ byteLength: 1,
321
+ },
322
+ ]
323
+
324
+ export function decodeQDuelSetTTLHoursOutput(
325
+ data: Uint8Array,
326
+ ): QDuelSetTTLHoursOutput {
327
+ return decodePayload(data, Q_DUEL_SET_TTL_HOURS_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as QDuelSetTTLHoursOutput
328
+ }
329
+
330
+ export const Q_DUEL_DEPOSIT_INPUT_TYPE = 5
331
+
332
+ export interface QDuelDepositOutput {
333
+ returnCode: number
334
+ }
335
+
336
+ const Q_DUEL_DEPOSIT_OUTPUT_FIELDS: BinaryField[] = [
337
+ {
338
+ name: 'returnCode',
339
+ type: 'uint8',
340
+ offset: 0,
341
+ byteLength: 1,
342
+ },
343
+ ]
344
+
345
+ export function decodeQDuelDepositOutput(
346
+ data: Uint8Array,
347
+ ): QDuelDepositOutput {
348
+ return decodePayload(data, Q_DUEL_DEPOSIT_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as QDuelDepositOutput
349
+ }
350
+
351
+ export const Q_DUEL_WITHDRAW_INPUT_TYPE = 6
352
+
353
+ export interface QDuelWithdrawInput {
354
+ amount: bigint
355
+ }
356
+
357
+ const Q_DUEL_WITHDRAW_INPUT_FIELDS: BinaryField[] = [
358
+ {
359
+ name: 'amount',
360
+ type: 'sint64',
361
+ offset: 0,
362
+ byteLength: 8,
363
+ },
364
+ ]
365
+
366
+ export function buildQDuelWithdrawInput(
367
+ input: QDuelWithdrawInput,
368
+ ): ContractCall {
369
+ return { contractIndex: Q_DUEL_CONTRACT_INDEX, inputType: Q_DUEL_WITHDRAW_INPUT_TYPE, payload: buildPayload(Q_DUEL_WITHDRAW_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
370
+ }
371
+
372
+ export interface QDuelWithdrawOutput {
373
+ returnCode: number
374
+ }
375
+
376
+ const Q_DUEL_WITHDRAW_OUTPUT_FIELDS: BinaryField[] = [
377
+ {
378
+ name: 'returnCode',
379
+ type: 'uint8',
380
+ offset: 0,
381
+ byteLength: 1,
382
+ },
383
+ ]
384
+
385
+ export function decodeQDuelWithdrawOutput(
386
+ data: Uint8Array,
387
+ ): QDuelWithdrawOutput {
388
+ return decodePayload(data, Q_DUEL_WITHDRAW_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as QDuelWithdrawOutput
389
+ }
390
+
391
+ export const Q_DUEL_CLOSE_ROOM_INPUT_TYPE = 7
392
+
393
+ export interface QDuelCloseRoomOutput {
394
+ returnCode: number
395
+ }
396
+
397
+ const Q_DUEL_CLOSE_ROOM_OUTPUT_FIELDS: BinaryField[] = [
398
+ {
399
+ name: 'returnCode',
400
+ type: 'uint8',
401
+ offset: 0,
402
+ byteLength: 1,
403
+ },
404
+ ]
405
+
406
+ export function decodeQDuelCloseRoomOutput(
407
+ data: Uint8Array,
408
+ ): QDuelCloseRoomOutput {
409
+ return decodePayload(data, Q_DUEL_CLOSE_ROOM_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as QDuelCloseRoomOutput
410
+ }
411
+
412
+ export const Q_DUEL_GET_PERCENT_FEES_INPUT_TYPE = 1
413
+ export const Q_DUEL_GET_PERCENT_FEES_INPUT_SIZE = 0
414
+
415
+ export interface QDuelGetPercentFeesOutput {
416
+ devFeePercentBps: number
417
+ burnFeePercentBps: number
418
+ shareholdersFeePercentBps: number
419
+ percentScale: number
420
+ returnCode: bigint
421
+ }
422
+
423
+ const Q_DUEL_GET_PERCENT_FEES_OUTPUT_FIELDS: BinaryField[] = [
424
+ {
425
+ name: 'devFeePercentBps',
426
+ type: 'uint8',
427
+ offset: 0,
428
+ byteLength: 1,
429
+ },
430
+ {
431
+ name: 'burnFeePercentBps',
432
+ type: 'uint8',
433
+ offset: 1,
434
+ byteLength: 1,
435
+ },
436
+ {
437
+ name: 'shareholdersFeePercentBps',
438
+ type: 'uint8',
439
+ offset: 2,
440
+ byteLength: 1,
441
+ },
442
+ {
443
+ name: 'percentScale',
444
+ type: 'uint16',
445
+ offset: 3,
446
+ byteLength: 2,
447
+ },
448
+ {
449
+ name: 'returnCode',
450
+ type: 'uint64',
451
+ offset: 5,
452
+ byteLength: 8,
453
+ },
454
+ ]
455
+
456
+ export function decodeQDuelGetPercentFeesOutput(
457
+ data: Uint8Array,
458
+ ): QDuelGetPercentFeesOutput {
459
+ return decodePayload(data, Q_DUEL_GET_PERCENT_FEES_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as QDuelGetPercentFeesOutput
460
+ }
461
+
462
+ export async function qDuelGetPercentFees(
463
+ live: SmartContractCaller,
464
+ options?: ContractCallOptions,
465
+ ): Promise<Result<QDuelGetPercentFeesOutput, QubicRpcError>> {
466
+ return callContractFunction({
467
+ live,
468
+ contractIndex: Q_DUEL_CONTRACT_INDEX,
469
+ inputType: Q_DUEL_GET_PERCENT_FEES_INPUT_TYPE,
470
+ inputSize: Q_DUEL_GET_PERCENT_FEES_INPUT_SIZE,
471
+ inputFields: [],
472
+ outputFields: Q_DUEL_GET_PERCENT_FEES_OUTPUT_FIELDS,
473
+ structs: STRUCTS,
474
+ input: {},
475
+ ...options,
476
+ })
477
+ }
478
+
479
+ export const Q_DUEL_GET_ROOMS_INPUT_TYPE = 2
480
+ export const Q_DUEL_GET_ROOMS_INPUT_SIZE = 0
481
+
482
+ export interface QDuelGetRoomsOutput {
483
+ rooms: number[]
484
+ returnCode: number
485
+ }
486
+
487
+ const Q_DUEL_GET_ROOMS_OUTPUT_FIELDS: BinaryField[] = [
488
+ {
489
+ name: 'rooms',
490
+ type: 'array',
491
+ offset: 0,
492
+ byteLength: 61440,
493
+ arrayLength: 512,
494
+ arrayItemByteLength: 120,
495
+ arrayItemStructRef: 'RoomInfo',
496
+ },
497
+ {
498
+ name: 'returnCode',
499
+ type: 'uint8',
500
+ offset: 61440,
501
+ byteLength: 1,
502
+ },
503
+ ]
504
+
505
+ export function decodeQDuelGetRoomsOutput(
506
+ data: Uint8Array,
507
+ ): QDuelGetRoomsOutput {
508
+ return decodePayload(data, Q_DUEL_GET_ROOMS_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as QDuelGetRoomsOutput
509
+ }
510
+
511
+ export async function qDuelGetRooms(
512
+ live: SmartContractCaller,
513
+ options?: ContractCallOptions,
514
+ ): Promise<Result<QDuelGetRoomsOutput, QubicRpcError>> {
515
+ return callContractFunction({
516
+ live,
517
+ contractIndex: Q_DUEL_CONTRACT_INDEX,
518
+ inputType: Q_DUEL_GET_ROOMS_INPUT_TYPE,
519
+ inputSize: Q_DUEL_GET_ROOMS_INPUT_SIZE,
520
+ inputFields: [],
521
+ outputFields: Q_DUEL_GET_ROOMS_OUTPUT_FIELDS,
522
+ structs: STRUCTS,
523
+ input: {},
524
+ ...options,
525
+ })
526
+ }
527
+
528
+ export const Q_DUEL_GET_TTL_HOURS_INPUT_TYPE = 3
529
+ export const Q_DUEL_GET_TTL_HOURS_INPUT_SIZE = 0
530
+
531
+ export interface QDuelGetTTLHoursOutput {
532
+ ttlHours: number
533
+ returnCode: number
534
+ }
535
+
536
+ const Q_DUEL_GET_TTL_HOURS_OUTPUT_FIELDS: BinaryField[] = [
537
+ {
538
+ name: 'ttlHours',
539
+ type: 'uint8',
540
+ offset: 0,
541
+ byteLength: 1,
542
+ },
543
+ {
544
+ name: 'returnCode',
545
+ type: 'uint8',
546
+ offset: 1,
547
+ byteLength: 1,
548
+ },
549
+ ]
550
+
551
+ export function decodeQDuelGetTTLHoursOutput(
552
+ data: Uint8Array,
553
+ ): QDuelGetTTLHoursOutput {
554
+ return decodePayload(data, Q_DUEL_GET_TTL_HOURS_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as QDuelGetTTLHoursOutput
555
+ }
556
+
557
+ export async function qDuelGetTTLHours(
558
+ live: SmartContractCaller,
559
+ options?: ContractCallOptions,
560
+ ): Promise<Result<QDuelGetTTLHoursOutput, QubicRpcError>> {
561
+ return callContractFunction({
562
+ live,
563
+ contractIndex: Q_DUEL_CONTRACT_INDEX,
564
+ inputType: Q_DUEL_GET_TTL_HOURS_INPUT_TYPE,
565
+ inputSize: Q_DUEL_GET_TTL_HOURS_INPUT_SIZE,
566
+ inputFields: [],
567
+ outputFields: Q_DUEL_GET_TTL_HOURS_OUTPUT_FIELDS,
568
+ structs: STRUCTS,
569
+ input: {},
570
+ ...options,
571
+ })
572
+ }
573
+
574
+ export const Q_DUEL_GET_USER_PROFILE_INPUT_TYPE = 4
575
+ export const Q_DUEL_GET_USER_PROFILE_INPUT_SIZE = 32
576
+
577
+ export interface QDuelGetUserProfileInput {
578
+ userId: string
579
+ }
580
+
581
+ const Q_DUEL_GET_USER_PROFILE_INPUT_FIELDS: BinaryField[] = [
582
+ {
583
+ name: 'userId',
584
+ type: 'id',
585
+ offset: 0,
586
+ byteLength: 32,
587
+ },
588
+ ]
589
+
590
+ export function buildQDuelGetUserProfileInput(
591
+ input: QDuelGetUserProfileInput,
592
+ identityToPublicKey: (identity: string) => Uint8Array,
593
+ ): Uint8Array {
594
+ return buildPayload(Q_DUEL_GET_USER_PROFILE_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey)
595
+ }
596
+
597
+ export interface QDuelGetUserProfileOutput {
598
+ roomId: string
599
+ depositedAmount: bigint
600
+ locked: bigint
601
+ stake: bigint
602
+ raiseStep: bigint
603
+ maxStake: bigint
604
+ returnCode: number
605
+ }
606
+
607
+ const Q_DUEL_GET_USER_PROFILE_OUTPUT_FIELDS: BinaryField[] = [
608
+ {
609
+ name: 'roomId',
610
+ type: 'id',
611
+ offset: 0,
612
+ byteLength: 32,
613
+ },
614
+ {
615
+ name: 'depositedAmount',
616
+ type: 'uint64',
617
+ offset: 32,
618
+ byteLength: 8,
619
+ },
620
+ {
621
+ name: 'locked',
622
+ type: 'uint64',
623
+ offset: 40,
624
+ byteLength: 8,
625
+ },
626
+ {
627
+ name: 'stake',
628
+ type: 'uint64',
629
+ offset: 48,
630
+ byteLength: 8,
631
+ },
632
+ {
633
+ name: 'raiseStep',
634
+ type: 'uint64',
635
+ offset: 56,
636
+ byteLength: 8,
637
+ },
638
+ {
639
+ name: 'maxStake',
640
+ type: 'uint64',
641
+ offset: 64,
642
+ byteLength: 8,
643
+ },
644
+ {
645
+ name: 'returnCode',
646
+ type: 'uint8',
647
+ offset: 72,
648
+ byteLength: 1,
649
+ },
650
+ ]
651
+
652
+ export function decodeQDuelGetUserProfileOutput(
653
+ data: Uint8Array,
654
+ publicKeyToIdentity: (pk: Uint8Array) => string,
655
+ ): QDuelGetUserProfileOutput {
656
+ return decodePayload(data, Q_DUEL_GET_USER_PROFILE_OUTPUT_FIELDS, STRUCTS, publicKeyToIdentity) as unknown as QDuelGetUserProfileOutput
657
+ }
658
+
659
+ export async function qDuelGetUserProfile(
660
+ live: SmartContractCaller,
661
+ input: QDuelGetUserProfileInput,
662
+ options?: ContractCallOptions,
663
+ ): Promise<Result<QDuelGetUserProfileOutput, QubicRpcError>> {
664
+ return callContractFunction({
665
+ live,
666
+ contractIndex: Q_DUEL_CONTRACT_INDEX,
667
+ inputType: Q_DUEL_GET_USER_PROFILE_INPUT_TYPE,
668
+ inputSize: Q_DUEL_GET_USER_PROFILE_INPUT_SIZE,
669
+ inputFields: Q_DUEL_GET_USER_PROFILE_INPUT_FIELDS,
670
+ outputFields: Q_DUEL_GET_USER_PROFILE_OUTPUT_FIELDS,
671
+ structs: STRUCTS,
672
+ input: (input as unknown as Record<string, unknown>),
673
+ ...options,
674
+ })
675
+ }
676
+
677
+ export const Q_DUEL_CALCULATE_REVENUE_INPUT_TYPE = 5
678
+ export const Q_DUEL_CALCULATE_REVENUE_INPUT_SIZE = 8
679
+
680
+ export interface QDuelCalculateRevenueInput {
681
+ amount: bigint
682
+ }
683
+
684
+ const Q_DUEL_CALCULATE_REVENUE_INPUT_FIELDS: BinaryField[] = [
685
+ {
686
+ name: 'amount',
687
+ type: 'uint64',
688
+ offset: 0,
689
+ byteLength: 8,
690
+ },
691
+ ]
692
+
693
+ export function buildQDuelCalculateRevenueInput(
694
+ input: QDuelCalculateRevenueInput,
695
+ ): Uint8Array {
696
+ return buildPayload(Q_DUEL_CALCULATE_REVENUE_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32))
697
+ }
698
+
699
+ export interface QDuelCalculateRevenueOutput {
700
+ devFee: bigint
701
+ burnFee: bigint
702
+ shareholdersFee: bigint
703
+ winner: bigint
704
+ }
705
+
706
+ const Q_DUEL_CALCULATE_REVENUE_OUTPUT_FIELDS: BinaryField[] = [
707
+ {
708
+ name: 'devFee',
709
+ type: 'uint64',
710
+ offset: 0,
711
+ byteLength: 8,
712
+ },
713
+ {
714
+ name: 'burnFee',
715
+ type: 'uint64',
716
+ offset: 8,
717
+ byteLength: 8,
718
+ },
719
+ {
720
+ name: 'shareholdersFee',
721
+ type: 'uint64',
722
+ offset: 16,
723
+ byteLength: 8,
724
+ },
725
+ {
726
+ name: 'winner',
727
+ type: 'uint64',
728
+ offset: 24,
729
+ byteLength: 8,
730
+ },
731
+ ]
732
+
733
+ export function decodeQDuelCalculateRevenueOutput(
734
+ data: Uint8Array,
735
+ ): QDuelCalculateRevenueOutput {
736
+ return decodePayload(data, Q_DUEL_CALCULATE_REVENUE_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as QDuelCalculateRevenueOutput
737
+ }
738
+
739
+ export async function qDuelCalculateRevenue(
740
+ live: SmartContractCaller,
741
+ input: QDuelCalculateRevenueInput,
742
+ options?: ContractCallOptions,
743
+ ): Promise<Result<QDuelCalculateRevenueOutput, QubicRpcError>> {
744
+ return callContractFunction({
745
+ live,
746
+ contractIndex: Q_DUEL_CONTRACT_INDEX,
747
+ inputType: Q_DUEL_CALCULATE_REVENUE_INPUT_TYPE,
748
+ inputSize: Q_DUEL_CALCULATE_REVENUE_INPUT_SIZE,
749
+ inputFields: Q_DUEL_CALCULATE_REVENUE_INPUT_FIELDS,
750
+ outputFields: Q_DUEL_CALCULATE_REVENUE_OUTPUT_FIELDS,
751
+ structs: STRUCTS,
752
+ input: (input as unknown as Record<string, unknown>),
753
+ ...options,
754
+ })
755
+ }
756
+
757
+ export const Q_DUEL_GET_LAST_WINNERS_INPUT_TYPE = 6
758
+ export const Q_DUEL_GET_LAST_WINNERS_INPUT_SIZE = 0
759
+
760
+ export interface QDuelGetLastWinnersOutput {
761
+ winners: number[]
762
+ returnCode: number
763
+ }
764
+
765
+ const Q_DUEL_GET_LAST_WINNERS_OUTPUT_FIELDS: BinaryField[] = [
766
+ {
767
+ name: 'winners',
768
+ type: 'array',
769
+ offset: 0,
770
+ byteLength: 13312,
771
+ arrayLength: 128,
772
+ arrayItemByteLength: 104,
773
+ arrayItemStructRef: 'WinnerData',
774
+ },
775
+ {
776
+ name: 'returnCode',
777
+ type: 'uint8',
778
+ offset: 13312,
779
+ byteLength: 1,
780
+ },
781
+ ]
782
+
783
+ export function decodeQDuelGetLastWinnersOutput(
784
+ data: Uint8Array,
785
+ ): QDuelGetLastWinnersOutput {
786
+ return decodePayload(data, Q_DUEL_GET_LAST_WINNERS_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as QDuelGetLastWinnersOutput
787
+ }
788
+
789
+ export async function qDuelGetLastWinners(
790
+ live: SmartContractCaller,
791
+ options?: ContractCallOptions,
792
+ ): Promise<Result<QDuelGetLastWinnersOutput, QubicRpcError>> {
793
+ return callContractFunction({
794
+ live,
795
+ contractIndex: Q_DUEL_CONTRACT_INDEX,
796
+ inputType: Q_DUEL_GET_LAST_WINNERS_INPUT_TYPE,
797
+ inputSize: Q_DUEL_GET_LAST_WINNERS_INPUT_SIZE,
798
+ inputFields: [],
799
+ outputFields: Q_DUEL_GET_LAST_WINNERS_OUTPUT_FIELDS,
800
+ structs: STRUCTS,
801
+ input: {},
802
+ ...options,
803
+ })
804
+ }
805
+
806
+ export const qDuel = {
807
+ contractIndex: Q_DUEL_CONTRACT_INDEX,
808
+ GetPercentFees: qDuelGetPercentFees,
809
+ GetRooms: qDuelGetRooms,
810
+ GetTTLHours: qDuelGetTTLHours,
811
+ GetUserProfile: qDuelGetUserProfile,
812
+ CalculateRevenue: qDuelCalculateRevenue,
813
+ GetLastWinners: qDuelGetLastWinners,
814
+ buildCreateRoomInput: buildQDuelCreateRoomInput,
815
+ decodeCreateRoomOutput: decodeQDuelCreateRoomOutput,
816
+ buildConnectToRoomInput: buildQDuelConnectToRoomInput,
817
+ decodeConnectToRoomOutput: decodeQDuelConnectToRoomOutput,
818
+ buildSetPercentFeesInput: buildQDuelSetPercentFeesInput,
819
+ decodeSetPercentFeesOutput: decodeQDuelSetPercentFeesOutput,
820
+ buildSetTTLHoursInput: buildQDuelSetTTLHoursInput,
821
+ decodeSetTTLHoursOutput: decodeQDuelSetTTLHoursOutput,
822
+ decodeDepositOutput: decodeQDuelDepositOutput,
823
+ buildWithdrawInput: buildQDuelWithdrawInput,
824
+ decodeWithdrawOutput: decodeQDuelWithdrawOutput,
825
+ decodeCloseRoomOutput: decodeQDuelCloseRoomOutput,
826
+ }
827
+