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