@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,1162 @@
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 VOTTUN_BRIDGE_CONTRACT_INDEX = 25
9
+
10
+ export interface VottunBridgeOrderResponseStruct {
11
+ originAccount: string
12
+ destinationAccount: number[]
13
+ orderId: bigint
14
+ amount: bigint
15
+ memo: number[]
16
+ sourceChain: number
17
+ qubicDestination: string
18
+ status: number
19
+ }
20
+
21
+ export interface VottunBridgeAdminProposalStruct {
22
+ proposalId: bigint
23
+ proposalType: number
24
+ targetAddress: string
25
+ oldAddress: string
26
+ amount: bigint
27
+ approvals: string[]
28
+ approvalsCount: number
29
+ executed: number
30
+ active: number
31
+ }
32
+
33
+ export interface VottunBridgeBridgeOrderStruct {
34
+ qubicSender: string
35
+ qubicDestination: string
36
+ ethAddress: number[]
37
+ orderId: bigint
38
+ amount: bigint
39
+ orderType: number
40
+ status: number
41
+ fromQubicToEthereum: number
42
+ tokensReceived: number
43
+ tokensLocked: number
44
+ }
45
+
46
+ const STRUCTS: Record<string, NamedStruct> = {
47
+ 'OrderResponse': {
48
+ name: 'OrderResponse',
49
+ byteLength: 213,
50
+ fields: [
51
+ {
52
+ name: 'originAccount',
53
+ type: 'id',
54
+ offset: 0,
55
+ byteLength: 32,
56
+ },
57
+ {
58
+ name: 'destinationAccount',
59
+ type: 'array',
60
+ offset: 32,
61
+ byteLength: 64,
62
+ arrayLength: 64,
63
+ arrayItemType: 'uint8',
64
+ arrayItemByteLength: 1,
65
+ },
66
+ {
67
+ name: 'orderId',
68
+ type: 'uint64',
69
+ offset: 96,
70
+ byteLength: 8,
71
+ },
72
+ {
73
+ name: 'amount',
74
+ type: 'uint64',
75
+ offset: 104,
76
+ byteLength: 8,
77
+ },
78
+ {
79
+ name: 'memo',
80
+ type: 'array',
81
+ offset: 112,
82
+ byteLength: 64,
83
+ arrayLength: 64,
84
+ arrayItemType: 'uint8',
85
+ arrayItemByteLength: 1,
86
+ },
87
+ {
88
+ name: 'sourceChain',
89
+ type: 'uint32',
90
+ offset: 176,
91
+ byteLength: 4,
92
+ },
93
+ {
94
+ name: 'qubicDestination',
95
+ type: 'id',
96
+ offset: 180,
97
+ byteLength: 32,
98
+ },
99
+ {
100
+ name: 'status',
101
+ type: 'uint8',
102
+ offset: 212,
103
+ byteLength: 1,
104
+ },
105
+ ],
106
+ },
107
+ 'AdminProposal': {
108
+ name: 'AdminProposal',
109
+ byteLength: 596,
110
+ fields: [
111
+ {
112
+ name: 'proposalId',
113
+ type: 'uint64',
114
+ offset: 0,
115
+ byteLength: 8,
116
+ },
117
+ {
118
+ name: 'proposalType',
119
+ type: 'uint8',
120
+ offset: 8,
121
+ byteLength: 1,
122
+ },
123
+ {
124
+ name: 'targetAddress',
125
+ type: 'id',
126
+ offset: 9,
127
+ byteLength: 32,
128
+ },
129
+ {
130
+ name: 'oldAddress',
131
+ type: 'id',
132
+ offset: 41,
133
+ byteLength: 32,
134
+ },
135
+ {
136
+ name: 'amount',
137
+ type: 'uint64',
138
+ offset: 73,
139
+ byteLength: 8,
140
+ },
141
+ {
142
+ name: 'approvals',
143
+ type: 'array',
144
+ offset: 81,
145
+ byteLength: 512,
146
+ arrayLength: 16,
147
+ arrayItemType: 'id',
148
+ arrayItemByteLength: 32,
149
+ },
150
+ {
151
+ name: 'approvalsCount',
152
+ type: 'uint8',
153
+ offset: 593,
154
+ byteLength: 1,
155
+ },
156
+ {
157
+ name: 'executed',
158
+ type: 'uint8',
159
+ offset: 594,
160
+ byteLength: 1,
161
+ },
162
+ {
163
+ name: 'active',
164
+ type: 'uint8',
165
+ offset: 595,
166
+ byteLength: 1,
167
+ },
168
+ ],
169
+ },
170
+ 'BridgeOrder': {
171
+ name: 'BridgeOrder',
172
+ byteLength: 149,
173
+ fields: [
174
+ {
175
+ name: 'qubicSender',
176
+ type: 'id',
177
+ offset: 0,
178
+ byteLength: 32,
179
+ },
180
+ {
181
+ name: 'qubicDestination',
182
+ type: 'id',
183
+ offset: 32,
184
+ byteLength: 32,
185
+ },
186
+ {
187
+ name: 'ethAddress',
188
+ type: 'array',
189
+ offset: 64,
190
+ byteLength: 64,
191
+ arrayLength: 64,
192
+ arrayItemType: 'uint8',
193
+ arrayItemByteLength: 1,
194
+ },
195
+ {
196
+ name: 'orderId',
197
+ type: 'uint64',
198
+ offset: 128,
199
+ byteLength: 8,
200
+ },
201
+ {
202
+ name: 'amount',
203
+ type: 'uint64',
204
+ offset: 136,
205
+ byteLength: 8,
206
+ },
207
+ {
208
+ name: 'orderType',
209
+ type: 'uint8',
210
+ offset: 144,
211
+ byteLength: 1,
212
+ },
213
+ {
214
+ name: 'status',
215
+ type: 'uint8',
216
+ offset: 145,
217
+ byteLength: 1,
218
+ },
219
+ {
220
+ name: 'fromQubicToEthereum',
221
+ type: 'uint8',
222
+ offset: 146,
223
+ byteLength: 1,
224
+ },
225
+ {
226
+ name: 'tokensReceived',
227
+ type: 'uint8',
228
+ offset: 147,
229
+ byteLength: 1,
230
+ },
231
+ {
232
+ name: 'tokensLocked',
233
+ type: 'uint8',
234
+ offset: 148,
235
+ byteLength: 1,
236
+ },
237
+ ],
238
+ },
239
+ }
240
+
241
+ export const VOTTUN_BRIDGE_CREATE_ORDER_INPUT_TYPE = 1
242
+
243
+ export interface VottunBridgeCreateOrderInput {
244
+ qubicDestination: string
245
+ amount: bigint
246
+ ethAddress: number[]
247
+ fromQubicToEthereum: number
248
+ }
249
+
250
+ const VOTTUN_BRIDGE_CREATE_ORDER_INPUT_FIELDS: BinaryField[] = [
251
+ {
252
+ name: 'qubicDestination',
253
+ type: 'id',
254
+ offset: 0,
255
+ byteLength: 32,
256
+ },
257
+ {
258
+ name: 'amount',
259
+ type: 'uint64',
260
+ offset: 32,
261
+ byteLength: 8,
262
+ },
263
+ {
264
+ name: 'ethAddress',
265
+ type: 'array',
266
+ offset: 40,
267
+ byteLength: 64,
268
+ arrayLength: 64,
269
+ arrayItemType: 'uint8',
270
+ arrayItemByteLength: 1,
271
+ },
272
+ {
273
+ name: 'fromQubicToEthereum',
274
+ type: 'uint8',
275
+ offset: 104,
276
+ byteLength: 1,
277
+ },
278
+ ]
279
+
280
+ export function buildVottunBridgeCreateOrderInput(
281
+ input: VottunBridgeCreateOrderInput,
282
+ identityToPublicKey: (identity: string) => Uint8Array,
283
+ ): ContractCall {
284
+ return { contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX, inputType: VOTTUN_BRIDGE_CREATE_ORDER_INPUT_TYPE, payload: buildPayload(VOTTUN_BRIDGE_CREATE_ORDER_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey) }
285
+ }
286
+
287
+ export interface VottunBridgeCreateOrderOutput {
288
+ status: number
289
+ orderId: bigint
290
+ }
291
+
292
+ const VOTTUN_BRIDGE_CREATE_ORDER_OUTPUT_FIELDS: BinaryField[] = [
293
+ {
294
+ name: 'status',
295
+ type: 'uint8',
296
+ offset: 0,
297
+ byteLength: 1,
298
+ },
299
+ {
300
+ name: 'orderId',
301
+ type: 'uint64',
302
+ offset: 1,
303
+ byteLength: 8,
304
+ },
305
+ ]
306
+
307
+ export function decodeVottunBridgeCreateOrderOutput(
308
+ data: Uint8Array,
309
+ ): VottunBridgeCreateOrderOutput {
310
+ return decodePayload(data, VOTTUN_BRIDGE_CREATE_ORDER_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeCreateOrderOutput
311
+ }
312
+
313
+ export const VOTTUN_BRIDGE_COMPLETE_ORDER_INPUT_TYPE = 2
314
+
315
+ export interface VottunBridgeCompleteOrderInput {
316
+ orderId: bigint
317
+ }
318
+
319
+ const VOTTUN_BRIDGE_COMPLETE_ORDER_INPUT_FIELDS: BinaryField[] = [
320
+ {
321
+ name: 'orderId',
322
+ type: 'uint64',
323
+ offset: 0,
324
+ byteLength: 8,
325
+ },
326
+ ]
327
+
328
+ export function buildVottunBridgeCompleteOrderInput(
329
+ input: VottunBridgeCompleteOrderInput,
330
+ ): ContractCall {
331
+ return { contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX, inputType: VOTTUN_BRIDGE_COMPLETE_ORDER_INPUT_TYPE, payload: buildPayload(VOTTUN_BRIDGE_COMPLETE_ORDER_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
332
+ }
333
+
334
+ export interface VottunBridgeCompleteOrderOutput {
335
+ status: number
336
+ }
337
+
338
+ const VOTTUN_BRIDGE_COMPLETE_ORDER_OUTPUT_FIELDS: BinaryField[] = [
339
+ {
340
+ name: 'status',
341
+ type: 'uint8',
342
+ offset: 0,
343
+ byteLength: 1,
344
+ },
345
+ ]
346
+
347
+ export function decodeVottunBridgeCompleteOrderOutput(
348
+ data: Uint8Array,
349
+ ): VottunBridgeCompleteOrderOutput {
350
+ return decodePayload(data, VOTTUN_BRIDGE_COMPLETE_ORDER_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeCompleteOrderOutput
351
+ }
352
+
353
+ export const VOTTUN_BRIDGE_REFUND_ORDER_INPUT_TYPE = 3
354
+
355
+ export interface VottunBridgeRefundOrderInput {
356
+ orderId: bigint
357
+ }
358
+
359
+ const VOTTUN_BRIDGE_REFUND_ORDER_INPUT_FIELDS: BinaryField[] = [
360
+ {
361
+ name: 'orderId',
362
+ type: 'uint64',
363
+ offset: 0,
364
+ byteLength: 8,
365
+ },
366
+ ]
367
+
368
+ export function buildVottunBridgeRefundOrderInput(
369
+ input: VottunBridgeRefundOrderInput,
370
+ ): ContractCall {
371
+ return { contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX, inputType: VOTTUN_BRIDGE_REFUND_ORDER_INPUT_TYPE, payload: buildPayload(VOTTUN_BRIDGE_REFUND_ORDER_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
372
+ }
373
+
374
+ export interface VottunBridgeRefundOrderOutput {
375
+ status: number
376
+ }
377
+
378
+ const VOTTUN_BRIDGE_REFUND_ORDER_OUTPUT_FIELDS: BinaryField[] = [
379
+ {
380
+ name: 'status',
381
+ type: 'uint8',
382
+ offset: 0,
383
+ byteLength: 1,
384
+ },
385
+ ]
386
+
387
+ export function decodeVottunBridgeRefundOrderOutput(
388
+ data: Uint8Array,
389
+ ): VottunBridgeRefundOrderOutput {
390
+ return decodePayload(data, VOTTUN_BRIDGE_REFUND_ORDER_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeRefundOrderOutput
391
+ }
392
+
393
+ export const VOTTUN_BRIDGE_TRANSFER_TO_CONTRACT_INPUT_TYPE = 4
394
+
395
+ export interface VottunBridgeTransferToContractInput {
396
+ amount: bigint
397
+ orderId: bigint
398
+ }
399
+
400
+ const VOTTUN_BRIDGE_TRANSFER_TO_CONTRACT_INPUT_FIELDS: BinaryField[] = [
401
+ {
402
+ name: 'amount',
403
+ type: 'uint64',
404
+ offset: 0,
405
+ byteLength: 8,
406
+ },
407
+ {
408
+ name: 'orderId',
409
+ type: 'uint64',
410
+ offset: 8,
411
+ byteLength: 8,
412
+ },
413
+ ]
414
+
415
+ export function buildVottunBridgeTransferToContractInput(
416
+ input: VottunBridgeTransferToContractInput,
417
+ ): ContractCall {
418
+ return { contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX, inputType: VOTTUN_BRIDGE_TRANSFER_TO_CONTRACT_INPUT_TYPE, payload: buildPayload(VOTTUN_BRIDGE_TRANSFER_TO_CONTRACT_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
419
+ }
420
+
421
+ export interface VottunBridgeTransferToContractOutput {
422
+ status: number
423
+ }
424
+
425
+ const VOTTUN_BRIDGE_TRANSFER_TO_CONTRACT_OUTPUT_FIELDS: BinaryField[] = [
426
+ {
427
+ name: 'status',
428
+ type: 'uint8',
429
+ offset: 0,
430
+ byteLength: 1,
431
+ },
432
+ ]
433
+
434
+ export function decodeVottunBridgeTransferToContractOutput(
435
+ data: Uint8Array,
436
+ ): VottunBridgeTransferToContractOutput {
437
+ return decodePayload(data, VOTTUN_BRIDGE_TRANSFER_TO_CONTRACT_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeTransferToContractOutput
438
+ }
439
+
440
+ export const VOTTUN_BRIDGE_ADD_LIQUIDITY_INPUT_TYPE = 5
441
+
442
+ export interface VottunBridgeAddLiquidityOutput {
443
+ status: number
444
+ addedAmount: bigint
445
+ totalLocked: bigint
446
+ }
447
+
448
+ const VOTTUN_BRIDGE_ADD_LIQUIDITY_OUTPUT_FIELDS: BinaryField[] = [
449
+ {
450
+ name: 'status',
451
+ type: 'uint8',
452
+ offset: 0,
453
+ byteLength: 1,
454
+ },
455
+ {
456
+ name: 'addedAmount',
457
+ type: 'uint64',
458
+ offset: 1,
459
+ byteLength: 8,
460
+ },
461
+ {
462
+ name: 'totalLocked',
463
+ type: 'uint64',
464
+ offset: 9,
465
+ byteLength: 8,
466
+ },
467
+ ]
468
+
469
+ export function decodeVottunBridgeAddLiquidityOutput(
470
+ data: Uint8Array,
471
+ ): VottunBridgeAddLiquidityOutput {
472
+ return decodePayload(data, VOTTUN_BRIDGE_ADD_LIQUIDITY_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeAddLiquidityOutput
473
+ }
474
+
475
+ export const VOTTUN_BRIDGE_CREATE_PROPOSAL_INPUT_TYPE = 6
476
+
477
+ export interface VottunBridgeCreateProposalInput {
478
+ proposalType: number
479
+ targetAddress: string
480
+ oldAddress: string
481
+ amount: bigint
482
+ }
483
+
484
+ const VOTTUN_BRIDGE_CREATE_PROPOSAL_INPUT_FIELDS: BinaryField[] = [
485
+ {
486
+ name: 'proposalType',
487
+ type: 'uint8',
488
+ offset: 0,
489
+ byteLength: 1,
490
+ },
491
+ {
492
+ name: 'targetAddress',
493
+ type: 'id',
494
+ offset: 1,
495
+ byteLength: 32,
496
+ },
497
+ {
498
+ name: 'oldAddress',
499
+ type: 'id',
500
+ offset: 33,
501
+ byteLength: 32,
502
+ },
503
+ {
504
+ name: 'amount',
505
+ type: 'uint64',
506
+ offset: 65,
507
+ byteLength: 8,
508
+ },
509
+ ]
510
+
511
+ export function buildVottunBridgeCreateProposalInput(
512
+ input: VottunBridgeCreateProposalInput,
513
+ identityToPublicKey: (identity: string) => Uint8Array,
514
+ ): ContractCall {
515
+ return { contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX, inputType: VOTTUN_BRIDGE_CREATE_PROPOSAL_INPUT_TYPE, payload: buildPayload(VOTTUN_BRIDGE_CREATE_PROPOSAL_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey) }
516
+ }
517
+
518
+ export interface VottunBridgeCreateProposalOutput {
519
+ status: number
520
+ proposalId: bigint
521
+ }
522
+
523
+ const VOTTUN_BRIDGE_CREATE_PROPOSAL_OUTPUT_FIELDS: BinaryField[] = [
524
+ {
525
+ name: 'status',
526
+ type: 'uint8',
527
+ offset: 0,
528
+ byteLength: 1,
529
+ },
530
+ {
531
+ name: 'proposalId',
532
+ type: 'uint64',
533
+ offset: 1,
534
+ byteLength: 8,
535
+ },
536
+ ]
537
+
538
+ export function decodeVottunBridgeCreateProposalOutput(
539
+ data: Uint8Array,
540
+ ): VottunBridgeCreateProposalOutput {
541
+ return decodePayload(data, VOTTUN_BRIDGE_CREATE_PROPOSAL_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeCreateProposalOutput
542
+ }
543
+
544
+ export const VOTTUN_BRIDGE_APPROVE_PROPOSAL_INPUT_TYPE = 7
545
+
546
+ export interface VottunBridgeApproveProposalInput {
547
+ proposalId: bigint
548
+ }
549
+
550
+ const VOTTUN_BRIDGE_APPROVE_PROPOSAL_INPUT_FIELDS: BinaryField[] = [
551
+ {
552
+ name: 'proposalId',
553
+ type: 'uint64',
554
+ offset: 0,
555
+ byteLength: 8,
556
+ },
557
+ ]
558
+
559
+ export function buildVottunBridgeApproveProposalInput(
560
+ input: VottunBridgeApproveProposalInput,
561
+ ): ContractCall {
562
+ return { contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX, inputType: VOTTUN_BRIDGE_APPROVE_PROPOSAL_INPUT_TYPE, payload: buildPayload(VOTTUN_BRIDGE_APPROVE_PROPOSAL_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
563
+ }
564
+
565
+ export interface VottunBridgeApproveProposalOutput {
566
+ status: number
567
+ executed: number
568
+ }
569
+
570
+ const VOTTUN_BRIDGE_APPROVE_PROPOSAL_OUTPUT_FIELDS: BinaryField[] = [
571
+ {
572
+ name: 'status',
573
+ type: 'uint8',
574
+ offset: 0,
575
+ byteLength: 1,
576
+ },
577
+ {
578
+ name: 'executed',
579
+ type: 'uint8',
580
+ offset: 1,
581
+ byteLength: 1,
582
+ },
583
+ ]
584
+
585
+ export function decodeVottunBridgeApproveProposalOutput(
586
+ data: Uint8Array,
587
+ ): VottunBridgeApproveProposalOutput {
588
+ return decodePayload(data, VOTTUN_BRIDGE_APPROVE_PROPOSAL_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeApproveProposalOutput
589
+ }
590
+
591
+ export const VOTTUN_BRIDGE_CANCEL_PROPOSAL_INPUT_TYPE = 8
592
+
593
+ export interface VottunBridgeCancelProposalInput {
594
+ proposalId: bigint
595
+ }
596
+
597
+ const VOTTUN_BRIDGE_CANCEL_PROPOSAL_INPUT_FIELDS: BinaryField[] = [
598
+ {
599
+ name: 'proposalId',
600
+ type: 'uint64',
601
+ offset: 0,
602
+ byteLength: 8,
603
+ },
604
+ ]
605
+
606
+ export function buildVottunBridgeCancelProposalInput(
607
+ input: VottunBridgeCancelProposalInput,
608
+ ): ContractCall {
609
+ return { contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX, inputType: VOTTUN_BRIDGE_CANCEL_PROPOSAL_INPUT_TYPE, payload: buildPayload(VOTTUN_BRIDGE_CANCEL_PROPOSAL_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
610
+ }
611
+
612
+ export interface VottunBridgeCancelProposalOutput {
613
+ status: number
614
+ }
615
+
616
+ const VOTTUN_BRIDGE_CANCEL_PROPOSAL_OUTPUT_FIELDS: BinaryField[] = [
617
+ {
618
+ name: 'status',
619
+ type: 'uint8',
620
+ offset: 0,
621
+ byteLength: 1,
622
+ },
623
+ ]
624
+
625
+ export function decodeVottunBridgeCancelProposalOutput(
626
+ data: Uint8Array,
627
+ ): VottunBridgeCancelProposalOutput {
628
+ return decodePayload(data, VOTTUN_BRIDGE_CANCEL_PROPOSAL_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeCancelProposalOutput
629
+ }
630
+
631
+ export const VOTTUN_BRIDGE_GET_ORDER_INPUT_TYPE = 1
632
+ export const VOTTUN_BRIDGE_GET_ORDER_INPUT_SIZE = 8
633
+
634
+ export interface VottunBridgeGetOrderInput {
635
+ orderId: bigint
636
+ }
637
+
638
+ const VOTTUN_BRIDGE_GET_ORDER_INPUT_FIELDS: BinaryField[] = [
639
+ {
640
+ name: 'orderId',
641
+ type: 'uint64',
642
+ offset: 0,
643
+ byteLength: 8,
644
+ },
645
+ ]
646
+
647
+ export function buildVottunBridgeGetOrderInput(
648
+ input: VottunBridgeGetOrderInput,
649
+ ): Uint8Array {
650
+ return buildPayload(VOTTUN_BRIDGE_GET_ORDER_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32))
651
+ }
652
+
653
+ export interface VottunBridgeGetOrderOutput {
654
+ status: number
655
+ order: VottunBridgeOrderResponseStruct
656
+ message: number[]
657
+ }
658
+
659
+ const VOTTUN_BRIDGE_GET_ORDER_OUTPUT_FIELDS: BinaryField[] = [
660
+ {
661
+ name: 'status',
662
+ type: 'uint8',
663
+ offset: 0,
664
+ byteLength: 1,
665
+ },
666
+ {
667
+ name: 'order',
668
+ type: 'struct',
669
+ offset: 1,
670
+ byteLength: 213,
671
+ structRef: 'OrderResponse',
672
+ },
673
+ {
674
+ name: 'message',
675
+ type: 'array',
676
+ offset: 214,
677
+ byteLength: 32,
678
+ arrayLength: 32,
679
+ arrayItemType: 'uint8',
680
+ arrayItemByteLength: 1,
681
+ },
682
+ ]
683
+
684
+ export function decodeVottunBridgeGetOrderOutput(
685
+ data: Uint8Array,
686
+ ): VottunBridgeGetOrderOutput {
687
+ return decodePayload(data, VOTTUN_BRIDGE_GET_ORDER_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeGetOrderOutput
688
+ }
689
+
690
+ export async function vottunBridgeGetOrder(
691
+ live: SmartContractCaller,
692
+ input: VottunBridgeGetOrderInput,
693
+ options?: ContractCallOptions,
694
+ ): Promise<Result<VottunBridgeGetOrderOutput, QubicRpcError>> {
695
+ return callContractFunction({
696
+ live,
697
+ contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX,
698
+ inputType: VOTTUN_BRIDGE_GET_ORDER_INPUT_TYPE,
699
+ inputSize: VOTTUN_BRIDGE_GET_ORDER_INPUT_SIZE,
700
+ inputFields: VOTTUN_BRIDGE_GET_ORDER_INPUT_FIELDS,
701
+ outputFields: VOTTUN_BRIDGE_GET_ORDER_OUTPUT_FIELDS,
702
+ structs: STRUCTS,
703
+ input: (input as unknown as Record<string, unknown>),
704
+ ...options,
705
+ })
706
+ }
707
+
708
+ export const VOTTUN_BRIDGE_GET_TOTAL_RECEIVED_TOKENS_INPUT_TYPE = 3
709
+ export const VOTTUN_BRIDGE_GET_TOTAL_RECEIVED_TOKENS_INPUT_SIZE = 0
710
+
711
+ export interface VottunBridgeGetTotalReceivedTokensOutput {
712
+ totalTokens: bigint
713
+ }
714
+
715
+ const VOTTUN_BRIDGE_GET_TOTAL_RECEIVED_TOKENS_OUTPUT_FIELDS: BinaryField[] = [
716
+ {
717
+ name: 'totalTokens',
718
+ type: 'uint64',
719
+ offset: 0,
720
+ byteLength: 8,
721
+ },
722
+ ]
723
+
724
+ export function decodeVottunBridgeGetTotalReceivedTokensOutput(
725
+ data: Uint8Array,
726
+ ): VottunBridgeGetTotalReceivedTokensOutput {
727
+ return decodePayload(data, VOTTUN_BRIDGE_GET_TOTAL_RECEIVED_TOKENS_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeGetTotalReceivedTokensOutput
728
+ }
729
+
730
+ export async function vottunBridgeGetTotalReceivedTokens(
731
+ live: SmartContractCaller,
732
+ options?: ContractCallOptions,
733
+ ): Promise<Result<VottunBridgeGetTotalReceivedTokensOutput, QubicRpcError>> {
734
+ return callContractFunction({
735
+ live,
736
+ contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX,
737
+ inputType: VOTTUN_BRIDGE_GET_TOTAL_RECEIVED_TOKENS_INPUT_TYPE,
738
+ inputSize: VOTTUN_BRIDGE_GET_TOTAL_RECEIVED_TOKENS_INPUT_SIZE,
739
+ inputFields: [],
740
+ outputFields: VOTTUN_BRIDGE_GET_TOTAL_RECEIVED_TOKENS_OUTPUT_FIELDS,
741
+ structs: STRUCTS,
742
+ input: {},
743
+ ...options,
744
+ })
745
+ }
746
+
747
+ export const VOTTUN_BRIDGE_GET_TOTAL_LOCKED_TOKENS_INPUT_TYPE = 4
748
+ export const VOTTUN_BRIDGE_GET_TOTAL_LOCKED_TOKENS_INPUT_SIZE = 0
749
+
750
+ export interface VottunBridgeGetTotalLockedTokensOutput {
751
+ totalLockedTokens: bigint
752
+ }
753
+
754
+ const VOTTUN_BRIDGE_GET_TOTAL_LOCKED_TOKENS_OUTPUT_FIELDS: BinaryField[] = [
755
+ {
756
+ name: 'totalLockedTokens',
757
+ type: 'uint64',
758
+ offset: 0,
759
+ byteLength: 8,
760
+ },
761
+ ]
762
+
763
+ export function decodeVottunBridgeGetTotalLockedTokensOutput(
764
+ data: Uint8Array,
765
+ ): VottunBridgeGetTotalLockedTokensOutput {
766
+ return decodePayload(data, VOTTUN_BRIDGE_GET_TOTAL_LOCKED_TOKENS_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeGetTotalLockedTokensOutput
767
+ }
768
+
769
+ export async function vottunBridgeGetTotalLockedTokens(
770
+ live: SmartContractCaller,
771
+ options?: ContractCallOptions,
772
+ ): Promise<Result<VottunBridgeGetTotalLockedTokensOutput, QubicRpcError>> {
773
+ return callContractFunction({
774
+ live,
775
+ contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX,
776
+ inputType: VOTTUN_BRIDGE_GET_TOTAL_LOCKED_TOKENS_INPUT_TYPE,
777
+ inputSize: VOTTUN_BRIDGE_GET_TOTAL_LOCKED_TOKENS_INPUT_SIZE,
778
+ inputFields: [],
779
+ outputFields: VOTTUN_BRIDGE_GET_TOTAL_LOCKED_TOKENS_OUTPUT_FIELDS,
780
+ structs: STRUCTS,
781
+ input: {},
782
+ ...options,
783
+ })
784
+ }
785
+
786
+ export const VOTTUN_BRIDGE_GET_ORDER_BY_DETAILS_INPUT_TYPE = 5
787
+ export const VOTTUN_BRIDGE_GET_ORDER_BY_DETAILS_INPUT_SIZE = 73
788
+
789
+ export interface VottunBridgeGetOrderByDetailsInput {
790
+ ethAddress: number[]
791
+ amount: bigint
792
+ status: number
793
+ }
794
+
795
+ const VOTTUN_BRIDGE_GET_ORDER_BY_DETAILS_INPUT_FIELDS: BinaryField[] = [
796
+ {
797
+ name: 'ethAddress',
798
+ type: 'array',
799
+ offset: 0,
800
+ byteLength: 64,
801
+ arrayLength: 64,
802
+ arrayItemType: 'uint8',
803
+ arrayItemByteLength: 1,
804
+ },
805
+ {
806
+ name: 'amount',
807
+ type: 'uint64',
808
+ offset: 64,
809
+ byteLength: 8,
810
+ },
811
+ {
812
+ name: 'status',
813
+ type: 'uint8',
814
+ offset: 72,
815
+ byteLength: 1,
816
+ },
817
+ ]
818
+
819
+ export function buildVottunBridgeGetOrderByDetailsInput(
820
+ input: VottunBridgeGetOrderByDetailsInput,
821
+ ): Uint8Array {
822
+ return buildPayload(VOTTUN_BRIDGE_GET_ORDER_BY_DETAILS_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32))
823
+ }
824
+
825
+ export interface VottunBridgeGetOrderByDetailsOutput {
826
+ status: number
827
+ orderId: bigint
828
+ qubicDestination: string
829
+ }
830
+
831
+ const VOTTUN_BRIDGE_GET_ORDER_BY_DETAILS_OUTPUT_FIELDS: BinaryField[] = [
832
+ {
833
+ name: 'status',
834
+ type: 'uint8',
835
+ offset: 0,
836
+ byteLength: 1,
837
+ },
838
+ {
839
+ name: 'orderId',
840
+ type: 'uint64',
841
+ offset: 1,
842
+ byteLength: 8,
843
+ },
844
+ {
845
+ name: 'qubicDestination',
846
+ type: 'id',
847
+ offset: 9,
848
+ byteLength: 32,
849
+ },
850
+ ]
851
+
852
+ export function decodeVottunBridgeGetOrderByDetailsOutput(
853
+ data: Uint8Array,
854
+ publicKeyToIdentity: (pk: Uint8Array) => string,
855
+ ): VottunBridgeGetOrderByDetailsOutput {
856
+ return decodePayload(data, VOTTUN_BRIDGE_GET_ORDER_BY_DETAILS_OUTPUT_FIELDS, STRUCTS, publicKeyToIdentity) as unknown as VottunBridgeGetOrderByDetailsOutput
857
+ }
858
+
859
+ export async function vottunBridgeGetOrderByDetails(
860
+ live: SmartContractCaller,
861
+ input: VottunBridgeGetOrderByDetailsInput,
862
+ options?: ContractCallOptions,
863
+ ): Promise<Result<VottunBridgeGetOrderByDetailsOutput, QubicRpcError>> {
864
+ return callContractFunction({
865
+ live,
866
+ contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX,
867
+ inputType: VOTTUN_BRIDGE_GET_ORDER_BY_DETAILS_INPUT_TYPE,
868
+ inputSize: VOTTUN_BRIDGE_GET_ORDER_BY_DETAILS_INPUT_SIZE,
869
+ inputFields: VOTTUN_BRIDGE_GET_ORDER_BY_DETAILS_INPUT_FIELDS,
870
+ outputFields: VOTTUN_BRIDGE_GET_ORDER_BY_DETAILS_OUTPUT_FIELDS,
871
+ structs: STRUCTS,
872
+ input: (input as unknown as Record<string, unknown>),
873
+ ...options,
874
+ })
875
+ }
876
+
877
+ export const VOTTUN_BRIDGE_GET_CONTRACT_INFO_INPUT_TYPE = 6
878
+ export const VOTTUN_BRIDGE_GET_CONTRACT_INFO_INPUT_SIZE = 0
879
+
880
+ export interface VottunBridgeGetContractInfoOutput {
881
+ managers: string[]
882
+ nextOrderId: bigint
883
+ lockedTokens: bigint
884
+ totalReceivedTokens: bigint
885
+ earnedFees: bigint
886
+ tradeFeeBillionths: number
887
+ sourceChain: number
888
+ firstOrders: number[]
889
+ totalOrdersFound: bigint
890
+ emptySlots: bigint
891
+ multisigAdmins: string[]
892
+ numberOfAdmins: number
893
+ requiredApprovals: number
894
+ totalProposals: bigint
895
+ }
896
+
897
+ const VOTTUN_BRIDGE_GET_CONTRACT_INFO_OUTPUT_FIELDS: BinaryField[] = [
898
+ {
899
+ name: 'managers',
900
+ type: 'array',
901
+ offset: 0,
902
+ byteLength: 512,
903
+ arrayLength: 16,
904
+ arrayItemType: 'id',
905
+ arrayItemByteLength: 32,
906
+ },
907
+ {
908
+ name: 'nextOrderId',
909
+ type: 'uint64',
910
+ offset: 512,
911
+ byteLength: 8,
912
+ },
913
+ {
914
+ name: 'lockedTokens',
915
+ type: 'uint64',
916
+ offset: 520,
917
+ byteLength: 8,
918
+ },
919
+ {
920
+ name: 'totalReceivedTokens',
921
+ type: 'uint64',
922
+ offset: 528,
923
+ byteLength: 8,
924
+ },
925
+ {
926
+ name: 'earnedFees',
927
+ type: 'uint64',
928
+ offset: 536,
929
+ byteLength: 8,
930
+ },
931
+ {
932
+ name: 'tradeFeeBillionths',
933
+ type: 'uint32',
934
+ offset: 544,
935
+ byteLength: 4,
936
+ },
937
+ {
938
+ name: 'sourceChain',
939
+ type: 'uint32',
940
+ offset: 548,
941
+ byteLength: 4,
942
+ },
943
+ {
944
+ name: 'firstOrders',
945
+ type: 'array',
946
+ offset: 552,
947
+ byteLength: 2384,
948
+ arrayLength: 16,
949
+ arrayItemByteLength: 149,
950
+ arrayItemStructRef: 'BridgeOrder',
951
+ },
952
+ {
953
+ name: 'totalOrdersFound',
954
+ type: 'uint64',
955
+ offset: 2936,
956
+ byteLength: 8,
957
+ },
958
+ {
959
+ name: 'emptySlots',
960
+ type: 'uint64',
961
+ offset: 2944,
962
+ byteLength: 8,
963
+ },
964
+ {
965
+ name: 'multisigAdmins',
966
+ type: 'array',
967
+ offset: 2952,
968
+ byteLength: 512,
969
+ arrayLength: 16,
970
+ arrayItemType: 'id',
971
+ arrayItemByteLength: 32,
972
+ },
973
+ {
974
+ name: 'numberOfAdmins',
975
+ type: 'uint8',
976
+ offset: 3464,
977
+ byteLength: 1,
978
+ },
979
+ {
980
+ name: 'requiredApprovals',
981
+ type: 'uint8',
982
+ offset: 3465,
983
+ byteLength: 1,
984
+ },
985
+ {
986
+ name: 'totalProposals',
987
+ type: 'uint64',
988
+ offset: 3466,
989
+ byteLength: 8,
990
+ },
991
+ ]
992
+
993
+ export function decodeVottunBridgeGetContractInfoOutput(
994
+ data: Uint8Array,
995
+ publicKeyToIdentity: (pk: Uint8Array) => string,
996
+ ): VottunBridgeGetContractInfoOutput {
997
+ return decodePayload(data, VOTTUN_BRIDGE_GET_CONTRACT_INFO_OUTPUT_FIELDS, STRUCTS, publicKeyToIdentity) as unknown as VottunBridgeGetContractInfoOutput
998
+ }
999
+
1000
+ export async function vottunBridgeGetContractInfo(
1001
+ live: SmartContractCaller,
1002
+ options?: ContractCallOptions,
1003
+ ): Promise<Result<VottunBridgeGetContractInfoOutput, QubicRpcError>> {
1004
+ return callContractFunction({
1005
+ live,
1006
+ contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX,
1007
+ inputType: VOTTUN_BRIDGE_GET_CONTRACT_INFO_INPUT_TYPE,
1008
+ inputSize: VOTTUN_BRIDGE_GET_CONTRACT_INFO_INPUT_SIZE,
1009
+ inputFields: [],
1010
+ outputFields: VOTTUN_BRIDGE_GET_CONTRACT_INFO_OUTPUT_FIELDS,
1011
+ structs: STRUCTS,
1012
+ input: {},
1013
+ ...options,
1014
+ })
1015
+ }
1016
+
1017
+ export const VOTTUN_BRIDGE_GET_AVAILABLE_FEES_INPUT_TYPE = 7
1018
+ export const VOTTUN_BRIDGE_GET_AVAILABLE_FEES_INPUT_SIZE = 0
1019
+
1020
+ export interface VottunBridgeGetAvailableFeesOutput {
1021
+ availableFees: bigint
1022
+ totalEarnedFees: bigint
1023
+ totalDistributedFees: bigint
1024
+ }
1025
+
1026
+ const VOTTUN_BRIDGE_GET_AVAILABLE_FEES_OUTPUT_FIELDS: BinaryField[] = [
1027
+ {
1028
+ name: 'availableFees',
1029
+ type: 'uint64',
1030
+ offset: 0,
1031
+ byteLength: 8,
1032
+ },
1033
+ {
1034
+ name: 'totalEarnedFees',
1035
+ type: 'uint64',
1036
+ offset: 8,
1037
+ byteLength: 8,
1038
+ },
1039
+ {
1040
+ name: 'totalDistributedFees',
1041
+ type: 'uint64',
1042
+ offset: 16,
1043
+ byteLength: 8,
1044
+ },
1045
+ ]
1046
+
1047
+ export function decodeVottunBridgeGetAvailableFeesOutput(
1048
+ data: Uint8Array,
1049
+ ): VottunBridgeGetAvailableFeesOutput {
1050
+ return decodePayload(data, VOTTUN_BRIDGE_GET_AVAILABLE_FEES_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeGetAvailableFeesOutput
1051
+ }
1052
+
1053
+ export async function vottunBridgeGetAvailableFees(
1054
+ live: SmartContractCaller,
1055
+ options?: ContractCallOptions,
1056
+ ): Promise<Result<VottunBridgeGetAvailableFeesOutput, QubicRpcError>> {
1057
+ return callContractFunction({
1058
+ live,
1059
+ contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX,
1060
+ inputType: VOTTUN_BRIDGE_GET_AVAILABLE_FEES_INPUT_TYPE,
1061
+ inputSize: VOTTUN_BRIDGE_GET_AVAILABLE_FEES_INPUT_SIZE,
1062
+ inputFields: [],
1063
+ outputFields: VOTTUN_BRIDGE_GET_AVAILABLE_FEES_OUTPUT_FIELDS,
1064
+ structs: STRUCTS,
1065
+ input: {},
1066
+ ...options,
1067
+ })
1068
+ }
1069
+
1070
+ export const VOTTUN_BRIDGE_GET_PROPOSAL_INPUT_TYPE = 8
1071
+ export const VOTTUN_BRIDGE_GET_PROPOSAL_INPUT_SIZE = 8
1072
+
1073
+ export interface VottunBridgeGetProposalInput {
1074
+ proposalId: bigint
1075
+ }
1076
+
1077
+ const VOTTUN_BRIDGE_GET_PROPOSAL_INPUT_FIELDS: BinaryField[] = [
1078
+ {
1079
+ name: 'proposalId',
1080
+ type: 'uint64',
1081
+ offset: 0,
1082
+ byteLength: 8,
1083
+ },
1084
+ ]
1085
+
1086
+ export function buildVottunBridgeGetProposalInput(
1087
+ input: VottunBridgeGetProposalInput,
1088
+ ): Uint8Array {
1089
+ return buildPayload(VOTTUN_BRIDGE_GET_PROPOSAL_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32))
1090
+ }
1091
+
1092
+ export interface VottunBridgeGetProposalOutput {
1093
+ status: number
1094
+ proposal: VottunBridgeAdminProposalStruct
1095
+ }
1096
+
1097
+ const VOTTUN_BRIDGE_GET_PROPOSAL_OUTPUT_FIELDS: BinaryField[] = [
1098
+ {
1099
+ name: 'status',
1100
+ type: 'uint8',
1101
+ offset: 0,
1102
+ byteLength: 1,
1103
+ },
1104
+ {
1105
+ name: 'proposal',
1106
+ type: 'struct',
1107
+ offset: 1,
1108
+ byteLength: 596,
1109
+ structRef: 'AdminProposal',
1110
+ },
1111
+ ]
1112
+
1113
+ export function decodeVottunBridgeGetProposalOutput(
1114
+ data: Uint8Array,
1115
+ ): VottunBridgeGetProposalOutput {
1116
+ return decodePayload(data, VOTTUN_BRIDGE_GET_PROPOSAL_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as VottunBridgeGetProposalOutput
1117
+ }
1118
+
1119
+ export async function vottunBridgeGetProposal(
1120
+ live: SmartContractCaller,
1121
+ input: VottunBridgeGetProposalInput,
1122
+ options?: ContractCallOptions,
1123
+ ): Promise<Result<VottunBridgeGetProposalOutput, QubicRpcError>> {
1124
+ return callContractFunction({
1125
+ live,
1126
+ contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX,
1127
+ inputType: VOTTUN_BRIDGE_GET_PROPOSAL_INPUT_TYPE,
1128
+ inputSize: VOTTUN_BRIDGE_GET_PROPOSAL_INPUT_SIZE,
1129
+ inputFields: VOTTUN_BRIDGE_GET_PROPOSAL_INPUT_FIELDS,
1130
+ outputFields: VOTTUN_BRIDGE_GET_PROPOSAL_OUTPUT_FIELDS,
1131
+ structs: STRUCTS,
1132
+ input: (input as unknown as Record<string, unknown>),
1133
+ ...options,
1134
+ })
1135
+ }
1136
+
1137
+ export const vottunBridge = {
1138
+ contractIndex: VOTTUN_BRIDGE_CONTRACT_INDEX,
1139
+ getOrder: vottunBridgeGetOrder,
1140
+ getTotalReceivedTokens: vottunBridgeGetTotalReceivedTokens,
1141
+ getTotalLockedTokens: vottunBridgeGetTotalLockedTokens,
1142
+ getOrderByDetails: vottunBridgeGetOrderByDetails,
1143
+ getContractInfo: vottunBridgeGetContractInfo,
1144
+ getAvailableFees: vottunBridgeGetAvailableFees,
1145
+ getProposal: vottunBridgeGetProposal,
1146
+ buildCreateOrderInput: buildVottunBridgeCreateOrderInput,
1147
+ decodeCreateOrderOutput: decodeVottunBridgeCreateOrderOutput,
1148
+ buildCompleteOrderInput: buildVottunBridgeCompleteOrderInput,
1149
+ decodeCompleteOrderOutput: decodeVottunBridgeCompleteOrderOutput,
1150
+ buildRefundOrderInput: buildVottunBridgeRefundOrderInput,
1151
+ decodeRefundOrderOutput: decodeVottunBridgeRefundOrderOutput,
1152
+ buildTransferToContractInput: buildVottunBridgeTransferToContractInput,
1153
+ decodeTransferToContractOutput: decodeVottunBridgeTransferToContractOutput,
1154
+ decodeAddLiquidityOutput: decodeVottunBridgeAddLiquidityOutput,
1155
+ buildCreateProposalInput: buildVottunBridgeCreateProposalInput,
1156
+ decodeCreateProposalOutput: decodeVottunBridgeCreateProposalOutput,
1157
+ buildApproveProposalInput: buildVottunBridgeApproveProposalInput,
1158
+ decodeApproveProposalOutput: decodeVottunBridgeApproveProposalOutput,
1159
+ buildCancelProposalInput: buildVottunBridgeCancelProposalInput,
1160
+ decodeCancelProposalOutput: decodeVottunBridgeCancelProposalOutput,
1161
+ }
1162
+