@ghostspeak/sdk
Version:
TypeScript SDK for GhostSpeak AI Agent Commerce Protocol - Production Ready Beta
1,894 lines (1,714 loc) • 124 kB
TypeScript
import { Option, Address, ReadonlyUint8Array, EncodedAccount, MaybeEncodedAccount, fetchEncodedAccount, IInstruction, TransactionSigner } from '@solana/kit';
import { Address as Address$1 } from '@solana/addresses';
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';
import { Rpc, GetAccountInfoApi } from '@solana/rpc';
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
type AccessAuditConfig = {
auditEnabled: boolean;
realTimeMonitoring: boolean;
retentionPeriod: bigint;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Access policy definition */
type AccessPolicy = {
/** Policy identifier */
policyId: string;
/** Policy name */
name: string;
/** Policy description */
description: string;
/** Policy type */
policyType: PolicyType;
/** Policy rules */
rules: Array<PolicyRule>;
/** Policy scope */
scope: PolicyScope;
/** Policy priority */
priority: number;
/** Policy status */
status: PolicyStatus;
/** Effective date */
effectiveDate: bigint;
/** Expiration date */
expirationDate: Option<bigint>;
/** Policy metadata */
metadata: PolicyMetadata;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Account lockout policies */
type AccountLockoutPolicies = {
/** Max failed attempts before lockout */
maxFailedAttempts: number;
/** Lockout duration */
lockoutDuration: bigint;
/** Progressive lockout enabled */
progressiveLockout: boolean;
/** Unlock methods */
unlockMethods: Array<UnlockMethod>;
/** Notification requirements */
notificationRequirements: Array<NotificationRequirement>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
interface Action {
[key: string]: unknown;
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Role activation requirements */
type ActivationRequirement = {
/** Requirement type */
requirementType: ActivationRequirementType;
/** Required approvers */
approvers: Array<Address>;
/** Minimum approvals needed */
minApprovals: number;
/** Approval timeout */
approvalTimeout: bigint;
/** Evidence requirements */
evidenceRequirements: Array<string>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Types of role activation requirements */
declare enum ActivationRequirementType {
ManagerApproval = 0,
PeerReview = 1,
SecurityClearance = 2,
BackgroundCheck = 3,
TrainingCompletion = 4,
CertificationRequired = 5,
BusinessJustification = 6,
TechnicalAssessment = 7
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Template aging policies */
type AgingPolicy = {
/** Biometric type */
biometricType: BiometricType;
/** Maximum age */
maxAge: bigint;
/** Refresh requirements */
refreshRequirements: Array<string>;
/** Degradation handling */
degradationHandling: DegradationHandling;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Authentication levels */
declare enum AuthenticationLevel {
Low = 0,
Medium = 1,
High = 2,
VeryHigh = 3
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Authentication methods */
declare enum AuthenticationMethod {
Password = 0,
DigitalSignature = 1,
Biometric = 2,
Token = 3,
Certificate = 4,
Sms = 5,
Email = 6,
App = 7,
Hardware = 8
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Authentication policies */
type AuthenticationPolicies = {
/** Multi-factor authentication required */
mfaRequired: boolean;
/** Supported authentication methods */
supportedMethods: Array<AuthenticationMethod>;
/** Authentication strength requirements */
strengthRequirements: AuthenticationStrength;
/** Account lockout policies */
lockoutPolicies: AccountLockoutPolicies;
/** Biometric policies */
biometricPolicies: Option<BiometricPolicies>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Authentication strength requirements */
type AuthenticationStrength = {
/** Minimum authentication level */
minimumLevel: AuthenticationLevel;
/** Risk-based authentication */
riskBased: boolean;
/** Adaptive authentication */
adaptive: boolean;
/** Step-up authentication triggers */
stepUpTriggers: Array<StepUpTrigger>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
type AuthorizationPolicies = {
defaultDeny: boolean;
explicitPermissionsRequired: boolean;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Biometric authentication policies */
type BiometricPolicies = {
/** Supported biometric types */
supportedTypes: Array<BiometricType>;
/** Biometric quality requirements */
qualityRequirements: BiometricQuality;
/** Liveness detection required */
livenessDetection: boolean;
/** Biometric template protection */
templateProtection: BiometricProtection;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Biometric template protection */
type BiometricProtection = {
/** Template encryption required */
encryptionRequired: boolean;
/** Template storage method */
storageMethod: BiometricStorageMethod;
/** Template revocation support */
revocationSupport: boolean;
/** Template aging policies */
agingPolicies: Array<AgingPolicy>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
declare enum BiometricQuality {
Low = 0,
Medium = 1,
High = 2
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Biometric template storage methods */
declare enum BiometricStorageMethod {
OnDevice = 0,
Encrypted = 1,
Hashed = 2,
Distributed = 3,
None = 4
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Types of biometric authentication */
declare enum BiometricType {
Fingerprint = 0,
FaceRecognition = 1,
IrisRecognition = 2,
VoiceRecognition = 3,
Signature = 4,
Gait = 5,
Behavioral = 6
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
type CompliancePolicies = {
frameworks: Array<string>;
auditRequirements: Array<string>;
reportingRequirements: Array<string>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Constraint condition definition */
type ConstraintCondition = {
/** Attribute name */
attribute: string;
/** Condition operator */
operator: ConstraintOperator;
/** Expected value */
value: string;
/** Value type */
valueType: ValueType;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Operators for constraint conditions */
declare enum ConstraintOperator {
Equals = 0,
NotEquals = 1,
GreaterThan = 2,
LessThan = 3,
GreaterThanOrEqual = 4,
LessThanOrEqual = 5,
Contains = 6,
NotContains = 7,
In = 8,
NotIn = 9,
Matches = 10,
NotMatches = 11
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Data access levels */
declare enum DataAccessLevel {
Public = 0,
Internal = 1,
Confidential = 2,
Restricted = 3,
TopSecret = 4
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
type DataProtectionPolicies = {
encryptionRequired: boolean;
classificationRequired: boolean;
dlpEnabled: boolean;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Handling of template degradation */
declare enum DegradationHandling {
RequireRefresh = 0,
GradualDegradation = 1,
ImmediateExpiry = 2,
AdaptiveThreshold = 3
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
type EmergencyAccessConfig = {
breakGlassEnabled: boolean;
emergencyContacts: Array<Address>;
approvalRequired: boolean;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Emergency configuration for multisig */
type EmergencyConfig = {
/** Emergency contacts */
emergencyContacts: Array<Address>;
/** Emergency threshold override */
emergencyThreshold: number;
/** Emergency timeout (shorter than normal) */
emergencyTimeout: bigint;
/** Allowed emergency transaction types */
emergencyTransactionTypes: Array<TransactionType>;
/** Emergency freeze enabled */
freezeEnabled: boolean;
/** Current freeze status */
frozen: boolean;
/** Freeze timestamp */
frozenAt: Option<bigint>;
/** Auto-unfreeze after duration */
autoUnfreezeDuration: Option<bigint>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Enforcement levels for constraints */
declare enum EnforcementLevel {
Hard = 0,
Soft = 1,
Advisory = 2,
ExceptionBased = 3
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Geographic region definition */
type GeographicRegion = {
/** Region name */
name: string;
/** Latitude boundaries */
latitudeRange: LatitudeRange;
/** Longitude boundaries */
longitudeRange: LongitudeRange;
/** Radius for circular regions (meters) */
radius: Option<number>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Hierarchical boundary definition */
type HierarchicalBoundary = {
/** Boundary level */
level: string;
/** Boundary value */
value: string;
/** Include descendants */
includeDescendants: boolean;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
type IncidentResponsePolicies = {
responseTeam: Array<Address>;
escalationProcedures: Array<string>;
notificationRequirements: Array<NotificationRequirement>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Latitude range for geographic constraints */
type LatitudeRange = {
/** Minimum latitude */
min: number;
/** Maximum latitude */
max: number;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Location-based access constraints */
type LocationConstraints = {
/** Allowed countries (ISO codes) */
allowedCountries: Array<string>;
/** Blocked countries (ISO codes) */
blockedCountries: Array<string>;
/** Allowed IP address ranges (CIDR) */
allowedIpRanges: Array<string>;
/** Blocked IP address ranges (CIDR) */
blockedIpRanges: Array<string>;
/** Geofencing enabled */
geofencingEnabled: boolean;
/** Allowed geographic regions */
allowedRegions: Array<GeographicRegion>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Longitude range for geographic constraints */
type LongitudeRange = {
/** Minimum longitude */
min: number;
/** Maximum longitude */
max: number;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
interface MultisigConfig {
requireSequentialSigning: boolean;
allowOwnerOffCurve: boolean;
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Individual signature in multisig */
type MultisigSignature = {
/** Signer public key */
signer: Address;
/** Signature data */
signature: ReadonlyUint8Array;
/** Signature timestamp */
signedAt: bigint;
/** Signature method/algorithm */
signatureMethod: string;
/** Additional verification data */
verificationData: Option<ReadonlyUint8Array>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
type NetworkSecurityPolicies = {
firewallRequired: boolean;
intrusionDetection: boolean;
trafficMonitoring: boolean;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Notification methods */
declare enum NotificationMethod {
OnChain = 0,
Email = 1,
Sms = 2,
Push = 3,
InApp = 4,
All = 5
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Notification priorities */
declare enum NotificationPriority {
Low = 0,
Medium = 1,
High = 2,
Critical = 3,
Emergency = 4
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Notification requirements for security events */
type NotificationRequirement = {
/** Event type */
eventType: SecurityEventType;
/** Notification targets */
targets: Array<NotificationTarget>;
/** Notification method */
method: NotificationMethod;
/** Notification timing */
timing: NotificationTiming;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Notification targets */
type NotificationTarget = {
/** Target type */
targetType: NotificationTargetType;
/** Target identifier */
targetId: string;
/** Notification priority */
priority: NotificationPriority;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Types of notification targets */
declare enum NotificationTargetType {
User = 0,
Administrator = 1,
SecurityTeam = 2,
ComplianceTeam = 3,
Manager = 4,
AuditTeam = 5,
ExternalSystem = 6
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Notification timing */
declare enum NotificationTiming {
Immediate = 0,
Delayed = 1,
Batched = 2,
Scheduled = 3
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
type PasswordPolicies = {
minimumLength: number;
complexityRequirements: Array<string>;
historyCount: number;
maxAge: bigint;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Pending transaction in multisig queue */
type PendingTransaction = {
/** Transaction ID */
transactionId: bigint;
/** Transaction type */
transactionType: TransactionType;
/** Target program/account */
target: Address;
/** Transaction data */
data: ReadonlyUint8Array;
/** Required signatures */
requiredSignatures: number;
/** Current signatures */
signatures: Array<MultisigSignature>;
/** Creation timestamp */
createdAt: bigint;
/** Expiration timestamp */
expiresAt: bigint;
/** Transaction priority */
priority: TransactionPriority;
/** Execution conditions */
executionConditions: Array<ExecutionCondition>;
/** Transaction status */
status: TransactionStatus;
/** Time lock (if applicable) */
timeLock: Option<TimeLock>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Permission definition */
type Permission = {
/** Permission identifier */
permissionId: string;
/** Permission name */
name: string;
/** Permission description */
description: string;
/** Resource type this permission applies to */
resourceType: string;
/** Actions allowed by this permission */
actions: Array<Action>;
/** Permission scope */
scope: PermissionScope;
/** Permission constraints */
constraints: Array<PermissionConstraint>;
/** Permission metadata */
metadata: PermissionMetadata;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Permission constraint */
type PermissionConstraint = {
/** Constraint type */
constraintType: PermissionConstraintType;
/** Constraint conditions */
conditions: Array<ConstraintCondition>;
/** Constraint enforcement */
enforcement: EnforcementLevel;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Types of permission constraints */
declare enum PermissionConstraintType {
Temporal = 0,
Contextual = 1,
Conditional = 2,
ResourceBased = 3,
AttributeBased = 4,
RiskBased = 5
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Permission metadata */
type PermissionMetadata = {
/** Business justification */
businessJustification: string;
/** Risk assessment */
riskAssessment: RiskAssessment;
/** Compliance mapping */
complianceMapping: Array<string>;
/** Related permissions */
relatedPermissions: Array<string>;
/** Permission owner */
owner: Option<Address>;
/** Last review */
lastReview: Option<bigint>;
/** Review frequency */
reviewFrequency: bigint;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Permission scope definition */
type PermissionScope = {
/** Scope type */
scopeType: ScopeType;
/** Scope boundaries */
boundaries: ScopeBoundaries;
/** Hierarchical scope */
hierarchical: boolean;
/** Inherited permissions */
inherited: boolean;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Policy metadata */
type PolicyMetadata = {
/** Policy author */
author: Option<Address>;
/** Policy approver */
approver: Option<Address>;
/** Approval date */
approvalDate: Option<bigint>;
/** Business justification */
businessJustification: string;
/** Compliance references */
complianceReferences: Array<string>;
/** Risk assessment */
riskAssessment: Option<string>;
/** Review schedule */
reviewSchedule: ReviewSchedule;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Policy rule definition */
type PolicyRule = {
/** Rule identifier */
ruleId: string;
/** Rule conditions */
conditions: Array<RuleCondition>;
/** Rule effect */
effect: RuleEffect;
/** Rule priority */
priority: number;
/** Rule enabled */
enabled: boolean;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Policy scope */
type PolicyScope = {
/** Applicable subjects */
subjects: Array<string>;
/** Applicable resources */
resources: Array<string>;
/** Applicable actions */
actions: Array<string>;
/** Scope inheritance */
inheritance: ScopeInheritance;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Policy status */
declare enum PolicyStatus {
Active = 0,
Inactive = 1,
Draft = 2,
UnderReview = 3,
Deprecated = 4,
Suspended = 5
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Types of access policies */
declare enum PolicyType {
Allow = 0,
Deny = 1,
Conditional = 2,
Delegated = 3,
Temporary = 4,
Emergency = 5
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
interface ResourceConstraints {
[key: string]: unknown;
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Review schedule for policies */
type ReviewSchedule = {
/** Review frequency */
frequency: bigint;
/** Last review date */
lastReview: Option<bigint>;
/** Next review date */
nextReview: bigint;
/** Review owners */
reviewOwners: Array<Address>;
/** Review criteria */
reviewCriteria: Array<string>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Risk acceptance status */
type RiskAcceptance = {
/** Risk accepted */
accepted: boolean;
/** Accepting authority */
acceptingAuthority: Option<Address>;
/** Acceptance date */
acceptanceDate: Option<bigint>;
/** Acceptance reasoning */
reasoning: Option<string>;
/** Review date */
reviewDate: Option<bigint>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Risk assessment for permissions */
type RiskAssessment = {
/** Overall risk score */
riskScore: number;
/** Risk factors */
riskFactors: Array<RiskFactor>;
/** Mitigation measures */
mitigationMeasures: Array<string>;
/** Risk acceptance */
riskAcceptance: RiskAcceptance;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Risk categories */
declare enum RiskCategory {
Operational = 0,
Financial = 1,
Compliance = 2,
Security = 3,
Reputational = 4,
Technical = 5,
Legal = 6
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Individual risk factor */
type RiskFactor = {
/** Factor name */
name: string;
/** Factor category */
category: RiskCategory;
/** Impact score */
impact: number;
/** Likelihood score */
likelihood: number;
/** Risk score */
riskScore: number;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Risk levels for roles */
declare enum RiskLevel {
Low = 0,
Medium = 1,
High = 2,
Critical = 3
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Role definition with permissions and constraints */
type Role = {
/** Role identifier */
roleId: string;
/** Role name */
name: string;
/** Role description */
description: string;
/** Role type */
roleType: RoleType;
/** Permission assignments */
permissions: Array<string>;
/** Role constraints */
constraints: RoleConstraints;
/** Inheritance relationships */
inheritsFrom: Array<string>;
/** Role metadata */
metadata: RoleMetadata;
/** Role status */
status: RoleStatus;
/** Creation timestamp */
createdAt: bigint;
/** Last modification timestamp */
modifiedAt: bigint;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Constraints applied to roles */
type RoleConstraints = {
/** Time-based constraints */
timeConstraints: Option<TimeConstraints>;
/** Location-based constraints */
locationConstraints: Option<LocationConstraints>;
/** Resource-based constraints */
resourceConstraints: Option<ResourceConstraints>;
/** Session-based constraints */
sessionConstraints: Option<SessionConstraints>;
/** Segregation of duties constraints */
sodConstraints: Array<SodConstraint>;
/** Maximum concurrent sessions */
maxConcurrentSessions: Option<number>;
/** Role activation requirements */
activationRequirements: Array<ActivationRequirement>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Role metadata for additional information */
type RoleMetadata = {
/** Business purpose */
businessPurpose: string;
/** Risk level */
riskLevel: RiskLevel;
/** Data access level */
dataAccessLevel: DataAccessLevel;
/** Compliance requirements */
complianceRequirements: Array<string>;
/** Role owner */
roleOwner: Option<Address>;
/** Role custodian */
roleCustodian: Option<Address>;
/** Review frequency */
reviewFrequency: bigint;
/** Last review timestamp */
lastReview: Option<bigint>;
/** Next review due */
nextReview: Option<bigint>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Role status */
declare enum RoleStatus {
Active = 0,
Inactive = 1,
Deprecated = 2,
UnderReview = 3,
Suspended = 4
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Types of roles in the system */
declare enum RoleType {
Administrative = 0,
Operational = 1,
ReadOnly = 2,
Compliance = 3,
Emergency = 4,
Custom = 5,
Service = 6,
Guest = 7
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
interface RuleCondition {
[key: string]: unknown;
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Rule effects */
declare enum RuleEffect {
Allow = 0,
Deny = 1,
AuditOnly = 2,
RequireApproval = 3,
RequireMfa = 4,
RequireJustification = 5
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Scope boundaries definition */
type ScopeBoundaries = {
/** Included resources */
includedResources: Array<string>;
/** Excluded resources */
excludedResources: Array<string>;
/** Resource patterns (regex) */
resourcePatterns: Array<string>;
/** Hierarchical boundaries */
hierarchicalBoundaries: Array<HierarchicalBoundary>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Scope inheritance options */
declare enum ScopeInheritance {
None = 0,
Hierarchical = 1,
Delegated = 2,
Inherited = 3
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Types of permission scopes */
declare enum ScopeType {
Global = 0,
Organization = 1,
Department = 2,
Project = 3,
Resource = 4,
Individual = 5
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Types of security events */
declare enum SecurityEventType {
AccountLockout = 0,
PasswordChange = 1,
PrivilegeEscalation = 2,
SuspiciousActivity = 3,
PolicyViolation = 4,
AccessDenied = 5,
DataBreach = 6,
SystemCompromise = 7
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Comprehensive security policies configuration */
type SecurityPolicies = {
/** Authentication policies */
authentication: AuthenticationPolicies;
/** Authorization policies */
authorization: AuthorizationPolicies;
/** Password policies */
password: PasswordPolicies;
/** Session policies */
session: SessionPolicies;
/** Data protection policies */
dataProtection: DataProtectionPolicies;
/** Network security policies */
networkSecurity: NetworkSecurityPolicies;
/** Incident response policies */
incidentResponse: IncidentResponsePolicies;
/** Compliance policies */
compliance: CompliancePolicies;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Session-based access constraints */
type SessionConstraints = {
/** Maximum session duration */
maxSessionDuration: bigint;
/** Idle timeout */
idleTimeout: bigint;
/** Re-authentication interval */
reauthInterval: bigint;
/** Multi-factor authentication required */
mfaRequired: boolean;
/** Device fingerprinting required */
deviceFingerprinting: boolean;
/** Session encryption required */
sessionEncryption: boolean;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
type SessionPolicies = {
maxSessionDuration: bigint;
idleTimeout: bigint;
concurrentSessions: number;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Segregation of duties constraint */
type SodConstraint = {
/** Constraint name */
name: string;
/** Conflicting roles */
conflictingRoles: Array<string>;
/** Constraint type */
constraintType: SodConstraintType;
/** Enforcement level */
enforcementLevel: EnforcementLevel;
/** Exception procedures */
exceptionProcedures: Array<string>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Types of segregation of duties constraints */
declare enum SodConstraintType {
Static = 0,
Dynamic = 1,
Temporal = 2,
Contextual = 3
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Triggers for step-up authentication */
declare enum StepUpTrigger {
HighRiskAction = 0,
SensitiveData = 1,
LargeTransaction = 2,
NewDevice = 3,
UnusualLocation = 4,
TimeBasedRisk = 5,
BehaviorAnomaly = 6
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Time-based access constraints */
type TimeConstraints = {
/** Allowed hours (0-23) */
allowedHours: ReadonlyUint8Array;
/** Allowed days of week (1-7) */
allowedDays: ReadonlyUint8Array;
/** Timezone for time calculations */
timezone: string;
/** Maximum session duration (seconds) */
maxSessionDuration: Option<bigint>;
/** Role expiration timestamp */
expiresAt: Option<bigint>;
/** Periodic reactivation required */
reactivationPeriod: Option<bigint>;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Time lock mechanism for delayed execution */
type TimeLock = {
/** Lock duration in seconds */
duration: bigint;
/** Lock start timestamp */
lockedAt: bigint;
/** Unlock timestamp */
unlocksAt: bigint;
/** Early unlock conditions */
earlyUnlockConditions: Array<ExecutionCondition>;
/** Lock type */
lockType: TimeLockType;
/** Can be cancelled before execution */
cancellable: boolean;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Types of time locks */
declare enum TimeLockType {
Standard = 0,
Vesting = 1,
Emergency = 2,
Governance = 3
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Transaction priority levels */
declare enum TransactionPriority {
Low = 0,
Normal = 1,
High = 2,
Critical = 3,
Emergency = 4
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Transaction execution status */
declare enum TransactionStatus {
Pending = 0,
PartiallyApproved = 1,
FullyApproved = 2,
Executed = 3,
Cancelled = 4,
Expired = 5,
Failed = 6
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Types of transactions that can be executed */
declare enum TransactionType {
Transfer = 0,
Withdrawal = 1,
EscrowRelease = 2,
ProposalCreation = 3,
VoteExecution = 4,
ParameterUpdate = 5,
SignerAddition = 6,
SignerRemoval = 7,
ThresholdUpdate = 8,
ConfigUpdate = 9,
EmergencyFreeze = 10,
EmergencyUnfreeze = 11,
SecurityPolicyUpdate = 12,
ProtocolUpgrade = 13,
FeatureToggle = 14,
RiskParameterUpdate = 15,
CustomInstruction = 16
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Methods to unlock accounts */
declare enum UnlockMethod {
TimeBasedAutoUnlock = 0,
AdminUnlock = 1,
SelfServiceUnlock = 2,
MultiFactorUnlock = 3,
SupervisorUnlock = 4
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
/** Value types for constraint conditions */
declare enum ValueType {
String = 0,
Number = 1,
Boolean = 2,
Date = 3,
Time = 4,
Duration = 5,
List = 6,
Object = 7
}
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
type Multisig = {
discriminator: ReadonlyUint8Array;
/** Unique identifier */
multisigId: bigint;
/** Required number of signatures */
threshold: number;
/** List of authorized signers */
signers: Array<Address>;
/** Multisig owner (can modify signers) */
owner: Address;
/** Creation timestamp */
createdAt: bigint;
/** Last update timestamp */
updatedAt: bigint;
/** Current nonce (prevents replay attacks) */
nonce: bigint;
/** Pending transactions */
pendingTransactions: Array<PendingTransaction>;
/** Configuration settings */
config: MultisigConfig;
/** Emergency settings */
emergencyConfig: EmergencyConfig;
/** Reserved space for future extensions */
reserved: ReadonlyUint8Array;
};
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
type RbacConfig = {
discriminator: ReadonlyUint8Array;
/** Authority for RBAC management */
authority: Address;
/** Creation timestamp */
createdAt: bigint;
/** Last update timestamp */
updatedAt: bigint;
/** Version for compatibility */
version: number;
/** Role definitions */
roles: Array<Role>;
/** Permission definitions */
permissions: Array<Permission>;
/** Access policies */
accessPolicies: Array<AccessPolicy>;
/** Security policies */
securityPolicies: SecurityPolicies;
/** Audit configuration */
auditConfig: AccessAuditConfig;
/** Emergency access procedures */
emergencyAccess: EmergencyAccessConfig;
/** Reserved space */
reserved: ReadonlyUint8Array;
};
/**
* Discriminator Validation Utilities
*
* Handles discriminator validation and provides fallback mechanisms
* for accounts with mismatched discriminators
*/
interface DiscriminatorValidationResult {
isValid: boolean;
expectedLength: number;
actualLength: number;
canDecode: boolean;
needsMigration: boolean;
errorMessage?: string;
}
interface AccountInspectionResult {
address: string;
dataLength: number;
discriminator: Uint8Array | null;
discriminatorLength: number;
isAgentAccount: boolean;
needsMigration: boolean;
rawData: Uint8Array;
}
/**
* Validates account discriminator before attempting to decode
*/
declare function validateAccountDiscriminator(accountData: Uint8Array, expectedDiscriminator: Uint8Array): DiscriminatorValidationResult;
/**
* Create user-friendly error message for discriminator issues
*/
declare function createDiscriminatorErrorMessage(validation: DiscriminatorValidationResult, accountType: string, address: string): string;
/**
* Safe Agent account decoding with discriminator validation
* Returns a compatibility result with exists property
*/
declare function safeDecodeAgent(encodedAccount: {
address: Address$1;
data: Uint8Array;
}): Promise<{
exists: boolean;
data?: unknown;
} | null>;
/**
* Inspects account data and extracts useful information about discriminator
*/
declare function inspectAccountData(encodedAccount: EncodedAccount | MaybeEncodedAccount, address: string): AccountInspectionResult;
/**
* Account Migration Utility
*
* Handles migration of old Agent accounts that were created with
* different discriminator formats to the current format.
*/
interface MigrationPlan {
address: string;
currentState: 'valid' | 'needs_migration' | 'invalid' | 'not_exists';
migrationType: 'none' | 'recreate' | 'data_conversion' | 'unsupported';
issues: string[];
recommendations: string[];
canAutoMigrate: boolean;
}
interface MigrationResult {
success: boolean;
address: string;
action: 'skipped' | 'migrated' | 'failed';
error?: string;
newAccountData?: Uint8Array;
}
interface LegacyAgentData {
discriminator: Uint8Array;
owner?: string;
name?: string;
}
/**
* Analyzes an account and creates a migration plan
*/
declare function createMigrationPlan(encodedAccount: EncodedAccount | MaybeEncodedAccount, address: string): Promise<MigrationPlan>;
/**
* Attempts to extract meaningful data from a legacy account
*/
declare function extractLegacyData(encodedAccount: EncodedAccount | MaybeEncodedAccount): LegacyAgentData | null;
/**
* Creates a detailed migration report for multiple accounts
*/
declare function createMigrationReport(accounts: {
address: string;
encodedAccount: EncodedAccount | MaybeEncodedAccount;
}[]): Promise<{
summary: {
total: number;
valid: number;
needsMigration: number;
invalid: number;
canAutoMigrate: number;
};
plans: MigrationPlan[];
recommendations: string[];
}>;
/**
* Simulates migration without actually performing it
*/
declare function simulateMigration(encodedAccount: EncodedAccount | MaybeEncodedAccount, address: string): Promise<{
plan: MigrationPlan;
simulation: {
wouldSucceed: boolean;
estimatedSteps: string[];
warnings: string[];
requiredActions: string[];
};
}>;
/**
* Provides user-friendly migration instructions
*/
declare function getMigrationInstructions(plan: MigrationPlan): string[];
/**
* Account Diagnostics Utility
*
* Comprehensive diagnostic tools for inspecting and debugging
* account discriminator issues and data format problems.
*/
interface DiagnosticReport {
address: string;
timestamp: string;
accountExists: boolean;
discriminatorValidation: ReturnType<typeof validateAccountDiscriminator>;
inspection: AccountInspectionResult;
migrationPlan: Awaited<ReturnType<typeof createMigrationPlan>>;
migrationSimulation: Awaited<ReturnType<typeof simulateMigration>>;
recommendations: string[];
debugInfo: {
expectedDiscriminator: number[];
actualDiscriminator: number[] | null;
dataPreview: number[];
programId?: string;
};
}
interface BatchDiagnosticReport {
summary: {
total: number;
valid: number;
invalid: number;
needsMigration: number;
notExists: number;
};
rep