@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
@@ -0,0 +1,1181 @@
1
+ import { T as TagDecayConfig, b as ReputationMetrics, c as TagScore, d as TagFilters, e as TagQueryResult, G as GovernanceProposal, f as VotingResults, Q as QuorumRequirements, V as VoteChoice, I as IPFSConfig, g as IPFSUploadOptions, h as IPFSOperationResult, i as IPFSUploadResult, j as IPFSRetrievalOptions, k as IPFSRetrievalResult, l as IPFSPinResult, m as IPFSContentMetadata, C as ContentStorageResult } from './reputation-types-Yebf0Rm_.js';
2
+ import { EncodedAccount, MaybeEncodedAccount, fetchEncodedAccount, Address as Address$1 } from '@solana/kit';
3
+ import { Address } from '@solana/addresses';
4
+
5
+ /**
6
+ * Reputation Tag Engine
7
+ *
8
+ * Automatically assigns and manages reputation tags based on agent metrics.
9
+ * Implements confidence scoring, evidence tracking, and tag decay mechanisms.
10
+ *
11
+ * Features:
12
+ * - Auto-tagging based on performance metrics
13
+ * - Confidence calculation with evidence counting
14
+ * - Time-based tag decay (stale tags after 90 days)
15
+ * - Tag validation and limits enforcement
16
+ */
17
+
18
+ /**
19
+ * Reputation Tag Engine
20
+ *
21
+ * Core engine for automatic tag assignment and management
22
+ */
23
+ declare class ReputationTagEngine {
24
+ private tagCriteria;
25
+ private decayConfig;
26
+ constructor(decayConfig?: TagDecayConfig);
27
+ /**
28
+ * Initialize all tag assignment criteria
29
+ */
30
+ private initializeTagCriteria;
31
+ /**
32
+ * Calculate tags for an agent based on their metrics
33
+ */
34
+ calculateTags(metrics: ReputationMetrics): Promise<TagScore[]>;
35
+ /**
36
+ * Apply decay to existing tags based on age
37
+ */
38
+ applyTagDecay(tagScores: TagScore[], currentTimestamp?: number): TagScore[];
39
+ /**
40
+ * Merge new tags with existing tags, updating confidence scores
41
+ */
42
+ mergeTags(existingTags: TagScore[], newTags: TagScore[]): TagScore[];
43
+ /**
44
+ * Filter tags based on criteria
45
+ */
46
+ filterTags(tags: TagScore[], filters: TagFilters): TagScore[];
47
+ /**
48
+ * Get category for a tag
49
+ */
50
+ private getTagCategory;
51
+ /**
52
+ * Validate tag name length
53
+ */
54
+ validateTagName(tagName: string): boolean;
55
+ /**
56
+ * Validate confidence score
57
+ */
58
+ validateConfidence(confidence: number): boolean;
59
+ /**
60
+ * Get confidence level description
61
+ */
62
+ getConfidenceLevel(confidence: number): string;
63
+ /**
64
+ * Sort tags by confidence (descending)
65
+ */
66
+ sortByConfidence(tags: TagScore[]): TagScore[];
67
+ /**
68
+ * Sort tags by evidence count (descending)
69
+ */
70
+ sortByEvidence(tags: TagScore[]): TagScore[];
71
+ /**
72
+ * Sort tags by last updated (most recent first)
73
+ */
74
+ sortByRecent(tags: TagScore[]): TagScore[];
75
+ /**
76
+ * Get top N tags by confidence
77
+ */
78
+ getTopTags(tags: TagScore[], count: number): TagScore[];
79
+ /**
80
+ * Categorize tags by type
81
+ */
82
+ categorizeTags(tags: TagScore[]): TagQueryResult;
83
+ }
84
+
85
+ /**
86
+ * Discriminator Validation Utilities
87
+ *
88
+ * Handles discriminator validation and provides fallback mechanisms
89
+ * for accounts with mismatched discriminators
90
+ */
91
+
92
+ interface DiscriminatorValidationResult {
93
+ isValid: boolean;
94
+ expectedLength: number;
95
+ actualLength: number;
96
+ canDecode: boolean;
97
+ needsMigration: boolean;
98
+ errorMessage?: string;
99
+ }
100
+ interface AccountInspectionResult {
101
+ address: string;
102
+ dataLength: number;
103
+ discriminator: Uint8Array | null;
104
+ discriminatorLength: number;
105
+ isAgentAccount: boolean;
106
+ needsMigration: boolean;
107
+ rawData: Uint8Array;
108
+ }
109
+ /**
110
+ * Validates account discriminator before attempting to decode
111
+ */
112
+ declare function validateAccountDiscriminator(accountData: Uint8Array, expectedDiscriminator: Uint8Array): DiscriminatorValidationResult;
113
+ /**
114
+ * Create user-friendly error message for discriminator issues
115
+ */
116
+ declare function createDiscriminatorErrorMessage(validation: DiscriminatorValidationResult, accountType: string, address: string): string;
117
+ /**
118
+ * Safe Agent account decoding with discriminator validation
119
+ * Returns a compatibility result with exists property
120
+ */
121
+ declare function safeDecodeAgent(encodedAccount: {
122
+ address: Address;
123
+ data: Uint8Array;
124
+ }): Promise<{
125
+ exists: boolean;
126
+ data?: unknown;
127
+ } | null>;
128
+ /**
129
+ * Inspects account data and extracts useful information about discriminator
130
+ */
131
+ declare function inspectAccountData(encodedAccount: EncodedAccount | MaybeEncodedAccount, address: string): AccountInspectionResult;
132
+
133
+ /**
134
+ * Account Migration Utility
135
+ *
136
+ * Handles migration of old Agent accounts that were created with
137
+ * different discriminator formats to the current format.
138
+ */
139
+
140
+ interface MigrationPlan {
141
+ address: string;
142
+ currentState: 'valid' | 'needs_migration' | 'invalid' | 'not_exists';
143
+ migrationType: 'none' | 'recreate' | 'data_conversion' | 'unsupported';
144
+ issues: string[];
145
+ recommendations: string[];
146
+ canAutoMigrate: boolean;
147
+ }
148
+ interface MigrationResult {
149
+ success: boolean;
150
+ address: string;
151
+ action: 'skipped' | 'migrated' | 'failed';
152
+ error?: string;
153
+ newAccountData?: Uint8Array;
154
+ }
155
+ interface LegacyAgentData {
156
+ discriminator: Uint8Array;
157
+ owner?: string;
158
+ name?: string;
159
+ }
160
+ /**
161
+ * Analyzes an account and creates a migration plan
162
+ */
163
+ declare function createMigrationPlan(encodedAccount: EncodedAccount | MaybeEncodedAccount, address: string): Promise<MigrationPlan>;
164
+ /**
165
+ * Attempts to extract meaningful data from a legacy account
166
+ */
167
+ declare function extractLegacyData(encodedAccount: EncodedAccount | MaybeEncodedAccount): LegacyAgentData | null;
168
+ /**
169
+ * Creates a detailed migration report for multiple accounts
170
+ */
171
+ declare function createMigrationReport(accounts: {
172
+ address: string;
173
+ encodedAccount: EncodedAccount | MaybeEncodedAccount;
174
+ }[]): Promise<{
175
+ summary: {
176
+ total: number;
177
+ valid: number;
178
+ needsMigration: number;
179
+ invalid: number;
180
+ canAutoMigrate: number;
181
+ };
182
+ plans: MigrationPlan[];
183
+ recommendations: string[];
184
+ }>;
185
+ /**
186
+ * Simulates migration without actually performing it
187
+ */
188
+ declare function simulateMigration(encodedAccount: EncodedAccount | MaybeEncodedAccount, address: string): Promise<{
189
+ plan: MigrationPlan;
190
+ simulation: {
191
+ wouldSucceed: boolean;
192
+ estimatedSteps: string[];
193
+ warnings: string[];
194
+ requiredActions: string[];
195
+ };
196
+ }>;
197
+ /**
198
+ * Provides user-friendly migration instructions
199
+ */
200
+ declare function getMigrationInstructions(plan: MigrationPlan): string[];
201
+
202
+ /**
203
+ * Account Diagnostics Utility
204
+ *
205
+ * Comprehensive diagnostic tools for inspecting and debugging
206
+ * account discriminator issues and data format problems.
207
+ */
208
+
209
+ interface DiagnosticReport {
210
+ address: string;
211
+ timestamp: string;
212
+ accountExists: boolean;
213
+ discriminatorValidation: ReturnType<typeof validateAccountDiscriminator>;
214
+ inspection: AccountInspectionResult;
215
+ migrationPlan: Awaited<ReturnType<typeof createMigrationPlan>>;
216
+ migrationSimulation: Awaited<ReturnType<typeof simulateMigration>>;
217
+ recommendations: string[];
218
+ debugInfo: {
219
+ expectedDiscriminator: number[];
220
+ actualDiscriminator: number[] | null;
221
+ dataPreview: number[];
222
+ programId?: string;
223
+ };
224
+ }
225
+ interface BatchDiagnosticReport {
226
+ summary: {
227
+ total: number;
228
+ valid: number;
229
+ invalid: number;
230
+ needsMigration: number;
231
+ notExists: number;
232
+ };
233
+ reports: DiagnosticReport[];
234
+ globalRecommendations: string[];
235
+ timestamp: string;
236
+ }
237
+ /**
238
+ * Runs comprehensive diagnostics on a single account
239
+ */
240
+ declare function runAccountDiagnostics(encodedAccount: EncodedAccount | MaybeEncodedAccount, address: string): Promise<DiagnosticReport>;
241
+ /**
242
+ * Runs diagnostics on multiple accounts
243
+ */
244
+ declare function runBatchDiagnostics(accounts: {
245
+ address: string;
246
+ encodedAccount: EncodedAccount | MaybeEncodedAccount;
247
+ }[]): Promise<BatchDiagnosticReport>;
248
+ /**
249
+ * Fetches and diagnoses an account directly from the blockchain
250
+ */
251
+ declare function diagnoseAccountFromChain(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address$1, options?: {
252
+ logToConsole?: boolean;
253
+ }): Promise<DiagnosticReport>;
254
+ /**
255
+ * Fetches and diagnoses multiple accounts from the blockchain
256
+ */
257
+ declare function diagnoseBatchFromChain(rpc: Parameters<typeof fetchEncodedAccount>[0], addresses: Address$1[], options?: {
258
+ logToConsole?: boolean;
259
+ maxConcurrent?: number;
260
+ }): Promise<BatchDiagnosticReport>;
261
+ /**
262
+ * Exports a diagnostic report as JSON
263
+ */
264
+ declare function exportDiagnosticReport(report: DiagnosticReport | BatchDiagnosticReport, filename?: string): string;
265
+
266
+ type accountDiagnostics_BatchDiagnosticReport = BatchDiagnosticReport;
267
+ type accountDiagnostics_DiagnosticReport = DiagnosticReport;
268
+ declare const accountDiagnostics_diagnoseAccountFromChain: typeof diagnoseAccountFromChain;
269
+ declare const accountDiagnostics_diagnoseBatchFromChain: typeof diagnoseBatchFromChain;
270
+ declare const accountDiagnostics_exportDiagnosticReport: typeof exportDiagnosticReport;
271
+ declare const accountDiagnostics_runAccountDiagnostics: typeof runAccountDiagnostics;
272
+ declare const accountDiagnostics_runBatchDiagnostics: typeof runBatchDiagnostics;
273
+ declare namespace accountDiagnostics {
274
+ 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 };
275
+ }
276
+
277
+ /**
278
+ * Enhanced Client Error Utilities
279
+ *
280
+ * Provides wrapper functions for SDK operations that automatically enhance
281
+ * error messages with detailed instruction account information.
282
+ */
283
+
284
+ /**
285
+ * Enhanced error class for SDK operations
286
+ */
287
+ declare class GhostSpeakSDKError extends Error {
288
+ readonly originalError: Error;
289
+ readonly operation: string;
290
+ readonly instructionName?: string;
291
+ constructor(operation: string, originalError: Error, instructionName?: string);
292
+ }
293
+ /**
294
+ * Type for account context
295
+ */
296
+ type AccountContext = Address | {
297
+ address: Address;
298
+ name?: string;
299
+ };
300
+ /**
301
+ * Wrapper for async operations that enhances errors with instruction context
302
+ */
303
+ declare function withEnhancedErrors<T>(operation: string, instructionName: string | undefined, fn: () => Promise<T>, debugAccounts?: AccountContext[]): Promise<T>;
304
+ /**
305
+ * Wrapper for synchronous operations that enhances errors with instruction context
306
+ */
307
+ declare function withEnhancedErrorsSync<T>(operation: string, instructionName: string | undefined, fn: () => T, debugAccounts?: AccountContext[]): T;
308
+ /**
309
+ * Parse and enhance transaction errors with instruction context
310
+ */
311
+ declare function enhanceTransactionError(error: Error, instructionName?: string, accounts?: AccountContext[]): Error;
312
+ /**
313
+ * Helper to log detailed error information for debugging
314
+ */
315
+ declare function logEnhancedError(error: Error, context?: {
316
+ operation?: string;
317
+ instructionName?: string;
318
+ accounts?: AccountContext[];
319
+ params?: Record<string, unknown>;
320
+ }): void;
321
+ /**
322
+ * Error context for operations
323
+ */
324
+ interface ErrorContext {
325
+ operation: string;
326
+ instructionName?: string;
327
+ accounts?: AccountContext[];
328
+ params?: Record<string, unknown>;
329
+ }
330
+ /**
331
+ * Create a detailed error context for operations
332
+ */
333
+ declare function createErrorContext(operation: string, instructionName?: string, accounts?: AccountContext[], params?: Record<string, unknown>): ErrorContext;
334
+ /**
335
+ * Validate common preconditions and throw enhanced errors
336
+ */
337
+ declare function validatePreconditions(checks: {
338
+ condition: boolean;
339
+ message: string;
340
+ instructionName?: string;
341
+ }[]): void;
342
+ /**
343
+ * Helper to extract instruction name from operation context
344
+ */
345
+ declare function extractInstructionName(operation: string): string | undefined;
346
+
347
+ /**
348
+ * Token Utilities for SPL Token and Token 2022 (Token Extensions)
349
+ *
350
+ * Provides comprehensive token handling utilities including:
351
+ * - Associated Token Account (ATA) derivation for both SPL Token and Token 2022
352
+ * - Token 2022 specific features (transfer fees, confidential transfers, etc.)
353
+ * - Token program detection and validation
354
+ * - Account creation and management utilities
355
+ *
356
+ * Based on the latest SPL Token 2022 specification and @solana/kit v2.3.0
357
+ */
358
+
359
+ /**
360
+ * Token program variants supported by GhostSpeak
361
+ */
362
+ declare enum TokenProgram {
363
+ /** Original SPL Token Program */
364
+ SPL_TOKEN = "spl-token",
365
+ /** SPL Token 2022 (Token Extensions) Program */
366
+ TOKEN_2022 = "token-2022"
367
+ }
368
+ /**
369
+ * Associated Token Account information
370
+ */
371
+ interface AssociatedTokenAccount {
372
+ /** The derived ATA address */
373
+ address: Address;
374
+ /** The wallet/owner address */
375
+ owner: Address;
376
+ /** The token mint address */
377
+ mint: Address;
378
+ /** The token program used (SPL Token or Token 2022) */
379
+ tokenProgram: Address;
380
+ /** Whether this is a Token 2022 ATA */
381
+ isToken2022: boolean;
382
+ }
383
+ /**
384
+ * Token 2022 Extension Types
385
+ * Based on the latest Token Extensions specification
386
+ */
387
+ declare enum TokenExtension {
388
+ /** Uninitialized account */
389
+ UNINITIALIZED = 0,
390
+ /** Transfer fee extension */
391
+ TRANSFER_FEE_CONFIG = 1,
392
+ /** Transfer fee amount */
393
+ TRANSFER_FEE_AMOUNT = 2,
394
+ /** Mint close authority */
395
+ MINT_CLOSE_AUTHORITY = 3,
396
+ /** Confidential transfer mint */
397
+ CONFIDENTIAL_TRANSFER_MINT = 4,
398
+ /** Confidential transfer account */
399
+ CONFIDENTIAL_TRANSFER_ACCOUNT = 5,
400
+ /** Default account state */
401
+ DEFAULT_ACCOUNT_STATE = 6,
402
+ /** Immutable owner */
403
+ IMMUTABLE_OWNER = 7,
404
+ /** Memo transfer */
405
+ MEMO_TRANSFER = 8,
406
+ /** Non-transferable */
407
+ NON_TRANSFERABLE = 9,
408
+ /** Interest bearing mint */
409
+ INTEREST_BEARING_MINT = 10,
410
+ /** CPI guard */
411
+ CPI_GUARD = 11,
412
+ /** Permanent delegate */
413
+ PERMANENT_DELEGATE = 12,
414
+ /** Non-transferable account */
415
+ NON_TRANSFERABLE_ACCOUNT = 13,
416
+ /** Transfer hook */
417
+ TRANSFER_HOOK = 14,
418
+ /** Transfer hook account */
419
+ TRANSFER_HOOK_ACCOUNT = 15,
420
+ /** Metadata pointer */
421
+ METADATA_POINTER = 16,
422
+ /** Token metadata */
423
+ TOKEN_METADATA = 17,
424
+ /** Group pointer */
425
+ GROUP_POINTER = 18,
426
+ /** Token group */
427
+ TOKEN_GROUP = 19,
428
+ /** Group member pointer */
429
+ GROUP_MEMBER_POINTER = 20,
430
+ /** Token group member */
431
+ TOKEN_GROUP_MEMBER = 21
432
+ }
433
+ /**
434
+ * Transfer fee configuration for Token 2022
435
+ */
436
+ interface TransferFeeConfig {
437
+ /** Transfer fee basis points (0-10000, where 10000 = 100%) */
438
+ transferFeeBasisPoints: number;
439
+ /** Maximum transfer fee in token base units */
440
+ maximumFee: bigint;
441
+ /** Authority that can modify transfer fee config */
442
+ transferFeeConfigAuthority: Address | null;
443
+ /** Authority that can withdraw collected fees */
444
+ withdrawWithheldAuthority: Address | null;
445
+ /** Amount of fees currently withheld */
446
+ withheldAmount: bigint;
447
+ /** Older transfer fee configuration */
448
+ olderTransferFee: {
449
+ epoch: bigint;
450
+ transferFeeBasisPoints: number;
451
+ maximumFee: bigint;
452
+ };
453
+ /** Newer transfer fee configuration */
454
+ newerTransferFee: {
455
+ epoch: bigint;
456
+ transferFeeBasisPoints: number;
457
+ maximumFee: bigint;
458
+ };
459
+ }
460
+ /**
461
+ * Confidential transfer configuration for Token 2022
462
+ */
463
+ interface ConfidentialTransferConfig {
464
+ /** Authority that can configure confidential transfers */
465
+ authority: Address | null;
466
+ /** Automatically approve new accounts for confidential transfers */
467
+ autoApproveNewAccounts: boolean;
468
+ /** Public key for auditing confidential transfers */
469
+ auditorElgamalPubkey: Uint8Array | null;
470
+ }
471
+ /**
472
+ * Interest-bearing token configuration for Token 2022
473
+ */
474
+ interface InterestBearingConfig {
475
+ /** Authority that can update the interest rate */
476
+ rateAuthority: Address | null;
477
+ /** Current interest rate (basis points per year) */
478
+ currentRate: number;
479
+ /** Timestamp when interest bearing was initialized */
480
+ initializationTimestamp: bigint;
481
+ /** Timestamp of last rate update */
482
+ lastUpdateTimestamp: bigint;
483
+ /** Pre-computed interest rate */
484
+ preUpdateAverageRate: number;
485
+ }
486
+ /**
487
+ * Derive Associated Token Account address for any token program
488
+ *
489
+ * This is the core ATA derivation function that works with both
490
+ * SPL Token and Token 2022 programs. The derivation follows the
491
+ * standard pattern: ['owner', 'token_program', 'mint']
492
+ *
493
+ * @param owner - The wallet/owner address
494
+ * @param mint - The token mint address
495
+ * @param tokenProgram - The token program address (SPL Token or Token 2022)
496
+ * @returns Promise<Address> - The derived ATA address
497
+ */
498
+ declare function deriveAssociatedTokenAddress(owner: Address, mint: Address, tokenProgram?: Address): Promise<Address>;
499
+ /**
500
+ * Derive Associated Token Account for SPL Token (legacy)
501
+ *
502
+ * @param owner - The wallet/owner address
503
+ * @param mint - The token mint address
504
+ * @returns Promise<Address> - The derived ATA address
505
+ */
506
+ declare function deriveSplTokenAssociatedTokenAddress(owner: Address, mint: Address): Promise<Address>;
507
+ /**
508
+ * Derive Associated Token Account for Token 2022
509
+ *
510
+ * @param owner - The wallet/owner address
511
+ * @param mint - The token mint address
512
+ * @returns Promise<Address> - The derived ATA address
513
+ */
514
+ declare function deriveToken2022AssociatedTokenAddress(owner: Address, mint: Address): Promise<Address>;
515
+ /**
516
+ * Get complete ATA information including program detection
517
+ *
518
+ * @param owner - The wallet/owner address
519
+ * @param mint - The token mint address
520
+ * @param tokenProgram - Optional: specify token program, auto-detect if not provided
521
+ * @returns Promise<AssociatedTokenAccount> - Complete ATA information
522
+ */
523
+ declare function getAssociatedTokenAccount(owner: Address, mint: Address, tokenProgram?: Address): Promise<AssociatedTokenAccount>;
524
+ /**
525
+ * Detect which token program owns a given mint
526
+ * Note: This requires RPC calls to fetch mint account data
527
+ *
528
+ * @param mint - The token mint address
529
+ * @returns Promise<Address> - The token program address
530
+ */
531
+ declare function detectTokenProgram(mint: Address, rpcEndpoint?: string): Promise<Address>;
532
+ /**
533
+ * Check if a mint is a Token 2022 mint
534
+ *
535
+ * @param mint - The token mint address
536
+ * @returns Promise<boolean> - True if Token 2022, false if SPL Token
537
+ */
538
+ declare function isToken2022Mint(mint: Address): Promise<boolean>;
539
+ /**
540
+ * Get the appropriate token program for a given mint
541
+ *
542
+ * @param mint - The token mint address
543
+ * @returns Promise<TokenProgram> - The token program enum
544
+ */
545
+ declare function getTokenProgramType(mint: Address): Promise<TokenProgram>;
546
+ /**
547
+ * Check if a mint has the transfer fee extension
548
+ *
549
+ * @param mint - The token mint address
550
+ * @param rpcEndpoint - Optional RPC endpoint
551
+ * @returns Promise<boolean> - True if mint has transfer fee extension
552
+ */
553
+ declare function hasTransferFeeExtension(mint: Address, rpcEndpoint?: string): Promise<boolean>;
554
+ /**
555
+ * Check if a mint has the confidential transfer extension
556
+ *
557
+ * @param mint - The token mint address
558
+ * @param rpcEndpoint - Optional RPC endpoint
559
+ * @returns Promise<boolean> - True if mint has confidential transfer extension
560
+ */
561
+ declare function hasConfidentialTransferExtension(mint: Address, rpcEndpoint?: string): Promise<boolean>;
562
+ /**
563
+ * Check if a mint has the interest-bearing extension
564
+ *
565
+ * @param mint - The token mint address
566
+ * @param rpcEndpoint - Optional RPC endpoint
567
+ * @returns Promise<boolean> - True if mint has interest-bearing extension
568
+ */
569
+ declare function hasInterestBearingExtension(mint: Address, rpcEndpoint?: string): Promise<boolean>;
570
+ /**
571
+ * Get transfer fee configuration for a Token 2022 mint
572
+ *
573
+ * @param mint - The Token 2022 mint address
574
+ * @returns Promise<TransferFeeConfig | null> - Transfer fee config or null if not configured
575
+ */
576
+ declare function getTransferFeeConfig(mint: Address, _rpcEndpoint?: string): Promise<TransferFeeConfig | null>;
577
+ /**
578
+ * Get confidential transfer configuration for a Token 2022 mint
579
+ *
580
+ * @param mint - The Token 2022 mint address
581
+ * @returns Promise<ConfidentialTransferConfig | null> - Confidential transfer config or null
582
+ */
583
+ declare function getConfidentialTransferConfig(mint: Address, _rpcEndpoint?: string): Promise<ConfidentialTransferConfig | null>;
584
+ /**
585
+ * Get interest-bearing configuration for a Token 2022 mint
586
+ *
587
+ * @param mint - The Token 2022 mint address
588
+ * @returns Promise<InterestBearingConfig | null> - Interest-bearing config or null
589
+ */
590
+ declare function getInterestBearingConfig(mint: Address, _rpcEndpoint?: string): Promise<InterestBearingConfig | null>;
591
+ /**
592
+ * Get all possible ATA addresses for a wallet/mint pair
593
+ * Returns both SPL Token and Token 2022 ATAs
594
+ *
595
+ * @param owner - The wallet/owner address
596
+ * @param mint - The token mint address
597
+ * @returns Promise<{ splToken: Address, token2022: Address }> - Both ATA addresses
598
+ */
599
+ declare function getAllAssociatedTokenAddresses(owner: Address, mint: Address): Promise<{
600
+ splToken: Address;
601
+ token2022: Address;
602
+ }>;
603
+ /**
604
+ * Validate if an address could be a valid ATA
605
+ *
606
+ * @param address - The address to validate
607
+ * @param owner - The expected owner
608
+ * @param mint - The expected mint
609
+ * @returns Promise<{ isValid: boolean, program?: Address }> - Validation result
610
+ */
611
+ declare function validateAssociatedTokenAddress(address: Address, owner: Address, mint: Address): Promise<{
612
+ isValid: boolean;
613
+ program?: Address;
614
+ }>;
615
+ /**
616
+ * Convert TokenProgram enum to program address
617
+ *
618
+ * @param program - The token program enum
619
+ * @returns Address - The program address
620
+ */
621
+ declare function getTokenProgramAddress(program: TokenProgram): Address;
622
+ /**
623
+ * Convert program address to TokenProgram enum
624
+ *
625
+ * @param address - The program address
626
+ * @returns TokenProgram - The token program enum
627
+ */
628
+ declare function getTokenProgramFromAddress(address: Address): TokenProgram;
629
+ /**
630
+ * Format token amount with proper decimals
631
+ *
632
+ * @param amount - Raw token amount (in base units)
633
+ * @param decimals - Number of decimal places for the token
634
+ * @returns string - Formatted amount
635
+ */
636
+ declare function formatTokenAmount(amount: bigint, decimals: number): string;
637
+ /**
638
+ * Parse formatted token amount to raw base units
639
+ *
640
+ * @param formatted - Formatted token amount string
641
+ * @param decimals - Number of decimal places for the token
642
+ * @returns bigint - Raw token amount
643
+ */
644
+ declare function parseTokenAmount(formatted: string, decimals: number): bigint;
645
+
646
+ /**
647
+ * Governance Helper Utilities
648
+ *
649
+ * Comprehensive utilities for RBAC management, multi-signature wallets,
650
+ * proposal lifecycle, and voting mechanisms.
651
+ */
652
+
653
+ /**
654
+ * Derive multisig account PDA
655
+ */
656
+ declare function deriveMultisigPda(programId: Address$1, authority: Address$1, multisigId: bigint): Promise<Address$1>;
657
+ /**
658
+ * Derive proposal account PDA
659
+ */
660
+ declare function deriveProposalPda(programId: Address$1, multisig: Address$1, proposalId: bigint): Promise<Address$1>;
661
+ /**
662
+ * Derive RBAC account PDA
663
+ */
664
+ declare function deriveRbacPda(programId: Address$1, admin: Address$1): Promise<Address$1>;
665
+ declare class ProposalUtils {
666
+ /**
667
+ * Check if proposal is in voting period
668
+ */
669
+ static isVotingOpen(proposal: GovernanceProposal): boolean;
670
+ /**
671
+ * Check if proposal has expired
672
+ */
673
+ static hasExpired(proposal: GovernanceProposal): boolean;
674
+ /**
675
+ * Calculate time remaining for voting
676
+ */
677
+ static timeRemaining(proposal: GovernanceProposal): bigint;
678
+ /**
679
+ * Format time remaining as human-readable string
680
+ */
681
+ static formatTimeRemaining(proposal: GovernanceProposal): string;
682
+ /**
683
+ * Calculate if proposal has reached quorum
684
+ */
685
+ static hasReachedQuorum(votingResults: VotingResults, quorumRequirements: QuorumRequirements, totalEligibleVoters: number): boolean;
686
+ /**
687
+ * Calculate voting results summary
688
+ */
689
+ static calculateResults(votingResults: VotingResults): {
690
+ total: number;
691
+ forPercentage: number;
692
+ againstPercentage: number;
693
+ abstainPercentage: number;
694
+ passed: boolean;
695
+ };
696
+ /**
697
+ * Validate proposal
698
+ */
699
+ static validateProposal(proposal: GovernanceProposal): {
700
+ valid: boolean;
701
+ error?: string;
702
+ };
703
+ }
704
+ declare class VotingUtils {
705
+ /**
706
+ * Calculate vote weight based on token holdings or other factors
707
+ */
708
+ static calculateVoteWeight(baseWeight: number, tokenBalance?: bigint, stakeDuration?: bigint): number;
709
+ /**
710
+ * Format vote choice as string
711
+ */
712
+ static formatVoteChoice(voteChoice: VoteChoice): string;
713
+ /**
714
+ * Calculate if simple majority is reached
715
+ */
716
+ static hasSimpleMajority(votingResults: VotingResults): boolean;
717
+ /**
718
+ * Calculate if supermajority is reached (2/3)
719
+ */
720
+ static hasSupermajority(votingResults: VotingResults): boolean;
721
+ }
722
+ declare const PERMISSION_TEMPLATES: {
723
+ ADMIN: {
724
+ CREATE_PROPOSAL: {
725
+ action: string;
726
+ resource: string;
727
+ };
728
+ EXECUTE_PROPOSAL: {
729
+ action: string;
730
+ resource: string;
731
+ };
732
+ MANAGE_ROLES: {
733
+ action: string;
734
+ resource: string;
735
+ };
736
+ MANAGE_TREASURY: {
737
+ action: string;
738
+ resource: string;
739
+ };
740
+ };
741
+ MEMBER: {
742
+ VOTE: {
743
+ action: string;
744
+ resource: string;
745
+ };
746
+ VIEW: {
747
+ action: string;
748
+ resource: string;
749
+ };
750
+ COMMENT: {
751
+ action: string;
752
+ resource: string;
753
+ };
754
+ };
755
+ MODERATOR: {
756
+ CANCEL_PROPOSAL: {
757
+ action: string;
758
+ resource: string;
759
+ };
760
+ MODERATE_COMMENTS: {
761
+ action: string;
762
+ resource: string;
763
+ };
764
+ VIEW_REPORTS: {
765
+ action: string;
766
+ resource: string;
767
+ };
768
+ };
769
+ };
770
+ declare const ROLE_TEMPLATES: {
771
+ ADMIN: {
772
+ name: string;
773
+ description: string;
774
+ permissions: ({
775
+ action: string;
776
+ resource: string;
777
+ } | {
778
+ action: string;
779
+ resource: string;
780
+ } | {
781
+ action: string;
782
+ resource: string;
783
+ } | {
784
+ action: string;
785
+ resource: string;
786
+ })[];
787
+ };
788
+ MEMBER: {
789
+ name: string;
790
+ description: string;
791
+ permissions: ({
792
+ action: string;
793
+ resource: string;
794
+ } | {
795
+ action: string;
796
+ resource: string;
797
+ } | {
798
+ action: string;
799
+ resource: string;
800
+ })[];
801
+ };
802
+ MODERATOR: {
803
+ name: string;
804
+ description: string;
805
+ permissions: {
806
+ action: string;
807
+ resource: string;
808
+ }[];
809
+ };
810
+ };
811
+ interface GovernanceAnalytics {
812
+ totalProposals: number;
813
+ activeProposals: number;
814
+ passedProposals: number;
815
+ failedProposals: number;
816
+ averageVoterTurnout: number;
817
+ topVoters: {
818
+ address: Address$1;
819
+ voteCount: number;
820
+ }[];
821
+ proposalCategories: {
822
+ category: string;
823
+ count: number;
824
+ }[];
825
+ }
826
+ declare class GovernanceAnalyticsUtils {
827
+ /**
828
+ * Calculate governance health score (0-100)
829
+ */
830
+ static calculateHealthScore(analytics: GovernanceAnalytics): number;
831
+ /**
832
+ * Generate governance summary report
833
+ */
834
+ static generateSummaryReport(analytics: GovernanceAnalytics): string;
835
+ }
836
+
837
+ type governanceHelpers_GovernanceAnalytics = GovernanceAnalytics;
838
+ type governanceHelpers_GovernanceAnalyticsUtils = GovernanceAnalyticsUtils;
839
+ declare const governanceHelpers_GovernanceAnalyticsUtils: typeof GovernanceAnalyticsUtils;
840
+ declare const governanceHelpers_PERMISSION_TEMPLATES: typeof PERMISSION_TEMPLATES;
841
+ type governanceHelpers_ProposalUtils = ProposalUtils;
842
+ declare const governanceHelpers_ProposalUtils: typeof ProposalUtils;
843
+ declare const governanceHelpers_ROLE_TEMPLATES: typeof ROLE_TEMPLATES;
844
+ type governanceHelpers_VotingUtils = VotingUtils;
845
+ declare const governanceHelpers_VotingUtils: typeof VotingUtils;
846
+ declare const governanceHelpers_deriveMultisigPda: typeof deriveMultisigPda;
847
+ declare const governanceHelpers_deriveProposalPda: typeof deriveProposalPda;
848
+ declare const governanceHelpers_deriveRbacPda: typeof deriveRbacPda;
849
+ declare namespace governanceHelpers {
850
+ export { type governanceHelpers_GovernanceAnalytics as GovernanceAnalytics, governanceHelpers_GovernanceAnalyticsUtils as GovernanceAnalyticsUtils, governanceHelpers_PERMISSION_TEMPLATES as PERMISSION_TEMPLATES, governanceHelpers_ProposalUtils as ProposalUtils, governanceHelpers_ROLE_TEMPLATES as ROLE_TEMPLATES, governanceHelpers_VotingUtils as VotingUtils, governanceHelpers_deriveMultisigPda as deriveMultisigPda, governanceHelpers_deriveProposalPda as deriveProposalPda, governanceHelpers_deriveRbacPda as deriveRbacPda };
851
+ }
852
+
853
+ /**
854
+ * IPFS client implementation with multiple provider support
855
+ */
856
+
857
+ /**
858
+ * Main IPFS client with multiple provider support and fallback
859
+ */
860
+ declare class IPFSClient {
861
+ private config;
862
+ private providers;
863
+ private cache;
864
+ constructor(config: IPFSConfig);
865
+ private initializeProviders;
866
+ private createProvider;
867
+ /**
868
+ * Upload content to IPFS with automatic fallback
869
+ */
870
+ upload(content: string | Uint8Array, options?: IPFSUploadOptions): Promise<IPFSOperationResult<IPFSUploadResult>>;
871
+ /**
872
+ * Retrieve content from IPFS with caching and fallback
873
+ */
874
+ retrieve(hash: string, options?: IPFSRetrievalOptions): Promise<IPFSOperationResult<IPFSRetrievalResult>>;
875
+ /**
876
+ * Pin content on IPFS
877
+ */
878
+ pin(hash: string): Promise<IPFSOperationResult<IPFSPinResult>>;
879
+ /**
880
+ * Store content with automatic IPFS decision based on size
881
+ */
882
+ storeContent(content: string, type: IPFSContentMetadata['type'], options?: IPFSUploadOptions & {
883
+ forceIpfs?: boolean;
884
+ }): Promise<ContentStorageResult>;
885
+ /**
886
+ * Retrieve content that may be stored inline or on IPFS
887
+ */
888
+ retrieveContent(uri: string): Promise<string>;
889
+ /**
890
+ * Retry wrapper for operations
891
+ */
892
+ private withRetry;
893
+ /**
894
+ * Calculate checksum for content integrity
895
+ */
896
+ private calculateChecksum;
897
+ /**
898
+ * Clear cache
899
+ */
900
+ clearCache(): void;
901
+ /**
902
+ * Get cache stats
903
+ */
904
+ getCacheStats(): {
905
+ size: number;
906
+ keys: string[];
907
+ };
908
+ }
909
+
910
+ type ipfsClient_IPFSClient = IPFSClient;
911
+ declare const ipfsClient_IPFSClient: typeof IPFSClient;
912
+ declare namespace ipfsClient {
913
+ export { ipfsClient_IPFSClient as IPFSClient };
914
+ }
915
+
916
+ /**
917
+ * ElGamal Encryption Implementation
918
+ *
919
+ * Implements twisted ElGamal encryption over curve25519 for
920
+ * client-side privacy features.
921
+ *
922
+ * Key features:
923
+ * - Twisted ElGamal with Pedersen commitments
924
+ * - Homomorphic addition/subtraction of ciphertexts
925
+ * - Efficient decryption for small values (up to 32 bits)
926
+ */
927
+
928
+ /**
929
+ * ElGamal public key (32 bytes)
930
+ */
931
+ type ElGamalPubkey = Uint8Array;
932
+ /**
933
+ * ElGamal secret key (32 bytes)
934
+ */
935
+ type ElGamalSecretKey = Uint8Array;
936
+ /**
937
+ * ElGamal keypair
938
+ */
939
+ interface ElGamalKeypair {
940
+ publicKey: ElGamalPubkey;
941
+ secretKey: ElGamalSecretKey;
942
+ }
943
+ /**
944
+ * Pedersen commitment (curve point)
945
+ */
946
+ interface PedersenCommitment {
947
+ /** Commitment to the value */
948
+ commitment: Uint8Array;
949
+ }
950
+ /**
951
+ * Decrypt handle for ElGamal ciphertext
952
+ */
953
+ interface DecryptHandle {
954
+ /** Encrypted randomness */
955
+ handle: Uint8Array;
956
+ }
957
+ /**
958
+ * Twisted ElGamal ciphertext
959
+ * Split into Pedersen commitment and decrypt handle
960
+ */
961
+ interface ElGamalCiphertext {
962
+ /** Pedersen commitment (independent of pubkey) */
963
+ commitment: PedersenCommitment;
964
+ /** Decrypt handle (encodes randomness) */
965
+ handle: DecryptHandle;
966
+ }
967
+ /**
968
+ * Generate a new ElGamal keypair
969
+ *
970
+ * @param seed - Optional seed for deterministic generation
971
+ * @returns ElGamalKeypair
972
+ */
973
+ declare function generateElGamalKeypair(seed?: Uint8Array): ElGamalKeypair;
974
+
975
+ /**
976
+ * Client-Side Encryption Service
977
+ *
978
+ * Provides production-ready client-side encryption for privacy features
979
+ * using ElGamal encryption and x402 verification.
980
+ */
981
+
982
+ interface EncryptedData {
983
+ /** Encrypted payload */
984
+ ciphertext: ElGamalCiphertext;
985
+ /** Public key used for encryption */
986
+ publicKey: ElGamalPubkey;
987
+ /** Commitment to the plaintext (for verification) */
988
+ commitment: Uint8Array;
989
+ /** Timestamp of encryption */
990
+ timestamp: number;
991
+ /** Version for future compatibility */
992
+ version: number;
993
+ }
994
+ interface PrivateMetadata {
995
+ /** Encrypted data */
996
+ encrypted: EncryptedData;
997
+ /** Public metadata (not encrypted) */
998
+ public: Record<string, unknown>;
999
+ /** IPFS hash if stored off-chain */
1000
+ ipfsHash?: string;
1001
+ /** On-chain storage hash */
1002
+ storageHash: Uint8Array;
1003
+ }
1004
+ interface ClientEncryptionOptions {
1005
+ /** Whether to generate range proofs locally */
1006
+ generateLocalProofs?: boolean;
1007
+ /** Whether to store on IPFS */
1008
+ useIpfsStorage?: boolean;
1009
+ /** Custom encryption keypair (uses ephemeral if not provided) */
1010
+ encryptionKeypair?: ElGamalKeypair;
1011
+ }
1012
+ declare class ClientEncryptionService {
1013
+ private keypair;
1014
+ private featureFlags;
1015
+ constructor(options?: ClientEncryptionOptions);
1016
+ /**
1017
+ * Encrypt an amount for a recipient
1018
+ */
1019
+ encryptAmountForRecipient(amount: bigint, recipientPubkey: ElGamalPubkey): Promise<EncryptedData>;
1020
+ /**
1021
+ * Decrypt an amount (requires private key)
1022
+ */
1023
+ decryptAmount(encrypted: EncryptedData, secretKey: Uint8Array): Promise<bigint>;
1024
+ /**
1025
+ * Encrypt arbitrary data
1026
+ */
1027
+ encryptData(data: Uint8Array, recipientPubkey: ElGamalPubkey): Promise<EncryptedData>;
1028
+ /**
1029
+ * Create private metadata with mixed public/private data
1030
+ */
1031
+ createPrivateMetadata(privateData: Record<string, unknown>, publicData: Record<string, unknown>, recipientPubkey: ElGamalPubkey): Promise<PrivateMetadata>;
1032
+ /**
1033
+ * Verify encrypted data integrity
1034
+ */
1035
+ verifyCommitment(encrypted: EncryptedData): Promise<boolean>;
1036
+ /**
1037
+ * Create a commitment to an amount
1038
+ */
1039
+ private createCommitment;
1040
+ /**
1041
+ * Create a commitment to arbitrary data
1042
+ */
1043
+ private createDataCommitment;
1044
+ /**
1045
+ * Create storage hash for on-chain reference
1046
+ */
1047
+ private createStorageHash;
1048
+ /**
1049
+ * Combine multiple ciphertext chunks
1050
+ */
1051
+ private combineChunks;
1052
+ }
1053
+ /**
1054
+ * Generate a local privacy proof (verified via x402 consensus)
1055
+ * This provides cryptographic commitment without on-chain proofs
1056
+ */
1057
+ declare function generateLocalPrivacyProof(encrypted: EncryptedData, statement: string): Promise<{
1058
+ proof: Uint8Array;
1059
+ publicInputs: Uint8Array;
1060
+ timestamp: number;
1061
+ }>;
1062
+ /**
1063
+ * Verify a local privacy proof
1064
+ */
1065
+ declare function verifyLocalPrivacyProof(proof: Uint8Array, publicInputs: Uint8Array, encrypted: EncryptedData): Promise<boolean>;
1066
+
1067
+ type clientEncryption_ClientEncryptionOptions = ClientEncryptionOptions;
1068
+ type clientEncryption_ClientEncryptionService = ClientEncryptionService;
1069
+ declare const clientEncryption_ClientEncryptionService: typeof ClientEncryptionService;
1070
+ type clientEncryption_ElGamalCiphertext = ElGamalCiphertext;
1071
+ type clientEncryption_ElGamalKeypair = ElGamalKeypair;
1072
+ type clientEncryption_ElGamalPubkey = ElGamalPubkey;
1073
+ type clientEncryption_EncryptedData = EncryptedData;
1074
+ type clientEncryption_PrivateMetadata = PrivateMetadata;
1075
+ declare const clientEncryption_generateElGamalKeypair: typeof generateElGamalKeypair;
1076
+ declare const clientEncryption_generateLocalPrivacyProof: typeof generateLocalPrivacyProof;
1077
+ declare const clientEncryption_verifyLocalPrivacyProof: typeof verifyLocalPrivacyProof;
1078
+ declare namespace clientEncryption {
1079
+ 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 };
1080
+ }
1081
+
1082
+ /**
1083
+ * Feature Flags for GhostSpeak Protocol
1084
+ *
1085
+ * Centralized feature flag management for enabling/disabling features
1086
+ * based on network conditions and protocol status.
1087
+ */
1088
+ interface FeatureFlags {
1089
+ /** Enable confidential transfers (currently in beta) */
1090
+ CONFIDENTIAL_TRANSFERS_ENABLED: boolean;
1091
+ /** Use client-side encryption as fallback */
1092
+ USE_CLIENT_ENCRYPTION: boolean;
1093
+ /** Enable IPFS integration for private metadata */
1094
+ ENABLE_IPFS_STORAGE: boolean;
1095
+ /** Enable compressed NFTs for agents */
1096
+ ENABLE_COMPRESSED_AGENTS: boolean;
1097
+ /** Enable governance features */
1098
+ ENABLE_GOVERNANCE: boolean;
1099
+ /** Enable analytics collection */
1100
+ ENABLE_ANALYTICS: boolean;
1101
+ /** Show beta/experimental features in UI */
1102
+ SHOW_EXPERIMENTAL_FEATURES: boolean;
1103
+ }
1104
+ /**
1105
+ * Default feature flags for production
1106
+ */
1107
+ declare const DEFAULT_FLAGS: FeatureFlags;
1108
+ /**
1109
+ * Development feature flags (all features enabled)
1110
+ */
1111
+ declare const DEV_FLAGS: FeatureFlags;
1112
+ /**
1113
+ * Feature flag manager
1114
+ */
1115
+ declare class FeatureFlagManager {
1116
+ private flags;
1117
+ private overrides;
1118
+ constructor(environment?: 'production' | 'development');
1119
+ /**
1120
+ * Load flag overrides from environment variables
1121
+ */
1122
+ private loadOverridesFromEnv;
1123
+ /**
1124
+ * Get current feature flags
1125
+ */
1126
+ getFlags(): FeatureFlags;
1127
+ /**
1128
+ * Check if a specific feature is enabled
1129
+ */
1130
+ isEnabled(feature: keyof FeatureFlags): boolean;
1131
+ /**
1132
+ * Set a feature flag (runtime override)
1133
+ */
1134
+ setFlag(feature: keyof FeatureFlags, enabled: boolean): void;
1135
+ /**
1136
+ * Reset all overrides
1137
+ */
1138
+ resetOverrides(): void;
1139
+ /**
1140
+ * Get privacy feature status
1141
+ */
1142
+ getPrivacyStatus(): {
1143
+ mode: 'client-encryption' | 'disabled';
1144
+ beta: boolean;
1145
+ message: string;
1146
+ };
1147
+ /**
1148
+ * Check if we should use client encryption
1149
+ */
1150
+ shouldUseClientEncryption(): boolean;
1151
+ }
1152
+ /**
1153
+ * Get or create the global feature flag manager
1154
+ */
1155
+ declare function getFeatureFlags(environment?: 'production' | 'development'): FeatureFlagManager;
1156
+ /**
1157
+ * Quick helper to check if a feature is enabled
1158
+ */
1159
+ declare function isFeatureEnabled(feature: keyof FeatureFlags): boolean;
1160
+ /**
1161
+ * Quick helper to get privacy status
1162
+ */
1163
+ declare function getPrivacyStatus(): {
1164
+ mode: "client-encryption" | "disabled";
1165
+ beta: boolean;
1166
+ message: string;
1167
+ };
1168
+
1169
+ declare const featureFlags_DEFAULT_FLAGS: typeof DEFAULT_FLAGS;
1170
+ declare const featureFlags_DEV_FLAGS: typeof DEV_FLAGS;
1171
+ type featureFlags_FeatureFlagManager = FeatureFlagManager;
1172
+ declare const featureFlags_FeatureFlagManager: typeof FeatureFlagManager;
1173
+ type featureFlags_FeatureFlags = FeatureFlags;
1174
+ declare const featureFlags_getFeatureFlags: typeof getFeatureFlags;
1175
+ declare const featureFlags_getPrivacyStatus: typeof getPrivacyStatus;
1176
+ declare const featureFlags_isFeatureEnabled: typeof isFeatureEnabled;
1177
+ declare namespace featureFlags {
1178
+ 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 };
1179
+ }
1180
+
1181
+ export { hasTransferFeeExtension as $, type AccountInspectionResult as A, diagnoseAccountFromChain as B, ClientEncryptionService as C, type DiscriminatorValidationResult as D, type ErrorContext as E, diagnoseBatchFromChain as F, GhostSpeakSDKError as G, exportDiagnosticReport as H, IPFSClient as I, type DiagnosticReport as J, type BatchDiagnosticReport as K, type LegacyAgentData as L, type MigrationPlan as M, withEnhancedErrorsSync as N, logEnhancedError as O, validatePreconditions as P, extractInstructionName as Q, ReputationTagEngine as R, deriveSplTokenAssociatedTokenAddress as S, TokenProgram as T, deriveToken2022AssociatedTokenAddress as U, getAssociatedTokenAccount as V, getAllAssociatedTokenAddresses as W, validateAssociatedTokenAddress as X, getTokenProgramAddress as Y, getTokenProgramFromAddress as Z, TokenExtension as _, detectTokenProgram as a, hasConfidentialTransferExtension as a0, hasInterestBearingExtension as a1, getTransferFeeConfig as a2, getConfidentialTransferConfig as a3, getInterestBearingConfig as a4, type AssociatedTokenAccount as a5, type TransferFeeConfig as a6, type ConfidentialTransferConfig as a7, type InterestBearingConfig as a8, deriveMultisigPda as a9, deriveProposalPda as aa, generateLocalPrivacyProof as ab, verifyLocalPrivacyProof as ac, type EncryptedData as ad, type PrivateMetadata as ae, type ClientEncryptionOptions as af, getFeatureFlags as ag, isFeatureEnabled as ah, FeatureFlagManager as ai, type FeatureFlags as aj, 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, createDiscriminatorErrorMessage as m, inspectAccountData as n, createMigrationPlan as o, parseTokenAmount as p, createMigrationReport as q, simulateMigration as r, safeDecodeAgent as s, getMigrationInstructions as t, extractLegacyData as u, validateAccountDiscriminator as v, withEnhancedErrors as w, type MigrationResult as x, runAccountDiagnostics as y, runBatchDiagnostics as z };