@ghostspeak/sdk 2.0.5 → 2.0.7

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 (121) hide show
  1. package/README.md +152 -30
  2. package/dist/GhostSpeakClient-CWmGaM9Q.d.ts +1007 -0
  3. package/dist/StakingModule-C5rzuOWb.d.ts +2526 -0
  4. package/dist/{agent-M74TCRON.js → agent-5YLZ7DAC.js} +4 -4
  5. package/dist/{agent-M74TCRON.js.map → agent-5YLZ7DAC.js.map} +1 -1
  6. package/dist/batch-operations-45CQFEID.js +4 -0
  7. package/dist/batch-operations-45CQFEID.js.map +1 -0
  8. package/dist/browser.d.ts +45 -554
  9. package/dist/browser.js +15 -842
  10. package/dist/browser.js.map +1 -1
  11. package/dist/chunk-AL3HQN73.js +754 -0
  12. package/dist/chunk-AL3HQN73.js.map +1 -0
  13. package/dist/chunk-BF3IQ35I.js +284 -0
  14. package/dist/chunk-BF3IQ35I.js.map +1 -0
  15. package/dist/chunk-BQDGRTVP.js +168 -0
  16. package/dist/chunk-BQDGRTVP.js.map +1 -0
  17. package/dist/chunk-C5CDA3WX.js +7314 -0
  18. package/dist/chunk-C5CDA3WX.js.map +1 -0
  19. package/dist/chunk-E3FD2CNY.js +1869 -0
  20. package/dist/chunk-E3FD2CNY.js.map +1 -0
  21. package/dist/{chunk-V3SOFUAZ.js → chunk-G7S6B6WB.js} +327 -493
  22. package/dist/chunk-G7S6B6WB.js.map +1 -0
  23. package/dist/chunk-IHVDQ4YI.js +4231 -0
  24. package/dist/chunk-IHVDQ4YI.js.map +1 -0
  25. package/dist/chunk-JV2SWONF.js +98 -0
  26. package/dist/chunk-JV2SWONF.js.map +1 -0
  27. package/dist/chunk-KB6CKIUK.js +231 -0
  28. package/dist/chunk-KB6CKIUK.js.map +1 -0
  29. package/dist/chunk-RIZZPLLB.js +343 -0
  30. package/dist/chunk-RIZZPLLB.js.map +1 -0
  31. package/dist/chunk-S74EH3KD.js +7890 -0
  32. package/dist/chunk-S74EH3KD.js.map +1 -0
  33. package/dist/chunk-SFTSZ3LC.js +156 -0
  34. package/dist/chunk-SFTSZ3LC.js.map +1 -0
  35. package/dist/chunk-SKMJJ3Q6.js +125 -0
  36. package/dist/chunk-SKMJJ3Q6.js.map +1 -0
  37. package/dist/chunk-SZGFSCNU.js +3682 -0
  38. package/dist/chunk-SZGFSCNU.js.map +1 -0
  39. package/dist/chunk-TTB4OS2D.js +69 -0
  40. package/dist/chunk-TTB4OS2D.js.map +1 -0
  41. package/dist/chunk-UP2VWCW5.js +33 -0
  42. package/dist/{chunk-NSBPE2FW.js.map → chunk-UP2VWCW5.js.map} +1 -1
  43. package/dist/{chunk-UJUGGLMT.js → chunk-VQZQCHUT.js} +5 -5
  44. package/dist/{chunk-UJUGGLMT.js.map → chunk-VQZQCHUT.js.map} +1 -1
  45. package/dist/client.d.ts +6 -4
  46. package/dist/client.js +12 -10
  47. package/dist/createAgentAuthorization-ULG47ZJI.js +5 -0
  48. package/dist/createAgentAuthorization-ULG47ZJI.js.map +1 -0
  49. package/dist/credentials.d.ts +155 -0
  50. package/dist/credentials.js +4 -0
  51. package/dist/credentials.js.map +1 -0
  52. package/dist/crypto.js +2 -2
  53. package/dist/errors.js +1 -1
  54. package/dist/feature-flags-B1g0DCPe.d.ts +1181 -0
  55. package/dist/generated-EG5USUFG.js +9 -0
  56. package/dist/{generated-VNLHMR6Y.js.map → generated-EG5USUFG.js.map} +1 -1
  57. package/dist/{ghostspeak_wasm-SB2RPJ3D.js → ghostspeak_wasm-F227HOSM.js} +3 -3
  58. package/dist/{ghostspeak_wasm-SB2RPJ3D.js.map → ghostspeak_wasm-F227HOSM.js.map} +1 -1
  59. package/dist/index.d.ts +1210 -1506
  60. package/dist/index.js +601 -3532
  61. package/dist/index.js.map +1 -1
  62. package/dist/metafile-esm.json +1 -1
  63. package/dist/minimal/core-minimal.d.ts +2383 -1264
  64. package/dist/minimal/core-minimal.js +9 -9
  65. package/dist/minimal/core-minimal.js.map +1 -1
  66. package/dist/nacl-fast-W5BJ3KZ2.js +2229 -0
  67. package/dist/nacl-fast-W5BJ3KZ2.js.map +1 -0
  68. package/dist/pda-4KP7CURF.js +4 -0
  69. package/dist/pda-4KP7CURF.js.map +1 -0
  70. package/dist/pda-Ce7VYg4T.d.ts +25 -0
  71. package/dist/reputation-types-Yebf0Rm_.d.ts +1071 -0
  72. package/dist/revokeAuthorization-OK7E7OK3.js +5 -0
  73. package/dist/revokeAuthorization-OK7E7OK3.js.map +1 -0
  74. package/dist/signature-verification-DGxR4aYQ.d.ts +448 -0
  75. package/dist/types.js +1 -1
  76. package/dist/updateReputationWithAuth-Y4ONEVSP.js +5 -0
  77. package/dist/updateReputationWithAuth-Y4ONEVSP.js.map +1 -0
  78. package/dist/utils.d.ts +69 -203
  79. package/dist/utils.js +15 -153
  80. package/dist/utils.js.map +1 -1
  81. package/package.json +28 -31
  82. package/dist/.tsbuildinfo +0 -1
  83. package/dist/GhostSpeakClient-hsGuGg__.d.ts +0 -860
  84. package/dist/GovernanceModule-DQYYys-H.d.ts +0 -1766
  85. package/dist/chunk-ASQXX4IT.js +0 -572
  86. package/dist/chunk-ASQXX4IT.js.map +0 -1
  87. package/dist/chunk-COGZFWOT.js +0 -19657
  88. package/dist/chunk-COGZFWOT.js.map +0 -1
  89. package/dist/chunk-FKRN4PW5.js +0 -1667
  90. package/dist/chunk-FKRN4PW5.js.map +0 -1
  91. package/dist/chunk-GMHIUK2R.js +0 -7526
  92. package/dist/chunk-GMHIUK2R.js.map +0 -1
  93. package/dist/chunk-IAWBZYPE.js +0 -356
  94. package/dist/chunk-IAWBZYPE.js.map +0 -1
  95. package/dist/chunk-NSBPE2FW.js +0 -15
  96. package/dist/chunk-OWYHJG6H.js +0 -13311
  97. package/dist/chunk-OWYHJG6H.js.map +0 -1
  98. package/dist/chunk-RDDPOFR5.js +0 -3
  99. package/dist/chunk-RDDPOFR5.js.map +0 -1
  100. package/dist/chunk-RERCHKZP.js +0 -35
  101. package/dist/chunk-RERCHKZP.js.map +0 -1
  102. package/dist/chunk-TVVGXYCI.js +0 -2887
  103. package/dist/chunk-TVVGXYCI.js.map +0 -1
  104. package/dist/chunk-V3SOFUAZ.js.map +0 -1
  105. package/dist/chunk-ZGP5552B.js +0 -377
  106. package/dist/chunk-ZGP5552B.js.map +0 -1
  107. package/dist/chunk-ZWOYNHVK.js +0 -196
  108. package/dist/chunk-ZWOYNHVK.js.map +0 -1
  109. package/dist/dist/.tsbuildinfo +0 -1
  110. package/dist/elgamal-VZLWB3XK.js +0 -5
  111. package/dist/elgamal-VZLWB3XK.js.map +0 -1
  112. package/dist/feature-flags-V722ZuXO.d.ts +0 -3512
  113. package/dist/generated-VNLHMR6Y.js +0 -5
  114. package/dist/ipfs-types-BOt9ZNg4.d.ts +0 -592
  115. package/dist/multisigConfig-BzEhy6jy.d.ts +0 -58
  116. package/dist/pda-B_nS8SbD.d.ts +0 -114
  117. package/dist/pda-S4BFJVGE.js +0 -4
  118. package/dist/pda-S4BFJVGE.js.map +0 -1
  119. package/dist/system-addresses-BFNLEbFx.d.ts +0 -857
  120. package/dist/token-2022-rpc-RALH4RK7.js +0 -593
  121. package/dist/token-2022-rpc-RALH4RK7.js.map +0 -1
@@ -1,3512 +0,0 @@
1
- import { Option, Address, ReadonlyUint8Array, Commitment, EncodedAccount, MaybeEncodedAccount, fetchEncodedAccount } from '@solana/kit';
2
- import { Address as Address$1 } from '@solana/addresses';
3
- import { k as ExecutionCondition, l as ConditionType, G as GovernanceProposal, m as VotingResults, Q as QuorumRequirements, V as VoteChoice, I as IPFSConfig, a as IPFSUploadOptions, c as IPFSOperationResult, g as IPFSUploadResult, h as IPFSRetrievalOptions, i as IPFSRetrievalResult, j as IPFSPinResult, b as IPFSContentMetadata, C as ContentStorageResult } from './ipfs-types-BOt9ZNg4.js';
4
- import { T as TransactionType, a as MultisigConfig } from './multisigConfig-BzEhy6jy.js';
5
-
6
- /**
7
- * This code was AUTOGENERATED using the Codama library.
8
- * Please DO NOT EDIT THIS FILE, instead use visitors
9
- * to add features, then rerun Codama to update it.
10
- *
11
- * @see https://github.com/codama-idl/codama
12
- */
13
-
14
- type AccessAuditConfig = {
15
- auditEnabled: boolean;
16
- realTimeMonitoring: boolean;
17
- retentionPeriod: bigint;
18
- };
19
-
20
- /**
21
- * This code was AUTOGENERATED using the Codama library.
22
- * Please DO NOT EDIT THIS FILE, instead use visitors
23
- * to add features, then rerun Codama to update it.
24
- *
25
- * @see https://github.com/codama-idl/codama
26
- */
27
-
28
- /** Access policy definition */
29
- type AccessPolicy = {
30
- /** Policy identifier */
31
- policyId: string;
32
- /** Policy name */
33
- name: string;
34
- /** Policy description */
35
- description: string;
36
- /** Policy type */
37
- policyType: PolicyType;
38
- /** Policy rules */
39
- rules: Array<PolicyRule>;
40
- /** Policy scope */
41
- scope: PolicyScope;
42
- /** Policy priority */
43
- priority: number;
44
- /** Policy status */
45
- status: PolicyStatus;
46
- /** Effective date */
47
- effectiveDate: bigint;
48
- /** Expiration date */
49
- expirationDate: Option<bigint>;
50
- /** Policy metadata */
51
- metadata: PolicyMetadata;
52
- };
53
-
54
- /**
55
- * This code was AUTOGENERATED using the Codama library.
56
- * Please DO NOT EDIT THIS FILE, instead use visitors
57
- * to add features, then rerun Codama to update it.
58
- *
59
- * @see https://github.com/codama-idl/codama
60
- */
61
-
62
- /** Account lockout policies */
63
- type AccountLockoutPolicies = {
64
- /** Max failed attempts before lockout */
65
- maxFailedAttempts: number;
66
- /** Lockout duration */
67
- lockoutDuration: bigint;
68
- /** Progressive lockout enabled */
69
- progressiveLockout: boolean;
70
- /** Unlock methods */
71
- unlockMethods: Array<UnlockMethod>;
72
- /** Notification requirements */
73
- notificationRequirements: Array<NotificationRequirement>;
74
- };
75
-
76
- /**
77
- * This code was AUTOGENERATED using the Codama library.
78
- * Please DO NOT EDIT THIS FILE, instead use visitors
79
- * to add features, then rerun Codama to update it.
80
- *
81
- * @see https://github.com/codama-idl/codama
82
- */
83
-
84
- /** Role activation requirements */
85
- type ActivationRequirement = {
86
- /** Requirement type */
87
- requirementType: ActivationRequirementType;
88
- /** Required approvers */
89
- approvers: Array<Address>;
90
- /** Minimum approvals needed */
91
- minApprovals: number;
92
- /** Approval timeout */
93
- approvalTimeout: bigint;
94
- /** Evidence requirements */
95
- evidenceRequirements: Array<string>;
96
- };
97
-
98
- /**
99
- * This code was AUTOGENERATED using the Codama library.
100
- * Please DO NOT EDIT THIS FILE, instead use visitors
101
- * to add features, then rerun Codama to update it.
102
- *
103
- * @see https://github.com/codama-idl/codama
104
- */
105
-
106
- /** Types of role activation requirements */
107
- declare enum ActivationRequirementType {
108
- ManagerApproval = 0,
109
- PeerReview = 1,
110
- SecurityClearance = 2,
111
- BackgroundCheck = 3,
112
- TrainingCompletion = 4,
113
- CertificationRequired = 5,
114
- BusinessJustification = 6,
115
- TechnicalAssessment = 7
116
- }
117
-
118
- /**
119
- * This code was AUTOGENERATED using the Codama library.
120
- * Please DO NOT EDIT THIS FILE, instead use visitors
121
- * to add features, then rerun Codama to update it.
122
- *
123
- * @see https://github.com/codama-idl/codama
124
- */
125
-
126
- /** Template aging policies */
127
- type AgingPolicy = {
128
- /** Biometric type */
129
- biometricType: BiometricType;
130
- /** Maximum age */
131
- maxAge: bigint;
132
- /** Refresh requirements */
133
- refreshRequirements: Array<string>;
134
- /** Degradation handling */
135
- degradationHandling: DegradationHandling;
136
- };
137
-
138
- /**
139
- * This code was AUTOGENERATED using the Codama library.
140
- * Please DO NOT EDIT THIS FILE, instead use visitors
141
- * to add features, then rerun Codama to update it.
142
- *
143
- * @see https://github.com/codama-idl/codama
144
- */
145
-
146
- /** Authentication levels */
147
- declare enum AuthenticationLevel {
148
- Low = 0,
149
- Medium = 1,
150
- High = 2,
151
- VeryHigh = 3
152
- }
153
-
154
- /**
155
- * This code was AUTOGENERATED using the Codama library.
156
- * Please DO NOT EDIT THIS FILE, instead use visitors
157
- * to add features, then rerun Codama to update it.
158
- *
159
- * @see https://github.com/codama-idl/codama
160
- */
161
-
162
- /** Authentication methods */
163
- declare enum AuthenticationMethod {
164
- Password = 0,
165
- DigitalSignature = 1,
166
- Biometric = 2,
167
- Token = 3,
168
- Certificate = 4,
169
- Sms = 5,
170
- Email = 6,
171
- App = 7,
172
- Hardware = 8
173
- }
174
-
175
- /**
176
- * This code was AUTOGENERATED using the Codama library.
177
- * Please DO NOT EDIT THIS FILE, instead use visitors
178
- * to add features, then rerun Codama to update it.
179
- *
180
- * @see https://github.com/codama-idl/codama
181
- */
182
-
183
- /** Authentication policies */
184
- type AuthenticationPolicies = {
185
- /** Multi-factor authentication required */
186
- mfaRequired: boolean;
187
- /** Supported authentication methods */
188
- supportedMethods: Array<AuthenticationMethod>;
189
- /** Authentication strength requirements */
190
- strengthRequirements: AuthenticationStrength;
191
- /** Account lockout policies */
192
- lockoutPolicies: AccountLockoutPolicies;
193
- /** Biometric policies */
194
- biometricPolicies: Option<BiometricPolicies>;
195
- };
196
-
197
- /**
198
- * This code was AUTOGENERATED using the Codama library.
199
- * Please DO NOT EDIT THIS FILE, instead use visitors
200
- * to add features, then rerun Codama to update it.
201
- *
202
- * @see https://github.com/codama-idl/codama
203
- */
204
-
205
- /** Authentication strength requirements */
206
- type AuthenticationStrength = {
207
- /** Minimum authentication level */
208
- minimumLevel: AuthenticationLevel;
209
- /** Risk-based authentication */
210
- riskBased: boolean;
211
- /** Adaptive authentication */
212
- adaptive: boolean;
213
- /** Step-up authentication triggers */
214
- stepUpTriggers: Array<StepUpTrigger>;
215
- };
216
-
217
- /**
218
- * This code was AUTOGENERATED using the Codama library.
219
- * Please DO NOT EDIT THIS FILE, instead use visitors
220
- * to add features, then rerun Codama to update it.
221
- *
222
- * @see https://github.com/codama-idl/codama
223
- */
224
-
225
- type AuthorizationPolicies = {
226
- defaultDeny: boolean;
227
- explicitPermissionsRequired: boolean;
228
- };
229
-
230
- /**
231
- * This code was AUTOGENERATED using the Codama library.
232
- * Please DO NOT EDIT THIS FILE, instead use visitors
233
- * to add features, then rerun Codama to update it.
234
- *
235
- * @see https://github.com/codama-idl/codama
236
- */
237
-
238
- /** Biometric authentication policies */
239
- type BiometricPolicies = {
240
- /** Supported biometric types */
241
- supportedTypes: Array<BiometricType>;
242
- /** Biometric quality requirements */
243
- qualityRequirements: BiometricQuality;
244
- /** Liveness detection required */
245
- livenessDetection: boolean;
246
- /** Biometric template protection */
247
- templateProtection: BiometricProtection;
248
- };
249
-
250
- /**
251
- * This code was AUTOGENERATED using the Codama library.
252
- * Please DO NOT EDIT THIS FILE, instead use visitors
253
- * to add features, then rerun Codama to update it.
254
- *
255
- * @see https://github.com/codama-idl/codama
256
- */
257
-
258
- /** Biometric template protection */
259
- type BiometricProtection = {
260
- /** Template encryption required */
261
- encryptionRequired: boolean;
262
- /** Template storage method */
263
- storageMethod: BiometricStorageMethod;
264
- /** Template revocation support */
265
- revocationSupport: boolean;
266
- /** Template aging policies */
267
- agingPolicies: Array<AgingPolicy>;
268
- };
269
-
270
- /**
271
- * This code was AUTOGENERATED using the Codama library.
272
- * Please DO NOT EDIT THIS FILE, instead use visitors
273
- * to add features, then rerun Codama to update it.
274
- *
275
- * @see https://github.com/codama-idl/codama
276
- */
277
-
278
- /** Biometric template storage methods */
279
- declare enum BiometricStorageMethod {
280
- OnDevice = 0,
281
- Encrypted = 1,
282
- Hashed = 2,
283
- Distributed = 3,
284
- None = 4
285
- }
286
-
287
- /**
288
- * This code was AUTOGENERATED using the Codama library.
289
- * Please DO NOT EDIT THIS FILE, instead use visitors
290
- * to add features, then rerun Codama to update it.
291
- *
292
- * @see https://github.com/codama-idl/codama
293
- */
294
-
295
- /** Types of biometric authentication */
296
- declare enum BiometricType {
297
- Fingerprint = 0,
298
- FaceRecognition = 1,
299
- IrisRecognition = 2,
300
- VoiceRecognition = 3,
301
- Signature = 4,
302
- Gait = 5,
303
- Behavioral = 6
304
- }
305
-
306
- /**
307
- * This code was AUTOGENERATED using the Codama library.
308
- * Please DO NOT EDIT THIS FILE, instead use visitors
309
- * to add features, then rerun Codama to update it.
310
- *
311
- * @see https://github.com/codama-idl/codama
312
- */
313
-
314
- type CompliancePolicies = {
315
- frameworks: Array<string>;
316
- auditRequirements: Array<string>;
317
- reportingRequirements: Array<string>;
318
- };
319
-
320
- /**
321
- * This code was AUTOGENERATED using the Codama library.
322
- * Please DO NOT EDIT THIS FILE, instead use visitors
323
- * to add features, then rerun Codama to update it.
324
- *
325
- * @see https://github.com/codama-idl/codama
326
- */
327
-
328
- /** Constraint condition definition */
329
- type ConstraintCondition = {
330
- /** Attribute name */
331
- attribute: string;
332
- /** Condition operator */
333
- operator: ConstraintOperator;
334
- /** Expected value */
335
- value: string;
336
- /** Value type */
337
- valueType: ValueType;
338
- };
339
-
340
- /**
341
- * This code was AUTOGENERATED using the Codama library.
342
- * Please DO NOT EDIT THIS FILE, instead use visitors
343
- * to add features, then rerun Codama to update it.
344
- *
345
- * @see https://github.com/codama-idl/codama
346
- */
347
-
348
- /** Operators for constraint conditions */
349
- declare enum ConstraintOperator {
350
- Equals = 0,
351
- NotEquals = 1,
352
- GreaterThan = 2,
353
- LessThan = 3,
354
- GreaterThanOrEqual = 4,
355
- LessThanOrEqual = 5,
356
- Contains = 6,
357
- NotContains = 7,
358
- In = 8,
359
- NotIn = 9,
360
- Matches = 10,
361
- NotMatches = 11
362
- }
363
-
364
- /**
365
- * This code was AUTOGENERATED using the Codama library.
366
- * Please DO NOT EDIT THIS FILE, instead use visitors
367
- * to add features, then rerun Codama to update it.
368
- *
369
- * @see https://github.com/codama-idl/codama
370
- */
371
-
372
- /** Data access levels */
373
- declare enum DataAccessLevel {
374
- Public = 0,
375
- Internal = 1,
376
- Confidential = 2,
377
- Restricted = 3,
378
- TopSecret = 4
379
- }
380
-
381
- /**
382
- * This code was AUTOGENERATED using the Codama library.
383
- * Please DO NOT EDIT THIS FILE, instead use visitors
384
- * to add features, then rerun Codama to update it.
385
- *
386
- * @see https://github.com/codama-idl/codama
387
- */
388
-
389
- type DataProtectionPolicies = {
390
- encryptionRequired: boolean;
391
- classificationRequired: boolean;
392
- dlpEnabled: boolean;
393
- };
394
-
395
- /**
396
- * This code was AUTOGENERATED using the Codama library.
397
- * Please DO NOT EDIT THIS FILE, instead use visitors
398
- * to add features, then rerun Codama to update it.
399
- *
400
- * @see https://github.com/codama-idl/codama
401
- */
402
-
403
- /** Handling of template degradation */
404
- declare enum DegradationHandling {
405
- RequireRefresh = 0,
406
- GradualDegradation = 1,
407
- ImmediateExpiry = 2,
408
- AdaptiveThreshold = 3
409
- }
410
-
411
- /**
412
- * This code was AUTOGENERATED using the Codama library.
413
- * Please DO NOT EDIT THIS FILE, instead use visitors
414
- * to add features, then rerun Codama to update it.
415
- *
416
- * @see https://github.com/codama-idl/codama
417
- */
418
-
419
- type EmergencyAccessConfig = {
420
- breakGlassEnabled: boolean;
421
- emergencyContacts: Array<Address>;
422
- approvalRequired: boolean;
423
- };
424
-
425
- /**
426
- * This code was AUTOGENERATED using the Codama library.
427
- * Please DO NOT EDIT THIS FILE, instead use visitors
428
- * to add features, then rerun Codama to update it.
429
- *
430
- * @see https://github.com/codama-idl/codama
431
- */
432
-
433
- /** Emergency configuration for multisig */
434
- type EmergencyConfig = {
435
- /** Emergency contacts */
436
- emergencyContacts: Array<Address>;
437
- /** Emergency threshold override */
438
- emergencyThreshold: number;
439
- /** Emergency timeout (shorter than normal) */
440
- emergencyTimeout: bigint;
441
- /** Allowed emergency transaction types */
442
- emergencyTransactionTypes: Array<TransactionType>;
443
- /** Emergency freeze enabled */
444
- freezeEnabled: boolean;
445
- /** Current freeze status */
446
- frozen: boolean;
447
- /** Freeze timestamp */
448
- frozenAt: Option<bigint>;
449
- /** Auto-unfreeze after duration */
450
- autoUnfreezeDuration: Option<bigint>;
451
- };
452
-
453
- /**
454
- * This code was AUTOGENERATED using the Codama library.
455
- * Please DO NOT EDIT THIS FILE, instead use visitors
456
- * to add features, then rerun Codama to update it.
457
- *
458
- * @see https://github.com/codama-idl/codama
459
- */
460
-
461
- /** Enforcement levels for constraints */
462
- declare enum EnforcementLevel {
463
- Hard = 0,
464
- Soft = 1,
465
- Advisory = 2,
466
- ExceptionBased = 3
467
- }
468
-
469
- /**
470
- * This code was AUTOGENERATED using the Codama library.
471
- * Please DO NOT EDIT THIS FILE, instead use visitors
472
- * to add features, then rerun Codama to update it.
473
- *
474
- * @see https://github.com/codama-idl/codama
475
- */
476
-
477
- /** Geographic region definition */
478
- type GeographicRegion = {
479
- /** Region name */
480
- name: string;
481
- /** Latitude boundaries */
482
- latitudeRange: LatitudeRange;
483
- /** Longitude boundaries */
484
- longitudeRange: LongitudeRange;
485
- /** Radius for circular regions (meters) */
486
- radius: Option<number>;
487
- };
488
-
489
- /**
490
- * This code was AUTOGENERATED using the Codama library.
491
- * Please DO NOT EDIT THIS FILE, instead use visitors
492
- * to add features, then rerun Codama to update it.
493
- *
494
- * @see https://github.com/codama-idl/codama
495
- */
496
-
497
- /** Hierarchical boundary definition */
498
- type HierarchicalBoundary = {
499
- /** Boundary level */
500
- level: string;
501
- /** Boundary value */
502
- value: string;
503
- /** Include descendants */
504
- includeDescendants: boolean;
505
- };
506
-
507
- /**
508
- * This code was AUTOGENERATED using the Codama library.
509
- * Please DO NOT EDIT THIS FILE, instead use visitors
510
- * to add features, then rerun Codama to update it.
511
- *
512
- * @see https://github.com/codama-idl/codama
513
- */
514
-
515
- type IncidentResponsePolicies = {
516
- responseTeam: Array<Address>;
517
- escalationProcedures: Array<string>;
518
- notificationRequirements: Array<NotificationRequirement>;
519
- };
520
-
521
- /**
522
- * This code was AUTOGENERATED using the Codama library.
523
- * Please DO NOT EDIT THIS FILE, instead use visitors
524
- * to add features, then rerun Codama to update it.
525
- *
526
- * @see https://github.com/codama-idl/codama
527
- */
528
-
529
- /** Latitude range for geographic constraints */
530
- type LatitudeRange = {
531
- /** Minimum latitude */
532
- min: number;
533
- /** Maximum latitude */
534
- max: number;
535
- };
536
-
537
- /**
538
- * This code was AUTOGENERATED using the Codama library.
539
- * Please DO NOT EDIT THIS FILE, instead use visitors
540
- * to add features, then rerun Codama to update it.
541
- *
542
- * @see https://github.com/codama-idl/codama
543
- */
544
-
545
- /** Location-based access constraints */
546
- type LocationConstraints = {
547
- /** Allowed countries (ISO codes) */
548
- allowedCountries: Array<string>;
549
- /** Blocked countries (ISO codes) */
550
- blockedCountries: Array<string>;
551
- /** Allowed IP address ranges (CIDR) */
552
- allowedIpRanges: Array<string>;
553
- /** Blocked IP address ranges (CIDR) */
554
- blockedIpRanges: Array<string>;
555
- /** Geofencing enabled */
556
- geofencingEnabled: boolean;
557
- /** Allowed geographic regions */
558
- allowedRegions: Array<GeographicRegion>;
559
- };
560
-
561
- /**
562
- * This code was AUTOGENERATED using the Codama library.
563
- * Please DO NOT EDIT THIS FILE, instead use visitors
564
- * to add features, then rerun Codama to update it.
565
- *
566
- * @see https://github.com/codama-idl/codama
567
- */
568
-
569
- /** Longitude range for geographic constraints */
570
- type LongitudeRange = {
571
- /** Minimum longitude */
572
- min: number;
573
- /** Maximum longitude */
574
- max: number;
575
- };
576
-
577
- /**
578
- * This code was AUTOGENERATED using the Codama library.
579
- * Please DO NOT EDIT THIS FILE, instead use visitors
580
- * to add features, then rerun Codama to update it.
581
- *
582
- * @see https://github.com/codama-idl/codama
583
- */
584
-
585
- /** Individual signature in multisig */
586
- type MultisigSignature = {
587
- /** Signer public key */
588
- signer: Address;
589
- /** Signature data */
590
- signature: ReadonlyUint8Array;
591
- /** Signature timestamp */
592
- signedAt: bigint;
593
- /** Signature method/algorithm */
594
- signatureMethod: string;
595
- /** Additional verification data */
596
- verificationData: Option<ReadonlyUint8Array>;
597
- };
598
-
599
- /**
600
- * This code was AUTOGENERATED using the Codama library.
601
- * Please DO NOT EDIT THIS FILE, instead use visitors
602
- * to add features, then rerun Codama to update it.
603
- *
604
- * @see https://github.com/codama-idl/codama
605
- */
606
-
607
- /**
608
- * MultisigType defines the governance layer a multisig belongs to.
609
- * Different types have different permissions and requirements.
610
- */
611
- declare enum MultisigType {
612
- Protocol = 0,
613
- Dao = 1,
614
- Dispute = 2,
615
- AgentConsortium = 3,
616
- AgentTreasury = 4,
617
- Custom = 5
618
- }
619
-
620
- /**
621
- * This code was AUTOGENERATED using the Codama library.
622
- * Please DO NOT EDIT THIS FILE, instead use visitors
623
- * to add features, then rerun Codama to update it.
624
- *
625
- * @see https://github.com/codama-idl/codama
626
- */
627
-
628
- /** Metadata and requirements for each MultisigType */
629
- type MultisigTypeConfig = {
630
- /** The multisig type */
631
- multisigType: MultisigType;
632
- /** Required timelock duration in seconds (0 = no timelock) */
633
- timelockSeconds: bigint;
634
- /** Minimum number of signers allowed */
635
- minSigners: number;
636
- /** Maximum number of signers allowed */
637
- maxSigners: number;
638
- /** Minimum reputation score required (0-10000 basis points) */
639
- minReputationScore: number;
640
- /** Whether signers must hold governance tokens */
641
- requiresTokenHoldings: boolean;
642
- /** Minimum token balance required (if requires_token_holdings) */
643
- minTokenBalance: bigint;
644
- };
645
-
646
- /**
647
- * This code was AUTOGENERATED using the Codama library.
648
- * Please DO NOT EDIT THIS FILE, instead use visitors
649
- * to add features, then rerun Codama to update it.
650
- *
651
- * @see https://github.com/codama-idl/codama
652
- */
653
-
654
- type NetworkSecurityPolicies = {
655
- firewallRequired: boolean;
656
- intrusionDetection: boolean;
657
- trafficMonitoring: boolean;
658
- };
659
-
660
- /**
661
- * This code was AUTOGENERATED using the Codama library.
662
- * Please DO NOT EDIT THIS FILE, instead use visitors
663
- * to add features, then rerun Codama to update it.
664
- *
665
- * @see https://github.com/codama-idl/codama
666
- */
667
-
668
- /** Notification methods */
669
- declare enum NotificationMethod {
670
- OnChain = 0,
671
- Email = 1,
672
- Sms = 2,
673
- Push = 3,
674
- InApp = 4,
675
- All = 5
676
- }
677
-
678
- /**
679
- * This code was AUTOGENERATED using the Codama library.
680
- * Please DO NOT EDIT THIS FILE, instead use visitors
681
- * to add features, then rerun Codama to update it.
682
- *
683
- * @see https://github.com/codama-idl/codama
684
- */
685
-
686
- /** Notification priorities */
687
- declare enum NotificationPriority {
688
- Low = 0,
689
- Medium = 1,
690
- High = 2,
691
- Critical = 3,
692
- Emergency = 4
693
- }
694
-
695
- /**
696
- * This code was AUTOGENERATED using the Codama library.
697
- * Please DO NOT EDIT THIS FILE, instead use visitors
698
- * to add features, then rerun Codama to update it.
699
- *
700
- * @see https://github.com/codama-idl/codama
701
- */
702
-
703
- /** Notification requirements for security events */
704
- type NotificationRequirement = {
705
- /** Event type */
706
- eventType: SecurityEventType;
707
- /** Notification targets */
708
- targets: Array<NotificationTarget>;
709
- /** Notification method */
710
- method: NotificationMethod;
711
- /** Notification timing */
712
- timing: NotificationTiming;
713
- };
714
-
715
- /**
716
- * This code was AUTOGENERATED using the Codama library.
717
- * Please DO NOT EDIT THIS FILE, instead use visitors
718
- * to add features, then rerun Codama to update it.
719
- *
720
- * @see https://github.com/codama-idl/codama
721
- */
722
-
723
- /** Notification targets */
724
- type NotificationTarget = {
725
- /** Target type */
726
- targetType: NotificationTargetType;
727
- /** Target identifier */
728
- targetId: string;
729
- /** Notification priority */
730
- priority: NotificationPriority;
731
- };
732
-
733
- /**
734
- * This code was AUTOGENERATED using the Codama library.
735
- * Please DO NOT EDIT THIS FILE, instead use visitors
736
- * to add features, then rerun Codama to update it.
737
- *
738
- * @see https://github.com/codama-idl/codama
739
- */
740
-
741
- /** Types of notification targets */
742
- declare enum NotificationTargetType {
743
- User = 0,
744
- Administrator = 1,
745
- SecurityTeam = 2,
746
- ComplianceTeam = 3,
747
- Manager = 4,
748
- AuditTeam = 5,
749
- ExternalSystem = 6
750
- }
751
-
752
- /**
753
- * This code was AUTOGENERATED using the Codama library.
754
- * Please DO NOT EDIT THIS FILE, instead use visitors
755
- * to add features, then rerun Codama to update it.
756
- *
757
- * @see https://github.com/codama-idl/codama
758
- */
759
-
760
- /** Notification timing */
761
- declare enum NotificationTiming {
762
- Immediate = 0,
763
- Delayed = 1,
764
- Batched = 2,
765
- Scheduled = 3
766
- }
767
-
768
- /**
769
- * This code was AUTOGENERATED using the Codama library.
770
- * Please DO NOT EDIT THIS FILE, instead use visitors
771
- * to add features, then rerun Codama to update it.
772
- *
773
- * @see https://github.com/codama-idl/codama
774
- */
775
-
776
- type PasswordPolicies = {
777
- minimumLength: number;
778
- complexityRequirements: Array<string>;
779
- historyCount: number;
780
- maxAge: bigint;
781
- };
782
-
783
- /**
784
- * This code was AUTOGENERATED using the Codama library.
785
- * Please DO NOT EDIT THIS FILE, instead use visitors
786
- * to add features, then rerun Codama to update it.
787
- *
788
- * @see https://github.com/codama-idl/codama
789
- */
790
-
791
- /** Pending transaction in multisig queue */
792
- type PendingTransaction = {
793
- /** Transaction ID */
794
- transactionId: bigint;
795
- /** Transaction type */
796
- transactionType: TransactionType;
797
- /** Target program/account */
798
- target: Address;
799
- /** Transaction data */
800
- data: ReadonlyUint8Array;
801
- /** Required signatures */
802
- requiredSignatures: number;
803
- /** Current signatures */
804
- signatures: Array<MultisigSignature>;
805
- /** Creation timestamp */
806
- createdAt: bigint;
807
- /** Expiration timestamp */
808
- expiresAt: bigint;
809
- /** Transaction priority */
810
- priority: TransactionPriority;
811
- /** Execution conditions */
812
- executionConditions: Array<ExecutionCondition>;
813
- /** Transaction status */
814
- status: TransactionStatus;
815
- /** Time lock (if applicable) */
816
- timeLock: Option<TimeLock>;
817
- };
818
-
819
- /**
820
- * This code was AUTOGENERATED using the Codama library.
821
- * Please DO NOT EDIT THIS FILE, instead use visitors
822
- * to add features, then rerun Codama to update it.
823
- *
824
- * @see https://github.com/codama-idl/codama
825
- */
826
-
827
- /** Permission definition */
828
- type Permission = {
829
- /** Permission identifier */
830
- permissionId: string;
831
- /** Permission name */
832
- name: string;
833
- /** Permission description */
834
- description: string;
835
- /** Resource type this permission applies to */
836
- resourceType: string;
837
- /** Actions allowed by this permission */
838
- actions: Array<Action>;
839
- /** Permission scope */
840
- scope: PermissionScope;
841
- /** Permission constraints */
842
- constraints: Array<PermissionConstraint>;
843
- /** Permission metadata */
844
- metadata: PermissionMetadata;
845
- };
846
-
847
- /**
848
- * This code was AUTOGENERATED using the Codama library.
849
- * Please DO NOT EDIT THIS FILE, instead use visitors
850
- * to add features, then rerun Codama to update it.
851
- *
852
- * @see https://github.com/codama-idl/codama
853
- */
854
-
855
- /** Permission constraint */
856
- type PermissionConstraint = {
857
- /** Constraint type */
858
- constraintType: PermissionConstraintType;
859
- /** Constraint conditions */
860
- conditions: Array<ConstraintCondition>;
861
- /** Constraint enforcement */
862
- enforcement: EnforcementLevel;
863
- };
864
-
865
- /**
866
- * This code was AUTOGENERATED using the Codama library.
867
- * Please DO NOT EDIT THIS FILE, instead use visitors
868
- * to add features, then rerun Codama to update it.
869
- *
870
- * @see https://github.com/codama-idl/codama
871
- */
872
-
873
- /** Types of permission constraints */
874
- declare enum PermissionConstraintType {
875
- Temporal = 0,
876
- Contextual = 1,
877
- Conditional = 2,
878
- ResourceBased = 3,
879
- AttributeBased = 4,
880
- RiskBased = 5
881
- }
882
-
883
- /**
884
- * This code was AUTOGENERATED using the Codama library.
885
- * Please DO NOT EDIT THIS FILE, instead use visitors
886
- * to add features, then rerun Codama to update it.
887
- *
888
- * @see https://github.com/codama-idl/codama
889
- */
890
-
891
- /** Permission metadata */
892
- type PermissionMetadata = {
893
- /** Business justification */
894
- businessJustification: string;
895
- /** Risk assessment */
896
- riskAssessment: RiskAssessment;
897
- /** Compliance mapping */
898
- complianceMapping: Array<string>;
899
- /** Related permissions */
900
- relatedPermissions: Array<string>;
901
- /** Permission owner */
902
- owner: Option<Address>;
903
- /** Last review */
904
- lastReview: Option<bigint>;
905
- /** Review frequency */
906
- reviewFrequency: bigint;
907
- };
908
-
909
- /**
910
- * This code was AUTOGENERATED using the Codama library.
911
- * Please DO NOT EDIT THIS FILE, instead use visitors
912
- * to add features, then rerun Codama to update it.
913
- *
914
- * @see https://github.com/codama-idl/codama
915
- */
916
-
917
- /** Permission scope definition */
918
- type PermissionScope = {
919
- /** Scope type */
920
- scopeType: ScopeType;
921
- /** Scope boundaries */
922
- boundaries: ScopeBoundaries;
923
- /** Hierarchical scope */
924
- hierarchical: boolean;
925
- /** Inherited permissions */
926
- inherited: boolean;
927
- };
928
-
929
- /**
930
- * This code was AUTOGENERATED using the Codama library.
931
- * Please DO NOT EDIT THIS FILE, instead use visitors
932
- * to add features, then rerun Codama to update it.
933
- *
934
- * @see https://github.com/codama-idl/codama
935
- */
936
-
937
- /** Policy metadata */
938
- type PolicyMetadata = {
939
- /** Policy author */
940
- author: Option<Address>;
941
- /** Policy approver */
942
- approver: Option<Address>;
943
- /** Approval date */
944
- approvalDate: Option<bigint>;
945
- /** Business justification */
946
- businessJustification: string;
947
- /** Compliance references */
948
- complianceReferences: Array<string>;
949
- /** Risk assessment */
950
- riskAssessment: Option<string>;
951
- /** Review schedule */
952
- reviewSchedule: ReviewSchedule;
953
- };
954
-
955
- /**
956
- * This code was AUTOGENERATED using the Codama library.
957
- * Please DO NOT EDIT THIS FILE, instead use visitors
958
- * to add features, then rerun Codama to update it.
959
- *
960
- * @see https://github.com/codama-idl/codama
961
- */
962
-
963
- /** Policy rule definition */
964
- type PolicyRule = {
965
- /** Rule identifier */
966
- ruleId: string;
967
- /** Rule conditions */
968
- conditions: Array<RuleCondition>;
969
- /** Rule effect */
970
- effect: RuleEffect;
971
- /** Rule priority */
972
- priority: number;
973
- /** Rule enabled */
974
- enabled: boolean;
975
- };
976
-
977
- /**
978
- * This code was AUTOGENERATED using the Codama library.
979
- * Please DO NOT EDIT THIS FILE, instead use visitors
980
- * to add features, then rerun Codama to update it.
981
- *
982
- * @see https://github.com/codama-idl/codama
983
- */
984
-
985
- /** Policy scope */
986
- type PolicyScope = {
987
- /** Applicable subjects */
988
- subjects: Array<string>;
989
- /** Applicable resources */
990
- resources: Array<string>;
991
- /** Applicable actions */
992
- actions: Array<string>;
993
- /** Scope inheritance */
994
- inheritance: ScopeInheritance;
995
- };
996
-
997
- /**
998
- * This code was AUTOGENERATED using the Codama library.
999
- * Please DO NOT EDIT THIS FILE, instead use visitors
1000
- * to add features, then rerun Codama to update it.
1001
- *
1002
- * @see https://github.com/codama-idl/codama
1003
- */
1004
-
1005
- /** Policy status */
1006
- declare enum PolicyStatus {
1007
- Active = 0,
1008
- Inactive = 1,
1009
- Draft = 2,
1010
- UnderReview = 3,
1011
- Deprecated = 4,
1012
- Suspended = 5
1013
- }
1014
-
1015
- /**
1016
- * This code was AUTOGENERATED using the Codama library.
1017
- * Please DO NOT EDIT THIS FILE, instead use visitors
1018
- * to add features, then rerun Codama to update it.
1019
- *
1020
- * @see https://github.com/codama-idl/codama
1021
- */
1022
-
1023
- /** Types of access policies */
1024
- declare enum PolicyType {
1025
- Allow = 0,
1026
- Deny = 1,
1027
- Conditional = 2,
1028
- Delegated = 3,
1029
- Temporary = 4,
1030
- Emergency = 5
1031
- }
1032
-
1033
- /**
1034
- * This code was AUTOGENERATED using the Codama library.
1035
- * Please DO NOT EDIT THIS FILE, instead use visitors
1036
- * to add features, then rerun Codama to update it.
1037
- *
1038
- * @see https://github.com/codama-idl/codama
1039
- */
1040
-
1041
- /** Review schedule for policies */
1042
- type ReviewSchedule = {
1043
- /** Review frequency */
1044
- frequency: bigint;
1045
- /** Last review date */
1046
- lastReview: Option<bigint>;
1047
- /** Next review date */
1048
- nextReview: bigint;
1049
- /** Review owners */
1050
- reviewOwners: Array<Address>;
1051
- /** Review criteria */
1052
- reviewCriteria: Array<string>;
1053
- };
1054
-
1055
- /**
1056
- * This code was AUTOGENERATED using the Codama library.
1057
- * Please DO NOT EDIT THIS FILE, instead use visitors
1058
- * to add features, then rerun Codama to update it.
1059
- *
1060
- * @see https://github.com/codama-idl/codama
1061
- */
1062
-
1063
- /** Risk acceptance status */
1064
- type RiskAcceptance = {
1065
- /** Risk accepted */
1066
- accepted: boolean;
1067
- /** Accepting authority */
1068
- acceptingAuthority: Option<Address>;
1069
- /** Acceptance date */
1070
- acceptanceDate: Option<bigint>;
1071
- /** Acceptance reasoning */
1072
- reasoning: Option<string>;
1073
- /** Review date */
1074
- reviewDate: Option<bigint>;
1075
- };
1076
-
1077
- /**
1078
- * This code was AUTOGENERATED using the Codama library.
1079
- * Please DO NOT EDIT THIS FILE, instead use visitors
1080
- * to add features, then rerun Codama to update it.
1081
- *
1082
- * @see https://github.com/codama-idl/codama
1083
- */
1084
-
1085
- /** Risk assessment for permissions */
1086
- type RiskAssessment = {
1087
- /** Overall risk score */
1088
- riskScore: number;
1089
- /** Risk factors */
1090
- riskFactors: Array<RiskFactor>;
1091
- /** Mitigation measures */
1092
- mitigationMeasures: Array<string>;
1093
- /** Risk acceptance */
1094
- riskAcceptance: RiskAcceptance;
1095
- };
1096
-
1097
- /**
1098
- * This code was AUTOGENERATED using the Codama library.
1099
- * Please DO NOT EDIT THIS FILE, instead use visitors
1100
- * to add features, then rerun Codama to update it.
1101
- *
1102
- * @see https://github.com/codama-idl/codama
1103
- */
1104
-
1105
- /** Risk categories */
1106
- declare enum RiskCategory {
1107
- Operational = 0,
1108
- Financial = 1,
1109
- Compliance = 2,
1110
- Security = 3,
1111
- Reputational = 4,
1112
- Technical = 5,
1113
- Legal = 6
1114
- }
1115
-
1116
- /**
1117
- * This code was AUTOGENERATED using the Codama library.
1118
- * Please DO NOT EDIT THIS FILE, instead use visitors
1119
- * to add features, then rerun Codama to update it.
1120
- *
1121
- * @see https://github.com/codama-idl/codama
1122
- */
1123
-
1124
- /** Individual risk factor */
1125
- type RiskFactor = {
1126
- /** Factor name */
1127
- name: string;
1128
- /** Factor category */
1129
- category: RiskCategory;
1130
- /** Impact score */
1131
- impact: number;
1132
- /** Likelihood score */
1133
- likelihood: number;
1134
- /** Risk score */
1135
- riskScore: number;
1136
- };
1137
-
1138
- /**
1139
- * This code was AUTOGENERATED using the Codama library.
1140
- * Please DO NOT EDIT THIS FILE, instead use visitors
1141
- * to add features, then rerun Codama to update it.
1142
- *
1143
- * @see https://github.com/codama-idl/codama
1144
- */
1145
-
1146
- /** Risk levels for roles */
1147
- declare enum RiskLevel {
1148
- Low = 0,
1149
- Medium = 1,
1150
- High = 2,
1151
- Critical = 3
1152
- }
1153
-
1154
- /**
1155
- * This code was AUTOGENERATED using the Codama library.
1156
- * Please DO NOT EDIT THIS FILE, instead use visitors
1157
- * to add features, then rerun Codama to update it.
1158
- *
1159
- * @see https://github.com/codama-idl/codama
1160
- */
1161
-
1162
- /** Role definition with permissions and constraints */
1163
- type Role = {
1164
- /** Role identifier */
1165
- roleId: string;
1166
- /** Role name */
1167
- name: string;
1168
- /** Role description */
1169
- description: string;
1170
- /** Role type */
1171
- roleType: RoleType;
1172
- /** Permission assignments */
1173
- permissions: Array<string>;
1174
- /** Role constraints */
1175
- constraints: RoleConstraints;
1176
- /** Inheritance relationships */
1177
- inheritsFrom: Array<string>;
1178
- /** Role metadata */
1179
- metadata: RoleMetadata;
1180
- /** Role status */
1181
- status: RoleStatus;
1182
- /** Creation timestamp */
1183
- createdAt: bigint;
1184
- /** Last modification timestamp */
1185
- modifiedAt: bigint;
1186
- };
1187
-
1188
- /**
1189
- * This code was AUTOGENERATED using the Codama library.
1190
- * Please DO NOT EDIT THIS FILE, instead use visitors
1191
- * to add features, then rerun Codama to update it.
1192
- *
1193
- * @see https://github.com/codama-idl/codama
1194
- */
1195
-
1196
- /** Constraints applied to roles */
1197
- type RoleConstraints = {
1198
- /** Time-based constraints */
1199
- timeConstraints: Option<TimeConstraints>;
1200
- /** Location-based constraints */
1201
- locationConstraints: Option<LocationConstraints>;
1202
- /** Resource-based constraints */
1203
- resourceConstraints: Option<ResourceConstraints>;
1204
- /** Session-based constraints */
1205
- sessionConstraints: Option<SessionConstraints>;
1206
- /** Segregation of duties constraints */
1207
- sodConstraints: Array<SodConstraint>;
1208
- /** Maximum concurrent sessions */
1209
- maxConcurrentSessions: Option<number>;
1210
- /** Role activation requirements */
1211
- activationRequirements: Array<ActivationRequirement>;
1212
- };
1213
-
1214
- /**
1215
- * This code was AUTOGENERATED using the Codama library.
1216
- * Please DO NOT EDIT THIS FILE, instead use visitors
1217
- * to add features, then rerun Codama to update it.
1218
- *
1219
- * @see https://github.com/codama-idl/codama
1220
- */
1221
-
1222
- /** Role metadata for additional information */
1223
- type RoleMetadata = {
1224
- /** Business purpose */
1225
- businessPurpose: string;
1226
- /** Risk level */
1227
- riskLevel: RiskLevel;
1228
- /** Data access level */
1229
- dataAccessLevel: DataAccessLevel;
1230
- /** Compliance requirements */
1231
- complianceRequirements: Array<string>;
1232
- /** Role owner */
1233
- roleOwner: Option<Address>;
1234
- /** Role custodian */
1235
- roleCustodian: Option<Address>;
1236
- /** Review frequency */
1237
- reviewFrequency: bigint;
1238
- /** Last review timestamp */
1239
- lastReview: Option<bigint>;
1240
- /** Next review due */
1241
- nextReview: Option<bigint>;
1242
- };
1243
-
1244
- /**
1245
- * This code was AUTOGENERATED using the Codama library.
1246
- * Please DO NOT EDIT THIS FILE, instead use visitors
1247
- * to add features, then rerun Codama to update it.
1248
- *
1249
- * @see https://github.com/codama-idl/codama
1250
- */
1251
-
1252
- /** Role status */
1253
- declare enum RoleStatus {
1254
- Active = 0,
1255
- Inactive = 1,
1256
- Deprecated = 2,
1257
- UnderReview = 3,
1258
- Suspended = 4
1259
- }
1260
-
1261
- /**
1262
- * This code was AUTOGENERATED using the Codama library.
1263
- * Please DO NOT EDIT THIS FILE, instead use visitors
1264
- * to add features, then rerun Codama to update it.
1265
- *
1266
- * @see https://github.com/codama-idl/codama
1267
- */
1268
-
1269
- /** Types of roles in the system */
1270
- declare enum RoleType {
1271
- Administrative = 0,
1272
- Operational = 1,
1273
- ReadOnly = 2,
1274
- Compliance = 3,
1275
- Emergency = 4,
1276
- Custom = 5,
1277
- Service = 6,
1278
- Guest = 7
1279
- }
1280
-
1281
- /**
1282
- * This code was AUTOGENERATED using the Codama library.
1283
- * Please DO NOT EDIT THIS FILE, instead use visitors
1284
- * to add features, then rerun Codama to update it.
1285
- *
1286
- * @see https://github.com/codama-idl/codama
1287
- */
1288
-
1289
- /** Rule effects */
1290
- declare enum RuleEffect {
1291
- Allow = 0,
1292
- Deny = 1,
1293
- AuditOnly = 2,
1294
- RequireApproval = 3,
1295
- RequireMfa = 4,
1296
- RequireJustification = 5
1297
- }
1298
-
1299
- /**
1300
- * This code was AUTOGENERATED using the Codama library.
1301
- * Please DO NOT EDIT THIS FILE, instead use visitors
1302
- * to add features, then rerun Codama to update it.
1303
- *
1304
- * @see https://github.com/codama-idl/codama
1305
- */
1306
-
1307
- /** Scope boundaries definition */
1308
- type ScopeBoundaries = {
1309
- /** Included resources */
1310
- includedResources: Array<string>;
1311
- /** Excluded resources */
1312
- excludedResources: Array<string>;
1313
- /** Resource patterns (regex) */
1314
- resourcePatterns: Array<string>;
1315
- /** Hierarchical boundaries */
1316
- hierarchicalBoundaries: Array<HierarchicalBoundary>;
1317
- };
1318
-
1319
- /**
1320
- * This code was AUTOGENERATED using the Codama library.
1321
- * Please DO NOT EDIT THIS FILE, instead use visitors
1322
- * to add features, then rerun Codama to update it.
1323
- *
1324
- * @see https://github.com/codama-idl/codama
1325
- */
1326
-
1327
- /** Scope inheritance options */
1328
- declare enum ScopeInheritance {
1329
- None = 0,
1330
- Hierarchical = 1,
1331
- Delegated = 2,
1332
- Inherited = 3
1333
- }
1334
-
1335
- /**
1336
- * This code was AUTOGENERATED using the Codama library.
1337
- * Please DO NOT EDIT THIS FILE, instead use visitors
1338
- * to add features, then rerun Codama to update it.
1339
- *
1340
- * @see https://github.com/codama-idl/codama
1341
- */
1342
-
1343
- /** Types of permission scopes */
1344
- declare enum ScopeType {
1345
- Global = 0,
1346
- Organization = 1,
1347
- Department = 2,
1348
- Project = 3,
1349
- Resource = 4,
1350
- Individual = 5
1351
- }
1352
-
1353
- /**
1354
- * This code was AUTOGENERATED using the Codama library.
1355
- * Please DO NOT EDIT THIS FILE, instead use visitors
1356
- * to add features, then rerun Codama to update it.
1357
- *
1358
- * @see https://github.com/codama-idl/codama
1359
- */
1360
-
1361
- /** Types of security events */
1362
- declare enum SecurityEventType {
1363
- AccountLockout = 0,
1364
- PasswordChange = 1,
1365
- PrivilegeEscalation = 2,
1366
- SuspiciousActivity = 3,
1367
- PolicyViolation = 4,
1368
- AccessDenied = 5,
1369
- DataBreach = 6,
1370
- SystemCompromise = 7
1371
- }
1372
-
1373
- /**
1374
- * This code was AUTOGENERATED using the Codama library.
1375
- * Please DO NOT EDIT THIS FILE, instead use visitors
1376
- * to add features, then rerun Codama to update it.
1377
- *
1378
- * @see https://github.com/codama-idl/codama
1379
- */
1380
-
1381
- /** Comprehensive security policies configuration */
1382
- type SecurityPolicies = {
1383
- /** Authentication policies */
1384
- authentication: AuthenticationPolicies;
1385
- /** Authorization policies */
1386
- authorization: AuthorizationPolicies;
1387
- /** Password policies */
1388
- password: PasswordPolicies;
1389
- /** Session policies */
1390
- session: SessionPolicies;
1391
- /** Data protection policies */
1392
- dataProtection: DataProtectionPolicies;
1393
- /** Network security policies */
1394
- networkSecurity: NetworkSecurityPolicies;
1395
- /** Incident response policies */
1396
- incidentResponse: IncidentResponsePolicies;
1397
- /** Compliance policies */
1398
- compliance: CompliancePolicies;
1399
- };
1400
-
1401
- /**
1402
- * This code was AUTOGENERATED using the Codama library.
1403
- * Please DO NOT EDIT THIS FILE, instead use visitors
1404
- * to add features, then rerun Codama to update it.
1405
- *
1406
- * @see https://github.com/codama-idl/codama
1407
- */
1408
-
1409
- /** Session-based access constraints */
1410
- type SessionConstraints = {
1411
- /** Maximum session duration */
1412
- maxSessionDuration: bigint;
1413
- /** Idle timeout */
1414
- idleTimeout: bigint;
1415
- /** Re-authentication interval */
1416
- reauthInterval: bigint;
1417
- /** Multi-factor authentication required */
1418
- mfaRequired: boolean;
1419
- /** Device fingerprinting required */
1420
- deviceFingerprinting: boolean;
1421
- /** Session encryption required */
1422
- sessionEncryption: boolean;
1423
- };
1424
-
1425
- /**
1426
- * This code was AUTOGENERATED using the Codama library.
1427
- * Please DO NOT EDIT THIS FILE, instead use visitors
1428
- * to add features, then rerun Codama to update it.
1429
- *
1430
- * @see https://github.com/codama-idl/codama
1431
- */
1432
-
1433
- type SessionPolicies = {
1434
- maxSessionDuration: bigint;
1435
- idleTimeout: bigint;
1436
- concurrentSessions: number;
1437
- };
1438
-
1439
- /**
1440
- * This code was AUTOGENERATED using the Codama library.
1441
- * Please DO NOT EDIT THIS FILE, instead use visitors
1442
- * to add features, then rerun Codama to update it.
1443
- *
1444
- * @see https://github.com/codama-idl/codama
1445
- */
1446
-
1447
- /** Segregation of duties constraint */
1448
- type SodConstraint = {
1449
- /** Constraint name */
1450
- name: string;
1451
- /** Conflicting roles */
1452
- conflictingRoles: Array<string>;
1453
- /** Constraint type */
1454
- constraintType: SodConstraintType;
1455
- /** Enforcement level */
1456
- enforcementLevel: EnforcementLevel;
1457
- /** Exception procedures */
1458
- exceptionProcedures: Array<string>;
1459
- };
1460
-
1461
- /**
1462
- * This code was AUTOGENERATED using the Codama library.
1463
- * Please DO NOT EDIT THIS FILE, instead use visitors
1464
- * to add features, then rerun Codama to update it.
1465
- *
1466
- * @see https://github.com/codama-idl/codama
1467
- */
1468
-
1469
- /** Types of segregation of duties constraints */
1470
- declare enum SodConstraintType {
1471
- Static = 0,
1472
- Dynamic = 1,
1473
- Temporal = 2,
1474
- Contextual = 3
1475
- }
1476
-
1477
- /**
1478
- * This code was AUTOGENERATED using the Codama library.
1479
- * Please DO NOT EDIT THIS FILE, instead use visitors
1480
- * to add features, then rerun Codama to update it.
1481
- *
1482
- * @see https://github.com/codama-idl/codama
1483
- */
1484
-
1485
- /** Triggers for step-up authentication */
1486
- declare enum StepUpTrigger {
1487
- HighRiskAction = 0,
1488
- SensitiveData = 1,
1489
- LargeTransaction = 2,
1490
- NewDevice = 3,
1491
- UnusualLocation = 4,
1492
- TimeBasedRisk = 5,
1493
- BehaviorAnomaly = 6
1494
- }
1495
-
1496
- /**
1497
- * This code was AUTOGENERATED using the Codama library.
1498
- * Please DO NOT EDIT THIS FILE, instead use visitors
1499
- * to add features, then rerun Codama to update it.
1500
- *
1501
- * @see https://github.com/codama-idl/codama
1502
- */
1503
-
1504
- /** Time-based access constraints */
1505
- type TimeConstraints = {
1506
- /** Allowed hours (0-23) */
1507
- allowedHours: ReadonlyUint8Array;
1508
- /** Allowed days of week (1-7) */
1509
- allowedDays: ReadonlyUint8Array;
1510
- /** Timezone for time calculations */
1511
- timezone: string;
1512
- /** Maximum session duration (seconds) */
1513
- maxSessionDuration: Option<bigint>;
1514
- /** Role expiration timestamp */
1515
- expiresAt: Option<bigint>;
1516
- /** Periodic reactivation required */
1517
- reactivationPeriod: Option<bigint>;
1518
- };
1519
-
1520
- /**
1521
- * This code was AUTOGENERATED using the Codama library.
1522
- * Please DO NOT EDIT THIS FILE, instead use visitors
1523
- * to add features, then rerun Codama to update it.
1524
- *
1525
- * @see https://github.com/codama-idl/codama
1526
- */
1527
-
1528
- /** Time lock mechanism for delayed execution */
1529
- type TimeLock = {
1530
- /** Lock duration in seconds */
1531
- duration: bigint;
1532
- /** Lock start timestamp */
1533
- lockedAt: bigint;
1534
- /** Unlock timestamp */
1535
- unlocksAt: bigint;
1536
- /** Early unlock conditions */
1537
- earlyUnlockConditions: Array<ExecutionCondition>;
1538
- /** Lock type */
1539
- lockType: TimeLockType;
1540
- /** Can be cancelled before execution */
1541
- cancellable: boolean;
1542
- };
1543
-
1544
- /**
1545
- * This code was AUTOGENERATED using the Codama library.
1546
- * Please DO NOT EDIT THIS FILE, instead use visitors
1547
- * to add features, then rerun Codama to update it.
1548
- *
1549
- * @see https://github.com/codama-idl/codama
1550
- */
1551
-
1552
- /** Types of time locks */
1553
- declare enum TimeLockType {
1554
- Standard = 0,
1555
- Vesting = 1,
1556
- Emergency = 2,
1557
- Governance = 3
1558
- }
1559
-
1560
- /**
1561
- * This code was AUTOGENERATED using the Codama library.
1562
- * Please DO NOT EDIT THIS FILE, instead use visitors
1563
- * to add features, then rerun Codama to update it.
1564
- *
1565
- * @see https://github.com/codama-idl/codama
1566
- */
1567
-
1568
- /** Transaction priority levels */
1569
- declare enum TransactionPriority {
1570
- Low = 0,
1571
- Normal = 1,
1572
- High = 2,
1573
- Critical = 3,
1574
- Emergency = 4
1575
- }
1576
-
1577
- /**
1578
- * This code was AUTOGENERATED using the Codama library.
1579
- * Please DO NOT EDIT THIS FILE, instead use visitors
1580
- * to add features, then rerun Codama to update it.
1581
- *
1582
- * @see https://github.com/codama-idl/codama
1583
- */
1584
-
1585
- /** Transaction execution status */
1586
- declare enum TransactionStatus {
1587
- Pending = 0,
1588
- PartiallyApproved = 1,
1589
- FullyApproved = 2,
1590
- Executed = 3,
1591
- Cancelled = 4,
1592
- Expired = 5,
1593
- Failed = 6
1594
- }
1595
-
1596
- /**
1597
- * This code was AUTOGENERATED using the Codama library.
1598
- * Please DO NOT EDIT THIS FILE, instead use visitors
1599
- * to add features, then rerun Codama to update it.
1600
- *
1601
- * @see https://github.com/codama-idl/codama
1602
- */
1603
-
1604
- /** Methods to unlock accounts */
1605
- declare enum UnlockMethod {
1606
- TimeBasedAutoUnlock = 0,
1607
- AdminUnlock = 1,
1608
- SelfServiceUnlock = 2,
1609
- MultiFactorUnlock = 3,
1610
- SupervisorUnlock = 4
1611
- }
1612
-
1613
- /**
1614
- * This code was AUTOGENERATED using the Codama library.
1615
- * Please DO NOT EDIT THIS FILE, instead use visitors
1616
- * to add features, then rerun Codama to update it.
1617
- *
1618
- * @see https://github.com/codama-idl/codama
1619
- */
1620
-
1621
- /** Value types for constraint conditions */
1622
- declare enum ValueType {
1623
- String = 0,
1624
- Number = 1,
1625
- Boolean = 2,
1626
- Date = 3,
1627
- Time = 4,
1628
- Duration = 5,
1629
- List = 6,
1630
- Object = 7
1631
- }
1632
-
1633
- /**
1634
- * This code was AUTOGENERATED by scripts/generate-missing-types.ts
1635
- */
1636
-
1637
- type Action = {
1638
- id: string;
1639
- name: string;
1640
- description: string;
1641
- resource_type: string;
1642
- actions: Array<ActionType>;
1643
- scope: PermissionScope;
1644
- constraints: Array<ActionConstraint>;
1645
- metadata: PermissionMetadata;
1646
- };
1647
-
1648
- /**
1649
- * This code was AUTOGENERATED by scripts/generate-missing-types.ts
1650
- */
1651
-
1652
- type ResourceConstraints = {
1653
- allowed_resource_types: Array<string>;
1654
- blocked_resource_types: Array<string>;
1655
- access_limits: Array<readonly [string, bigint]>;
1656
- quotas: Array<readonly [string, ResourceQuota]>;
1657
- compartments: Array<string>;
1658
- };
1659
-
1660
- /**
1661
- * This code was AUTOGENERATED by scripts/generate-missing-types.ts
1662
- */
1663
-
1664
- type BiometricQuality = {
1665
- minimum_quality: number;
1666
- assessment_method: string;
1667
- multiple_samples: boolean;
1668
- quality_thresholds: Array<readonly [string, number]>;
1669
- };
1670
-
1671
- /**
1672
- * This code was AUTOGENERATED by scripts/generate-missing-types.ts
1673
- */
1674
-
1675
- declare enum ActionType {
1676
- Create = 0,
1677
- Read = 1,
1678
- Update = 2,
1679
- Delete = 3,
1680
- Execute = 4,
1681
- Approve = 5,
1682
- Reject = 6,
1683
- Transfer = 7,
1684
- Lock = 8,
1685
- Unlock = 9,
1686
- Freeze = 10,
1687
- Unfreeze = 11,
1688
- Audit = 12,
1689
- Monitor = 13,
1690
- Configure = 14,
1691
- Deploy = 15,
1692
- Custom = 16
1693
- }
1694
-
1695
- /**
1696
- * This code was AUTOGENERATED by scripts/generate-missing-types.ts
1697
- */
1698
-
1699
- type ActionConstraint = {};
1700
-
1701
- /**
1702
- * This code was AUTOGENERATED by scripts/generate-missing-types.ts
1703
- */
1704
-
1705
- type RuleCondition = {
1706
- condition_type: ConditionType;
1707
- subject_attributes: Array<readonly [string, string]>;
1708
- resource_attributes: Array<readonly [string, string]>;
1709
- action_attributes: Array<readonly [string, string]>;
1710
- environment_attributes: Array<readonly [string, string]>;
1711
- };
1712
-
1713
- /**
1714
- * This code was AUTOGENERATED by scripts/generate-missing-types.ts
1715
- */
1716
-
1717
- type ResourceQuota = {
1718
- max_usage: bigint;
1719
- time_period: bigint;
1720
- reset_behavior: QuotaResetBehavior;
1721
- warning_threshold: number;
1722
- };
1723
-
1724
- /**
1725
- * This code was AUTOGENERATED by scripts/generate-missing-types.ts
1726
- */
1727
-
1728
- declare enum QuotaResetBehavior {
1729
- Rolling = 0,
1730
- Fixed = 1,
1731
- Manual = 2,
1732
- OnDemand = 3
1733
- }
1734
-
1735
- /**
1736
- * This code was AUTOGENERATED using the Codama library.
1737
- * Please DO NOT EDIT THIS FILE, instead use visitors
1738
- * to add features, then rerun Codama to update it.
1739
- *
1740
- * @see https://github.com/codama-idl/codama
1741
- */
1742
-
1743
- type Multisig = {
1744
- discriminator: ReadonlyUint8Array;
1745
- /** Unique identifier */
1746
- multisigId: bigint;
1747
- /** Multisig type classification (Protocol, DAO, Dispute, etc.) */
1748
- multisigType: MultisigType;
1749
- /** Required number of signatures */
1750
- threshold: number;
1751
- /** List of authorized signers */
1752
- signers: Array<Address>;
1753
- /** Multisig owner (can modify signers) */
1754
- owner: Address;
1755
- /** Creation timestamp */
1756
- createdAt: bigint;
1757
- /** Last update timestamp */
1758
- updatedAt: bigint;
1759
- /** Current nonce (prevents replay attacks) */
1760
- nonce: bigint;
1761
- /** Pending transactions */
1762
- pendingTransactions: Array<PendingTransaction>;
1763
- /** Configuration settings */
1764
- config: MultisigConfig;
1765
- /** Emergency settings */
1766
- emergencyConfig: EmergencyConfig;
1767
- /** Type-specific configuration */
1768
- typeConfig: MultisigTypeConfig;
1769
- /** Reserved space for future extensions */
1770
- reserved: ReadonlyUint8Array;
1771
- };
1772
-
1773
- /**
1774
- * This code was AUTOGENERATED using the Codama library.
1775
- * Please DO NOT EDIT THIS FILE, instead use visitors
1776
- * to add features, then rerun Codama to update it.
1777
- *
1778
- * @see https://github.com/codama-idl/codama
1779
- */
1780
-
1781
- type RbacConfig = {
1782
- discriminator: ReadonlyUint8Array;
1783
- /** Authority for RBAC management */
1784
- authority: Address;
1785
- /** Creation timestamp */
1786
- createdAt: bigint;
1787
- /** Last update timestamp */
1788
- updatedAt: bigint;
1789
- /** Version for compatibility */
1790
- version: number;
1791
- /** Role definitions */
1792
- roles: Array<Role>;
1793
- /** Permission definitions */
1794
- permissions: Array<Permission>;
1795
- /** Access policies */
1796
- accessPolicies: Array<AccessPolicy>;
1797
- /** Security policies */
1798
- securityPolicies: SecurityPolicies;
1799
- /** Audit configuration */
1800
- auditConfig: AccessAuditConfig;
1801
- /** Emergency access procedures */
1802
- emergencyAccess: EmergencyAccessConfig;
1803
- /** Reserved space */
1804
- reserved: ReadonlyUint8Array;
1805
- };
1806
-
1807
- /**
1808
- * x402 Agent Discovery Client
1809
- *
1810
- * Enables search and discovery of x402-enabled AI agents based on
1811
- * capabilities, pricing, reputation, and accepted payment tokens.
1812
- *
1813
- * @module x402/AgentDiscoveryClient
1814
- */
1815
-
1816
- /**
1817
- * Agent search parameters
1818
- */
1819
- interface AgentSearchParams {
1820
- capability?: string;
1821
- x402_enabled?: boolean;
1822
- accepted_tokens?: string[];
1823
- min_reputation?: number;
1824
- max_price?: bigint;
1825
- framework_origin?: string;
1826
- is_verified?: boolean;
1827
- page?: number;
1828
- limit?: number;
1829
- sort_by?: 'reputation' | 'price' | 'total_jobs' | 'created_at';
1830
- sort_order?: 'asc' | 'desc';
1831
- query?: string;
1832
- force_refresh?: boolean;
1833
- }
1834
- /**
1835
- * Agent data structure
1836
- */
1837
- interface Agent {
1838
- address: Address;
1839
- owner: Address;
1840
- name: string;
1841
- description: string;
1842
- capabilities: string[];
1843
- x402_enabled: boolean;
1844
- x402_payment_address: Address;
1845
- x402_accepted_tokens: Address[];
1846
- x402_price_per_call: bigint;
1847
- x402_service_endpoint: string;
1848
- x402_total_payments: bigint;
1849
- x402_total_calls: bigint;
1850
- last_payment_timestamp: bigint;
1851
- reputation_score: number;
1852
- total_jobs: bigint;
1853
- successful_jobs: bigint;
1854
- total_earnings: bigint;
1855
- average_rating: number;
1856
- created_at: bigint;
1857
- metadata_uri: string;
1858
- framework_origin: string;
1859
- is_verified: boolean;
1860
- }
1861
- /**
1862
- * Agent pricing information
1863
- */
1864
- interface AgentPricing {
1865
- price_per_call: bigint;
1866
- accepted_tokens: Array<{
1867
- token: Address;
1868
- decimals: number;
1869
- symbol: string;
1870
- }>;
1871
- payment_address: Address;
1872
- service_endpoint: string;
1873
- }
1874
- /**
1875
- * Agent search response
1876
- */
1877
- interface AgentSearchResponse {
1878
- agents: Agent[];
1879
- pagination: {
1880
- page: number;
1881
- limit: number;
1882
- total: number;
1883
- totalPages: number;
1884
- };
1885
- filters: AgentSearchParams;
1886
- fromCache?: boolean;
1887
- }
1888
- /**
1889
- * Discovery client options
1890
- */
1891
- interface AgentDiscoveryOptions {
1892
- rpcEndpoint: string;
1893
- programId: Address;
1894
- commitment?: Commitment;
1895
- cacheEnabled?: boolean;
1896
- cacheTTL?: number;
1897
- useDatabaseCache?: boolean;
1898
- }
1899
- /**
1900
- * Agent Discovery Client
1901
- *
1902
- * Provides methods to search, filter, and discover x402-enabled agents
1903
- * on the GhostSpeak marketplace.
1904
- */
1905
- declare class AgentDiscoveryClient {
1906
- private rpc;
1907
- private programId;
1908
- private commitment;
1909
- private cache;
1910
- private cacheEnabled;
1911
- private cacheTTL;
1912
- private useDatabaseCache;
1913
- private dbCache;
1914
- constructor(options: AgentDiscoveryOptions);
1915
- /**
1916
- * Search for agents with filters
1917
- */
1918
- searchAgents(params?: AgentSearchParams): Promise<AgentSearchResponse>;
1919
- /**
1920
- * Get agent by address with database cache support
1921
- *
1922
- * Cache hierarchy:
1923
- * 1. Check Turso database cache (if enabled)
1924
- * 2. Fallback to RPC fetch
1925
- * 3. Cache result in database for future requests
1926
- */
1927
- getAgent(address: Address, forceRefresh?: boolean): Promise<Agent | null>;
1928
- /**
1929
- * Helper to cache agent in database
1930
- */
1931
- private cacheAgentInDatabase;
1932
- /**
1933
- * Transform cached database agent to Agent interface
1934
- */
1935
- private transformCachedAgent;
1936
- /**
1937
- * Get agent pricing information
1938
- */
1939
- getAgentPricing(address: Address): Promise<AgentPricing | null>;
1940
- /**
1941
- * Get recommended agents based on criteria
1942
- */
1943
- getRecommendedAgents(capability?: string, limit?: number): Promise<Agent[]>;
1944
- /**
1945
- * Get agents by capability
1946
- */
1947
- getAgentsByCapability(capability: string): Promise<Agent[]>;
1948
- /**
1949
- * Get agents accepting specific token
1950
- */
1951
- getAgentsByToken(tokenAddress: Address): Promise<Agent[]>;
1952
- /**
1953
- * Get agents within price range
1954
- */
1955
- getAgentsByPriceRange(maxPrice: bigint, capability?: string): Promise<Agent[]>;
1956
- /**
1957
- * Search agents by text query
1958
- */
1959
- searchByQuery(query: string): Promise<Agent[]>;
1960
- private fetchAgentsFromChain;
1961
- private parseAgentAccount;
1962
- private applyFilters;
1963
- private sortAgents;
1964
- private getTokenInfo;
1965
- private getCacheKey;
1966
- private getFromCache;
1967
- private setCache;
1968
- /**
1969
- * Clear all cached data
1970
- */
1971
- clearCache(): void;
1972
- /**
1973
- * Get cache statistics
1974
- */
1975
- getCacheStats(): {
1976
- size: number;
1977
- enabled: boolean;
1978
- ttl: number;
1979
- };
1980
- }
1981
- /**
1982
- * Create an Agent Discovery Client instance
1983
- */
1984
- declare function createAgentDiscoveryClient(options: AgentDiscoveryOptions): AgentDiscoveryClient;
1985
-
1986
- /**
1987
- * Discriminator Validation Utilities
1988
- *
1989
- * Handles discriminator validation and provides fallback mechanisms
1990
- * for accounts with mismatched discriminators
1991
- */
1992
-
1993
- interface DiscriminatorValidationResult {
1994
- isValid: boolean;
1995
- expectedLength: number;
1996
- actualLength: number;
1997
- canDecode: boolean;
1998
- needsMigration: boolean;
1999
- errorMessage?: string;
2000
- }
2001
- interface AccountInspectionResult {
2002
- address: string;
2003
- dataLength: number;
2004
- discriminator: Uint8Array | null;
2005
- discriminatorLength: number;
2006
- isAgentAccount: boolean;
2007
- needsMigration: boolean;
2008
- rawData: Uint8Array;
2009
- }
2010
- /**
2011
- * Validates account discriminator before attempting to decode
2012
- */
2013
- declare function validateAccountDiscriminator(accountData: Uint8Array, expectedDiscriminator: Uint8Array): DiscriminatorValidationResult;
2014
- /**
2015
- * Create user-friendly error message for discriminator issues
2016
- */
2017
- declare function createDiscriminatorErrorMessage(validation: DiscriminatorValidationResult, accountType: string, address: string): string;
2018
- /**
2019
- * Safe Agent account decoding with discriminator validation
2020
- * Returns a compatibility result with exists property
2021
- */
2022
- declare function safeDecodeAgent(encodedAccount: {
2023
- address: Address$1;
2024
- data: Uint8Array;
2025
- }): Promise<{
2026
- exists: boolean;
2027
- data?: unknown;
2028
- } | null>;
2029
- /**
2030
- * Inspects account data and extracts useful information about discriminator
2031
- */
2032
- declare function inspectAccountData(encodedAccount: EncodedAccount | MaybeEncodedAccount, address: string): AccountInspectionResult;
2033
-
2034
- /**
2035
- * Account Migration Utility
2036
- *
2037
- * Handles migration of old Agent accounts that were created with
2038
- * different discriminator formats to the current format.
2039
- */
2040
-
2041
- interface MigrationPlan {
2042
- address: string;
2043
- currentState: 'valid' | 'needs_migration' | 'invalid' | 'not_exists';
2044
- migrationType: 'none' | 'recreate' | 'data_conversion' | 'unsupported';
2045
- issues: string[];
2046
- recommendations: string[];
2047
- canAutoMigrate: boolean;
2048
- }
2049
- interface MigrationResult {
2050
- success: boolean;
2051
- address: string;
2052
- action: 'skipped' | 'migrated' | 'failed';
2053
- error?: string;
2054
- newAccountData?: Uint8Array;
2055
- }
2056
- interface LegacyAgentData {
2057
- discriminator: Uint8Array;
2058
- owner?: string;
2059
- name?: string;
2060
- }
2061
- /**
2062
- * Analyzes an account and creates a migration plan
2063
- */
2064
- declare function createMigrationPlan(encodedAccount: EncodedAccount | MaybeEncodedAccount, address: string): Promise<MigrationPlan>;
2065
- /**
2066
- * Attempts to extract meaningful data from a legacy account
2067
- */
2068
- declare function extractLegacyData(encodedAccount: EncodedAccount | MaybeEncodedAccount): LegacyAgentData | null;
2069
- /**
2070
- * Creates a detailed migration report for multiple accounts
2071
- */
2072
- declare function createMigrationReport(accounts: {
2073
- address: string;
2074
- encodedAccount: EncodedAccount | MaybeEncodedAccount;
2075
- }[]): Promise<{
2076
- summary: {
2077
- total: number;
2078
- valid: number;
2079
- needsMigration: number;
2080
- invalid: number;
2081
- canAutoMigrate: number;
2082
- };
2083
- plans: MigrationPlan[];
2084
- recommendations: string[];
2085
- }>;
2086
- /**
2087
- * Simulates migration without actually performing it
2088
- */
2089
- declare function simulateMigration(encodedAccount: EncodedAccount | MaybeEncodedAccount, address: string): Promise<{
2090
- plan: MigrationPlan;
2091
- simulation: {
2092
- wouldSucceed: boolean;
2093
- estimatedSteps: string[];
2094
- warnings: string[];
2095
- requiredActions: string[];
2096
- };
2097
- }>;
2098
- /**
2099
- * Provides user-friendly migration instructions
2100
- */
2101
- declare function getMigrationInstructions(plan: MigrationPlan): string[];
2102
-
2103
- /**
2104
- * Account Diagnostics Utility
2105
- *
2106
- * Comprehensive diagnostic tools for inspecting and debugging
2107
- * account discriminator issues and data format problems.
2108
- */
2109
-
2110
- interface DiagnosticReport {
2111
- address: string;
2112
- timestamp: string;
2113
- accountExists: boolean;
2114
- discriminatorValidation: ReturnType<typeof validateAccountDiscriminator>;
2115
- inspection: AccountInspectionResult;
2116
- migrationPlan: Awaited<ReturnType<typeof createMigrationPlan>>;
2117
- migrationSimulation: Awaited<ReturnType<typeof simulateMigration>>;
2118
- recommendations: string[];
2119
- debugInfo: {
2120
- expectedDiscriminator: number[];
2121
- actualDiscriminator: number[] | null;
2122
- dataPreview: number[];
2123
- programId?: string;
2124
- };
2125
- }
2126
- interface BatchDiagnosticReport {
2127
- summary: {
2128
- total: number;
2129
- valid: number;
2130
- invalid: number;
2131
- needsMigration: number;
2132
- notExists: number;
2133
- };
2134
- reports: DiagnosticReport[];
2135
- globalRecommendations: string[];
2136
- timestamp: string;
2137
- }
2138
- /**
2139
- * Runs comprehensive diagnostics on a single account
2140
- */
2141
- declare function runAccountDiagnostics(encodedAccount: EncodedAccount | MaybeEncodedAccount, address: string): Promise<DiagnosticReport>;
2142
- /**
2143
- * Runs diagnostics on multiple accounts
2144
- */
2145
- declare function runBatchDiagnostics(accounts: {
2146
- address: string;
2147
- encodedAccount: EncodedAccount | MaybeEncodedAccount;
2148
- }[]): Promise<BatchDiagnosticReport>;
2149
- /**
2150
- * Fetches and diagnoses an account directly from the blockchain
2151
- */
2152
- declare function diagnoseAccountFromChain(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address, options?: {
2153
- logToConsole?: boolean;
2154
- }): Promise<DiagnosticReport>;
2155
- /**
2156
- * Fetches and diagnoses multiple accounts from the blockchain
2157
- */
2158
- declare function diagnoseBatchFromChain(rpc: Parameters<typeof fetchEncodedAccount>[0], addresses: Address[], options?: {
2159
- logToConsole?: boolean;
2160
- maxConcurrent?: number;
2161
- }): Promise<BatchDiagnosticReport>;
2162
- /**
2163
- * Exports a diagnostic report as JSON
2164
- */
2165
- declare function exportDiagnosticReport(report: DiagnosticReport | BatchDiagnosticReport, filename?: string): string;
2166
-
2167
- type accountDiagnostics_BatchDiagnosticReport = BatchDiagnosticReport;
2168
- type accountDiagnostics_DiagnosticReport = DiagnosticReport;
2169
- declare const accountDiagnostics_diagnoseAccountFromChain: typeof diagnoseAccountFromChain;
2170
- declare const accountDiagnostics_diagnoseBatchFromChain: typeof diagnoseBatchFromChain;
2171
- declare const accountDiagnostics_exportDiagnosticReport: typeof exportDiagnosticReport;
2172
- declare const accountDiagnostics_runAccountDiagnostics: typeof runAccountDiagnostics;
2173
- declare const accountDiagnostics_runBatchDiagnostics: typeof runBatchDiagnostics;
2174
- declare namespace accountDiagnostics {
2175
- export { type accountDiagnostics_BatchDiagnosticReport as BatchDiagnosticReport, type accountDiagnostics_DiagnosticReport as DiagnosticReport, accountDiagnostics_diagnoseAccountFromChain as diagnoseAccountFromChain, accountDiagnostics_diagnoseBatchFromChain as diagnoseBatchFromChain, accountDiagnostics_exportDiagnosticReport as exportDiagnosticReport, accountDiagnostics_runAccountDiagnostics as runAccountDiagnostics, accountDiagnostics_runBatchDiagnostics as runBatchDiagnostics };
2176
- }
2177
-
2178
- /**
2179
- * Enhanced Client Error Utilities
2180
- *
2181
- * Provides wrapper functions for SDK operations that automatically enhance
2182
- * error messages with detailed instruction account information.
2183
- */
2184
-
2185
- /**
2186
- * Enhanced error class for SDK operations
2187
- */
2188
- declare class GhostSpeakSDKError extends Error {
2189
- readonly originalError: Error;
2190
- readonly operation: string;
2191
- readonly instructionName?: string;
2192
- constructor(operation: string, originalError: Error, instructionName?: string);
2193
- }
2194
- /**
2195
- * Type for account context
2196
- */
2197
- type AccountContext = Address$1 | {
2198
- address: Address$1;
2199
- name?: string;
2200
- };
2201
- /**
2202
- * Wrapper for async operations that enhances errors with instruction context
2203
- */
2204
- declare function withEnhancedErrors<T>(operation: string, instructionName: string | undefined, fn: () => Promise<T>, debugAccounts?: AccountContext[]): Promise<T>;
2205
- /**
2206
- * Wrapper for synchronous operations that enhances errors with instruction context
2207
- */
2208
- declare function withEnhancedErrorsSync<T>(operation: string, instructionName: string | undefined, fn: () => T, debugAccounts?: AccountContext[]): T;
2209
- /**
2210
- * Parse and enhance transaction errors with instruction context
2211
- */
2212
- declare function enhanceTransactionError(error: Error, instructionName?: string, accounts?: AccountContext[]): Error;
2213
- /**
2214
- * Helper to log detailed error information for debugging
2215
- */
2216
- declare function logEnhancedError(error: Error, context?: {
2217
- operation?: string;
2218
- instructionName?: string;
2219
- accounts?: AccountContext[];
2220
- params?: Record<string, unknown>;
2221
- }): void;
2222
- /**
2223
- * Error context for operations
2224
- */
2225
- interface ErrorContext {
2226
- operation: string;
2227
- instructionName?: string;
2228
- accounts?: AccountContext[];
2229
- params?: Record<string, unknown>;
2230
- }
2231
- /**
2232
- * Create a detailed error context for operations
2233
- */
2234
- declare function createErrorContext(operation: string, instructionName?: string, accounts?: AccountContext[], params?: Record<string, unknown>): ErrorContext;
2235
- /**
2236
- * Validate common preconditions and throw enhanced errors
2237
- */
2238
- declare function validatePreconditions(checks: {
2239
- condition: boolean;
2240
- message: string;
2241
- instructionName?: string;
2242
- }[]): void;
2243
- /**
2244
- * Helper to extract instruction name from operation context
2245
- */
2246
- declare function extractInstructionName(operation: string): string | undefined;
2247
-
2248
- /**
2249
- * Token Utilities for SPL Token and Token 2022 (Token Extensions)
2250
- *
2251
- * Provides comprehensive token handling utilities including:
2252
- * - Associated Token Account (ATA) derivation for both SPL Token and Token 2022
2253
- * - Token 2022 specific features (transfer fees, confidential transfers, etc.)
2254
- * - Token program detection and validation
2255
- * - Account creation and management utilities
2256
- *
2257
- * Based on the latest SPL Token 2022 specification and @solana/kit v2.3.0
2258
- */
2259
-
2260
- /**
2261
- * Token program variants supported by GhostSpeak
2262
- */
2263
- declare enum TokenProgram {
2264
- /** Original SPL Token Program */
2265
- SPL_TOKEN = "spl-token",
2266
- /** SPL Token 2022 (Token Extensions) Program */
2267
- TOKEN_2022 = "token-2022"
2268
- }
2269
- /**
2270
- * Associated Token Account information
2271
- */
2272
- interface AssociatedTokenAccount {
2273
- /** The derived ATA address */
2274
- address: Address$1;
2275
- /** The wallet/owner address */
2276
- owner: Address$1;
2277
- /** The token mint address */
2278
- mint: Address$1;
2279
- /** The token program used (SPL Token or Token 2022) */
2280
- tokenProgram: Address$1;
2281
- /** Whether this is a Token 2022 ATA */
2282
- isToken2022: boolean;
2283
- }
2284
- /**
2285
- * Token 2022 Extension Types
2286
- * Based on the latest Token Extensions specification
2287
- */
2288
- declare enum TokenExtension {
2289
- /** Uninitialized account */
2290
- UNINITIALIZED = 0,
2291
- /** Transfer fee extension */
2292
- TRANSFER_FEE_CONFIG = 1,
2293
- /** Transfer fee amount */
2294
- TRANSFER_FEE_AMOUNT = 2,
2295
- /** Mint close authority */
2296
- MINT_CLOSE_AUTHORITY = 3,
2297
- /** Confidential transfer mint */
2298
- CONFIDENTIAL_TRANSFER_MINT = 4,
2299
- /** Confidential transfer account */
2300
- CONFIDENTIAL_TRANSFER_ACCOUNT = 5,
2301
- /** Default account state */
2302
- DEFAULT_ACCOUNT_STATE = 6,
2303
- /** Immutable owner */
2304
- IMMUTABLE_OWNER = 7,
2305
- /** Memo transfer */
2306
- MEMO_TRANSFER = 8,
2307
- /** Non-transferable */
2308
- NON_TRANSFERABLE = 9,
2309
- /** Interest bearing mint */
2310
- INTEREST_BEARING_MINT = 10,
2311
- /** CPI guard */
2312
- CPI_GUARD = 11,
2313
- /** Permanent delegate */
2314
- PERMANENT_DELEGATE = 12,
2315
- /** Non-transferable account */
2316
- NON_TRANSFERABLE_ACCOUNT = 13,
2317
- /** Transfer hook */
2318
- TRANSFER_HOOK = 14,
2319
- /** Transfer hook account */
2320
- TRANSFER_HOOK_ACCOUNT = 15,
2321
- /** Metadata pointer */
2322
- METADATA_POINTER = 16,
2323
- /** Token metadata */
2324
- TOKEN_METADATA = 17,
2325
- /** Group pointer */
2326
- GROUP_POINTER = 18,
2327
- /** Token group */
2328
- TOKEN_GROUP = 19,
2329
- /** Group member pointer */
2330
- GROUP_MEMBER_POINTER = 20,
2331
- /** Token group member */
2332
- TOKEN_GROUP_MEMBER = 21
2333
- }
2334
- /**
2335
- * Transfer fee configuration for Token 2022
2336
- */
2337
- interface TransferFeeConfig {
2338
- /** Transfer fee basis points (0-10000, where 10000 = 100%) */
2339
- transferFeeBasisPoints: number;
2340
- /** Maximum transfer fee in token base units */
2341
- maximumFee: bigint;
2342
- /** Authority that can modify transfer fee config */
2343
- transferFeeConfigAuthority: Address$1 | null;
2344
- /** Authority that can withdraw collected fees */
2345
- withdrawWithheldAuthority: Address$1 | null;
2346
- /** Amount of fees currently withheld */
2347
- withheldAmount: bigint;
2348
- /** Older transfer fee configuration */
2349
- olderTransferFee: {
2350
- epoch: bigint;
2351
- transferFeeBasisPoints: number;
2352
- maximumFee: bigint;
2353
- };
2354
- /** Newer transfer fee configuration */
2355
- newerTransferFee: {
2356
- epoch: bigint;
2357
- transferFeeBasisPoints: number;
2358
- maximumFee: bigint;
2359
- };
2360
- }
2361
- /**
2362
- * Confidential transfer configuration for Token 2022
2363
- */
2364
- interface ConfidentialTransferConfig {
2365
- /** Authority that can configure confidential transfers */
2366
- authority: Address$1 | null;
2367
- /** Automatically approve new accounts for confidential transfers */
2368
- autoApproveNewAccounts: boolean;
2369
- /** Public key for auditing confidential transfers */
2370
- auditorElgamalPubkey: Uint8Array | null;
2371
- }
2372
- /**
2373
- * Interest-bearing token configuration for Token 2022
2374
- */
2375
- interface InterestBearingConfig {
2376
- /** Authority that can update the interest rate */
2377
- rateAuthority: Address$1 | null;
2378
- /** Current interest rate (basis points per year) */
2379
- currentRate: number;
2380
- /** Timestamp when interest bearing was initialized */
2381
- initializationTimestamp: bigint;
2382
- /** Timestamp of last rate update */
2383
- lastUpdateTimestamp: bigint;
2384
- /** Pre-computed interest rate */
2385
- preUpdateAverageRate: number;
2386
- }
2387
- /**
2388
- * Derive Associated Token Account address for any token program
2389
- *
2390
- * This is the core ATA derivation function that works with both
2391
- * SPL Token and Token 2022 programs. The derivation follows the
2392
- * standard pattern: ['owner', 'token_program', 'mint']
2393
- *
2394
- * @param owner - The wallet/owner address
2395
- * @param mint - The token mint address
2396
- * @param tokenProgram - The token program address (SPL Token or Token 2022)
2397
- * @returns Promise<Address> - The derived ATA address
2398
- */
2399
- declare function deriveAssociatedTokenAddress(owner: Address$1, mint: Address$1, tokenProgram?: Address$1): Promise<Address$1>;
2400
- /**
2401
- * Derive Associated Token Account for SPL Token (legacy)
2402
- *
2403
- * @param owner - The wallet/owner address
2404
- * @param mint - The token mint address
2405
- * @returns Promise<Address> - The derived ATA address
2406
- */
2407
- declare function deriveSplTokenAssociatedTokenAddress(owner: Address$1, mint: Address$1): Promise<Address$1>;
2408
- /**
2409
- * Derive Associated Token Account for Token 2022
2410
- *
2411
- * @param owner - The wallet/owner address
2412
- * @param mint - The token mint address
2413
- * @returns Promise<Address> - The derived ATA address
2414
- */
2415
- declare function deriveToken2022AssociatedTokenAddress(owner: Address$1, mint: Address$1): Promise<Address$1>;
2416
- /**
2417
- * Get complete ATA information including program detection
2418
- *
2419
- * @param owner - The wallet/owner address
2420
- * @param mint - The token mint address
2421
- * @param tokenProgram - Optional: specify token program, auto-detect if not provided
2422
- * @returns Promise<AssociatedTokenAccount> - Complete ATA information
2423
- */
2424
- declare function getAssociatedTokenAccount(owner: Address$1, mint: Address$1, tokenProgram?: Address$1): Promise<AssociatedTokenAccount>;
2425
- /**
2426
- * Detect which token program owns a given mint
2427
- * Note: This requires RPC calls to fetch mint account data
2428
- *
2429
- * @param mint - The token mint address
2430
- * @returns Promise<Address> - The token program address
2431
- */
2432
- declare function detectTokenProgram(mint: Address$1, rpcEndpoint?: string): Promise<Address$1>;
2433
- /**
2434
- * Check if a mint is a Token 2022 mint
2435
- *
2436
- * @param mint - The token mint address
2437
- * @returns Promise<boolean> - True if Token 2022, false if SPL Token
2438
- */
2439
- declare function isToken2022Mint(mint: Address$1): Promise<boolean>;
2440
- /**
2441
- * Get the appropriate token program for a given mint
2442
- *
2443
- * @param mint - The token mint address
2444
- * @returns Promise<TokenProgram> - The token program enum
2445
- */
2446
- declare function getTokenProgramType(mint: Address$1): Promise<TokenProgram>;
2447
- /**
2448
- * Check if a mint has the transfer fee extension
2449
- *
2450
- * @param mint - The token mint address
2451
- * @param rpcEndpoint - Optional RPC endpoint
2452
- * @returns Promise<boolean> - True if mint has transfer fee extension
2453
- */
2454
- declare function hasTransferFeeExtension(mint: Address$1, rpcEndpoint?: string): Promise<boolean>;
2455
- /**
2456
- * Check if a mint has the confidential transfer extension
2457
- *
2458
- * @param mint - The token mint address
2459
- * @param rpcEndpoint - Optional RPC endpoint
2460
- * @returns Promise<boolean> - True if mint has confidential transfer extension
2461
- */
2462
- declare function hasConfidentialTransferExtension(mint: Address$1, rpcEndpoint?: string): Promise<boolean>;
2463
- /**
2464
- * Check if a mint has the interest-bearing extension
2465
- *
2466
- * @param mint - The token mint address
2467
- * @param rpcEndpoint - Optional RPC endpoint
2468
- * @returns Promise<boolean> - True if mint has interest-bearing extension
2469
- */
2470
- declare function hasInterestBearingExtension(mint: Address$1, rpcEndpoint?: string): Promise<boolean>;
2471
- /**
2472
- * Get transfer fee configuration for a Token 2022 mint
2473
- *
2474
- * @param mint - The Token 2022 mint address
2475
- * @returns Promise<TransferFeeConfig | null> - Transfer fee config or null if not configured
2476
- */
2477
- declare function getTransferFeeConfig(mint: Address$1, rpcEndpoint?: string): Promise<TransferFeeConfig | null>;
2478
- /**
2479
- * Get confidential transfer configuration for a Token 2022 mint
2480
- *
2481
- * @param mint - The Token 2022 mint address
2482
- * @returns Promise<ConfidentialTransferConfig | null> - Confidential transfer config or null
2483
- */
2484
- declare function getConfidentialTransferConfig(mint: Address$1, rpcEndpoint?: string): Promise<ConfidentialTransferConfig | null>;
2485
- /**
2486
- * Get interest-bearing configuration for a Token 2022 mint
2487
- *
2488
- * @param mint - The Token 2022 mint address
2489
- * @returns Promise<InterestBearingConfig | null> - Interest-bearing config or null
2490
- */
2491
- declare function getInterestBearingConfig(mint: Address$1, rpcEndpoint?: string): Promise<InterestBearingConfig | null>;
2492
- /**
2493
- * Get all possible ATA addresses for a wallet/mint pair
2494
- * Returns both SPL Token and Token 2022 ATAs
2495
- *
2496
- * @param owner - The wallet/owner address
2497
- * @param mint - The token mint address
2498
- * @returns Promise<{ splToken: Address, token2022: Address }> - Both ATA addresses
2499
- */
2500
- declare function getAllAssociatedTokenAddresses(owner: Address$1, mint: Address$1): Promise<{
2501
- splToken: Address$1;
2502
- token2022: Address$1;
2503
- }>;
2504
- /**
2505
- * Validate if an address could be a valid ATA
2506
- *
2507
- * @param address - The address to validate
2508
- * @param owner - The expected owner
2509
- * @param mint - The expected mint
2510
- * @returns Promise<{ isValid: boolean, program?: Address }> - Validation result
2511
- */
2512
- declare function validateAssociatedTokenAddress(address: Address$1, owner: Address$1, mint: Address$1): Promise<{
2513
- isValid: boolean;
2514
- program?: Address$1;
2515
- }>;
2516
- /**
2517
- * Convert TokenProgram enum to program address
2518
- *
2519
- * @param program - The token program enum
2520
- * @returns Address - The program address
2521
- */
2522
- declare function getTokenProgramAddress(program: TokenProgram): Address$1;
2523
- /**
2524
- * Convert program address to TokenProgram enum
2525
- *
2526
- * @param address - The program address
2527
- * @returns TokenProgram - The token program enum
2528
- */
2529
- declare function getTokenProgramFromAddress(address: Address$1): TokenProgram;
2530
- /**
2531
- * Format token amount with proper decimals
2532
- *
2533
- * @param amount - Raw token amount (in base units)
2534
- * @param decimals - Number of decimal places for the token
2535
- * @returns string - Formatted amount
2536
- */
2537
- declare function formatTokenAmount(amount: bigint, decimals: number): string;
2538
- /**
2539
- * Parse formatted token amount to raw base units
2540
- *
2541
- * @param formatted - Formatted token amount string
2542
- * @param decimals - Number of decimal places for the token
2543
- * @returns bigint - Raw token amount
2544
- */
2545
- declare function parseTokenAmount(formatted: string, decimals: number): bigint;
2546
-
2547
- /**
2548
- * ElGamal Encryption Implementation
2549
- *
2550
- * Implements twisted ElGamal encryption over curve25519 for
2551
- * client-side privacy features.
2552
- *
2553
- * Key features:
2554
- * - Twisted ElGamal with Pedersen commitments
2555
- * - Homomorphic addition/subtraction of ciphertexts
2556
- * - Efficient decryption for small values (up to 32 bits)
2557
- */
2558
-
2559
- /**
2560
- * ElGamal public key (32 bytes)
2561
- */
2562
- type ElGamalPubkey = Uint8Array;
2563
- /**
2564
- * ElGamal secret key (32 bytes)
2565
- */
2566
- type ElGamalSecretKey = Uint8Array;
2567
- /**
2568
- * ElGamal keypair
2569
- */
2570
- interface ElGamalKeypair {
2571
- publicKey: ElGamalPubkey;
2572
- secretKey: ElGamalSecretKey;
2573
- }
2574
- /**
2575
- * Pedersen commitment (curve point)
2576
- */
2577
- interface PedersenCommitment {
2578
- /** Commitment to the value */
2579
- commitment: Uint8Array;
2580
- }
2581
- /**
2582
- * Decrypt handle for ElGamal ciphertext
2583
- */
2584
- interface DecryptHandle {
2585
- /** Encrypted randomness */
2586
- handle: Uint8Array;
2587
- }
2588
- /**
2589
- * Twisted ElGamal ciphertext
2590
- * Split into Pedersen commitment and decrypt handle
2591
- */
2592
- interface ElGamalCiphertext {
2593
- /** Pedersen commitment (independent of pubkey) */
2594
- commitment: PedersenCommitment;
2595
- /** Decrypt handle (encodes randomness) */
2596
- handle: DecryptHandle;
2597
- }
2598
- /**
2599
- * Generate a new ElGamal keypair
2600
- *
2601
- * @param seed - Optional seed for deterministic generation
2602
- * @returns ElGamalKeypair
2603
- */
2604
- declare function generateElGamalKeypair(seed?: Uint8Array): ElGamalKeypair;
2605
-
2606
- /**
2607
- * Token 2022 Extensions Implementation
2608
- *
2609
- * Implements advanced Token 2022 features including:
2610
- * - Transfer fees with withdrawal mechanisms
2611
- * - Confidential transfers using ElGamal encryption
2612
- * - Interest-bearing tokens with rate calculations
2613
- * - Transfer hooks and metadata pointers
2614
- * - Account state management and CPI guards
2615
- *
2616
- * Based on the SPL Token 2022 specification and Solana Web3.js v2.3.0
2617
- */
2618
-
2619
- /**
2620
- * Transfer fee calculation result
2621
- */
2622
- interface TransferFeeCalculation {
2623
- /** Original transfer amount */
2624
- transferAmount: bigint;
2625
- /** Calculated fee amount */
2626
- feeAmount: bigint;
2627
- /** Amount after fee deduction */
2628
- netAmount: bigint;
2629
- /** Fee percentage (basis points) */
2630
- feeBasisPoints: number;
2631
- /** Whether fee was capped at maximum */
2632
- wasFeeCapped: boolean;
2633
- }
2634
- /**
2635
- * Calculate transfer fee for a Token 2022 transfer
2636
- *
2637
- * @param transferAmount - Amount being transferred (in token base units)
2638
- * @param feeConfig - Transfer fee configuration
2639
- * @returns TransferFeeCalculation - Detailed fee calculation
2640
- */
2641
- declare function calculateTransferFee(transferAmount: bigint, feeConfig: TransferFeeConfig): TransferFeeCalculation;
2642
- /**
2643
- * Calculate the total amount needed for a desired net transfer
2644
- * (reverse calculation when you want to send a specific net amount)
2645
- *
2646
- * @param desiredNetAmount - The amount you want the recipient to receive
2647
- * @param feeConfig - Transfer fee configuration
2648
- * @returns TransferFeeCalculation - Required total amount and fee breakdown
2649
- */
2650
- declare function calculateRequiredAmountForNetTransfer(desiredNetAmount: bigint, feeConfig: TransferFeeConfig): TransferFeeCalculation;
2651
- /**
2652
- * Estimate accumulated fees for multiple transfers
2653
- *
2654
- * @param transfers - Array of transfer amounts
2655
- * @param feeConfig - Transfer fee configuration
2656
- * @returns { totalFees: bigint, feeBreakdown: TransferFeeCalculation[] }
2657
- */
2658
- declare function estimateAccumulatedFees(transfers: bigint[], feeConfig: TransferFeeConfig): {
2659
- totalFees: bigint;
2660
- feeBreakdown: TransferFeeCalculation[];
2661
- };
2662
- /**
2663
- * Confidential transfer proof data
2664
- * Note: This is a simplified structure - actual implementation would include
2665
- * complex zero-knowledge proof data structures
2666
- */
2667
- interface ConfidentialTransferProof {
2668
- /** Encrypted transfer amount (ElGamal ciphertext) */
2669
- encryptedAmount: Uint8Array;
2670
- /** Range proof for the transfer amount */
2671
- rangeProof: Uint8Array;
2672
- /** Validity proof for the transfer */
2673
- validityProof: Uint8Array;
2674
- /** Auditor proof (if auditing is enabled) */
2675
- auditorProof?: Uint8Array;
2676
- }
2677
- /**
2678
- * Confidential account state
2679
- */
2680
- interface ConfidentialAccountState {
2681
- /** Whether the account is approved for confidential transfers */
2682
- approved: boolean;
2683
- /** Encrypted balance (ElGamal ciphertext) */
2684
- encryptedBalance: Uint8Array;
2685
- /** Pending balance encryption from incoming transfers */
2686
- pendingBalanceCredits: Uint8Array;
2687
- /** Number of pending credits */
2688
- pendingBalanceCreditsCounter: number;
2689
- /** Expected pending balance decryption */
2690
- expectedPendingBalanceCredits: bigint;
2691
- /** Actual pending balance decryption */
2692
- actualPendingBalanceCredits: bigint;
2693
- }
2694
- /**
2695
- * Generate confidential transfer proof
2696
- *
2697
- * Uses twisted ElGamal encryption to create confidential transfer proofs
2698
- * for the Token 2022 confidential transfer extension
2699
- *
2700
- * @param amount - Transfer amount (in token base units)
2701
- * @param senderKeypair - Sender's ElGamal keypair
2702
- * @param recipientPubkey - Recipient's ElGamal public key
2703
- * @param auditorPubkey - Optional auditor public key
2704
- * @returns Promise<ConfidentialTransferProof>
2705
- */
2706
- declare function generateConfidentialTransferProof(amount: bigint, senderKeypair: ElGamalKeypair, recipientPubkey: Uint8Array, auditorPubkey?: Uint8Array): Promise<ConfidentialTransferProof>;
2707
- /**
2708
- * Verify confidential transfer proof
2709
- *
2710
- * Note: In practice, proof verification happens on-chain via the
2711
- * confidential transfer extension. This is a client-side validation helper.
2712
- *
2713
- * @param proof - The proof to verify
2714
- * @param publicInputs - Public inputs for verification
2715
- * @returns Promise<boolean> - True if proof is valid
2716
- */
2717
- declare function verifyConfidentialTransferProof(proof: ConfidentialTransferProof, publicInputs: {
2718
- senderPubkey: Uint8Array;
2719
- recipientPubkey: Uint8Array;
2720
- auditorPubkey?: Uint8Array;
2721
- }): Promise<boolean>;
2722
- /**
2723
- * Interest calculation result
2724
- */
2725
- interface InterestCalculation {
2726
- /** Principal amount */
2727
- principal: bigint;
2728
- /** Interest rate (basis points per year) */
2729
- annualRateBasisPoints: number;
2730
- /** Time period for calculation (seconds) */
2731
- timePeriodSeconds: bigint;
2732
- /** Calculated interest amount */
2733
- interestAmount: bigint;
2734
- /** New total balance */
2735
- newAmount: bigint;
2736
- /** Effective annual rate */
2737
- effectiveAnnualRate: number;
2738
- }
2739
- /**
2740
- * Calculate interest for an interest-bearing token
2741
- *
2742
- * @param principal - Current token balance
2743
- * @param config - Interest-bearing configuration
2744
- * @param currentTimestamp - Current timestamp (seconds)
2745
- * @returns InterestCalculation - Detailed interest calculation
2746
- */
2747
- declare function calculateInterest(principal: bigint, config: InterestBearingConfig, currentTimestamp: bigint): InterestCalculation;
2748
- /**
2749
- * Calculate compound interest with custom compounding periods
2750
- *
2751
- * @param principal - Initial amount
2752
- * @param annualRateBasisPoints - Annual interest rate (basis points)
2753
- * @param compoundingPeriodsPerYear - Number of compounding periods per year (e.g., 12 for monthly)
2754
- * @param years - Time period in years (can be fractional)
2755
- * @returns InterestCalculation - Detailed compound interest calculation
2756
- */
2757
- declare function calculateCompoundInterest(principal: bigint, annualRateBasisPoints: number, compoundingPeriodsPerYear: number, years: number): InterestCalculation;
2758
- /**
2759
- * Transfer hook instruction data
2760
- */
2761
- interface TransferHookInstruction {
2762
- /** Program ID of the hook */
2763
- programId: Address$1;
2764
- /** Instruction data to pass to the hook */
2765
- instructionData: Uint8Array;
2766
- /** Additional accounts required by the hook */
2767
- additionalAccounts: Address$1[];
2768
- }
2769
- /**
2770
- * Transfer hook context passed to hook programs
2771
- */
2772
- interface TransferHookContext {
2773
- /** Source account */
2774
- source: Address$1;
2775
- /** Destination account */
2776
- destination: Address$1;
2777
- /** Authority performing the transfer */
2778
- authority: Address$1;
2779
- /** Transfer amount */
2780
- amount: bigint;
2781
- /** Token mint */
2782
- mint: Address$1;
2783
- /** Additional context data */
2784
- contextData: Uint8Array;
2785
- }
2786
- /**
2787
- * Validate transfer hook instruction format
2788
- *
2789
- * @param instruction - The hook instruction to validate
2790
- * @returns boolean - True if instruction format is valid
2791
- */
2792
- declare function validateTransferHookInstruction(instruction: TransferHookInstruction): boolean;
2793
- /**
2794
- * Create transfer hook instruction data
2795
- *
2796
- * @param hookProgramId - Program ID of the transfer hook
2797
- * @param context - Transfer context data
2798
- * @returns TransferHookInstruction - Formatted instruction
2799
- */
2800
- declare function createTransferHookInstruction(hookProgramId: Address$1, context: TransferHookContext): TransferHookInstruction;
2801
- /**
2802
- * Token metadata structure (simplified)
2803
- */
2804
- interface TokenMetadata {
2805
- /** Token name */
2806
- name: string;
2807
- /** Token symbol */
2808
- symbol: string;
2809
- /** Token description */
2810
- description: string;
2811
- /** Token image URI */
2812
- image?: string;
2813
- /** External URI for additional metadata */
2814
- externalUri?: string;
2815
- /** Additional attributes */
2816
- attributes?: {
2817
- trait_type: string;
2818
- value: string;
2819
- }[];
2820
- }
2821
- /**
2822
- * Metadata pointer configuration
2823
- */
2824
- interface MetadataPointerConfig {
2825
- /** Authority that can update metadata pointer */
2826
- authority: Address$1 | null;
2827
- /** Address where metadata is stored */
2828
- metadataAddress: Address$1 | null;
2829
- }
2830
- /**
2831
- * Serialize token metadata for on-chain storage
2832
- *
2833
- * @param metadata - Token metadata object
2834
- * @returns Uint8Array - Serialized metadata
2835
- */
2836
- declare function serializeTokenMetadata(metadata: TokenMetadata): Uint8Array;
2837
- /**
2838
- * Deserialize token metadata from on-chain storage
2839
- *
2840
- * @param data - Serialized metadata bytes
2841
- * @returns TokenMetadata - Parsed metadata object
2842
- */
2843
- declare function deserializeTokenMetadata(data: Uint8Array): TokenMetadata;
2844
- /**
2845
- * Token account state options for Token 2022
2846
- */
2847
- declare enum TokenAccountState {
2848
- /** Account is uninitialized */
2849
- UNINITIALIZED = 0,
2850
- /** Account is initialized and usable */
2851
- INITIALIZED = 1,
2852
- /** Account is frozen (transfers disabled) */
2853
- FROZEN = 2
2854
- }
2855
- /**
2856
- * CPI Guard configuration
2857
- */
2858
- interface CpiGuardConfig {
2859
- /** Whether CPI guard is enabled */
2860
- enabled: boolean;
2861
- /** Authority that can toggle CPI guard */
2862
- authority: Address$1 | null;
2863
- }
2864
- /**
2865
- * Non-transferable token configuration
2866
- */
2867
- interface NonTransferableConfig {
2868
- /** Whether the token is non-transferable */
2869
- nonTransferable: boolean;
2870
- }
2871
- /**
2872
- * Immutable owner configuration
2873
- */
2874
- interface ImmutableOwnerConfig {
2875
- /** Whether the account has immutable owner */
2876
- immutable: boolean;
2877
- }
2878
- /**
2879
- * Check if account state allows transfers
2880
- *
2881
- * @param state - Current account state
2882
- * @param isNonTransferable - Whether token is non-transferable
2883
- * @param isFrozen - Whether account is frozen
2884
- * @returns boolean - True if transfers are allowed
2885
- */
2886
- declare function canTransfer(state: TokenAccountState, isNonTransferable?: boolean, isFrozen?: boolean): boolean;
2887
- /**
2888
- * Get required extensions for account creation
2889
- *
2890
- * @param extensions - Desired extensions
2891
- * @returns TokenExtension[] - Required extensions in dependency order
2892
- */
2893
- declare function getRequiredExtensions(extensions: TokenExtension[]): TokenExtension[];
2894
- /**
2895
- * Convert basis points to percentage
2896
- *
2897
- * @param basisPoints - Basis points (10000 = 100%)
2898
- * @returns number - Percentage as decimal (1.0 = 100%)
2899
- */
2900
- declare function basisPointsToPercentage(basisPoints: number): number;
2901
- /**
2902
- * Convert percentage to basis points
2903
- *
2904
- * @param percentage - Percentage as decimal (1.0 = 100%)
2905
- * @returns number - Basis points
2906
- */
2907
- declare function percentageToBasisPoints(percentage: number): number;
2908
- /**
2909
- * Format basis points as readable percentage
2910
- *
2911
- * @param basisPoints - Basis points
2912
- * @returns string - Formatted percentage (e.g., "2.50%")
2913
- */
2914
- declare function formatBasisPoints(basisPoints: number): string;
2915
- /**
2916
- * Estimate gas costs for Token 2022 operations
2917
- *
2918
- * @param operation - Type of operation
2919
- * @param extensions - Extensions involved
2920
- * @returns bigint - Estimated compute units
2921
- */
2922
- declare function estimateComputeUnits(operation: 'transfer' | 'create_account' | 'mint' | 'burn', extensions?: TokenExtension[]): bigint;
2923
- /**
2924
- * Create transfer fee configuration with validation
2925
- */
2926
- declare function createTransferFeeConfig(params: {
2927
- transferFeeBasisPoints: number;
2928
- maximumFee: bigint;
2929
- transferFeeConfigAuthority: Address$1 | null;
2930
- withdrawWithheldAuthority: Address$1 | null;
2931
- }): TransferFeeConfig;
2932
- /**
2933
- * Create interest bearing configuration with validation
2934
- */
2935
- declare function createInterestBearingConfig(params: {
2936
- rateAuthority: Address$1 | null;
2937
- currentRate: number;
2938
- }): InterestBearingConfig;
2939
- /**
2940
- * Parse token extension data from raw bytes
2941
- */
2942
- declare function parseTokenExtension(extensionType: 'TransferFeeConfig' | 'InterestBearingConfig' | string, data: Uint8Array): TransferFeeConfig | InterestBearingConfig;
2943
-
2944
- type token2022Extensions_ConfidentialAccountState = ConfidentialAccountState;
2945
- type token2022Extensions_ConfidentialTransferProof = ConfidentialTransferProof;
2946
- type token2022Extensions_CpiGuardConfig = CpiGuardConfig;
2947
- type token2022Extensions_ImmutableOwnerConfig = ImmutableOwnerConfig;
2948
- type token2022Extensions_InterestCalculation = InterestCalculation;
2949
- type token2022Extensions_MetadataPointerConfig = MetadataPointerConfig;
2950
- type token2022Extensions_NonTransferableConfig = NonTransferableConfig;
2951
- type token2022Extensions_TokenAccountState = TokenAccountState;
2952
- declare const token2022Extensions_TokenAccountState: typeof TokenAccountState;
2953
- type token2022Extensions_TokenMetadata = TokenMetadata;
2954
- type token2022Extensions_TransferFeeCalculation = TransferFeeCalculation;
2955
- type token2022Extensions_TransferFeeConfig = TransferFeeConfig;
2956
- type token2022Extensions_TransferHookContext = TransferHookContext;
2957
- type token2022Extensions_TransferHookInstruction = TransferHookInstruction;
2958
- declare const token2022Extensions_basisPointsToPercentage: typeof basisPointsToPercentage;
2959
- declare const token2022Extensions_calculateCompoundInterest: typeof calculateCompoundInterest;
2960
- declare const token2022Extensions_calculateInterest: typeof calculateInterest;
2961
- declare const token2022Extensions_calculateRequiredAmountForNetTransfer: typeof calculateRequiredAmountForNetTransfer;
2962
- declare const token2022Extensions_calculateTransferFee: typeof calculateTransferFee;
2963
- declare const token2022Extensions_canTransfer: typeof canTransfer;
2964
- declare const token2022Extensions_createInterestBearingConfig: typeof createInterestBearingConfig;
2965
- declare const token2022Extensions_createTransferFeeConfig: typeof createTransferFeeConfig;
2966
- declare const token2022Extensions_createTransferHookInstruction: typeof createTransferHookInstruction;
2967
- declare const token2022Extensions_deserializeTokenMetadata: typeof deserializeTokenMetadata;
2968
- declare const token2022Extensions_estimateAccumulatedFees: typeof estimateAccumulatedFees;
2969
- declare const token2022Extensions_estimateComputeUnits: typeof estimateComputeUnits;
2970
- declare const token2022Extensions_formatBasisPoints: typeof formatBasisPoints;
2971
- declare const token2022Extensions_generateConfidentialTransferProof: typeof generateConfidentialTransferProof;
2972
- declare const token2022Extensions_getRequiredExtensions: typeof getRequiredExtensions;
2973
- declare const token2022Extensions_parseTokenExtension: typeof parseTokenExtension;
2974
- declare const token2022Extensions_percentageToBasisPoints: typeof percentageToBasisPoints;
2975
- declare const token2022Extensions_serializeTokenMetadata: typeof serializeTokenMetadata;
2976
- declare const token2022Extensions_validateTransferHookInstruction: typeof validateTransferHookInstruction;
2977
- declare const token2022Extensions_verifyConfidentialTransferProof: typeof verifyConfidentialTransferProof;
2978
- declare namespace token2022Extensions {
2979
- export { type token2022Extensions_ConfidentialAccountState as ConfidentialAccountState, type token2022Extensions_ConfidentialTransferProof as ConfidentialTransferProof, type token2022Extensions_CpiGuardConfig as CpiGuardConfig, type token2022Extensions_ImmutableOwnerConfig as ImmutableOwnerConfig, type token2022Extensions_InterestCalculation as InterestCalculation, type token2022Extensions_MetadataPointerConfig as MetadataPointerConfig, type token2022Extensions_NonTransferableConfig as NonTransferableConfig, token2022Extensions_TokenAccountState as TokenAccountState, type token2022Extensions_TokenMetadata as TokenMetadata, type token2022Extensions_TransferFeeCalculation as TransferFeeCalculation, type token2022Extensions_TransferFeeConfig as TransferFeeConfig, type token2022Extensions_TransferHookContext as TransferHookContext, type token2022Extensions_TransferHookInstruction as TransferHookInstruction, token2022Extensions_basisPointsToPercentage as basisPointsToPercentage, token2022Extensions_calculateCompoundInterest as calculateCompoundInterest, token2022Extensions_calculateInterest as calculateInterest, token2022Extensions_calculateRequiredAmountForNetTransfer as calculateRequiredAmountForNetTransfer, token2022Extensions_calculateTransferFee as calculateTransferFee, token2022Extensions_canTransfer as canTransfer, token2022Extensions_createInterestBearingConfig as createInterestBearingConfig, token2022Extensions_createTransferFeeConfig as createTransferFeeConfig, token2022Extensions_createTransferHookInstruction as createTransferHookInstruction, token2022Extensions_deserializeTokenMetadata as deserializeTokenMetadata, token2022Extensions_estimateAccumulatedFees as estimateAccumulatedFees, token2022Extensions_estimateComputeUnits as estimateComputeUnits, token2022Extensions_formatBasisPoints as formatBasisPoints, token2022Extensions_generateConfidentialTransferProof as generateConfidentialTransferProof, token2022Extensions_getRequiredExtensions as getRequiredExtensions, token2022Extensions_parseTokenExtension as parseTokenExtension, token2022Extensions_percentageToBasisPoints as percentageToBasisPoints, token2022Extensions_serializeTokenMetadata as serializeTokenMetadata, token2022Extensions_validateTransferHookInstruction as validateTransferHookInstruction, token2022Extensions_verifyConfidentialTransferProof as verifyConfidentialTransferProof };
2980
- }
2981
-
2982
- /**
2983
- * Governance Helper Utilities
2984
- *
2985
- * Comprehensive utilities for RBAC management, multi-signature wallets,
2986
- * proposal lifecycle, and voting mechanisms.
2987
- */
2988
-
2989
- /**
2990
- * Derive multisig account PDA
2991
- */
2992
- declare function deriveMultisigPda(programId: Address, authority: Address, multisigId: bigint): Promise<Address>;
2993
- /**
2994
- * Derive proposal account PDA
2995
- */
2996
- declare function deriveProposalPda(programId: Address, multisig: Address, proposalId: bigint): Promise<Address>;
2997
- /**
2998
- * Derive RBAC account PDA
2999
- */
3000
- declare function deriveRbacPda(programId: Address, admin: Address): Promise<Address>;
3001
- declare class MultisigUtils {
3002
- /**
3003
- * Calculate if a multisig action has reached threshold
3004
- */
3005
- static hasReachedThreshold(multisig: Multisig, approvalCount: number): boolean;
3006
- /**
3007
- * Check if an address is a signer on the multisig
3008
- */
3009
- static isSigner(multisig: Multisig, address: Address): boolean;
3010
- /**
3011
- * Calculate remaining signatures needed
3012
- */
3013
- static remainingSignatures(multisig: Multisig, currentApprovals: number): number;
3014
- /**
3015
- * Validate multisig configuration
3016
- */
3017
- static validateConfiguration(signers: Address[], threshold: number): {
3018
- valid: boolean;
3019
- error?: string;
3020
- };
3021
- /**
3022
- * Generate multisig configuration summary
3023
- */
3024
- static generateSummary(multisig: Multisig): string;
3025
- }
3026
- declare class ProposalUtils {
3027
- /**
3028
- * Check if proposal is in voting period
3029
- */
3030
- static isVotingOpen(proposal: GovernanceProposal): boolean;
3031
- /**
3032
- * Check if proposal has expired
3033
- */
3034
- static hasExpired(proposal: GovernanceProposal): boolean;
3035
- /**
3036
- * Calculate time remaining for voting
3037
- */
3038
- static timeRemaining(proposal: GovernanceProposal): bigint;
3039
- /**
3040
- * Format time remaining as human-readable string
3041
- */
3042
- static formatTimeRemaining(proposal: GovernanceProposal): string;
3043
- /**
3044
- * Calculate if proposal has reached quorum
3045
- */
3046
- static hasReachedQuorum(votingResults: VotingResults, quorumRequirements: QuorumRequirements, totalEligibleVoters: number): boolean;
3047
- /**
3048
- * Calculate voting results summary
3049
- */
3050
- static calculateResults(votingResults: VotingResults): {
3051
- total: number;
3052
- forPercentage: number;
3053
- againstPercentage: number;
3054
- abstainPercentage: number;
3055
- passed: boolean;
3056
- };
3057
- /**
3058
- * Validate proposal
3059
- */
3060
- static validateProposal(proposal: GovernanceProposal): {
3061
- valid: boolean;
3062
- error?: string;
3063
- };
3064
- }
3065
- declare class RbacUtils {
3066
- /**
3067
- * Check if a user has a specific permission
3068
- */
3069
- static hasPermission(rbac: RbacConfig, user: Address, permission: string): boolean;
3070
- /**
3071
- * Get user's role
3072
- */
3073
- static getUserRole(rbac: RbacConfig, user: Address): Role | null;
3074
- /**
3075
- * Check if permission string is valid
3076
- */
3077
- static isValidPermission(permission: string): boolean;
3078
- /**
3079
- * Validate role configuration
3080
- */
3081
- static validateRole(role: Role): {
3082
- valid: boolean;
3083
- error?: string;
3084
- };
3085
- /**
3086
- * Generate permission summary
3087
- */
3088
- static generatePermissionSummary(permissions: Permission[]): string;
3089
- }
3090
- declare class VotingUtils {
3091
- /**
3092
- * Calculate vote weight based on token holdings or other factors
3093
- */
3094
- static calculateVoteWeight(baseWeight: number, tokenBalance?: bigint, stakeDuration?: bigint): number;
3095
- /**
3096
- * Format vote choice as string
3097
- */
3098
- static formatVoteChoice(voteChoice: VoteChoice): string;
3099
- /**
3100
- * Calculate if simple majority is reached
3101
- */
3102
- static hasSimpleMajority(votingResults: VotingResults): boolean;
3103
- /**
3104
- * Calculate if supermajority is reached (2/3)
3105
- */
3106
- static hasSupermajority(votingResults: VotingResults): boolean;
3107
- }
3108
- declare const PERMISSION_TEMPLATES: {
3109
- ADMIN: {
3110
- CREATE_PROPOSAL: {
3111
- action: string;
3112
- resource: string;
3113
- };
3114
- EXECUTE_PROPOSAL: {
3115
- action: string;
3116
- resource: string;
3117
- };
3118
- MANAGE_ROLES: {
3119
- action: string;
3120
- resource: string;
3121
- };
3122
- MANAGE_TREASURY: {
3123
- action: string;
3124
- resource: string;
3125
- };
3126
- };
3127
- MEMBER: {
3128
- VOTE: {
3129
- action: string;
3130
- resource: string;
3131
- };
3132
- VIEW: {
3133
- action: string;
3134
- resource: string;
3135
- };
3136
- COMMENT: {
3137
- action: string;
3138
- resource: string;
3139
- };
3140
- };
3141
- MODERATOR: {
3142
- CANCEL_PROPOSAL: {
3143
- action: string;
3144
- resource: string;
3145
- };
3146
- MODERATE_COMMENTS: {
3147
- action: string;
3148
- resource: string;
3149
- };
3150
- VIEW_REPORTS: {
3151
- action: string;
3152
- resource: string;
3153
- };
3154
- };
3155
- };
3156
- declare const ROLE_TEMPLATES: {
3157
- ADMIN: {
3158
- name: string;
3159
- description: string;
3160
- permissions: ({
3161
- action: string;
3162
- resource: string;
3163
- } | {
3164
- action: string;
3165
- resource: string;
3166
- } | {
3167
- action: string;
3168
- resource: string;
3169
- } | {
3170
- action: string;
3171
- resource: string;
3172
- })[];
3173
- };
3174
- MEMBER: {
3175
- name: string;
3176
- description: string;
3177
- permissions: ({
3178
- action: string;
3179
- resource: string;
3180
- } | {
3181
- action: string;
3182
- resource: string;
3183
- } | {
3184
- action: string;
3185
- resource: string;
3186
- })[];
3187
- };
3188
- MODERATOR: {
3189
- name: string;
3190
- description: string;
3191
- permissions: {
3192
- action: string;
3193
- resource: string;
3194
- }[];
3195
- };
3196
- };
3197
- interface GovernanceAnalytics {
3198
- totalProposals: number;
3199
- activeProposals: number;
3200
- passedProposals: number;
3201
- failedProposals: number;
3202
- averageVoterTurnout: number;
3203
- topVoters: {
3204
- address: Address;
3205
- voteCount: number;
3206
- }[];
3207
- proposalCategories: {
3208
- category: string;
3209
- count: number;
3210
- }[];
3211
- }
3212
- declare class GovernanceAnalyticsUtils {
3213
- /**
3214
- * Calculate governance health score (0-100)
3215
- */
3216
- static calculateHealthScore(analytics: GovernanceAnalytics): number;
3217
- /**
3218
- * Generate governance summary report
3219
- */
3220
- static generateSummaryReport(analytics: GovernanceAnalytics): string;
3221
- }
3222
-
3223
- type governanceHelpers_GovernanceAnalytics = GovernanceAnalytics;
3224
- type governanceHelpers_GovernanceAnalyticsUtils = GovernanceAnalyticsUtils;
3225
- declare const governanceHelpers_GovernanceAnalyticsUtils: typeof GovernanceAnalyticsUtils;
3226
- type governanceHelpers_MultisigUtils = MultisigUtils;
3227
- declare const governanceHelpers_MultisigUtils: typeof MultisigUtils;
3228
- declare const governanceHelpers_PERMISSION_TEMPLATES: typeof PERMISSION_TEMPLATES;
3229
- type governanceHelpers_ProposalUtils = ProposalUtils;
3230
- declare const governanceHelpers_ProposalUtils: typeof ProposalUtils;
3231
- declare const governanceHelpers_ROLE_TEMPLATES: typeof ROLE_TEMPLATES;
3232
- type governanceHelpers_RbacUtils = RbacUtils;
3233
- declare const governanceHelpers_RbacUtils: typeof RbacUtils;
3234
- type governanceHelpers_VotingUtils = VotingUtils;
3235
- declare const governanceHelpers_VotingUtils: typeof VotingUtils;
3236
- declare const governanceHelpers_deriveMultisigPda: typeof deriveMultisigPda;
3237
- declare const governanceHelpers_deriveProposalPda: typeof deriveProposalPda;
3238
- declare const governanceHelpers_deriveRbacPda: typeof deriveRbacPda;
3239
- declare namespace governanceHelpers {
3240
- export { type governanceHelpers_GovernanceAnalytics as GovernanceAnalytics, governanceHelpers_GovernanceAnalyticsUtils as GovernanceAnalyticsUtils, governanceHelpers_MultisigUtils as MultisigUtils, governanceHelpers_PERMISSION_TEMPLATES as PERMISSION_TEMPLATES, governanceHelpers_ProposalUtils as ProposalUtils, governanceHelpers_ROLE_TEMPLATES as ROLE_TEMPLATES, governanceHelpers_RbacUtils as RbacUtils, governanceHelpers_VotingUtils as VotingUtils, governanceHelpers_deriveMultisigPda as deriveMultisigPda, governanceHelpers_deriveProposalPda as deriveProposalPda, governanceHelpers_deriveRbacPda as deriveRbacPda };
3241
- }
3242
-
3243
- /**
3244
- * IPFS client implementation with multiple provider support
3245
- */
3246
-
3247
- /**
3248
- * Main IPFS client with multiple provider support and fallback
3249
- */
3250
- declare class IPFSClient {
3251
- private config;
3252
- private providers;
3253
- private cache;
3254
- constructor(config: IPFSConfig);
3255
- private initializeProviders;
3256
- private createProvider;
3257
- /**
3258
- * Upload content to IPFS with automatic fallback
3259
- */
3260
- upload(content: string | Uint8Array, options?: IPFSUploadOptions): Promise<IPFSOperationResult<IPFSUploadResult>>;
3261
- /**
3262
- * Retrieve content from IPFS with caching and fallback
3263
- */
3264
- retrieve(hash: string, options?: IPFSRetrievalOptions): Promise<IPFSOperationResult<IPFSRetrievalResult>>;
3265
- /**
3266
- * Pin content on IPFS
3267
- */
3268
- pin(hash: string): Promise<IPFSOperationResult<IPFSPinResult>>;
3269
- /**
3270
- * Store content with automatic IPFS decision based on size
3271
- */
3272
- storeContent(content: string, type: IPFSContentMetadata['type'], options?: IPFSUploadOptions & {
3273
- forceIpfs?: boolean;
3274
- }): Promise<ContentStorageResult>;
3275
- /**
3276
- * Retrieve content that may be stored inline or on IPFS
3277
- */
3278
- retrieveContent(uri: string): Promise<string>;
3279
- /**
3280
- * Retry wrapper for operations
3281
- */
3282
- private withRetry;
3283
- /**
3284
- * Calculate checksum for content integrity
3285
- */
3286
- private calculateChecksum;
3287
- /**
3288
- * Clear cache
3289
- */
3290
- clearCache(): void;
3291
- /**
3292
- * Get cache stats
3293
- */
3294
- getCacheStats(): {
3295
- size: number;
3296
- keys: string[];
3297
- };
3298
- }
3299
-
3300
- type ipfsClient_IPFSClient = IPFSClient;
3301
- declare const ipfsClient_IPFSClient: typeof IPFSClient;
3302
- declare namespace ipfsClient {
3303
- export { ipfsClient_IPFSClient as IPFSClient };
3304
- }
3305
-
3306
- /**
3307
- * Client-Side Encryption Service
3308
- *
3309
- * Provides production-ready client-side encryption for privacy features
3310
- * using ElGamal encryption and x402 verification.
3311
- */
3312
-
3313
- interface EncryptedData {
3314
- /** Encrypted payload */
3315
- ciphertext: ElGamalCiphertext;
3316
- /** Public key used for encryption */
3317
- publicKey: ElGamalPubkey;
3318
- /** Commitment to the plaintext (for verification) */
3319
- commitment: Uint8Array;
3320
- /** Timestamp of encryption */
3321
- timestamp: number;
3322
- /** Version for future compatibility */
3323
- version: number;
3324
- }
3325
- interface PrivateMetadata {
3326
- /** Encrypted data */
3327
- encrypted: EncryptedData;
3328
- /** Public metadata (not encrypted) */
3329
- public: Record<string, unknown>;
3330
- /** IPFS hash if stored off-chain */
3331
- ipfsHash?: string;
3332
- /** On-chain storage hash */
3333
- storageHash: Uint8Array;
3334
- }
3335
- interface ClientEncryptionOptions {
3336
- /** Whether to generate range proofs locally */
3337
- generateLocalProofs?: boolean;
3338
- /** Whether to store on IPFS */
3339
- useIpfsStorage?: boolean;
3340
- /** Custom encryption keypair (uses ephemeral if not provided) */
3341
- encryptionKeypair?: ElGamalKeypair;
3342
- }
3343
- declare class ClientEncryptionService {
3344
- private keypair;
3345
- private featureFlags;
3346
- constructor(options?: ClientEncryptionOptions);
3347
- /**
3348
- * Encrypt an amount for a recipient
3349
- */
3350
- encryptAmountForRecipient(amount: bigint, recipientPubkey: ElGamalPubkey): Promise<EncryptedData>;
3351
- /**
3352
- * Decrypt an amount (requires private key)
3353
- */
3354
- decryptAmount(encrypted: EncryptedData, secretKey: Uint8Array): Promise<bigint>;
3355
- /**
3356
- * Encrypt arbitrary data
3357
- */
3358
- encryptData(data: Uint8Array, recipientPubkey: ElGamalPubkey): Promise<EncryptedData>;
3359
- /**
3360
- * Create private metadata with mixed public/private data
3361
- */
3362
- createPrivateMetadata(privateData: Record<string, unknown>, publicData: Record<string, unknown>, recipientPubkey: ElGamalPubkey): Promise<PrivateMetadata>;
3363
- /**
3364
- * Verify encrypted data integrity
3365
- */
3366
- verifyCommitment(encrypted: EncryptedData): Promise<boolean>;
3367
- /**
3368
- * Create a commitment to an amount
3369
- */
3370
- private createCommitment;
3371
- /**
3372
- * Create a commitment to arbitrary data
3373
- */
3374
- private createDataCommitment;
3375
- /**
3376
- * Create storage hash for on-chain reference
3377
- */
3378
- private createStorageHash;
3379
- /**
3380
- * Combine multiple ciphertext chunks
3381
- */
3382
- private combineChunks;
3383
- }
3384
- /**
3385
- * Generate a local privacy proof (verified via x402 consensus)
3386
- * This provides cryptographic commitment without on-chain proofs
3387
- */
3388
- declare function generateLocalPrivacyProof(encrypted: EncryptedData, statement: string): Promise<{
3389
- proof: Uint8Array;
3390
- publicInputs: Uint8Array;
3391
- timestamp: number;
3392
- }>;
3393
- /**
3394
- * Verify a local privacy proof
3395
- */
3396
- declare function verifyLocalPrivacyProof(proof: Uint8Array, publicInputs: Uint8Array, encrypted: EncryptedData): Promise<boolean>;
3397
-
3398
- type clientEncryption_ClientEncryptionOptions = ClientEncryptionOptions;
3399
- type clientEncryption_ClientEncryptionService = ClientEncryptionService;
3400
- declare const clientEncryption_ClientEncryptionService: typeof ClientEncryptionService;
3401
- type clientEncryption_ElGamalCiphertext = ElGamalCiphertext;
3402
- type clientEncryption_ElGamalKeypair = ElGamalKeypair;
3403
- type clientEncryption_ElGamalPubkey = ElGamalPubkey;
3404
- type clientEncryption_EncryptedData = EncryptedData;
3405
- type clientEncryption_PrivateMetadata = PrivateMetadata;
3406
- declare const clientEncryption_generateElGamalKeypair: typeof generateElGamalKeypair;
3407
- declare const clientEncryption_generateLocalPrivacyProof: typeof generateLocalPrivacyProof;
3408
- declare const clientEncryption_verifyLocalPrivacyProof: typeof verifyLocalPrivacyProof;
3409
- declare namespace clientEncryption {
3410
- export { type clientEncryption_ClientEncryptionOptions as ClientEncryptionOptions, clientEncryption_ClientEncryptionService as ClientEncryptionService, type clientEncryption_ElGamalCiphertext as ElGamalCiphertext, type clientEncryption_ElGamalKeypair as ElGamalKeypair, type clientEncryption_ElGamalPubkey as ElGamalPubkey, type clientEncryption_EncryptedData as EncryptedData, type clientEncryption_PrivateMetadata as PrivateMetadata, clientEncryption_generateElGamalKeypair as generateElGamalKeypair, clientEncryption_generateLocalPrivacyProof as generateLocalPrivacyProof, clientEncryption_verifyLocalPrivacyProof as verifyLocalPrivacyProof };
3411
- }
3412
-
3413
- /**
3414
- * Feature Flags for GhostSpeak Protocol
3415
- *
3416
- * Centralized feature flag management for enabling/disabling features
3417
- * based on network conditions and protocol status.
3418
- */
3419
- interface FeatureFlags {
3420
- /** Enable confidential transfers (currently in beta) */
3421
- CONFIDENTIAL_TRANSFERS_ENABLED: boolean;
3422
- /** Use client-side encryption as fallback */
3423
- USE_CLIENT_ENCRYPTION: boolean;
3424
- /** Enable IPFS integration for private metadata */
3425
- ENABLE_IPFS_STORAGE: boolean;
3426
- /** Enable compressed NFTs for agents */
3427
- ENABLE_COMPRESSED_AGENTS: boolean;
3428
- /** Enable governance features */
3429
- ENABLE_GOVERNANCE: boolean;
3430
- /** Enable analytics collection */
3431
- ENABLE_ANALYTICS: boolean;
3432
- /** Show beta/experimental features in UI */
3433
- SHOW_EXPERIMENTAL_FEATURES: boolean;
3434
- }
3435
- /**
3436
- * Default feature flags for production
3437
- */
3438
- declare const DEFAULT_FLAGS: FeatureFlags;
3439
- /**
3440
- * Development feature flags (all features enabled)
3441
- */
3442
- declare const DEV_FLAGS: FeatureFlags;
3443
- /**
3444
- * Feature flag manager
3445
- */
3446
- declare class FeatureFlagManager {
3447
- private flags;
3448
- private overrides;
3449
- constructor(environment?: 'production' | 'development');
3450
- /**
3451
- * Load flag overrides from environment variables
3452
- */
3453
- private loadOverridesFromEnv;
3454
- /**
3455
- * Get current feature flags
3456
- */
3457
- getFlags(): FeatureFlags;
3458
- /**
3459
- * Check if a specific feature is enabled
3460
- */
3461
- isEnabled(feature: keyof FeatureFlags): boolean;
3462
- /**
3463
- * Set a feature flag (runtime override)
3464
- */
3465
- setFlag(feature: keyof FeatureFlags, enabled: boolean): void;
3466
- /**
3467
- * Reset all overrides
3468
- */
3469
- resetOverrides(): void;
3470
- /**
3471
- * Get privacy feature status
3472
- */
3473
- getPrivacyStatus(): {
3474
- mode: 'client-encryption' | 'disabled';
3475
- beta: boolean;
3476
- message: string;
3477
- };
3478
- /**
3479
- * Check if we should use client encryption
3480
- */
3481
- shouldUseClientEncryption(): boolean;
3482
- }
3483
- /**
3484
- * Get or create the global feature flag manager
3485
- */
3486
- declare function getFeatureFlags(environment?: 'production' | 'development'): FeatureFlagManager;
3487
- /**
3488
- * Quick helper to check if a feature is enabled
3489
- */
3490
- declare function isFeatureEnabled(feature: keyof FeatureFlags): boolean;
3491
- /**
3492
- * Quick helper to get privacy status
3493
- */
3494
- declare function getPrivacyStatus(): {
3495
- mode: "client-encryption" | "disabled";
3496
- beta: boolean;
3497
- message: string;
3498
- };
3499
-
3500
- declare const featureFlags_DEFAULT_FLAGS: typeof DEFAULT_FLAGS;
3501
- declare const featureFlags_DEV_FLAGS: typeof DEV_FLAGS;
3502
- type featureFlags_FeatureFlagManager = FeatureFlagManager;
3503
- declare const featureFlags_FeatureFlagManager: typeof FeatureFlagManager;
3504
- type featureFlags_FeatureFlags = FeatureFlags;
3505
- declare const featureFlags_getFeatureFlags: typeof getFeatureFlags;
3506
- declare const featureFlags_getPrivacyStatus: typeof getPrivacyStatus;
3507
- declare const featureFlags_isFeatureEnabled: typeof isFeatureEnabled;
3508
- declare namespace featureFlags {
3509
- export { featureFlags_DEFAULT_FLAGS as DEFAULT_FLAGS, featureFlags_DEV_FLAGS as DEV_FLAGS, featureFlags_FeatureFlagManager as FeatureFlagManager, type featureFlags_FeatureFlags as FeatureFlags, featureFlags_getFeatureFlags as getFeatureFlags, featureFlags_getPrivacyStatus as getPrivacyStatus, featureFlags_isFeatureEnabled as isFeatureEnabled };
3510
- }
3511
-
3512
- export { getTokenProgramAddress as $, type Agent as A, extractLegacyData as B, ClientEncryptionService as C, type DiscriminatorValidationResult as D, type ErrorContext as E, type MigrationResult as F, GhostSpeakSDKError as G, runAccountDiagnostics as H, IPFSClient as I, runBatchDiagnostics as J, diagnoseAccountFromChain as K, type LegacyAgentData as L, type MigrationPlan as M, diagnoseBatchFromChain as N, exportDiagnosticReport as O, type DiagnosticReport as P, type BatchDiagnosticReport as Q, withEnhancedErrorsSync as R, logEnhancedError as S, TokenProgram as T, validatePreconditions as U, extractInstructionName as V, deriveSplTokenAssociatedTokenAddress as W, deriveToken2022AssociatedTokenAddress as X, getAssociatedTokenAccount as Y, getAllAssociatedTokenAddresses as Z, validateAssociatedTokenAddress as _, detectTokenProgram as a, getTokenProgramFromAddress as a0, TokenExtension as a1, hasTransferFeeExtension as a2, hasConfidentialTransferExtension as a3, hasInterestBearingExtension as a4, getTransferFeeConfig as a5, getConfidentialTransferConfig as a6, getInterestBearingConfig as a7, type AssociatedTokenAccount as a8, type TransferFeeConfig as a9, type MetadataPointerConfig as aA, type CpiGuardConfig as aB, type NonTransferableConfig as aC, type ImmutableOwnerConfig as aD, deriveMultisigPda as aE, deriveProposalPda as aF, generateLocalPrivacyProof as aG, verifyLocalPrivacyProof as aH, type EncryptedData as aI, type PrivateMetadata as aJ, type ClientEncryptionOptions as aK, getFeatureFlags as aL, isFeatureEnabled as aM, FeatureFlagManager as aN, type FeatureFlags as aO, type ConfidentialTransferConfig as aa, type InterestBearingConfig as ab, calculateTransferFee as ac, calculateRequiredAmountForNetTransfer as ad, estimateAccumulatedFees as ae, generateConfidentialTransferProof as af, verifyConfidentialTransferProof as ag, calculateInterest as ah, calculateCompoundInterest as ai, validateTransferHookInstruction as aj, createTransferHookInstruction as ak, serializeTokenMetadata as al, deserializeTokenMetadata as am, canTransfer as an, getRequiredExtensions as ao, basisPointsToPercentage as ap, percentageToBasisPoints as aq, formatBasisPoints as ar, estimateComputeUnits as as, TokenAccountState as at, type TransferFeeCalculation as au, type ConfidentialTransferProof as av, type InterestCalculation as aw, type TransferHookInstruction as ax, type TransferHookContext as ay, type TokenMetadata as az, ipfsClient as b, createErrorContext as c, deriveAssociatedTokenAddress as d, enhanceTransactionError as e, formatTokenAmount as f, getTokenProgramType as g, clientEncryption as h, isToken2022Mint as i, accountDiagnostics as j, governanceHelpers as k, featureFlags as l, AgentDiscoveryClient as m, createAgentDiscoveryClient as n, createDiscriminatorErrorMessage as o, parseTokenAmount as p, inspectAccountData as q, type AccountInspectionResult as r, safeDecodeAgent as s, token2022Extensions as t, createMigrationPlan as u, validateAccountDiscriminator as v, withEnhancedErrors as w, createMigrationReport as x, simulateMigration as y, getMigrationInstructions as z };