@qubic.org/contracts 0.2.7 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,1241 @@
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 GGWP_CONTRACT_INDEX = 28
9
+
10
+ const STRUCTS: Record<string, NamedStruct> = {}
11
+
12
+ export const GGWP_DEPOSIT_REVENUE_INPUT_TYPE = 1
13
+
14
+ export interface GGWPDepositRevenueOutput {
15
+ returnCode: number
16
+ }
17
+
18
+ const GGWP_DEPOSIT_REVENUE_OUTPUT_FIELDS: BinaryField[] = [
19
+ {
20
+ name: 'returnCode',
21
+ type: 'uint32',
22
+ offset: 0,
23
+ byteLength: 4,
24
+ },
25
+ ]
26
+
27
+ export function decodeGGWPDepositRevenueOutput(
28
+ data: Uint8Array,
29
+ ): GGWPDepositRevenueOutput {
30
+ return decodePayload(data, GGWP_DEPOSIT_REVENUE_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPDepositRevenueOutput
31
+ }
32
+
33
+ export const GGWP_ADD_CLAN_MEMBER_INPUT_TYPE = 2
34
+
35
+ export interface GGWPAddClanMemberInput {
36
+ memberAddress: string
37
+ rank: bigint
38
+ }
39
+
40
+ const GGWP_ADD_CLAN_MEMBER_INPUT_FIELDS: BinaryField[] = [
41
+ {
42
+ name: 'memberAddress',
43
+ type: 'id',
44
+ offset: 0,
45
+ byteLength: 32,
46
+ },
47
+ {
48
+ name: 'rank',
49
+ type: 'uint64',
50
+ offset: 32,
51
+ byteLength: 8,
52
+ },
53
+ ]
54
+
55
+ export function buildGGWPAddClanMemberInput(
56
+ input: GGWPAddClanMemberInput,
57
+ identityToPublicKey: (identity: string) => Uint8Array,
58
+ ): ContractCall {
59
+ return { contractIndex: GGWP_CONTRACT_INDEX, inputType: GGWP_ADD_CLAN_MEMBER_INPUT_TYPE, payload: buildPayload(GGWP_ADD_CLAN_MEMBER_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey) }
60
+ }
61
+
62
+ export interface GGWPAddClanMemberOutput {
63
+ returnCode: number
64
+ }
65
+
66
+ const GGWP_ADD_CLAN_MEMBER_OUTPUT_FIELDS: BinaryField[] = [
67
+ {
68
+ name: 'returnCode',
69
+ type: 'uint32',
70
+ offset: 0,
71
+ byteLength: 4,
72
+ },
73
+ ]
74
+
75
+ export function decodeGGWPAddClanMemberOutput(
76
+ data: Uint8Array,
77
+ ): GGWPAddClanMemberOutput {
78
+ return decodePayload(data, GGWP_ADD_CLAN_MEMBER_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPAddClanMemberOutput
79
+ }
80
+
81
+ export const GGWP_REMOVE_CLAN_MEMBER_INPUT_TYPE = 3
82
+
83
+ export interface GGWPRemoveClanMemberInput {
84
+ memberAddress: string
85
+ }
86
+
87
+ const GGWP_REMOVE_CLAN_MEMBER_INPUT_FIELDS: BinaryField[] = [
88
+ {
89
+ name: 'memberAddress',
90
+ type: 'id',
91
+ offset: 0,
92
+ byteLength: 32,
93
+ },
94
+ ]
95
+
96
+ export function buildGGWPRemoveClanMemberInput(
97
+ input: GGWPRemoveClanMemberInput,
98
+ identityToPublicKey: (identity: string) => Uint8Array,
99
+ ): ContractCall {
100
+ return { contractIndex: GGWP_CONTRACT_INDEX, inputType: GGWP_REMOVE_CLAN_MEMBER_INPUT_TYPE, payload: buildPayload(GGWP_REMOVE_CLAN_MEMBER_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey) }
101
+ }
102
+
103
+ export interface GGWPRemoveClanMemberOutput {
104
+ returnCode: number
105
+ }
106
+
107
+ const GGWP_REMOVE_CLAN_MEMBER_OUTPUT_FIELDS: BinaryField[] = [
108
+ {
109
+ name: 'returnCode',
110
+ type: 'uint32',
111
+ offset: 0,
112
+ byteLength: 4,
113
+ },
114
+ ]
115
+
116
+ export function decodeGGWPRemoveClanMemberOutput(
117
+ data: Uint8Array,
118
+ ): GGWPRemoveClanMemberOutput {
119
+ return decodePayload(data, GGWP_REMOVE_CLAN_MEMBER_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPRemoveClanMemberOutput
120
+ }
121
+
122
+ export const GGWP_SET_CLAN_RANK_INPUT_TYPE = 4
123
+
124
+ export interface GGWPSetClanRankInput {
125
+ memberAddress: string
126
+ rank: bigint
127
+ }
128
+
129
+ const GGWP_SET_CLAN_RANK_INPUT_FIELDS: BinaryField[] = [
130
+ {
131
+ name: 'memberAddress',
132
+ type: 'id',
133
+ offset: 0,
134
+ byteLength: 32,
135
+ },
136
+ {
137
+ name: 'rank',
138
+ type: 'uint64',
139
+ offset: 32,
140
+ byteLength: 8,
141
+ },
142
+ ]
143
+
144
+ export function buildGGWPSetClanRankInput(
145
+ input: GGWPSetClanRankInput,
146
+ identityToPublicKey: (identity: string) => Uint8Array,
147
+ ): ContractCall {
148
+ return { contractIndex: GGWP_CONTRACT_INDEX, inputType: GGWP_SET_CLAN_RANK_INPUT_TYPE, payload: buildPayload(GGWP_SET_CLAN_RANK_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey) }
149
+ }
150
+
151
+ export interface GGWPSetClanRankOutput {
152
+ returnCode: number
153
+ }
154
+
155
+ const GGWP_SET_CLAN_RANK_OUTPUT_FIELDS: BinaryField[] = [
156
+ {
157
+ name: 'returnCode',
158
+ type: 'uint32',
159
+ offset: 0,
160
+ byteLength: 4,
161
+ },
162
+ ]
163
+
164
+ export function decodeGGWPSetClanRankOutput(
165
+ data: Uint8Array,
166
+ ): GGWPSetClanRankOutput {
167
+ return decodePayload(data, GGWP_SET_CLAN_RANK_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPSetClanRankOutput
168
+ }
169
+
170
+ export const GGWP_SET_ADMIN_INPUT_TYPE = 5
171
+
172
+ export interface GGWPSetAdminInput {
173
+ newAdmin: string
174
+ }
175
+
176
+ const GGWP_SET_ADMIN_INPUT_FIELDS: BinaryField[] = [
177
+ {
178
+ name: 'newAdmin',
179
+ type: 'id',
180
+ offset: 0,
181
+ byteLength: 32,
182
+ },
183
+ ]
184
+
185
+ export function buildGGWPSetAdminInput(
186
+ input: GGWPSetAdminInput,
187
+ identityToPublicKey: (identity: string) => Uint8Array,
188
+ ): ContractCall {
189
+ return { contractIndex: GGWP_CONTRACT_INDEX, inputType: GGWP_SET_ADMIN_INPUT_TYPE, payload: buildPayload(GGWP_SET_ADMIN_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey) }
190
+ }
191
+
192
+ export interface GGWPSetAdminOutput {
193
+ returnCode: number
194
+ }
195
+
196
+ const GGWP_SET_ADMIN_OUTPUT_FIELDS: BinaryField[] = [
197
+ {
198
+ name: 'returnCode',
199
+ type: 'uint32',
200
+ offset: 0,
201
+ byteLength: 4,
202
+ },
203
+ ]
204
+
205
+ export function decodeGGWPSetAdminOutput(
206
+ data: Uint8Array,
207
+ ): GGWPSetAdminOutput {
208
+ return decodePayload(data, GGWP_SET_ADMIN_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPSetAdminOutput
209
+ }
210
+
211
+ export const GGWP_SET_EXCLUDE_ADDRESS_INPUT_TYPE = 6
212
+
213
+ export interface GGWPSetExcludeAddressInput {
214
+ slot: bigint
215
+ address: string
216
+ }
217
+
218
+ const GGWP_SET_EXCLUDE_ADDRESS_INPUT_FIELDS: BinaryField[] = [
219
+ {
220
+ name: 'slot',
221
+ type: 'uint64',
222
+ offset: 0,
223
+ byteLength: 8,
224
+ },
225
+ {
226
+ name: 'address',
227
+ type: 'id',
228
+ offset: 8,
229
+ byteLength: 32,
230
+ },
231
+ ]
232
+
233
+ export function buildGGWPSetExcludeAddressInput(
234
+ input: GGWPSetExcludeAddressInput,
235
+ identityToPublicKey: (identity: string) => Uint8Array,
236
+ ): ContractCall {
237
+ return { contractIndex: GGWP_CONTRACT_INDEX, inputType: GGWP_SET_EXCLUDE_ADDRESS_INPUT_TYPE, payload: buildPayload(GGWP_SET_EXCLUDE_ADDRESS_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey) }
238
+ }
239
+
240
+ export interface GGWPSetExcludeAddressOutput {
241
+ returnCode: number
242
+ }
243
+
244
+ const GGWP_SET_EXCLUDE_ADDRESS_OUTPUT_FIELDS: BinaryField[] = [
245
+ {
246
+ name: 'returnCode',
247
+ type: 'uint32',
248
+ offset: 0,
249
+ byteLength: 4,
250
+ },
251
+ ]
252
+
253
+ export function decodeGGWPSetExcludeAddressOutput(
254
+ data: Uint8Array,
255
+ ): GGWPSetExcludeAddressOutput {
256
+ return decodePayload(data, GGWP_SET_EXCLUDE_ADDRESS_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPSetExcludeAddressOutput
257
+ }
258
+
259
+ export const GGWP_STAKE_INPUT_TYPE = 7
260
+
261
+ export interface GGWPStakeInput {
262
+ numberOfShares: bigint
263
+ }
264
+
265
+ const GGWP_STAKE_INPUT_FIELDS: BinaryField[] = [
266
+ {
267
+ name: 'numberOfShares',
268
+ type: 'uint64',
269
+ offset: 0,
270
+ byteLength: 8,
271
+ },
272
+ ]
273
+
274
+ export function buildGGWPStakeInput(
275
+ input: GGWPStakeInput,
276
+ ): ContractCall {
277
+ return { contractIndex: GGWP_CONTRACT_INDEX, inputType: GGWP_STAKE_INPUT_TYPE, payload: buildPayload(GGWP_STAKE_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
278
+ }
279
+
280
+ export interface GGWPStakeOutput {
281
+ returnCode: number
282
+ }
283
+
284
+ const GGWP_STAKE_OUTPUT_FIELDS: BinaryField[] = [
285
+ {
286
+ name: 'returnCode',
287
+ type: 'uint32',
288
+ offset: 0,
289
+ byteLength: 4,
290
+ },
291
+ ]
292
+
293
+ export function decodeGGWPStakeOutput(
294
+ data: Uint8Array,
295
+ ): GGWPStakeOutput {
296
+ return decodePayload(data, GGWP_STAKE_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPStakeOutput
297
+ }
298
+
299
+ export const GGWP_REQUEST_UNSTAKE_INPUT_TYPE = 8
300
+
301
+ export interface GGWPRequestUnstakeInput {
302
+ numberOfShares: bigint
303
+ }
304
+
305
+ const GGWP_REQUEST_UNSTAKE_INPUT_FIELDS: BinaryField[] = [
306
+ {
307
+ name: 'numberOfShares',
308
+ type: 'uint64',
309
+ offset: 0,
310
+ byteLength: 8,
311
+ },
312
+ ]
313
+
314
+ export function buildGGWPRequestUnstakeInput(
315
+ input: GGWPRequestUnstakeInput,
316
+ ): ContractCall {
317
+ return { contractIndex: GGWP_CONTRACT_INDEX, inputType: GGWP_REQUEST_UNSTAKE_INPUT_TYPE, payload: buildPayload(GGWP_REQUEST_UNSTAKE_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
318
+ }
319
+
320
+ export interface GGWPRequestUnstakeOutput {
321
+ returnCode: number
322
+ }
323
+
324
+ const GGWP_REQUEST_UNSTAKE_OUTPUT_FIELDS: BinaryField[] = [
325
+ {
326
+ name: 'returnCode',
327
+ type: 'uint32',
328
+ offset: 0,
329
+ byteLength: 4,
330
+ },
331
+ ]
332
+
333
+ export function decodeGGWPRequestUnstakeOutput(
334
+ data: Uint8Array,
335
+ ): GGWPRequestUnstakeOutput {
336
+ return decodePayload(data, GGWP_REQUEST_UNSTAKE_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPRequestUnstakeOutput
337
+ }
338
+
339
+ export const GGWP_FINALIZE_UNSTAKE_INPUT_TYPE = 9
340
+
341
+ export interface GGWPFinalizeUnstakeOutput {
342
+ returnCode: number
343
+ }
344
+
345
+ const GGWP_FINALIZE_UNSTAKE_OUTPUT_FIELDS: BinaryField[] = [
346
+ {
347
+ name: 'returnCode',
348
+ type: 'uint32',
349
+ offset: 0,
350
+ byteLength: 4,
351
+ },
352
+ ]
353
+
354
+ export function decodeGGWPFinalizeUnstakeOutput(
355
+ data: Uint8Array,
356
+ ): GGWPFinalizeUnstakeOutput {
357
+ return decodePayload(data, GGWP_FINALIZE_UNSTAKE_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPFinalizeUnstakeOutput
358
+ }
359
+
360
+ export const GGWP_DEPOSIT_STAKING_REWARDS_INPUT_TYPE = 10
361
+
362
+ export interface GGWPDepositStakingRewardsInput {
363
+ numberOfShares: bigint
364
+ }
365
+
366
+ const GGWP_DEPOSIT_STAKING_REWARDS_INPUT_FIELDS: BinaryField[] = [
367
+ {
368
+ name: 'numberOfShares',
369
+ type: 'uint64',
370
+ offset: 0,
371
+ byteLength: 8,
372
+ },
373
+ ]
374
+
375
+ export function buildGGWPDepositStakingRewardsInput(
376
+ input: GGWPDepositStakingRewardsInput,
377
+ ): ContractCall {
378
+ return { contractIndex: GGWP_CONTRACT_INDEX, inputType: GGWP_DEPOSIT_STAKING_REWARDS_INPUT_TYPE, payload: buildPayload(GGWP_DEPOSIT_STAKING_REWARDS_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
379
+ }
380
+
381
+ export interface GGWPDepositStakingRewardsOutput {
382
+ returnCode: number
383
+ }
384
+
385
+ const GGWP_DEPOSIT_STAKING_REWARDS_OUTPUT_FIELDS: BinaryField[] = [
386
+ {
387
+ name: 'returnCode',
388
+ type: 'uint32',
389
+ offset: 0,
390
+ byteLength: 4,
391
+ },
392
+ ]
393
+
394
+ export function decodeGGWPDepositStakingRewardsOutput(
395
+ data: Uint8Array,
396
+ ): GGWPDepositStakingRewardsOutput {
397
+ return decodePayload(data, GGWP_DEPOSIT_STAKING_REWARDS_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPDepositStakingRewardsOutput
398
+ }
399
+
400
+ export const GGWP_CLAIM_STAKING_REWARDS_INPUT_TYPE = 11
401
+
402
+ export interface GGWPClaimStakingRewardsOutput {
403
+ returnCode: number
404
+ claimedAmount: bigint
405
+ }
406
+
407
+ const GGWP_CLAIM_STAKING_REWARDS_OUTPUT_FIELDS: BinaryField[] = [
408
+ {
409
+ name: 'returnCode',
410
+ type: 'uint32',
411
+ offset: 0,
412
+ byteLength: 4,
413
+ },
414
+ {
415
+ name: 'claimedAmount',
416
+ type: 'uint64',
417
+ offset: 4,
418
+ byteLength: 8,
419
+ },
420
+ ]
421
+
422
+ export function decodeGGWPClaimStakingRewardsOutput(
423
+ data: Uint8Array,
424
+ ): GGWPClaimStakingRewardsOutput {
425
+ return decodePayload(data, GGWP_CLAIM_STAKING_REWARDS_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPClaimStakingRewardsOutput
426
+ }
427
+
428
+ export const GGWP_PROPOSE_GOV_CHANGE_INPUT_TYPE = 12
429
+
430
+ export interface GGWPProposeGovChangeInput {
431
+ targetType: number
432
+ newAddress: string
433
+ }
434
+
435
+ const GGWP_PROPOSE_GOV_CHANGE_INPUT_FIELDS: BinaryField[] = [
436
+ {
437
+ name: 'targetType',
438
+ type: 'uint8',
439
+ offset: 0,
440
+ byteLength: 1,
441
+ },
442
+ {
443
+ name: 'newAddress',
444
+ type: 'id',
445
+ offset: 1,
446
+ byteLength: 32,
447
+ },
448
+ ]
449
+
450
+ export function buildGGWPProposeGovChangeInput(
451
+ input: GGWPProposeGovChangeInput,
452
+ identityToPublicKey: (identity: string) => Uint8Array,
453
+ ): ContractCall {
454
+ return { contractIndex: GGWP_CONTRACT_INDEX, inputType: GGWP_PROPOSE_GOV_CHANGE_INPUT_TYPE, payload: buildPayload(GGWP_PROPOSE_GOV_CHANGE_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey) }
455
+ }
456
+
457
+ export interface GGWPProposeGovChangeOutput {
458
+ returnCode: number
459
+ proposalIndex: bigint
460
+ passed: number
461
+ }
462
+
463
+ const GGWP_PROPOSE_GOV_CHANGE_OUTPUT_FIELDS: BinaryField[] = [
464
+ {
465
+ name: 'returnCode',
466
+ type: 'uint32',
467
+ offset: 0,
468
+ byteLength: 4,
469
+ },
470
+ {
471
+ name: 'proposalIndex',
472
+ type: 'uint64',
473
+ offset: 4,
474
+ byteLength: 8,
475
+ },
476
+ {
477
+ name: 'passed',
478
+ type: 'uint8',
479
+ offset: 12,
480
+ byteLength: 1,
481
+ },
482
+ ]
483
+
484
+ export function decodeGGWPProposeGovChangeOutput(
485
+ data: Uint8Array,
486
+ ): GGWPProposeGovChangeOutput {
487
+ return decodePayload(data, GGWP_PROPOSE_GOV_CHANGE_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPProposeGovChangeOutput
488
+ }
489
+
490
+ export const GGWP_VOTE_GOV_CHANGE_INPUT_TYPE = 13
491
+
492
+ export interface GGWPVoteGovChangeInput {
493
+ proposalIndex: bigint
494
+ approve: number
495
+ }
496
+
497
+ const GGWP_VOTE_GOV_CHANGE_INPUT_FIELDS: BinaryField[] = [
498
+ {
499
+ name: 'proposalIndex',
500
+ type: 'uint64',
501
+ offset: 0,
502
+ byteLength: 8,
503
+ },
504
+ {
505
+ name: 'approve',
506
+ type: 'uint8',
507
+ offset: 8,
508
+ byteLength: 1,
509
+ },
510
+ ]
511
+
512
+ export function buildGGWPVoteGovChangeInput(
513
+ input: GGWPVoteGovChangeInput,
514
+ ): ContractCall {
515
+ return { contractIndex: GGWP_CONTRACT_INDEX, inputType: GGWP_VOTE_GOV_CHANGE_INPUT_TYPE, payload: buildPayload(GGWP_VOTE_GOV_CHANGE_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32)) }
516
+ }
517
+
518
+ export interface GGWPVoteGovChangeOutput {
519
+ returnCode: number
520
+ passed: number
521
+ }
522
+
523
+ const GGWP_VOTE_GOV_CHANGE_OUTPUT_FIELDS: BinaryField[] = [
524
+ {
525
+ name: 'returnCode',
526
+ type: 'uint32',
527
+ offset: 0,
528
+ byteLength: 4,
529
+ },
530
+ {
531
+ name: 'passed',
532
+ type: 'uint8',
533
+ offset: 4,
534
+ byteLength: 1,
535
+ },
536
+ ]
537
+
538
+ export function decodeGGWPVoteGovChangeOutput(
539
+ data: Uint8Array,
540
+ ): GGWPVoteGovChangeOutput {
541
+ return decodePayload(data, GGWP_VOTE_GOV_CHANGE_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPVoteGovChangeOutput
542
+ }
543
+
544
+ export const GGWP_GET_STATUS_INPUT_TYPE = 1
545
+ export const GGWP_GET_STATUS_INPUT_SIZE = 0
546
+
547
+ export interface GGWPGetStatusOutput {
548
+ holderCount: bigint
549
+ totalTokensSnapshot: bigint
550
+ clanMemberCount: bigint
551
+ clanWeightedTotal: bigint
552
+ pendingRevenue: bigint
553
+ reinvestmentFund: bigint
554
+ execReserveFund: bigint
555
+ totalDistributed: bigint
556
+ totalDeposited: bigint
557
+ lastPayoutTick: bigint
558
+ lastDistributionEpoch: bigint
559
+ adminAddress: string
560
+ }
561
+
562
+ const GGWP_GET_STATUS_OUTPUT_FIELDS: BinaryField[] = [
563
+ {
564
+ name: 'holderCount',
565
+ type: 'uint64',
566
+ offset: 0,
567
+ byteLength: 8,
568
+ },
569
+ {
570
+ name: 'totalTokensSnapshot',
571
+ type: 'uint64',
572
+ offset: 8,
573
+ byteLength: 8,
574
+ },
575
+ {
576
+ name: 'clanMemberCount',
577
+ type: 'uint64',
578
+ offset: 16,
579
+ byteLength: 8,
580
+ },
581
+ {
582
+ name: 'clanWeightedTotal',
583
+ type: 'uint64',
584
+ offset: 24,
585
+ byteLength: 8,
586
+ },
587
+ {
588
+ name: 'pendingRevenue',
589
+ type: 'uint64',
590
+ offset: 32,
591
+ byteLength: 8,
592
+ },
593
+ {
594
+ name: 'reinvestmentFund',
595
+ type: 'uint64',
596
+ offset: 40,
597
+ byteLength: 8,
598
+ },
599
+ {
600
+ name: 'execReserveFund',
601
+ type: 'uint64',
602
+ offset: 48,
603
+ byteLength: 8,
604
+ },
605
+ {
606
+ name: 'totalDistributed',
607
+ type: 'uint64',
608
+ offset: 56,
609
+ byteLength: 8,
610
+ },
611
+ {
612
+ name: 'totalDeposited',
613
+ type: 'uint64',
614
+ offset: 64,
615
+ byteLength: 8,
616
+ },
617
+ {
618
+ name: 'lastPayoutTick',
619
+ type: 'uint64',
620
+ offset: 72,
621
+ byteLength: 8,
622
+ },
623
+ {
624
+ name: 'lastDistributionEpoch',
625
+ type: 'uint64',
626
+ offset: 80,
627
+ byteLength: 8,
628
+ },
629
+ {
630
+ name: 'adminAddress',
631
+ type: 'id',
632
+ offset: 88,
633
+ byteLength: 32,
634
+ },
635
+ ]
636
+
637
+ export function decodeGGWPGetStatusOutput(
638
+ data: Uint8Array,
639
+ publicKeyToIdentity: (pk: Uint8Array) => string,
640
+ ): GGWPGetStatusOutput {
641
+ return decodePayload(data, GGWP_GET_STATUS_OUTPUT_FIELDS, STRUCTS, publicKeyToIdentity) as unknown as GGWPGetStatusOutput
642
+ }
643
+
644
+ export async function gGWPGetStatus(
645
+ live: SmartContractCaller,
646
+ options?: ContractCallOptions,
647
+ ): Promise<Result<GGWPGetStatusOutput, QubicRpcError>> {
648
+ return callContractFunction({
649
+ live,
650
+ contractIndex: GGWP_CONTRACT_INDEX,
651
+ inputType: GGWP_GET_STATUS_INPUT_TYPE,
652
+ inputSize: GGWP_GET_STATUS_INPUT_SIZE,
653
+ inputFields: [],
654
+ outputFields: GGWP_GET_STATUS_OUTPUT_FIELDS,
655
+ structs: STRUCTS,
656
+ input: {},
657
+ ...options,
658
+ })
659
+ }
660
+
661
+ export const GGWP_GET_HOLDER_INFO_INPUT_TYPE = 2
662
+ export const GGWP_GET_HOLDER_INFO_INPUT_SIZE = 32
663
+
664
+ export interface GGWPGetHolderInfoInput {
665
+ holderAddress: string
666
+ }
667
+
668
+ const GGWP_GET_HOLDER_INFO_INPUT_FIELDS: BinaryField[] = [
669
+ {
670
+ name: 'holderAddress',
671
+ type: 'id',
672
+ offset: 0,
673
+ byteLength: 32,
674
+ },
675
+ ]
676
+
677
+ export function buildGGWPGetHolderInfoInput(
678
+ input: GGWPGetHolderInfoInput,
679
+ identityToPublicKey: (identity: string) => Uint8Array,
680
+ ): Uint8Array {
681
+ return buildPayload(GGWP_GET_HOLDER_INFO_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey)
682
+ }
683
+
684
+ export interface GGWPGetHolderInfoOutput {
685
+ tokenBalance: bigint
686
+ isHolder: number
687
+ }
688
+
689
+ const GGWP_GET_HOLDER_INFO_OUTPUT_FIELDS: BinaryField[] = [
690
+ {
691
+ name: 'tokenBalance',
692
+ type: 'uint64',
693
+ offset: 0,
694
+ byteLength: 8,
695
+ },
696
+ {
697
+ name: 'isHolder',
698
+ type: 'uint32',
699
+ offset: 8,
700
+ byteLength: 4,
701
+ },
702
+ ]
703
+
704
+ export function decodeGGWPGetHolderInfoOutput(
705
+ data: Uint8Array,
706
+ ): GGWPGetHolderInfoOutput {
707
+ return decodePayload(data, GGWP_GET_HOLDER_INFO_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPGetHolderInfoOutput
708
+ }
709
+
710
+ export async function gGWPGetHolderInfo(
711
+ live: SmartContractCaller,
712
+ input: GGWPGetHolderInfoInput,
713
+ options?: ContractCallOptions,
714
+ ): Promise<Result<GGWPGetHolderInfoOutput, QubicRpcError>> {
715
+ return callContractFunction({
716
+ live,
717
+ contractIndex: GGWP_CONTRACT_INDEX,
718
+ inputType: GGWP_GET_HOLDER_INFO_INPUT_TYPE,
719
+ inputSize: GGWP_GET_HOLDER_INFO_INPUT_SIZE,
720
+ inputFields: GGWP_GET_HOLDER_INFO_INPUT_FIELDS,
721
+ outputFields: GGWP_GET_HOLDER_INFO_OUTPUT_FIELDS,
722
+ structs: STRUCTS,
723
+ input: (input as unknown as Record<string, unknown>),
724
+ ...options,
725
+ })
726
+ }
727
+
728
+ export const GGWP_GET_CLAN_MEMBER_INFO_INPUT_TYPE = 3
729
+ export const GGWP_GET_CLAN_MEMBER_INFO_INPUT_SIZE = 32
730
+
731
+ export interface GGWPGetClanMemberInfoInput {
732
+ memberAddress: string
733
+ }
734
+
735
+ const GGWP_GET_CLAN_MEMBER_INFO_INPUT_FIELDS: BinaryField[] = [
736
+ {
737
+ name: 'memberAddress',
738
+ type: 'id',
739
+ offset: 0,
740
+ byteLength: 32,
741
+ },
742
+ ]
743
+
744
+ export function buildGGWPGetClanMemberInfoInput(
745
+ input: GGWPGetClanMemberInfoInput,
746
+ identityToPublicKey: (identity: string) => Uint8Array,
747
+ ): Uint8Array {
748
+ return buildPayload(GGWP_GET_CLAN_MEMBER_INFO_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey)
749
+ }
750
+
751
+ export interface GGWPGetClanMemberInfoOutput {
752
+ rank: bigint
753
+ isMember: number
754
+ }
755
+
756
+ const GGWP_GET_CLAN_MEMBER_INFO_OUTPUT_FIELDS: BinaryField[] = [
757
+ {
758
+ name: 'rank',
759
+ type: 'uint64',
760
+ offset: 0,
761
+ byteLength: 8,
762
+ },
763
+ {
764
+ name: 'isMember',
765
+ type: 'uint32',
766
+ offset: 8,
767
+ byteLength: 4,
768
+ },
769
+ ]
770
+
771
+ export function decodeGGWPGetClanMemberInfoOutput(
772
+ data: Uint8Array,
773
+ ): GGWPGetClanMemberInfoOutput {
774
+ return decodePayload(data, GGWP_GET_CLAN_MEMBER_INFO_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPGetClanMemberInfoOutput
775
+ }
776
+
777
+ export async function gGWPGetClanMemberInfo(
778
+ live: SmartContractCaller,
779
+ input: GGWPGetClanMemberInfoInput,
780
+ options?: ContractCallOptions,
781
+ ): Promise<Result<GGWPGetClanMemberInfoOutput, QubicRpcError>> {
782
+ return callContractFunction({
783
+ live,
784
+ contractIndex: GGWP_CONTRACT_INDEX,
785
+ inputType: GGWP_GET_CLAN_MEMBER_INFO_INPUT_TYPE,
786
+ inputSize: GGWP_GET_CLAN_MEMBER_INFO_INPUT_SIZE,
787
+ inputFields: GGWP_GET_CLAN_MEMBER_INFO_INPUT_FIELDS,
788
+ outputFields: GGWP_GET_CLAN_MEMBER_INFO_OUTPUT_FIELDS,
789
+ structs: STRUCTS,
790
+ input: (input as unknown as Record<string, unknown>),
791
+ ...options,
792
+ })
793
+ }
794
+
795
+ export const GGWP_GET_SHAREHOLDER_INFO_INPUT_TYPE = 4
796
+ export const GGWP_GET_SHAREHOLDER_INFO_INPUT_SIZE = 32
797
+
798
+ export interface GGWPGetShareholderInfoInput {
799
+ shareholderAddress: string
800
+ }
801
+
802
+ const GGWP_GET_SHAREHOLDER_INFO_INPUT_FIELDS: BinaryField[] = [
803
+ {
804
+ name: 'shareholderAddress',
805
+ type: 'id',
806
+ offset: 0,
807
+ byteLength: 32,
808
+ },
809
+ ]
810
+
811
+ export function buildGGWPGetShareholderInfoInput(
812
+ input: GGWPGetShareholderInfoInput,
813
+ identityToPublicKey: (identity: string) => Uint8Array,
814
+ ): Uint8Array {
815
+ return buildPayload(GGWP_GET_SHAREHOLDER_INFO_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey)
816
+ }
817
+
818
+ export interface GGWPGetShareholderInfoOutput {
819
+ shares: bigint
820
+ isShareholder: number
821
+ }
822
+
823
+ const GGWP_GET_SHAREHOLDER_INFO_OUTPUT_FIELDS: BinaryField[] = [
824
+ {
825
+ name: 'shares',
826
+ type: 'uint64',
827
+ offset: 0,
828
+ byteLength: 8,
829
+ },
830
+ {
831
+ name: 'isShareholder',
832
+ type: 'uint32',
833
+ offset: 8,
834
+ byteLength: 4,
835
+ },
836
+ ]
837
+
838
+ export function decodeGGWPGetShareholderInfoOutput(
839
+ data: Uint8Array,
840
+ ): GGWPGetShareholderInfoOutput {
841
+ return decodePayload(data, GGWP_GET_SHAREHOLDER_INFO_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPGetShareholderInfoOutput
842
+ }
843
+
844
+ export async function gGWPGetShareholderInfo(
845
+ live: SmartContractCaller,
846
+ input: GGWPGetShareholderInfoInput,
847
+ options?: ContractCallOptions,
848
+ ): Promise<Result<GGWPGetShareholderInfoOutput, QubicRpcError>> {
849
+ return callContractFunction({
850
+ live,
851
+ contractIndex: GGWP_CONTRACT_INDEX,
852
+ inputType: GGWP_GET_SHAREHOLDER_INFO_INPUT_TYPE,
853
+ inputSize: GGWP_GET_SHAREHOLDER_INFO_INPUT_SIZE,
854
+ inputFields: GGWP_GET_SHAREHOLDER_INFO_INPUT_FIELDS,
855
+ outputFields: GGWP_GET_SHAREHOLDER_INFO_OUTPUT_FIELDS,
856
+ structs: STRUCTS,
857
+ input: (input as unknown as Record<string, unknown>),
858
+ ...options,
859
+ })
860
+ }
861
+
862
+ export const GGWP_GET_STAKING_INFO_INPUT_TYPE = 5
863
+ export const GGWP_GET_STAKING_INFO_INPUT_SIZE = 32
864
+
865
+ export interface GGWPGetStakingInfoInput {
866
+ stakerAddress: string
867
+ }
868
+
869
+ const GGWP_GET_STAKING_INFO_INPUT_FIELDS: BinaryField[] = [
870
+ {
871
+ name: 'stakerAddress',
872
+ type: 'id',
873
+ offset: 0,
874
+ byteLength: 32,
875
+ },
876
+ ]
877
+
878
+ export function buildGGWPGetStakingInfoInput(
879
+ input: GGWPGetStakingInfoInput,
880
+ identityToPublicKey: (identity: string) => Uint8Array,
881
+ ): Uint8Array {
882
+ return buildPayload(GGWP_GET_STAKING_INFO_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, identityToPublicKey)
883
+ }
884
+
885
+ export interface GGWPGetStakingInfoOutput {
886
+ stakedAmount: bigint
887
+ pendingRewards: bigint
888
+ unstakeAmount: bigint
889
+ unstakeEpoch: bigint
890
+ totalStaked: bigint
891
+ stakingRewardPool: bigint
892
+ isStaker: number
893
+ }
894
+
895
+ const GGWP_GET_STAKING_INFO_OUTPUT_FIELDS: BinaryField[] = [
896
+ {
897
+ name: 'stakedAmount',
898
+ type: 'uint64',
899
+ offset: 0,
900
+ byteLength: 8,
901
+ },
902
+ {
903
+ name: 'pendingRewards',
904
+ type: 'uint64',
905
+ offset: 8,
906
+ byteLength: 8,
907
+ },
908
+ {
909
+ name: 'unstakeAmount',
910
+ type: 'uint64',
911
+ offset: 16,
912
+ byteLength: 8,
913
+ },
914
+ {
915
+ name: 'unstakeEpoch',
916
+ type: 'uint64',
917
+ offset: 24,
918
+ byteLength: 8,
919
+ },
920
+ {
921
+ name: 'totalStaked',
922
+ type: 'uint64',
923
+ offset: 32,
924
+ byteLength: 8,
925
+ },
926
+ {
927
+ name: 'stakingRewardPool',
928
+ type: 'uint64',
929
+ offset: 40,
930
+ byteLength: 8,
931
+ },
932
+ {
933
+ name: 'isStaker',
934
+ type: 'uint32',
935
+ offset: 48,
936
+ byteLength: 4,
937
+ },
938
+ ]
939
+
940
+ export function decodeGGWPGetStakingInfoOutput(
941
+ data: Uint8Array,
942
+ ): GGWPGetStakingInfoOutput {
943
+ return decodePayload(data, GGWP_GET_STAKING_INFO_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPGetStakingInfoOutput
944
+ }
945
+
946
+ export async function gGWPGetStakingInfo(
947
+ live: SmartContractCaller,
948
+ input: GGWPGetStakingInfoInput,
949
+ options?: ContractCallOptions,
950
+ ): Promise<Result<GGWPGetStakingInfoOutput, QubicRpcError>> {
951
+ return callContractFunction({
952
+ live,
953
+ contractIndex: GGWP_CONTRACT_INDEX,
954
+ inputType: GGWP_GET_STAKING_INFO_INPUT_TYPE,
955
+ inputSize: GGWP_GET_STAKING_INFO_INPUT_SIZE,
956
+ inputFields: GGWP_GET_STAKING_INFO_INPUT_FIELDS,
957
+ outputFields: GGWP_GET_STAKING_INFO_OUTPUT_FIELDS,
958
+ structs: STRUCTS,
959
+ input: (input as unknown as Record<string, unknown>),
960
+ ...options,
961
+ })
962
+ }
963
+
964
+ export const GGWP_GET_EXCLUDE_ADDRESSES_INPUT_TYPE = 6
965
+ export const GGWP_GET_EXCLUDE_ADDRESSES_INPUT_SIZE = 0
966
+
967
+ export interface GGWPGetExcludeAddressesOutput {
968
+ address1: string
969
+ address2: string
970
+ }
971
+
972
+ const GGWP_GET_EXCLUDE_ADDRESSES_OUTPUT_FIELDS: BinaryField[] = [
973
+ {
974
+ name: 'address1',
975
+ type: 'id',
976
+ offset: 0,
977
+ byteLength: 32,
978
+ },
979
+ {
980
+ name: 'address2',
981
+ type: 'id',
982
+ offset: 32,
983
+ byteLength: 32,
984
+ },
985
+ ]
986
+
987
+ export function decodeGGWPGetExcludeAddressesOutput(
988
+ data: Uint8Array,
989
+ publicKeyToIdentity: (pk: Uint8Array) => string,
990
+ ): GGWPGetExcludeAddressesOutput {
991
+ return decodePayload(data, GGWP_GET_EXCLUDE_ADDRESSES_OUTPUT_FIELDS, STRUCTS, publicKeyToIdentity) as unknown as GGWPGetExcludeAddressesOutput
992
+ }
993
+
994
+ export async function gGWPGetExcludeAddresses(
995
+ live: SmartContractCaller,
996
+ options?: ContractCallOptions,
997
+ ): Promise<Result<GGWPGetExcludeAddressesOutput, QubicRpcError>> {
998
+ return callContractFunction({
999
+ live,
1000
+ contractIndex: GGWP_CONTRACT_INDEX,
1001
+ inputType: GGWP_GET_EXCLUDE_ADDRESSES_INPUT_TYPE,
1002
+ inputSize: GGWP_GET_EXCLUDE_ADDRESSES_INPUT_SIZE,
1003
+ inputFields: [],
1004
+ outputFields: GGWP_GET_EXCLUDE_ADDRESSES_OUTPUT_FIELDS,
1005
+ structs: STRUCTS,
1006
+ input: {},
1007
+ ...options,
1008
+ })
1009
+ }
1010
+
1011
+ export const GGWP_GET_DISTRIBUTION_PREVIEW_INPUT_TYPE = 7
1012
+ export const GGWP_GET_DISTRIBUTION_PREVIEW_INPUT_SIZE = 8
1013
+
1014
+ export interface GGWPGetDistributionPreviewInput {
1015
+ amount: bigint
1016
+ }
1017
+
1018
+ const GGWP_GET_DISTRIBUTION_PREVIEW_INPUT_FIELDS: BinaryField[] = [
1019
+ {
1020
+ name: 'amount',
1021
+ type: 'uint64',
1022
+ offset: 0,
1023
+ byteLength: 8,
1024
+ },
1025
+ ]
1026
+
1027
+ export function buildGGWPGetDistributionPreviewInput(
1028
+ input: GGWPGetDistributionPreviewInput,
1029
+ ): Uint8Array {
1030
+ return buildPayload(GGWP_GET_DISTRIBUTION_PREVIEW_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32))
1031
+ }
1032
+
1033
+ export interface GGWPGetDistributionPreviewOutput {
1034
+ holderShare: bigint
1035
+ shareholderShare: bigint
1036
+ clanShare: bigint
1037
+ reinvestShare: bigint
1038
+ execReserveShare: bigint
1039
+ }
1040
+
1041
+ const GGWP_GET_DISTRIBUTION_PREVIEW_OUTPUT_FIELDS: BinaryField[] = [
1042
+ {
1043
+ name: 'holderShare',
1044
+ type: 'uint64',
1045
+ offset: 0,
1046
+ byteLength: 8,
1047
+ },
1048
+ {
1049
+ name: 'shareholderShare',
1050
+ type: 'uint64',
1051
+ offset: 8,
1052
+ byteLength: 8,
1053
+ },
1054
+ {
1055
+ name: 'clanShare',
1056
+ type: 'uint64',
1057
+ offset: 16,
1058
+ byteLength: 8,
1059
+ },
1060
+ {
1061
+ name: 'reinvestShare',
1062
+ type: 'uint64',
1063
+ offset: 24,
1064
+ byteLength: 8,
1065
+ },
1066
+ {
1067
+ name: 'execReserveShare',
1068
+ type: 'uint64',
1069
+ offset: 32,
1070
+ byteLength: 8,
1071
+ },
1072
+ ]
1073
+
1074
+ export function decodeGGWPGetDistributionPreviewOutput(
1075
+ data: Uint8Array,
1076
+ ): GGWPGetDistributionPreviewOutput {
1077
+ return decodePayload(data, GGWP_GET_DISTRIBUTION_PREVIEW_OUTPUT_FIELDS, STRUCTS, (_: Uint8Array) => { throw new Error('unreachable') }) as unknown as GGWPGetDistributionPreviewOutput
1078
+ }
1079
+
1080
+ export async function gGWPGetDistributionPreview(
1081
+ live: SmartContractCaller,
1082
+ input: GGWPGetDistributionPreviewInput,
1083
+ options?: ContractCallOptions,
1084
+ ): Promise<Result<GGWPGetDistributionPreviewOutput, QubicRpcError>> {
1085
+ return callContractFunction({
1086
+ live,
1087
+ contractIndex: GGWP_CONTRACT_INDEX,
1088
+ inputType: GGWP_GET_DISTRIBUTION_PREVIEW_INPUT_TYPE,
1089
+ inputSize: GGWP_GET_DISTRIBUTION_PREVIEW_INPUT_SIZE,
1090
+ inputFields: GGWP_GET_DISTRIBUTION_PREVIEW_INPUT_FIELDS,
1091
+ outputFields: GGWP_GET_DISTRIBUTION_PREVIEW_OUTPUT_FIELDS,
1092
+ structs: STRUCTS,
1093
+ input: (input as unknown as Record<string, unknown>),
1094
+ ...options,
1095
+ })
1096
+ }
1097
+
1098
+ export const GGWP_GET_GOV_PROPOSAL_INPUT_TYPE = 8
1099
+ export const GGWP_GET_GOV_PROPOSAL_INPUT_SIZE = 8
1100
+
1101
+ export interface GGWPGetGovProposalInput {
1102
+ proposalIndex: bigint
1103
+ }
1104
+
1105
+ const GGWP_GET_GOV_PROPOSAL_INPUT_FIELDS: BinaryField[] = [
1106
+ {
1107
+ name: 'proposalIndex',
1108
+ type: 'uint64',
1109
+ offset: 0,
1110
+ byteLength: 8,
1111
+ },
1112
+ ]
1113
+
1114
+ export function buildGGWPGetGovProposalInput(
1115
+ input: GGWPGetGovProposalInput,
1116
+ ): Uint8Array {
1117
+ return buildPayload(GGWP_GET_GOV_PROPOSAL_INPUT_FIELDS, STRUCTS, input as unknown as Record<string, FieldValue | Uint8Array>, (_: string) => new Uint8Array(32))
1118
+ }
1119
+
1120
+ export interface GGWPGetGovProposalOutput {
1121
+ status: number
1122
+ targetType: number
1123
+ proposedAddress: string
1124
+ proposalId: bigint
1125
+ proposalEpoch: bigint
1126
+ yesShares: bigint
1127
+ totalShares: bigint
1128
+ requiredShares: bigint
1129
+ }
1130
+
1131
+ const GGWP_GET_GOV_PROPOSAL_OUTPUT_FIELDS: BinaryField[] = [
1132
+ {
1133
+ name: 'status',
1134
+ type: 'uint8',
1135
+ offset: 0,
1136
+ byteLength: 1,
1137
+ },
1138
+ {
1139
+ name: 'targetType',
1140
+ type: 'uint8',
1141
+ offset: 1,
1142
+ byteLength: 1,
1143
+ },
1144
+ {
1145
+ name: 'proposedAddress',
1146
+ type: 'id',
1147
+ offset: 2,
1148
+ byteLength: 32,
1149
+ },
1150
+ {
1151
+ name: 'proposalId',
1152
+ type: 'uint64',
1153
+ offset: 34,
1154
+ byteLength: 8,
1155
+ },
1156
+ {
1157
+ name: 'proposalEpoch',
1158
+ type: 'uint64',
1159
+ offset: 42,
1160
+ byteLength: 8,
1161
+ },
1162
+ {
1163
+ name: 'yesShares',
1164
+ type: 'uint64',
1165
+ offset: 50,
1166
+ byteLength: 8,
1167
+ },
1168
+ {
1169
+ name: 'totalShares',
1170
+ type: 'uint64',
1171
+ offset: 58,
1172
+ byteLength: 8,
1173
+ },
1174
+ {
1175
+ name: 'requiredShares',
1176
+ type: 'uint64',
1177
+ offset: 66,
1178
+ byteLength: 8,
1179
+ },
1180
+ ]
1181
+
1182
+ export function decodeGGWPGetGovProposalOutput(
1183
+ data: Uint8Array,
1184
+ publicKeyToIdentity: (pk: Uint8Array) => string,
1185
+ ): GGWPGetGovProposalOutput {
1186
+ return decodePayload(data, GGWP_GET_GOV_PROPOSAL_OUTPUT_FIELDS, STRUCTS, publicKeyToIdentity) as unknown as GGWPGetGovProposalOutput
1187
+ }
1188
+
1189
+ export async function gGWPGetGovProposal(
1190
+ live: SmartContractCaller,
1191
+ input: GGWPGetGovProposalInput,
1192
+ options?: ContractCallOptions,
1193
+ ): Promise<Result<GGWPGetGovProposalOutput, QubicRpcError>> {
1194
+ return callContractFunction({
1195
+ live,
1196
+ contractIndex: GGWP_CONTRACT_INDEX,
1197
+ inputType: GGWP_GET_GOV_PROPOSAL_INPUT_TYPE,
1198
+ inputSize: GGWP_GET_GOV_PROPOSAL_INPUT_SIZE,
1199
+ inputFields: GGWP_GET_GOV_PROPOSAL_INPUT_FIELDS,
1200
+ outputFields: GGWP_GET_GOV_PROPOSAL_OUTPUT_FIELDS,
1201
+ structs: STRUCTS,
1202
+ input: (input as unknown as Record<string, unknown>),
1203
+ ...options,
1204
+ })
1205
+ }
1206
+
1207
+ export const gGWP = {
1208
+ contractIndex: GGWP_CONTRACT_INDEX,
1209
+ GetStatus: gGWPGetStatus,
1210
+ GetHolderInfo: gGWPGetHolderInfo,
1211
+ GetClanMemberInfo: gGWPGetClanMemberInfo,
1212
+ GetShareholderInfo: gGWPGetShareholderInfo,
1213
+ GetStakingInfo: gGWPGetStakingInfo,
1214
+ GetExcludeAddresses: gGWPGetExcludeAddresses,
1215
+ GetDistributionPreview: gGWPGetDistributionPreview,
1216
+ GetGovProposal: gGWPGetGovProposal,
1217
+ decodeDepositRevenueOutput: decodeGGWPDepositRevenueOutput,
1218
+ buildAddClanMemberInput: buildGGWPAddClanMemberInput,
1219
+ decodeAddClanMemberOutput: decodeGGWPAddClanMemberOutput,
1220
+ buildRemoveClanMemberInput: buildGGWPRemoveClanMemberInput,
1221
+ decodeRemoveClanMemberOutput: decodeGGWPRemoveClanMemberOutput,
1222
+ buildSetClanRankInput: buildGGWPSetClanRankInput,
1223
+ decodeSetClanRankOutput: decodeGGWPSetClanRankOutput,
1224
+ buildSetAdminInput: buildGGWPSetAdminInput,
1225
+ decodeSetAdminOutput: decodeGGWPSetAdminOutput,
1226
+ buildSetExcludeAddressInput: buildGGWPSetExcludeAddressInput,
1227
+ decodeSetExcludeAddressOutput: decodeGGWPSetExcludeAddressOutput,
1228
+ buildStakeInput: buildGGWPStakeInput,
1229
+ decodeStakeOutput: decodeGGWPStakeOutput,
1230
+ buildRequestUnstakeInput: buildGGWPRequestUnstakeInput,
1231
+ decodeRequestUnstakeOutput: decodeGGWPRequestUnstakeOutput,
1232
+ decodeFinalizeUnstakeOutput: decodeGGWPFinalizeUnstakeOutput,
1233
+ buildDepositStakingRewardsInput: buildGGWPDepositStakingRewardsInput,
1234
+ decodeDepositStakingRewardsOutput: decodeGGWPDepositStakingRewardsOutput,
1235
+ decodeClaimStakingRewardsOutput: decodeGGWPClaimStakingRewardsOutput,
1236
+ buildProposeGovChangeInput: buildGGWPProposeGovChangeInput,
1237
+ decodeProposeGovChangeOutput: decodeGGWPProposeGovChangeOutput,
1238
+ buildVoteGovChangeInput: buildGGWPVoteGovChangeInput,
1239
+ decodeVoteGovChangeOutput: decodeGGWPVoteGovChangeOutput,
1240
+ }
1241
+