@karn_lat/protocol-sdk 0.1.0-alpha.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 (157) hide show
  1. package/README.md +68 -0
  2. package/dist/__tests__/setup.d.ts +14 -0
  3. package/dist/__tests__/setup.d.ts.map +1 -0
  4. package/dist/__tests__/setup.js +44 -0
  5. package/dist/__tests__/setup.js.map +1 -0
  6. package/dist/clients/GovernorClient.d.ts +9 -0
  7. package/dist/clients/GovernorClient.d.ts.map +1 -0
  8. package/dist/clients/GovernorClient.js +18 -0
  9. package/dist/clients/GovernorClient.js.map +1 -0
  10. package/dist/clients/TreasuryClient.d.ts +9 -0
  11. package/dist/clients/TreasuryClient.d.ts.map +1 -0
  12. package/dist/clients/TreasuryClient.js +18 -0
  13. package/dist/clients/TreasuryClient.js.map +1 -0
  14. package/dist/clients/ValocracyClient.d.ts +13 -0
  15. package/dist/clients/ValocracyClient.d.ts.map +1 -0
  16. package/dist/clients/ValocracyClient.js +32 -0
  17. package/dist/clients/ValocracyClient.js.map +1 -0
  18. package/dist/clients/index.d.ts +4 -0
  19. package/dist/clients/index.d.ts.map +1 -0
  20. package/dist/clients/index.js +4 -0
  21. package/dist/clients/index.js.map +1 -0
  22. package/dist/generated/governor/src/index.d.ts +400 -0
  23. package/dist/generated/governor/src/index.d.ts.map +1 -0
  24. package/dist/generated/governor/src/index.js +63 -0
  25. package/dist/generated/governor/src/index.js.map +1 -0
  26. package/dist/generated/treasury/src/index.d.ts +474 -0
  27. package/dist/generated/treasury/src/index.d.ts.map +1 -0
  28. package/dist/generated/treasury/src/index.js +54 -0
  29. package/dist/generated/treasury/src/index.js.map +1 -0
  30. package/dist/generated/valocracy/src/index.d.ts +807 -0
  31. package/dist/generated/valocracy/src/index.d.ts.map +1 -0
  32. package/dist/generated/valocracy/src/index.js +114 -0
  33. package/dist/generated/valocracy/src/index.js.map +1 -0
  34. package/dist/index.d.ts +5 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +5 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/react/hooks/useGovernor.d.ts +24 -0
  39. package/dist/react/hooks/useGovernor.d.ts.map +1 -0
  40. package/dist/react/hooks/useGovernor.js +45 -0
  41. package/dist/react/hooks/useGovernor.js.map +1 -0
  42. package/dist/react/hooks/useMultiWallet.d.ts +35 -0
  43. package/dist/react/hooks/useMultiWallet.d.ts.map +1 -0
  44. package/dist/react/hooks/useMultiWallet.js +87 -0
  45. package/dist/react/hooks/useMultiWallet.js.map +1 -0
  46. package/dist/react/hooks/useTreasury.d.ts +14 -0
  47. package/dist/react/hooks/useTreasury.d.ts.map +1 -0
  48. package/dist/react/hooks/useTreasury.js +45 -0
  49. package/dist/react/hooks/useTreasury.js.map +1 -0
  50. package/dist/react/hooks/useValocracy.d.ts +16 -0
  51. package/dist/react/hooks/useValocracy.d.ts.map +1 -0
  52. package/dist/react/hooks/useValocracy.js +54 -0
  53. package/dist/react/hooks/useValocracy.js.map +1 -0
  54. package/dist/react/hooks/useWallet.d.ts +13 -0
  55. package/dist/react/hooks/useWallet.d.ts.map +1 -0
  56. package/dist/react/hooks/useWallet.js +51 -0
  57. package/dist/react/hooks/useWallet.js.map +1 -0
  58. package/dist/react/index.d.ts +7 -0
  59. package/dist/react/index.d.ts.map +1 -0
  60. package/dist/react/index.js +7 -0
  61. package/dist/react/index.js.map +1 -0
  62. package/dist/react/providers/KarnProvider.d.ts +25 -0
  63. package/dist/react/providers/KarnProvider.d.ts.map +1 -0
  64. package/dist/react/providers/KarnProvider.js +25 -0
  65. package/dist/react/providers/KarnProvider.js.map +1 -0
  66. package/dist/utils/decay.d.ts +19 -0
  67. package/dist/utils/decay.d.ts.map +1 -0
  68. package/dist/utils/decay.js +33 -0
  69. package/dist/utils/decay.js.map +1 -0
  70. package/dist/utils/index.d.ts +4 -0
  71. package/dist/utils/index.d.ts.map +1 -0
  72. package/dist/utils/index.js +4 -0
  73. package/dist/utils/index.js.map +1 -0
  74. package/dist/utils/polling.d.ts +75 -0
  75. package/dist/utils/polling.d.ts.map +1 -0
  76. package/dist/utils/polling.js +104 -0
  77. package/dist/utils/polling.js.map +1 -0
  78. package/dist/utils/simulation.d.ts +67 -0
  79. package/dist/utils/simulation.d.ts.map +1 -0
  80. package/dist/utils/simulation.js +88 -0
  81. package/dist/utils/simulation.js.map +1 -0
  82. package/dist/wallet/WalletManager.d.ts +77 -0
  83. package/dist/wallet/WalletManager.d.ts.map +1 -0
  84. package/dist/wallet/WalletManager.js +268 -0
  85. package/dist/wallet/WalletManager.js.map +1 -0
  86. package/dist/wallet/adapters/AlbedoAdapter.d.ts +47 -0
  87. package/dist/wallet/adapters/AlbedoAdapter.d.ts.map +1 -0
  88. package/dist/wallet/adapters/AlbedoAdapter.js +84 -0
  89. package/dist/wallet/adapters/AlbedoAdapter.js.map +1 -0
  90. package/dist/wallet/adapters/FreighterAdapter.d.ts +42 -0
  91. package/dist/wallet/adapters/FreighterAdapter.d.ts.map +1 -0
  92. package/dist/wallet/adapters/FreighterAdapter.js +107 -0
  93. package/dist/wallet/adapters/FreighterAdapter.js.map +1 -0
  94. package/dist/wallet/adapters/LobstrAdapter.d.ts +34 -0
  95. package/dist/wallet/adapters/LobstrAdapter.d.ts.map +1 -0
  96. package/dist/wallet/adapters/LobstrAdapter.js +89 -0
  97. package/dist/wallet/adapters/LobstrAdapter.js.map +1 -0
  98. package/dist/wallet/adapters/RabetAdapter.d.ts +39 -0
  99. package/dist/wallet/adapters/RabetAdapter.d.ts.map +1 -0
  100. package/dist/wallet/adapters/RabetAdapter.js +104 -0
  101. package/dist/wallet/adapters/RabetAdapter.js.map +1 -0
  102. package/dist/wallet/adapters/xBullAdapter.d.ts +41 -0
  103. package/dist/wallet/adapters/xBullAdapter.d.ts.map +1 -0
  104. package/dist/wallet/adapters/xBullAdapter.js +72 -0
  105. package/dist/wallet/adapters/xBullAdapter.js.map +1 -0
  106. package/dist/wallet/index.d.ts +20 -0
  107. package/dist/wallet/index.d.ts.map +1 -0
  108. package/dist/wallet/index.js +23 -0
  109. package/dist/wallet/index.js.map +1 -0
  110. package/dist/wallet/types.d.ts +165 -0
  111. package/dist/wallet/types.d.ts.map +1 -0
  112. package/dist/wallet/types.js +50 -0
  113. package/dist/wallet/types.js.map +1 -0
  114. package/examples/basic-usage.ts +28 -0
  115. package/jest.config.js +37 -0
  116. package/package.json +58 -0
  117. package/src/__tests__/README.md +364 -0
  118. package/src/__tests__/setup.ts +57 -0
  119. package/src/__tests__/utils/decay.test.ts +331 -0
  120. package/src/__tests__/wallet/WalletManager.test.ts +410 -0
  121. package/src/clients/GovernorClient.ts +23 -0
  122. package/src/clients/TreasuryClient.ts +23 -0
  123. package/src/clients/ValocracyClient.ts +48 -0
  124. package/src/clients/index.ts +3 -0
  125. package/src/generated/governor/README.md +54 -0
  126. package/src/generated/governor/package.json +17 -0
  127. package/src/generated/governor/src/index.ts +428 -0
  128. package/src/generated/governor/tsconfig.json +98 -0
  129. package/src/generated/treasury/README.md +54 -0
  130. package/src/generated/treasury/package.json +17 -0
  131. package/src/generated/treasury/src/index.ts +495 -0
  132. package/src/generated/treasury/tsconfig.json +98 -0
  133. package/src/generated/valocracy/README.md +54 -0
  134. package/src/generated/valocracy/package.json +17 -0
  135. package/src/generated/valocracy/src/index.ts +831 -0
  136. package/src/generated/valocracy/tsconfig.json +98 -0
  137. package/src/index.ts +4 -0
  138. package/src/react/hooks/useGovernor.ts +69 -0
  139. package/src/react/hooks/useMultiWallet.ts +169 -0
  140. package/src/react/hooks/useTreasury.ts +57 -0
  141. package/src/react/hooks/useValocracy.ts +66 -0
  142. package/src/react/hooks/useWallet.ts +60 -0
  143. package/src/react/index.ts +6 -0
  144. package/src/react/providers/KarnProvider.tsx +63 -0
  145. package/src/utils/decay.ts +44 -0
  146. package/src/utils/index.ts +3 -0
  147. package/src/utils/polling.ts +193 -0
  148. package/src/utils/simulation.ts +136 -0
  149. package/src/wallet/WalletManager.ts +360 -0
  150. package/src/wallet/adapters/AlbedoAdapter.ts +140 -0
  151. package/src/wallet/adapters/FreighterAdapter.ts +179 -0
  152. package/src/wallet/adapters/LobstrAdapter.ts +142 -0
  153. package/src/wallet/adapters/RabetAdapter.ts +162 -0
  154. package/src/wallet/adapters/xBullAdapter.ts +123 -0
  155. package/src/wallet/index.ts +37 -0
  156. package/src/wallet/types.ts +204 -0
  157. package/tsconfig.json +40 -0
@@ -0,0 +1,807 @@
1
+ import { Buffer } from "buffer";
2
+ import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions, Result } from '@stellar/stellar-sdk/contract';
3
+ import type { u64, Option } from '@stellar/stellar-sdk/contract';
4
+ export * from '@stellar/stellar-sdk';
5
+ export * as contract from '@stellar/stellar-sdk/contract';
6
+ export * as rpc from '@stellar/stellar-sdk/rpc';
7
+ /**
8
+ * Valor type definition with rarity and metadata
9
+ */
10
+ export interface Valor {
11
+ /**
12
+ * Metadata string (e.g., description, URI)
13
+ */
14
+ metadata: string;
15
+ /**
16
+ * The rarity multiplier for this valor type
17
+ */
18
+ rarity: u64;
19
+ }
20
+ /**
21
+ * User statistics including level and expiration
22
+ */
23
+ export interface UserStats {
24
+ /**
25
+ * The expiration timestamp (Unix seconds)
26
+ */
27
+ expiry: u64;
28
+ /**
29
+ * The accumulated governance level
30
+ */
31
+ level: u64;
32
+ /**
33
+ * The permanent portion of level that never decays (e.g., Founder badge)
34
+ */
35
+ permanent_level: u64;
36
+ /**
37
+ * Whether the user has verified their identity (ADR-003)
38
+ */
39
+ verified: boolean;
40
+ }
41
+ export declare const ValocracyError: {
42
+ /**
43
+ * Contract has already been initialized
44
+ */
45
+ 1: {
46
+ message: string;
47
+ };
48
+ /**
49
+ * Contract has not been initialized
50
+ */
51
+ 2: {
52
+ message: string;
53
+ };
54
+ /**
55
+ * Caller is not authorized (not a member or not the governor)
56
+ */
57
+ 3: {
58
+ message: string;
59
+ };
60
+ /**
61
+ * Valor ID does not exist
62
+ */
63
+ 4: {
64
+ message: string;
65
+ };
66
+ /**
67
+ * Token ID does not exist
68
+ */
69
+ 5: {
70
+ message: string;
71
+ };
72
+ /**
73
+ * Account does not exist
74
+ */
75
+ 6: {
76
+ message: string;
77
+ };
78
+ /**
79
+ * Token is soulbound and cannot be transferred
80
+ */
81
+ 7: {
82
+ message: string;
83
+ };
84
+ /**
85
+ * User has already self-registered (has a Member badge)
86
+ */
87
+ 8: {
88
+ message: string;
89
+ };
90
+ /**
91
+ * Invalid signature
92
+ */
93
+ 9: {
94
+ message: string;
95
+ };
96
+ /**
97
+ * Nonce already used
98
+ */
99
+ 10: {
100
+ message: string;
101
+ };
102
+ /**
103
+ * Signature expired
104
+ */
105
+ 11: {
106
+ message: string;
107
+ };
108
+ /**
109
+ * Invalid Valor ID
110
+ */
111
+ 12: {
112
+ message: string;
113
+ };
114
+ /**
115
+ * Mint not authorized
116
+ */
117
+ 13: {
118
+ message: string;
119
+ };
120
+ /**
121
+ * Badge not mintable
122
+ */
123
+ 14: {
124
+ message: string;
125
+ };
126
+ /**
127
+ * Reentrancy detected
128
+ */
129
+ 15: {
130
+ message: string;
131
+ };
132
+ };
133
+ /**
134
+ * Storage keys for the contract
135
+ */
136
+ export type DataKey = {
137
+ tag: "Admin";
138
+ values: void;
139
+ } | {
140
+ tag: "Initialized";
141
+ values: void;
142
+ } | {
143
+ tag: "Founder";
144
+ values: void;
145
+ } | {
146
+ tag: "Governor";
147
+ values: void;
148
+ } | {
149
+ tag: "Treasury";
150
+ values: void;
151
+ } | {
152
+ tag: "TotalSupply";
153
+ values: void;
154
+ } | {
155
+ tag: "MemberValorId";
156
+ values: void;
157
+ } | {
158
+ tag: "TokenValorId";
159
+ values: readonly [u64];
160
+ } | {
161
+ tag: "ValorData";
162
+ values: readonly [u64];
163
+ } | {
164
+ tag: "UserStats";
165
+ values: readonly [string];
166
+ } | {
167
+ tag: "TokenOwner";
168
+ values: readonly [u64];
169
+ } | {
170
+ tag: "Signer";
171
+ values: void;
172
+ } | {
173
+ tag: "UsedNonce";
174
+ values: readonly [string, u64];
175
+ };
176
+ export interface Client {
177
+ /**
178
+ * Construct and simulate a mint transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
179
+ * Mint a new soulbound NFT to an account.
180
+ *
181
+ * Requires authorization from a valid minter for the specific badge category.
182
+ * - Governance/Leadership/Track: See RBAC matrix
183
+ * - Community: Any member
184
+ */
185
+ mint: ({ minter, recipient, valor_id }: {
186
+ minter: string;
187
+ recipient: string;
188
+ valor_id: u64;
189
+ }, options?: {
190
+ /**
191
+ * The fee to pay for the transaction. Default: BASE_FEE
192
+ */
193
+ fee?: number;
194
+ /**
195
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
196
+ */
197
+ timeoutInSeconds?: number;
198
+ /**
199
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
200
+ */
201
+ simulate?: boolean;
202
+ }) => Promise<AssembledTransaction<Result<u64>>>;
203
+ /**
204
+ * Construct and simulate a name transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
205
+ * Get the contract name
206
+ */
207
+ name: (options?: {
208
+ /**
209
+ * The fee to pay for the transaction. Default: BASE_FEE
210
+ */
211
+ fee?: number;
212
+ /**
213
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
214
+ */
215
+ timeoutInSeconds?: number;
216
+ /**
217
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
218
+ */
219
+ simulate?: boolean;
220
+ }) => Promise<AssembledTransaction<string>>;
221
+ /**
222
+ * Construct and simulate a revoke transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
223
+ * Revoke (burn) a badge token.
224
+ *
225
+ * Governor-only. Removes the token, reduces the user's level by
226
+ * the badge's rarity value. Used for governance-decided removal.
227
+ */
228
+ revoke: ({ token_id }: {
229
+ token_id: u64;
230
+ }, options?: {
231
+ /**
232
+ * The fee to pay for the transaction. Default: BASE_FEE
233
+ */
234
+ fee?: number;
235
+ /**
236
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
237
+ */
238
+ timeoutInSeconds?: number;
239
+ /**
240
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
241
+ */
242
+ simulate?: boolean;
243
+ }) => Promise<AssembledTransaction<Result<void>>>;
244
+ /**
245
+ * Construct and simulate a symbol transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
246
+ * Get the contract symbol
247
+ */
248
+ symbol: (options?: {
249
+ /**
250
+ * The fee to pay for the transaction. Default: BASE_FEE
251
+ */
252
+ fee?: number;
253
+ /**
254
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
255
+ */
256
+ timeoutInSeconds?: number;
257
+ /**
258
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
259
+ */
260
+ simulate?: boolean;
261
+ }) => Promise<AssembledTransaction<string>>;
262
+ /**
263
+ * Construct and simulate a founder transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
264
+ * Get the founder address
265
+ */
266
+ founder: (options?: {
267
+ /**
268
+ * The fee to pay for the transaction. Default: BASE_FEE
269
+ */
270
+ fee?: number;
271
+ /**
272
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
273
+ */
274
+ timeoutInSeconds?: number;
275
+ /**
276
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
277
+ */
278
+ simulate?: boolean;
279
+ }) => Promise<AssembledTransaction<Option<string>>>;
280
+ /**
281
+ * Construct and simulate a upgrade transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
282
+ * Upgrade the contract to a new WASM hash.
283
+ * Only callable by the governor (requires governance proposal).
284
+ */
285
+ upgrade: ({ new_wasm_hash }: {
286
+ new_wasm_hash: Buffer;
287
+ }, options?: {
288
+ /**
289
+ * The fee to pay for the transaction. Default: BASE_FEE
290
+ */
291
+ fee?: number;
292
+ /**
293
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
294
+ */
295
+ timeoutInSeconds?: number;
296
+ /**
297
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
298
+ */
299
+ simulate?: boolean;
300
+ }) => Promise<AssembledTransaction<Result<void>>>;
301
+ /**
302
+ * Construct and simulate a governor transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
303
+ * Get the governor contract address
304
+ */
305
+ governor: (options?: {
306
+ /**
307
+ * The fee to pay for the transaction. Default: BASE_FEE
308
+ */
309
+ fee?: number;
310
+ /**
311
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
312
+ */
313
+ timeoutInSeconds?: number;
314
+ /**
315
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
316
+ */
317
+ simulate?: boolean;
318
+ }) => Promise<AssembledTransaction<Option<string>>>;
319
+ /**
320
+ * Construct and simulate a level_of transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
321
+ * Get the raw level of an account (without decay)
322
+ */
323
+ level_of: ({ account }: {
324
+ account: string;
325
+ }, options?: {
326
+ /**
327
+ * The fee to pay for the transaction. Default: BASE_FEE
328
+ */
329
+ fee?: number;
330
+ /**
331
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
332
+ */
333
+ timeoutInSeconds?: number;
334
+ /**
335
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
336
+ */
337
+ simulate?: boolean;
338
+ }) => Promise<AssembledTransaction<u64>>;
339
+ /**
340
+ * Construct and simulate a owner_of transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
341
+ * Get the owner of a token
342
+ */
343
+ owner_of: ({ token_id }: {
344
+ token_id: u64;
345
+ }, options?: {
346
+ /**
347
+ * The fee to pay for the transaction. Default: BASE_FEE
348
+ */
349
+ fee?: number;
350
+ /**
351
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
352
+ */
353
+ timeoutInSeconds?: number;
354
+ /**
355
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
356
+ */
357
+ simulate?: boolean;
358
+ }) => Promise<AssembledTransaction<Option<string>>>;
359
+ /**
360
+ * Construct and simulate a treasury transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
361
+ * Get the treasury contract address
362
+ */
363
+ treasury: (options?: {
364
+ /**
365
+ * The fee to pay for the transaction. Default: BASE_FEE
366
+ */
367
+ fee?: number;
368
+ /**
369
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
370
+ */
371
+ timeoutInSeconds?: number;
372
+ /**
373
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
374
+ */
375
+ simulate?: boolean;
376
+ }) => Promise<AssembledTransaction<Option<string>>>;
377
+ /**
378
+ * Construct and simulate a expiry_of transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
379
+ * Get the expiry timestamp of an account
380
+ */
381
+ expiry_of: ({ account }: {
382
+ account: string;
383
+ }, options?: {
384
+ /**
385
+ * The fee to pay for the transaction. Default: BASE_FEE
386
+ */
387
+ fee?: number;
388
+ /**
389
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
390
+ */
391
+ timeoutInSeconds?: number;
392
+ /**
393
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
394
+ */
395
+ simulate?: boolean;
396
+ }) => Promise<AssembledTransaction<u64>>;
397
+ /**
398
+ * Construct and simulate a get_votes transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
399
+ * Get the current voting power (Mana) of an account
400
+ *
401
+ * Mana = MEMBER_FLOOR + bonus (decay applies to extra_level only)
402
+ * Registered accounts always retain at least MEMBER_FLOOR voting power.
403
+ */
404
+ get_votes: ({ account }: {
405
+ account: string;
406
+ }, options?: {
407
+ /**
408
+ * The fee to pay for the transaction. Default: BASE_FEE
409
+ */
410
+ fee?: number;
411
+ /**
412
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
413
+ */
414
+ timeoutInSeconds?: number;
415
+ /**
416
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
417
+ */
418
+ simulate?: boolean;
419
+ }) => Promise<AssembledTransaction<u64>>;
420
+ /**
421
+ * Construct and simulate a rarity_of transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
422
+ * Get the rarity of a valor type
423
+ */
424
+ rarity_of: ({ valor_id }: {
425
+ valor_id: u64;
426
+ }, options?: {
427
+ /**
428
+ * The fee to pay for the transaction. Default: BASE_FEE
429
+ */
430
+ fee?: number;
431
+ /**
432
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
433
+ */
434
+ timeoutInSeconds?: number;
435
+ /**
436
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
437
+ */
438
+ simulate?: boolean;
439
+ }) => Promise<AssembledTransaction<u64>>;
440
+ /**
441
+ * Construct and simulate a set_valor transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
442
+ * Create or update a Valor type with rarity and metadata.
443
+ *
444
+ * Governor-only. Badge type changes require a governance proposal.
445
+ */
446
+ set_valor: ({ valor_id, rarity, metadata }: {
447
+ valor_id: u64;
448
+ rarity: u64;
449
+ metadata: string;
450
+ }, options?: {
451
+ /**
452
+ * The fee to pay for the transaction. Default: BASE_FEE
453
+ */
454
+ fee?: number;
455
+ /**
456
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
457
+ */
458
+ timeoutInSeconds?: number;
459
+ /**
460
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
461
+ */
462
+ simulate?: boolean;
463
+ }) => Promise<AssembledTransaction<Result<void>>>;
464
+ /**
465
+ * Construct and simulate a initialize transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
466
+ * Initialize the Valocracy contract.
467
+ *
468
+ * No admin: sets all configuration at once. Registers initial valor types,
469
+ * mints the Founder badge, and stores the member badge ID for self-registration.
470
+ *
471
+ * # Arguments
472
+ * * `founder` - Address that receives the permanent Founder badge
473
+ * * `governor` - Governor contract address
474
+ * * `treasury` - Treasury contract address
475
+ * * `name` - Contract name
476
+ * * `symbol` - Contract symbol
477
+ * * `member_valor_id` - Valor ID used by self_register() (the Member badge)
478
+ * * `valor_ids` - List of valor IDs to register
479
+ * * `valor_rarities` - List of rarities (parallel to valor_ids)
480
+ * * `valor_metadatas` - List of metadata strings (parallel to valor_ids)
481
+ * * `founder_valor_id` - Which valor_id is the Founder badge
482
+ */
483
+ initialize: ({ founder, governor, treasury, member_valor_id, valor_ids, valor_rarities, valor_metadatas, founder_valor_id, signer }: {
484
+ founder: string;
485
+ governor: string;
486
+ treasury: string;
487
+ member_valor_id: u64;
488
+ valor_ids: Array<u64>;
489
+ valor_rarities: Array<u64>;
490
+ valor_metadatas: Array<string>;
491
+ founder_valor_id: u64;
492
+ signer: Buffer;
493
+ }, options?: {
494
+ /**
495
+ * The fee to pay for the transaction. Default: BASE_FEE
496
+ */
497
+ fee?: number;
498
+ /**
499
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
500
+ */
501
+ timeoutInSeconds?: number;
502
+ /**
503
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
504
+ */
505
+ simulate?: boolean;
506
+ }) => Promise<AssembledTransaction<Result<void>>>;
507
+ /**
508
+ * Construct and simulate a is_verified transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
509
+ * Check if a member has completed identity verification (ADR-003).
510
+ *
511
+ * Returns false if the account is not registered.
512
+ */
513
+ is_verified: ({ account }: {
514
+ account: string;
515
+ }, options?: {
516
+ /**
517
+ * The fee to pay for the transaction. Default: BASE_FEE
518
+ */
519
+ fee?: number;
520
+ /**
521
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
522
+ */
523
+ timeoutInSeconds?: number;
524
+ /**
525
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
526
+ */
527
+ simulate?: boolean;
528
+ }) => Promise<AssembledTransaction<boolean>>;
529
+ /**
530
+ * Construct and simulate a metadata_of transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
531
+ * Get the metadata of a valor type
532
+ */
533
+ metadata_of: ({ valor_id }: {
534
+ valor_id: u64;
535
+ }, options?: {
536
+ /**
537
+ * The fee to pay for the transaction. Default: BASE_FEE
538
+ */
539
+ fee?: number;
540
+ /**
541
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
542
+ */
543
+ timeoutInSeconds?: number;
544
+ /**
545
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
546
+ */
547
+ simulate?: boolean;
548
+ }) => Promise<AssembledTransaction<string>>;
549
+ /**
550
+ * Construct and simulate a valor_id_of transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
551
+ * Get the valor ID linked to a token
552
+ */
553
+ valor_id_of: ({ token_id }: {
554
+ token_id: u64;
555
+ }, options?: {
556
+ /**
557
+ * The fee to pay for the transaction. Default: BASE_FEE
558
+ */
559
+ fee?: number;
560
+ /**
561
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
562
+ */
563
+ timeoutInSeconds?: number;
564
+ /**
565
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
566
+ */
567
+ simulate?: boolean;
568
+ }) => Promise<AssembledTransaction<Option<u64>>>;
569
+ /**
570
+ * Construct and simulate a set_verified transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
571
+ * Set the verification status of a member (ADR-003).
572
+ *
573
+ * Governor-only. Used after identity verification is complete.
574
+ * Unverified members cannot withdraw funds from the treasury.
575
+ */
576
+ set_verified: ({ member, verified }: {
577
+ member: string;
578
+ verified: boolean;
579
+ }, options?: {
580
+ /**
581
+ * The fee to pay for the transaction. Default: BASE_FEE
582
+ */
583
+ fee?: number;
584
+ /**
585
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
586
+ */
587
+ timeoutInSeconds?: number;
588
+ /**
589
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
590
+ */
591
+ simulate?: boolean;
592
+ }) => Promise<AssembledTransaction<Result<void>>>;
593
+ /**
594
+ * Construct and simulate a total_supply transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
595
+ * Get total supply of minted tokens
596
+ */
597
+ total_supply: (options?: {
598
+ /**
599
+ * The fee to pay for the transaction. Default: BASE_FEE
600
+ */
601
+ fee?: number;
602
+ /**
603
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
604
+ */
605
+ timeoutInSeconds?: number;
606
+ /**
607
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
608
+ */
609
+ simulate?: boolean;
610
+ }) => Promise<AssembledTransaction<u64>>;
611
+ /**
612
+ * Construct and simulate a guardian_mint transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
613
+ * Mint a new soulbound NFT using backend signature (Guardian).
614
+ *
615
+ * Payload: account | valor_id | nonce | expiry
616
+ */
617
+ guardian_mint: ({ account, valor_id, signature, nonce, expiry }: {
618
+ account: string;
619
+ valor_id: u64;
620
+ signature: Buffer;
621
+ nonce: u64;
622
+ expiry: u64;
623
+ }, options?: {
624
+ /**
625
+ * The fee to pay for the transaction. Default: BASE_FEE
626
+ */
627
+ fee?: number;
628
+ /**
629
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
630
+ */
631
+ timeoutInSeconds?: number;
632
+ /**
633
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
634
+ */
635
+ simulate?: boolean;
636
+ }) => Promise<AssembledTransaction<Result<u64>>>;
637
+ /**
638
+ * Construct and simulate a self_register transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
639
+ */
640
+ self_register: ({ caller, signature, nonce, expiry }: {
641
+ caller: string;
642
+ signature: Buffer;
643
+ nonce: u64;
644
+ expiry: u64;
645
+ }, options?: {
646
+ /**
647
+ * The fee to pay for the transaction. Default: BASE_FEE
648
+ */
649
+ fee?: number;
650
+ /**
651
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
652
+ */
653
+ timeoutInSeconds?: number;
654
+ /**
655
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
656
+ */
657
+ simulate?: boolean;
658
+ }) => Promise<AssembledTransaction<Result<u64>>>;
659
+ /**
660
+ * Construct and simulate a calculate_mana transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
661
+ * Calculate Mana (voting power with Member Floor)
662
+ *
663
+ * Formula: Mana = floor + bonus
664
+ * - floor = MEMBER_FLOOR (fixed constant, e.g. 5)
665
+ * - extra_level = level - floor
666
+ * - bonus = (extra_level * time_remaining) / VACANCY_PERIOD
667
+ *
668
+ * Inactive members decay to exactly MEMBER_FLOOR regardless of their
669
+ * accumulated level. Legacy status offers zero protection against inactivity.
670
+ */
671
+ calculate_mana: ({ level, permanent_level, expiry, current_time }: {
672
+ level: u64;
673
+ permanent_level: u64;
674
+ expiry: u64;
675
+ current_time: u64;
676
+ }, options?: {
677
+ /**
678
+ * The fee to pay for the transaction. Default: BASE_FEE
679
+ */
680
+ fee?: number;
681
+ /**
682
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
683
+ */
684
+ timeoutInSeconds?: number;
685
+ /**
686
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
687
+ */
688
+ simulate?: boolean;
689
+ }) => Promise<AssembledTransaction<u64>>;
690
+ /**
691
+ * Construct and simulate a vacancy_period transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
692
+ * Get the vacancy period (180 days in seconds)
693
+ */
694
+ vacancy_period: (options?: {
695
+ /**
696
+ * The fee to pay for the transaction. Default: BASE_FEE
697
+ */
698
+ fee?: number;
699
+ /**
700
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
701
+ */
702
+ timeoutInSeconds?: number;
703
+ /**
704
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
705
+ */
706
+ simulate?: boolean;
707
+ }) => Promise<AssembledTransaction<u64>>;
708
+ /**
709
+ * Construct and simulate a update_governor transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
710
+ * Update the governor contract address (migration path).
711
+ * Only callable by the current governor.
712
+ */
713
+ update_governor: ({ new_governor }: {
714
+ new_governor: string;
715
+ }, options?: {
716
+ /**
717
+ * The fee to pay for the transaction. Default: BASE_FEE
718
+ */
719
+ fee?: number;
720
+ /**
721
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
722
+ */
723
+ timeoutInSeconds?: number;
724
+ /**
725
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
726
+ */
727
+ simulate?: boolean;
728
+ }) => Promise<AssembledTransaction<Result<void>>>;
729
+ /**
730
+ * Construct and simulate a update_treasury transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
731
+ * Update the treasury contract address.
732
+ * Only callable by the current governor.
733
+ */
734
+ update_treasury: ({ new_treasury }: {
735
+ new_treasury: string;
736
+ }, options?: {
737
+ /**
738
+ * The fee to pay for the transaction. Default: BASE_FEE
739
+ */
740
+ fee?: number;
741
+ /**
742
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
743
+ */
744
+ timeoutInSeconds?: number;
745
+ /**
746
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
747
+ */
748
+ simulate?: boolean;
749
+ }) => Promise<AssembledTransaction<Result<void>>>;
750
+ /**
751
+ * Construct and simulate a has_voting_power transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
752
+ * Check if account has any active voting power
753
+ *
754
+ * Any registered account (level > 0) always has at least MEMBER_FLOOR voting power.
755
+ */
756
+ has_voting_power: ({ account }: {
757
+ account: string;
758
+ }, options?: {
759
+ /**
760
+ * The fee to pay for the transaction. Default: BASE_FEE
761
+ */
762
+ fee?: number;
763
+ /**
764
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
765
+ */
766
+ timeoutInSeconds?: number;
767
+ /**
768
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
769
+ */
770
+ simulate?: boolean;
771
+ }) => Promise<AssembledTransaction<boolean>>;
772
+ /**
773
+ * Construct and simulate a permanent_level_of transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
774
+ * Get the permanent level of an account
775
+ */
776
+ permanent_level_of: ({ account }: {
777
+ account: string;
778
+ }, options?: {
779
+ /**
780
+ * The fee to pay for the transaction. Default: BASE_FEE
781
+ */
782
+ fee?: number;
783
+ /**
784
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
785
+ */
786
+ timeoutInSeconds?: number;
787
+ /**
788
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
789
+ */
790
+ simulate?: boolean;
791
+ }) => Promise<AssembledTransaction<u64>>;
792
+ }
793
+ export declare class Client extends ContractClient {
794
+ readonly options: ContractClientOptions;
795
+ static deploy<T = Client>(
796
+ /** Options for initializing a Client as well as for calling a method, with extras specific to deploying. */
797
+ options: MethodOptions & Omit<ContractClientOptions, "contractId"> & {
798
+ /** The hash of the Wasm blob, which must already be installed on-chain. */
799
+ wasmHash: Buffer | string;
800
+ /** Salt used to generate the contract's ID. Passed through to {@link Operation.createCustomContract}. Default: random. */
801
+ salt?: Buffer | Uint8Array;
802
+ /** The format used to decode `wasmHash`, if it's provided as a string. */
803
+ format?: "hex" | "base64";
804
+ }): Promise<AssembledTransaction<T>>;
805
+ constructor(options: ContractClientOptions);
806
+ }
807
+ //# sourceMappingURL=index.d.ts.map