@ghostspeak/sdk 2.0.6 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +295 -30
  2. package/dist/GhostSpeakClient-bnXwUPHI.d.ts +1011 -0
  3. package/dist/StakingModule-DunDShLq.d.ts +2446 -0
  4. package/dist/{agent-M74TCRON.js → agent-S42FIMR7.js} +4 -4
  5. package/dist/{agent-M74TCRON.js.map → agent-S42FIMR7.js.map} +1 -1
  6. package/dist/batch-operations-45CQFEID.js +4 -0
  7. package/dist/batch-operations-45CQFEID.js.map +1 -0
  8. package/dist/browser-CI5_6Gzk.d.ts +234 -0
  9. package/dist/browser.d.ts +6 -576
  10. package/dist/browser.js +15 -842
  11. package/dist/browser.js.map +1 -1
  12. package/dist/chunk-46QWY3MG.js +156 -0
  13. package/dist/chunk-46QWY3MG.js.map +1 -0
  14. package/dist/{chunk-F3DZMBUA.js → chunk-5QBSC4T4.js} +327 -493
  15. package/dist/chunk-5QBSC4T4.js.map +1 -0
  16. package/dist/chunk-5QZVFUXB.js +4176 -0
  17. package/dist/chunk-5QZVFUXB.js.map +1 -0
  18. package/dist/chunk-6XCCMJ6M.js +1865 -0
  19. package/dist/chunk-6XCCMJ6M.js.map +1 -0
  20. package/dist/chunk-A7ALCVUI.js +98 -0
  21. package/dist/chunk-A7ALCVUI.js.map +1 -0
  22. package/dist/chunk-AWMGX3OX.js +814 -0
  23. package/dist/chunk-AWMGX3OX.js.map +1 -0
  24. package/dist/chunk-BF3IQ35I.js +284 -0
  25. package/dist/chunk-BF3IQ35I.js.map +1 -0
  26. package/dist/chunk-BQDGRTVP.js +168 -0
  27. package/dist/chunk-BQDGRTVP.js.map +1 -0
  28. package/dist/chunk-IQM5RASO.js +8502 -0
  29. package/dist/chunk-IQM5RASO.js.map +1 -0
  30. package/dist/chunk-JYXSOXCP.js +3850 -0
  31. package/dist/chunk-JYXSOXCP.js.map +1 -0
  32. package/dist/chunk-OXA7MECJ.js +7787 -0
  33. package/dist/chunk-OXA7MECJ.js.map +1 -0
  34. package/dist/chunk-QLRWUHN2.js +231 -0
  35. package/dist/chunk-QLRWUHN2.js.map +1 -0
  36. package/dist/chunk-SKMJJ3Q6.js +125 -0
  37. package/dist/chunk-SKMJJ3Q6.js.map +1 -0
  38. package/dist/chunk-TTB4OS2D.js +69 -0
  39. package/dist/chunk-TTB4OS2D.js.map +1 -0
  40. package/dist/chunk-UP2VWCW5.js +33 -0
  41. package/dist/{chunk-NSBPE2FW.js.map → chunk-UP2VWCW5.js.map} +1 -1
  42. package/dist/{chunk-UJUGGLMT.js → chunk-VQZQCHUT.js} +5 -5
  43. package/dist/{chunk-UJUGGLMT.js.map → chunk-VQZQCHUT.js.map} +1 -1
  44. package/dist/client.d.ts +4 -4
  45. package/dist/client.js +11 -10
  46. package/dist/createAgentAuthorization-KGZNXZBT.js +5 -0
  47. package/dist/createAgentAuthorization-KGZNXZBT.js.map +1 -0
  48. package/dist/credentials.js +1 -1
  49. package/dist/crypto.js +2 -2
  50. package/dist/errors.js +1 -1
  51. package/dist/feature-flags-B1g0DCPe.d.ts +1181 -0
  52. package/dist/generated-QJREJQ2C.js +9 -0
  53. package/dist/{generated-VNLHMR6Y.js.map → generated-QJREJQ2C.js.map} +1 -1
  54. package/dist/{ghostspeak_wasm-SB2RPJ3D.js → ghostspeak_wasm-F227HOSM.js} +3 -3
  55. package/dist/{ghostspeak_wasm-SB2RPJ3D.js.map → ghostspeak_wasm-F227HOSM.js.map} +1 -1
  56. package/dist/index.d.ts +1179 -1498
  57. package/dist/index.js +356 -3578
  58. package/dist/index.js.map +1 -1
  59. package/dist/metafile-esm.json +1 -1
  60. package/dist/minimal/core-minimal.d.ts +2446 -1245
  61. package/dist/minimal/core-minimal.js +9 -9
  62. package/dist/minimal/core-minimal.js.map +1 -1
  63. package/dist/nacl-fast-W5BJ3KZ2.js +2229 -0
  64. package/dist/nacl-fast-W5BJ3KZ2.js.map +1 -0
  65. package/dist/pda-4KP7CURF.js +4 -0
  66. package/dist/pda-4KP7CURF.js.map +1 -0
  67. package/dist/pda-Ce7VYg4T.d.ts +25 -0
  68. package/dist/reputation-types-Yebf0Rm_.d.ts +1071 -0
  69. package/dist/revokeAuthorization-2ZRO6GUZ.js +5 -0
  70. package/dist/revokeAuthorization-2ZRO6GUZ.js.map +1 -0
  71. package/dist/signature-verification-DGxR4aYQ.d.ts +448 -0
  72. package/dist/types.js +1 -1
  73. package/dist/updateReputationWithAuth-PCEUOCFV.js +5 -0
  74. package/dist/updateReputationWithAuth-PCEUOCFV.js.map +1 -0
  75. package/dist/utils.d.ts +69 -203
  76. package/dist/utils.js +15 -153
  77. package/dist/utils.js.map +1 -1
  78. package/package.json +27 -34
  79. package/dist/.tsbuildinfo +0 -1
  80. package/dist/GhostSpeakClient-D_66Uzsf.d.ts +0 -707
  81. package/dist/GovernanceModule-DQYYys-H.d.ts +0 -1766
  82. package/dist/chunk-APCKGD23.js +0 -1328
  83. package/dist/chunk-APCKGD23.js.map +0 -1
  84. package/dist/chunk-ASQXX4IT.js +0 -572
  85. package/dist/chunk-ASQXX4IT.js.map +0 -1
  86. package/dist/chunk-COGZFWOT.js +0 -19657
  87. package/dist/chunk-COGZFWOT.js.map +0 -1
  88. package/dist/chunk-F3DZMBUA.js.map +0 -1
  89. package/dist/chunk-GMHIUK2R.js +0 -7526
  90. package/dist/chunk-GMHIUK2R.js.map +0 -1
  91. package/dist/chunk-IAWBZYPE.js +0 -356
  92. package/dist/chunk-IAWBZYPE.js.map +0 -1
  93. package/dist/chunk-NSBPE2FW.js +0 -15
  94. package/dist/chunk-OWYHJG6H.js +0 -13311
  95. package/dist/chunk-OWYHJG6H.js.map +0 -1
  96. package/dist/chunk-RDDPOFR5.js +0 -3
  97. package/dist/chunk-RDDPOFR5.js.map +0 -1
  98. package/dist/chunk-RERCHKZP.js +0 -35
  99. package/dist/chunk-RERCHKZP.js.map +0 -1
  100. package/dist/chunk-TVVGXYCI.js +0 -2887
  101. package/dist/chunk-TVVGXYCI.js.map +0 -1
  102. package/dist/chunk-ZGP5552B.js +0 -377
  103. package/dist/chunk-ZGP5552B.js.map +0 -1
  104. package/dist/chunk-ZWOYNHVK.js +0 -196
  105. package/dist/chunk-ZWOYNHVK.js.map +0 -1
  106. package/dist/dist/.tsbuildinfo +0 -1
  107. package/dist/elgamal-VZLWB3XK.js +0 -5
  108. package/dist/elgamal-VZLWB3XK.js.map +0 -1
  109. package/dist/feature-flags-V722ZuXO.d.ts +0 -3512
  110. package/dist/generated-VNLHMR6Y.js +0 -5
  111. package/dist/ipfs-types-BOt9ZNg4.d.ts +0 -592
  112. package/dist/multisigConfig-BzEhy6jy.d.ts +0 -58
  113. package/dist/pda-B_nS8SbD.d.ts +0 -114
  114. package/dist/pda-S4BFJVGE.js +0 -4
  115. package/dist/pda-S4BFJVGE.js.map +0 -1
  116. package/dist/system-addresses-BFNLEbFx.d.ts +0 -857
  117. package/dist/token-2022-rpc-RALH4RK7.js +0 -593
  118. package/dist/token-2022-rpc-RALH4RK7.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,23 +1,22 @@
1
- export { c as Credential, a as CredentialKind, C as CredentialModule, b as CredentialStatus, d as CredentialTemplate, G as GhostSpeakClient, I as IssuedCredentialResult, M as MultisigModule, e as UnifiedCredentialConfig, U as UnifiedCredentialService, W as W3CVerifiableCredential, G as default, l as lamportsToSol, s as sol } from './GhostSpeakClient-D_66Uzsf.js';
2
- import { ReadonlyUint8Array, Address, OptionOrNullable, Option, TransactionSigner, AccountMeta, Instruction, InstructionWithData, InstructionWithAccounts, WritableAccount, ReadonlySignerAccount, AccountSignerMeta, ReadonlyAccount, WritableSignerAccount, Slot, Lamports, Epoch, Base58EncodedBytes, Base64EncodedBytes, TransactionError, Base64EncodedWireTransaction, Signature, TransactionMessageBytesBase64, Rpc, SolanaRpcApi, GetTransactionApi, Commitment as Commitment$1, KeyPairSigner } from '@solana/kit';
1
+ import { P as PrivacyMode, R as ReputationTier, S as ScoreRange, a as PrivacySettings, M as MetricVisibility, V as VisibleReputation } from './GhostSpeakClient-bnXwUPHI.js';
2
+ export { j as ApplyPresetParams, A as AuthorizationModule, G as GhostSpeakClient, h as GrantAccessParams, I as InitializePrivacyParams, n as IssuedCredentialResult, e as PRIVACY_CONSTANTS, b as PrivacyModule, f as PrivacyPreset, d as PrivacyPresets, i as RevokeAccessParams, g as SetMetricVisibilityParams, m as UnifiedCredentialConfig, k as UnifiedCredentialService, U as UpdatePrivacyModeParams, c as VisibilityLevel, G as default, l as lamportsToSol, s as sol } from './GhostSpeakClient-bnXwUPHI.js';
3
+ import { Address, ReadonlyUint8Array, Option, Decoder, TransactionSigner, AccountMeta, Instruction, InstructionWithData, InstructionWithAccounts, WritableAccount, ReadonlySignerAccount, AccountSignerMeta, ReadonlyAccount, OptionOrNullable, WritableSignerAccount, Slot, Lamports, Epoch, Base58EncodedBytes, Base64EncodedBytes, TransactionError, Base64EncodedWireTransaction, Signature, TransactionMessageBytesBase64, Commitment as Commitment$1, KeyPairSigner } from '@solana/kit';
3
4
  export { TransactionSigner, address, createKeyPairSignerFromBytes, createSolanaRpc, generateKeyPairSigner } from '@solana/kit';
4
- export { AddressOf, Agent, AgentCreationParams, AgentEvent, AgentMetadata, AgentType, Attachment, Channel, ChannelCreationParams, ChannelEvent, ChannelType, CommunicationMessage, CommunicationSession, ConfidentialBalance, ConfidentialTransfer, CreateCommunicationSessionParams, DeepPartial, ErrorCode, Escrow, EscrowCreationParams, EscrowEvent, Event, FilterOptions, Message, MessageType, Milestone, PaginationOptions, ParticipantStatus, QueryResult, Rating, Reaction, Reputation, Result, SDKError, SendCommunicationMessageParams, SimulationResult, Transaction, TransferProof, UpdateParticipantStatusParams, WithAddress, isError, isSuccess, unwrap } from './types.js';
5
+ export { AddressOf, Agent, AgentCreationParams, AgentEvent, AgentMetadata, AgentType, Attachment, Channel, ChannelCreationParams, ChannelEvent, ChannelType, CommunicationMessage, CommunicationSession, ConfidentialBalance, ConfidentialTransfer, CreateCommunicationSessionParams, DeepPartial, ErrorCode, Escrow, EscrowCreationParams, EscrowEvent, Event, FilterOptions, Message, MessageType, Milestone, PaginationOptions, ParticipantStatus, ParticipantType, QueryResult, Rating, Reaction, Reputation, Result, SDKError, SendCommunicationMessageParams, SimulationResult, Transaction, TransferProof, UpdateParticipantStatusParams, WithAddress, isError, isSuccess, unwrap } from './types.js';
5
6
  export { AccountNotFoundError, ErrorFactory, ErrorHandler, InsufficientBalanceError, InvalidInputError, NetworkError, SimulationFailedError, TimeoutError, TransactionFailedError, ValidationError } from './errors.js';
6
- import { g as GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS } from './GovernanceModule-DQYYys-H.js';
7
- export { t as A2AMessage, s as A2ASession, n as AgentAccount, m as AgentRegistrationData, k as AgentWithAddress, i as AuctionStatus, j as AuctionType, B as BaseModule, Z as Commitment, z as CreateA2ASessionParams, y as CreateEscrowParams, x as CreateJobPostingParams, C as CreateMultisigParams, h as CreateProposalParams, w as CreateServiceListingParams, D as DelegationScope, Y as EmergencyConfig, q as EscrowAccount, r as EscrowStatus, E as ExecutionParams, $ as ExtendedRpcApi, G as GhostSpeakConfig, v as GhostSpeakError, a as GovernanceModule, I as InstructionBuilder, p as JobPosting, M as MarketplaceModule, u as PricingModel, P as ProposalType, R as RegisterAgentParams, _ as RetryConfig, K as RpcAccountInfo, O as RpcAccountInfoResponse, a0 as RpcApi, Q as RpcMultipleAccountsResponse, L as RpcProgramAccount, N as RpcProgramAccountsResponse, H as RpcResponse, a1 as RpcSubscriptionApi, F as SendA2AMessageParams, o as ServiceListingData, l as ServiceListingWithAddress, W as SimulatedTransactionResponse, X as SolanaRpcClient, T as Token2022Module, U as TransactionResponse, V as VoteParams, a2 as getAgentDecoder } from './GovernanceModule-DQYYys-H.js';
7
+ import { c as AccessTier, d as GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, P as PricingModelArgs, E as ExtendedRpcApi } from './StakingModule-DunDShLq.js';
8
+ export { a5 as AgentAccount, A as AgentModule, a4 as AgentRegistrationData, a3 as AgentWithAddress, B as BaseModule, e as CacheConfig, C as CacheManager, f as ClaimGhostParams, aj as Commitment, Z as CreateDidDocumentParams, h as CreateProposalParams, n as Credential, l as CredentialKind, k as CredentialModule, m as CredentialStatus, o as CredentialTemplate, $ as DeactivateDidDocumentParams, Q as DidDocument, r as DidError, s as DidErrorClass, D as DidModule, X as DidResolutionMetadata, ai as EmergencyConfig, j as ExecutionParams, a as GhostModule, G as GhostSpeakConfig, a7 as GhostSpeakError, b as GovernanceModule, I as InstructionBuilder, M as MultisigModule, N as Network, a2 as PayAIReputationRecordInput, g as PreparedClaimResult, a6 as PricingModel, i as ProposalType, a8 as RegisterAgentParams, a1 as ReputationData, R as ReputationModule, a0 as ResolveDidDocumentParams, ak as RetryConfig, aa as RpcAccountInfo, ad as RpcAccountInfoResponse, al as RpcApi, ae as RpcMultipleAccountsResponse, ab as RpcProgramAccount, ac as RpcProgramAccountsResponse, a9 as RpcResponse, am as RpcSubscriptionApi, U as ServiceEndpoint, q as ServiceEndpointType, ag as SimulatedTransactionResponse, ah as SolanaRpcClient, an as StakingAccount, ao as StakingConfig, af as TransactionResponse, _ as UpdateDidDocumentParams, T as VerificationMethod, V as VerificationMethodType, p as VerificationRelationship, Y as W3CDidDocument, W as W3CVerifiableCredential, J as canPerformAction, y as createEd25519VerificationMethod, z as createServiceEndpoint, aq as decodeAgent, t as deriveDidDocumentPda, K as didDocumentToJson, x as exportAsW3CDidDocument, ar as fetchAgent, as as fetchMaybeAgent, u as generateDidString, ap as getAgentDecoder, O as getIdentifierFromDid, H as getMethodsForRelationship, L as getNetworkFromDid, at as getStakingAccountDecoder, au as getStakingConfigDecoder, F as isDidActive, w as parseDidString, v as validateDidString } from './StakingModule-DunDShLq.js';
8
9
  import { Address as Address$1 } from '@solana/addresses';
9
- import { m as ChannelTypeArgs, n as MessageTypeArgs } from './system-addresses-BFNLEbFx.js';
10
- export { c as ASSOCIATED_TOKEN_PROGRAM_ADDRESS, A as AgentModule, C as ChannelModule, o as CreateWorkOrderParams, D as DisputeStatus, E as EscrowModule, G as GHOSTSPEAK_PROGRAM_ID, g as GeneratedChannelType, e as GeneratedEscrowStatus, h as GeneratedMessageType, k as GeneratedWorkOrderStatus, a as NATIVE_MINT_ADDRESS, R as RejectDeliveryParams, S as SubmitDeliveryParams, b as TOKEN_2022_PROGRAM_ADDRESS, T as TOKEN_PROGRAM_ADDRESS, V as VerifyDeliveryParams, W as WorkOrderModule, k as WorkOrderStatus, u as getChannelDecoder, p as getCreateWorkOrderInstruction, t as getEscrowDecoder, v as getMessageDecoder, s as getRejectWorkDeliveryInstruction, q as getSubmitWorkDeliveryInstruction, r as getVerifyWorkDeliveryInstruction, x as getWorkDeliveryDecoder, w as getWorkOrderDecoder } from './system-addresses-BFNLEbFx.js';
10
+ export { l as AuthorizationFilter, p as AuthorizationInvalidReason, q as AuthorizationMessage, n as AuthorizationMetadata, o as AuthorizationProof, u as AuthorizationRevocation, A as AuthorizationStatus, t as AuthorizationUsage, k as AuthorizationWithStatus, B as BatchAuthorizationVerification, C as CreateAuthorizationParams, R as ReputationAuthorization, m as SolanaNetwork, V as VerificationDetails, r as VerifyAuthorizationParams, c as createAuthorizationMessage, b as createSignedAuthorization, e as deserializeAuthorization, g as generateNonce, f as getAuthorizationId, h as isAuthorizationExhausted, i as isAuthorizationExpired, d as serializeAuthorization, a as signAuthorizationMessage, j as validateAuthorizationNetwork, v as verifyAuthorizationSignature } from './signature-verification-DGxR4aYQ.js';
11
+ export { h as ASSOCIATED_TOKEN_PROGRAM_ADDRESS, A as ATTESTATION_SEED, d as AttestationPDAResult, C as CREDENTIAL_SEED, e as CreateAttestationConfig, f as GHOSTSPEAK_PROGRAM_ID, c as GhostOwnershipAttestationData, G as GhostSpeakCredentialConfig, N as NATIVE_MINT_ADDRESS, S as SASAttestationHelper, a as SAS_PROGRAM_ID, b as SCHEMA_SEED, g as TOKEN_2022_PROGRAM_ADDRESS, T as TOKEN_PROGRAM_ADDRESS } from './browser-CI5_6Gzk.js';
12
+ import { I as IPFSClient, C as ClientEncryptionService } from './feature-flags-B1g0DCPe.js';
13
+ export { A as AccountInspectionResult, a5 as AssociatedTokenAccount, K as BatchDiagnosticReport, af as ClientEncryptionOptions, a7 as ConfidentialTransferConfig, J as DiagnosticReport, D as DiscriminatorValidationResult, ad as EncryptedData, ai as FeatureFlagManager, aj as FeatureFlags, G as GhostSpeakSDKError, a8 as InterestBearingConfig, L as LegacyAgentData, M as MigrationPlan, x as MigrationResult, ae as PrivateMetadata, R as ReputationTagEngine, _ as TokenExtension, T as TokenProgram, a6 as TransferFeeConfig, m as createDiscriminatorErrorMessage, c as createErrorContext, o as createMigrationPlan, q as createMigrationReport, d as deriveAssociatedTokenAddress, a9 as deriveMultisigPda, aa as deriveProposalPda, S as deriveSplTokenAssociatedTokenAddress, U as deriveToken2022AssociatedTokenAddress, a as detectTokenProgram, B as diagnoseAccountFromChain, F as diagnoseBatchFromChain, e as enhanceTransactionError, H as exportDiagnosticReport, Q as extractInstructionName, u as extractLegacyData, f as formatTokenAmount, ab as generateLocalPrivacyProof, W as getAllAssociatedTokenAddresses, V as getAssociatedTokenAccount, a3 as getConfidentialTransferConfig, ag as getFeatureFlags, a4 as getInterestBearingConfig, t as getMigrationInstructions, Y as getTokenProgramAddress, Z as getTokenProgramFromAddress, g as getTokenProgramType, a2 as getTransferFeeConfig, a0 as hasConfidentialTransferExtension, a1 as hasInterestBearingExtension, $ as hasTransferFeeExtension, n as inspectAccountData, ah as isFeatureEnabled, i as isToken2022Mint, O as logEnhancedError, p as parseTokenAmount, y as runAccountDiagnostics, z as runBatchDiagnostics, s as safeDecodeAgent, r as simulateMigration, v as validateAccountDiscriminator, X as validateAssociatedTokenAddress, P as validatePreconditions, ac as verifyLocalPrivacyProof, w as withEnhancedErrors, N as withEnhancedErrorsSync } from './feature-flags-B1g0DCPe.js';
14
+ import { Rpc, GetSignaturesForAddressApi, GetTransactionApi, GetAccountInfoApi } from '@solana/rpc';
15
+ import { I as IPFSConfig, g as IPFSUploadOptions, C as ContentStorageResult, m as IPFSContentMetadata, h as IPFSOperationResult, r as IPFSError } from './reputation-types-Yebf0Rm_.js';
16
+ export { B as BadgeType, t as BehaviorTag, A as BulkTagUpdateRequest, o as CategoryReputation, u as ComplianceTag, D as DEFAULT_TAG_DECAY, K as FlexibleContent, l as IPFSPinResult, H as IPFSProviderConfig, j as IPFSRetrievalOptions, k as IPFSRetrievalResult, i as IPFSUploadResult, J as JobPerformance, F as ProposalStatus, s as REPUTATION_CONSTANTS, a as ReputationCalculationResult, p as ReputationTier, S as SkillTag, v as TAG_CONSTANTS, q as TagCategory, w as TagConfidenceLevel, x as TagCriteria, T as TagDecayConfig, y as TagEvaluation, d as TagFilters, e as TagQueryResult, b as TagReputationMetrics, c as TagScoreType, z as TagUpdateRequest } from './reputation-types-Yebf0Rm_.js';
11
17
  export { CrossmintClientOptions, CredentialType as CrossmintCredentialType, IssuedCredential as CrossmintIssuedCredential, CrossmintVCClient, GHOSTSPEAK_CREDENTIAL_TYPES } from './credentials.js';
12
- import { EventEmitter } from 'node:events';
13
- import { I as IPFSClient, C as ClientEncryptionService } from './feature-flags-V722ZuXO.js';
14
- export { r as AccountInspectionResult, m as AgentDiscoveryClient, a8 as AssociatedTokenAccount, Q as BatchDiagnosticReport, aK as ClientEncryptionOptions, aa as ConfidentialTransferConfig, av as ConfidentialTransferProof, aB as CpiGuardConfig, P as DiagnosticReport, D as DiscriminatorValidationResult, aI as EncryptedData, aN as FeatureFlagManager, aO as FeatureFlags, G as GhostSpeakSDKError, aD as ImmutableOwnerConfig, ab as InterestBearingConfig, aw as InterestCalculation, L as LegacyAgentData, aA as MetadataPointerConfig, M as MigrationPlan, F as MigrationResult, aC as NonTransferableConfig, aJ as PrivateMetadata, at as TokenAccountState, a1 as TokenExtension, az as TokenMetadata, T as TokenProgram, au as TransferFeeCalculation, a9 as TransferFeeConfig, ay as TransferHookContext, ax as TransferHookInstruction, ap as basisPointsToPercentage, ai as calculateCompoundInterest, ah as calculateInterest, ad as calculateRequiredAmountForNetTransfer, ac as calculateTransferFee, an as canTransfer, n as createAgentDiscoveryClient, o as createDiscriminatorErrorMessage, c as createErrorContext, u as createMigrationPlan, x as createMigrationReport, ak as createTransferHookInstruction, d as deriveAssociatedTokenAddress, aE as deriveMultisigPda, aF as deriveProposalPda, W as deriveSplTokenAssociatedTokenAddress, X as deriveToken2022AssociatedTokenAddress, am as deserializeTokenMetadata, a as detectTokenProgram, K as diagnoseAccountFromChain, N as diagnoseBatchFromChain, e as enhanceTransactionError, ae as estimateAccumulatedFees, as as estimateComputeUnits, O as exportDiagnosticReport, V as extractInstructionName, B as extractLegacyData, ar as formatBasisPoints, f as formatTokenAmount, af as generateConfidentialTransferProof, aG as generateLocalPrivacyProof, Z as getAllAssociatedTokenAddresses, Y as getAssociatedTokenAccount, a6 as getConfidentialTransferConfig, aL as getFeatureFlags, a7 as getInterestBearingConfig, z as getMigrationInstructions, ao as getRequiredExtensions, $ as getTokenProgramAddress, a0 as getTokenProgramFromAddress, g as getTokenProgramType, a5 as getTransferFeeConfig, a3 as hasConfidentialTransferExtension, a4 as hasInterestBearingExtension, a2 as hasTransferFeeExtension, q as inspectAccountData, aM as isFeatureEnabled, i as isToken2022Mint, S as logEnhancedError, p as parseTokenAmount, aq as percentageToBasisPoints, H as runAccountDiagnostics, J as runBatchDiagnostics, s as safeDecodeAgent, al as serializeTokenMetadata, y as simulateMigration, v as validateAccountDiscriminator, _ as validateAssociatedTokenAddress, U as validatePreconditions, aj as validateTransferHookInstruction, ag as verifyConfidentialTransferProof, aH as verifyLocalPrivacyProof, w as withEnhancedErrors, R as withEnhancedErrorsSync } from './feature-flags-V722ZuXO.js';
15
18
  export { ElGamalCiphertext, ElGamalKeypair, TransferProof as ElGamalTransferProof, WasmModule, WithdrawProof, decrypt, elgamal, encrypt, generateKeypair, generateTransferProof, generateWithdrawProof, isWasmAvailable, loadWasmModule, wasmBridge } from './crypto.js';
16
- import { I as IPFSConfig, a as IPFSUploadOptions, C as ContentStorageResult, b as IPFSContentMetadata, c as IPFSOperationResult, d as IPFSError } from './ipfs-types-BOt9ZNg4.js';
17
- export { F as FlexibleContent, j as IPFSPinResult, f as IPFSProviderConfig, h as IPFSRetrievalOptions, i as IPFSRetrievalResult, g as IPFSUploadResult, e as ProposalStatus } from './ipfs-types-BOt9ZNg4.js';
18
- export { j as deriveA2AMessagePda, k as deriveA2ASessionPda, d as deriveAgentPda, r as deriveAgentVerificationPda, e as deriveChannelPda, m as deriveEscrowPDA, n as deriveJobApplicationPda, h as deriveJobPostingPda, p as derivePaymentPda, a as deriveServiceListingPda, q as deriveServicePurchasePda, i as deriveUserRegistryPda, o as deriveWorkDeliveryPda, l as deriveWorkOrderPda, f as findProgramDerivedAddress } from './pda-B_nS8SbD.js';
19
- import { Rpc as Rpc$1, GetAccountInfoApi } from '@solana/rpc';
20
- import './multisigConfig-BzEhy6jy.js';
19
+ export { d as deriveAgentPda, b as deriveAgentVerificationPda, a as deriveUserRegistryPda, f as findProgramDerivedAddress } from './pda-Ce7VYg4T.js';
21
20
 
22
21
  /**
23
22
  * This code was AUTOGENERATED using the Codama library.
@@ -27,16 +26,19 @@ import './multisigConfig-BzEhy6jy.js';
27
26
  * @see https://github.com/codama-idl/codama
28
27
  */
29
28
 
30
- type A2AMessage = {
31
- discriminator: ReadonlyUint8Array;
32
- messageId: bigint;
33
- session: Address;
34
- sender: Address;
35
- content: string;
36
- messageType: string;
37
- sentAt: bigint;
38
- bump: number;
29
+ /** Arbitrator's final decision on disputed escrow */
30
+ type ArbitratorDecision = {
31
+ __kind: "FavorClient";
32
+ reason: string;
33
+ } | {
34
+ __kind: "FavorAgent";
35
+ reason: string;
36
+ } | {
37
+ __kind: "Split";
38
+ clientPercentage: number;
39
+ reason: string;
39
40
  };
41
+ type ArbitratorDecisionArgs = ArbitratorDecision;
40
42
 
41
43
  /**
42
44
  * This code was AUTOGENERATED using the Codama library.
@@ -46,17 +48,10 @@ type A2AMessage = {
46
48
  * @see https://github.com/codama-idl/codama
47
49
  */
48
50
 
49
- type A2ASession = {
50
- discriminator: ReadonlyUint8Array;
51
- sessionId: bigint;
52
- initiator: Address;
53
- responder: Address;
54
- sessionType: string;
55
- metadata: string;
56
- isActive: boolean;
57
- createdAt: bigint;
58
- expiresAt: bigint;
59
- bump: number;
51
+ type DeliverySubmittedEvent = {
52
+ escrowId: bigint;
53
+ agent: Address;
54
+ deliveryProof: string;
60
55
  };
61
56
 
62
57
  /**
@@ -67,14 +62,10 @@ type A2ASession = {
67
62
  * @see https://github.com/codama-idl/codama
68
63
  */
69
64
 
70
- type A2AStatus = {
71
- discriminator: ReadonlyUint8Array;
72
- agent: Address;
73
- status: string;
74
- capabilities: Array<string>;
75
- availability: boolean;
76
- lastUpdated: bigint;
77
- bump: number;
65
+ type DisputeFiledEvent = {
66
+ escrowId: bigint;
67
+ client: Address;
68
+ reason: string;
78
69
  };
79
70
 
80
71
  /**
@@ -85,15 +76,10 @@ type A2AStatus = {
85
76
  * @see https://github.com/codama-idl/codama
86
77
  */
87
78
 
88
- type AgentAnalyticsEvent = {
89
- agent: Address;
90
- operation: string;
91
- revenue: bigint;
92
- transactionCount: number;
93
- successRate: number;
94
- averageRating: number;
95
- responseTime: bigint;
96
- timestamp: bigint;
79
+ type DisputeResolvedEvent = {
80
+ escrowId: bigint;
81
+ decision: ArbitratorDecision;
82
+ arbitrator: Address;
97
83
  };
98
84
 
99
85
  /**
@@ -104,11 +90,10 @@ type AgentAnalyticsEvent = {
104
90
  * @see https://github.com/codama-idl/codama
105
91
  */
106
92
 
107
- type AttachmentInfoArgs = {
108
- fileType: string;
109
- fileSize: number | bigint;
110
- fileHash: string;
111
- storageUrl: string;
93
+ type EscrowCompletedEvent = {
94
+ escrowId: bigint;
95
+ agent: Address;
96
+ amount: bigint;
112
97
  };
113
98
 
114
99
  /**
@@ -119,12 +104,12 @@ type AttachmentInfoArgs = {
119
104
  * @see https://github.com/codama-idl/codama
120
105
  */
121
106
 
122
- type ChannelMetadataArgs = {
123
- name: OptionOrNullable<string>;
124
- description: OptionOrNullable<string>;
125
- avatarUrl: OptionOrNullable<string>;
126
- tags: Array<string>;
127
- settings: ChannelSettingsArgs;
107
+ type EscrowCreatedEvent = {
108
+ escrowId: bigint;
109
+ client: Address;
110
+ agent: Address;
111
+ amount: bigint;
112
+ deadline: bigint;
128
113
  };
129
114
 
130
115
  /**
@@ -135,15 +120,13 @@ type ChannelMetadataArgs = {
135
120
  * @see https://github.com/codama-idl/codama
136
121
  */
137
122
 
138
- type ChannelSettings = {
139
- allowFileSharing: boolean;
140
- allowExternalInvites: boolean;
141
- messageRetentionDays: number;
142
- maxMessageSize: number;
143
- requireEncryption: boolean;
144
- autoArchiveAfterDays: number;
145
- };
146
- type ChannelSettingsArgs = ChannelSettings;
123
+ /** Escrow lifecycle states */
124
+ declare enum EscrowStatus {
125
+ Active = 0,
126
+ Completed = 1,
127
+ Disputed = 2,
128
+ Cancelled = 3
129
+ }
147
130
 
148
131
  /**
149
132
  * This code was AUTOGENERATED using the Codama library.
@@ -153,12 +136,11 @@ type ChannelSettingsArgs = ChannelSettings;
153
136
  * @see https://github.com/codama-idl/codama
154
137
  */
155
138
 
156
- type EconomicMetricsEvent = {
157
- totalValueLocked: bigint;
158
- dailyVolume: bigint;
159
- feeRevenue: bigint;
160
- uniqueUsers: number;
161
- timestamp: bigint;
139
+ type GhostSlashedEvent = {
140
+ agent: Address;
141
+ amount: bigint;
142
+ reason: SlashReason;
143
+ newTier: AccessTier;
162
144
  };
163
145
 
164
146
  /**
@@ -169,12 +151,14 @@ type EconomicMetricsEvent = {
169
151
  * @see https://github.com/codama-idl/codama
170
152
  */
171
153
 
172
- type MarketplaceActivityEvent = {
173
- activityType: string;
154
+ type GhostStakedEvent = {
174
155
  agent: Address;
175
- service: Option<Address>;
176
- value: bigint;
177
- timestamp: bigint;
156
+ amount: bigint;
157
+ unlockAt: bigint;
158
+ reputationBoostBps: number;
159
+ tier: AccessTier;
160
+ dailyApiCalls: number;
161
+ votingPower: bigint;
178
162
  };
179
163
 
180
164
  /**
@@ -185,12 +169,9 @@ type MarketplaceActivityEvent = {
185
169
  * @see https://github.com/codama-idl/codama
186
170
  */
187
171
 
188
- type MessageMetadataArgs = {
189
- replyTo: OptionOrNullable<Address>;
190
- threadId: OptionOrNullable<string>;
191
- attachments: Array<AttachmentInfoArgs>;
192
- mentions: Array<Address>;
193
- reactions: Array<MessageReactionArgs>;
172
+ type GhostUnstakedEvent = {
173
+ agent: Address;
174
+ amount: bigint;
194
175
  };
195
176
 
196
177
  /**
@@ -201,11 +182,15 @@ type MessageMetadataArgs = {
201
182
  * @see https://github.com/codama-idl/codama
202
183
  */
203
184
 
204
- type MessageReaction = {
205
- emoji: string;
206
- users: Array<Address>;
185
+ type ReputationTagsUpdatedEvent = {
186
+ agent: Address;
187
+ totalTags: number;
188
+ skillTagsCount: number;
189
+ behaviorTagsCount: number;
190
+ complianceTagsCount: number;
191
+ tagScoresCount: number;
192
+ timestamp: bigint;
207
193
  };
208
- type MessageReactionArgs = MessageReaction;
209
194
 
210
195
  /**
211
196
  * This code was AUTOGENERATED using the Codama library.
@@ -215,12 +200,15 @@ type MessageReactionArgs = MessageReaction;
215
200
  * @see https://github.com/codama-idl/codama
216
201
  */
217
202
 
218
- type NetworkHealthEvent = {
219
- activeAgents: number;
220
- transactionThroughput: bigint;
221
- averageLatency: bigint;
222
- errorRate: number;
223
- timestamp: bigint;
203
+ type ServiceEndpointArgs = {
204
+ /** Service identifier (e.g., "agent-api") */
205
+ id: string;
206
+ /** Type of service */
207
+ serviceType: ServiceEndpointTypeArgs;
208
+ /** Service endpoint URI */
209
+ serviceEndpoint: string;
210
+ /** Optional description */
211
+ description: string;
224
212
  };
225
213
 
226
214
  /**
@@ -231,11 +219,15 @@ type NetworkHealthEvent = {
231
219
  * @see https://github.com/codama-idl/codama
232
220
  */
233
221
 
234
- /** Participant type enum for distinguishing between humans and agents */
235
- declare enum ParticipantType {
236
- Human = 0,
237
- Agent = 1
222
+ /** Service endpoint type */
223
+ declare enum ServiceEndpointType {
224
+ AIAgentService = 0,
225
+ DIDCommMessaging = 1,
226
+ CredentialRepository = 2,
227
+ LinkedDomains = 3,
228
+ Custom = 4
238
229
  }
230
+ type ServiceEndpointTypeArgs = ServiceEndpointType;
239
231
 
240
232
  /**
241
233
  * This code was AUTOGENERATED using the Codama library.
@@ -245,14 +237,13 @@ declare enum ParticipantType {
245
237
  * @see https://github.com/codama-idl/codama
246
238
  */
247
239
 
248
- type ServicePerformanceEvent = {
249
- service: Address;
250
- provider: Address;
251
- executionTime: bigint;
252
- success: boolean;
253
- qualityScore: Option<number>;
254
- timestamp: bigint;
255
- };
240
+ /** Reasons for slashing staked tokens */
241
+ declare enum SlashReason {
242
+ Fraud = 0,
243
+ DisputeLoss = 1,
244
+ Custom = 2
245
+ }
246
+ type SlashReasonArgs = SlashReason;
256
247
 
257
248
  /**
258
249
  * This code was AUTOGENERATED using the Codama library.
@@ -262,29 +253,41 @@ type ServicePerformanceEvent = {
262
253
  * @see https://github.com/codama-idl/codama
263
254
  */
264
255
 
265
- type TransactionAnalyticsEvent = {
266
- transactionType: string;
267
- amount: bigint;
268
- from: Address;
269
- to: Address;
270
- status: string;
256
+ type TagDecayAppliedEvent = {
257
+ agent: Address;
258
+ tagsRemoved: number;
259
+ remainingTags: number;
271
260
  timestamp: bigint;
272
- blockHeight: bigint;
273
261
  };
274
262
 
275
263
  /**
276
- * This code was AUTOGENERATED by scripts/generate-missing-types.ts
264
+ * This code was AUTOGENERATED using the Codama library.
265
+ * Please DO NOT EDIT THIS FILE, instead use visitors
266
+ * to add features, then rerun Codama to update it.
267
+ *
268
+ * @see https://github.com/codama-idl/codama
277
269
  */
278
270
 
279
- type CommunicationSessionData = {
280
- session_id: bigint;
281
- initiator: Address;
282
- initiator_type: ParticipantType;
283
- responder: Address;
284
- responder_type: ParticipantType;
285
- session_type: string;
286
- metadata: string;
287
- expires_at: bigint;
271
+ /** Tag score with confidence tracking */
272
+ type TagScore = {
273
+ /** Tag name (e.g., "fast-responder", "defi-expert") */
274
+ tagName: string;
275
+ /** Confidence score in basis points (0-10000) */
276
+ confidence: number;
277
+ /** Number of supporting data points for this tag */
278
+ evidenceCount: number;
279
+ /** Last time this tag was updated */
280
+ lastUpdated: bigint;
281
+ };
282
+ type TagScoreArgs = {
283
+ /** Tag name (e.g., "fast-responder", "defi-expert") */
284
+ tagName: string;
285
+ /** Confidence score in basis points (0-10000) */
286
+ confidence: number;
287
+ /** Number of supporting data points for this tag */
288
+ evidenceCount: number;
289
+ /** Last time this tag was updated */
290
+ lastUpdated: number | bigint;
288
291
  };
289
292
 
290
293
  /**
@@ -295,26 +298,97 @@ type CommunicationSessionData = {
295
298
  * @see https://github.com/codama-idl/codama
296
299
  */
297
300
 
298
- type AddMessageReactionInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountChannel extends string | AccountMeta<string> = string, TAccountMessage extends string | AccountMeta<string> = string, TAccountReentrancyGuard extends string | AccountMeta<string> = string, TAccountUser extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
299
- TAccountChannel extends string ? WritableAccount<TAccountChannel> : TAccountChannel,
300
- TAccountMessage extends string ? WritableAccount<TAccountMessage> : TAccountMessage,
301
- TAccountReentrancyGuard extends string ? WritableAccount<TAccountReentrancyGuard> : TAccountReentrancyGuard,
302
- TAccountUser extends string ? ReadonlySignerAccount<TAccountUser> & AccountSignerMeta<TAccountUser> : TAccountUser,
303
- ...TRemainingAccounts
304
- ]>;
305
- type AddMessageReactionInstructionDataArgs = {
306
- reaction: string;
301
+ type VerificationMethodArgs = {
302
+ /** Method identifier (e.g., "key-1") */
303
+ id: string;
304
+ /** Type of verification method */
305
+ methodType: VerificationMethodTypeArgs;
306
+ /** DID of the controller (usually the DID itself) */
307
+ controller: string;
308
+ /** Public key in multibase format (base58btc) */
309
+ publicKeyMultibase: string;
310
+ /** Verification relationships this key has */
311
+ relationships: Array<VerificationRelationshipArgs>;
312
+ /** Creation timestamp */
313
+ createdAt: number | bigint;
314
+ /** Revoked flag */
315
+ revoked: boolean;
307
316
  };
308
- type AddMessageReactionInput<TAccountChannel extends string = string, TAccountMessage extends string = string, TAccountReentrancyGuard extends string = string, TAccountUser extends string = string> = {
309
- channel: Address<TAccountChannel>;
310
- message: Address<TAccountMessage>;
311
- reentrancyGuard: Address<TAccountReentrancyGuard>;
312
- user: TransactionSigner<TAccountUser>;
313
- reaction: AddMessageReactionInstructionDataArgs["reaction"];
317
+
318
+ /**
319
+ * This code was AUTOGENERATED using the Codama library.
320
+ * Please DO NOT EDIT THIS FILE, instead use visitors
321
+ * to add features, then rerun Codama to update it.
322
+ *
323
+ * @see https://github.com/codama-idl/codama
324
+ */
325
+
326
+ /** Verification method type for DIDs */
327
+ declare enum VerificationMethodType {
328
+ Ed25519VerificationKey2020 = 0,
329
+ X25519KeyAgreementKey2020 = 1,
330
+ EcdsaSecp256k1VerificationKey2019 = 2
331
+ }
332
+ type VerificationMethodTypeArgs = VerificationMethodType;
333
+
334
+ /**
335
+ * This code was AUTOGENERATED using the Codama library.
336
+ * Please DO NOT EDIT THIS FILE, instead use visitors
337
+ * to add features, then rerun Codama to update it.
338
+ *
339
+ * @see https://github.com/codama-idl/codama
340
+ */
341
+
342
+ /** Verification relationship types */
343
+ declare enum VerificationRelationship {
344
+ Authentication = 0,
345
+ AssertionMethod = 1,
346
+ KeyAgreement = 2,
347
+ CapabilityInvocation = 3,
348
+ CapabilityDelegation = 4
349
+ }
350
+ type VerificationRelationshipArgs = VerificationRelationship;
351
+
352
+ /**
353
+ * This code was AUTOGENERATED using the Codama library.
354
+ * Please DO NOT EDIT THIS FILE, instead use visitors
355
+ * to add features, then rerun Codama to update it.
356
+ *
357
+ * @see https://github.com/codama-idl/codama
358
+ */
359
+
360
+ type GhostProtectEscrow = {
361
+ discriminator: ReadonlyUint8Array;
362
+ /** Unique escrow ID */
363
+ escrowId: bigint;
364
+ /** Client (payer) */
365
+ client: Address;
366
+ /** Agent (service provider) */
367
+ agent: Address;
368
+ /** Payment amount */
369
+ amount: bigint;
370
+ /** Payment token mint */
371
+ tokenMint: Address;
372
+ /** Escrow status */
373
+ status: EscrowStatus;
374
+ /** Job description (IPFS hash) */
375
+ jobDescription: string;
376
+ /** Delivery proof (IPFS hash) */
377
+ deliveryProof: Option<string>;
378
+ /** Deadline timestamp */
379
+ deadline: bigint;
380
+ /** Created timestamp */
381
+ createdAt: bigint;
382
+ /** Completed/disputed timestamp */
383
+ completedAt: Option<bigint>;
384
+ /** Dispute reason (if disputed) */
385
+ disputeReason: Option<string>;
386
+ /** Arbitrator decision (if disputed) */
387
+ arbitratorDecision: Option<ArbitratorDecision>;
388
+ bump: number;
314
389
  };
315
- declare function getAddMessageReactionInstruction<TAccountChannel extends string, TAccountMessage extends string, TAccountReentrancyGuard extends string, TAccountUser extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: AddMessageReactionInput<TAccountChannel, TAccountMessage, TAccountReentrancyGuard, TAccountUser>, config?: {
316
- programAddress?: TProgramAddress;
317
- }): AddMessageReactionInstruction<TProgramAddress, TAccountChannel, TAccountMessage, TAccountReentrancyGuard, TAccountUser>;
390
+ /** Gets the decoder for {@link GhostProtectEscrow} account data. */
391
+ declare function getGhostProtectEscrowDecoder(): Decoder<GhostProtectEscrow>;
318
392
 
319
393
  /**
320
394
  * This code was AUTOGENERATED using the Codama library.
@@ -324,33 +398,24 @@ declare function getAddMessageReactionInstruction<TAccountChannel extends string
324
398
  * @see https://github.com/codama-idl/codama
325
399
  */
326
400
 
327
- type CancelEscrowInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountEscrow extends string | AccountMeta<string> = string, TAccountReentrancyGuard extends string | AccountMeta<string> = string, TAccountEscrowTokenAccount extends string | AccountMeta<string> = string, TAccountClientRefundAccount extends string | AccountMeta<string> = string, TAccountPaymentToken extends string | AccountMeta<string> = string, TAccountAuthority extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
401
+ type ApproveDeliveryInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountEscrow extends string | AccountMeta<string> = string, TAccountEscrowVault extends string | AccountMeta<string> = string, TAccountAgentTokenAccount extends string | AccountMeta<string> = string, TAccountClient extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
328
402
  TAccountEscrow extends string ? WritableAccount<TAccountEscrow> : TAccountEscrow,
329
- TAccountReentrancyGuard extends string ? WritableAccount<TAccountReentrancyGuard> : TAccountReentrancyGuard,
330
- TAccountEscrowTokenAccount extends string ? WritableAccount<TAccountEscrowTokenAccount> : TAccountEscrowTokenAccount,
331
- TAccountClientRefundAccount extends string ? WritableAccount<TAccountClientRefundAccount> : TAccountClientRefundAccount,
332
- TAccountPaymentToken extends string ? ReadonlyAccount<TAccountPaymentToken> : TAccountPaymentToken,
333
- TAccountAuthority extends string ? WritableSignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
403
+ TAccountEscrowVault extends string ? WritableAccount<TAccountEscrowVault> : TAccountEscrowVault,
404
+ TAccountAgentTokenAccount extends string ? WritableAccount<TAccountAgentTokenAccount> : TAccountAgentTokenAccount,
405
+ TAccountClient extends string ? ReadonlySignerAccount<TAccountClient> & AccountSignerMeta<TAccountClient> : TAccountClient,
334
406
  TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
335
407
  ...TRemainingAccounts
336
408
  ]>;
337
- type CancelEscrowInstructionDataArgs = {
338
- cancellationReason: string;
339
- };
340
- type CancelEscrowInput<TAccountEscrow extends string = string, TAccountReentrancyGuard extends string = string, TAccountEscrowTokenAccount extends string = string, TAccountClientRefundAccount extends string = string, TAccountPaymentToken extends string = string, TAccountAuthority extends string = string, TAccountTokenProgram extends string = string> = {
409
+ type ApproveDeliveryInput<TAccountEscrow extends string = string, TAccountEscrowVault extends string = string, TAccountAgentTokenAccount extends string = string, TAccountClient extends string = string, TAccountTokenProgram extends string = string> = {
341
410
  escrow: Address<TAccountEscrow>;
342
- reentrancyGuard: Address<TAccountReentrancyGuard>;
343
- escrowTokenAccount: Address<TAccountEscrowTokenAccount>;
344
- clientRefundAccount: Address<TAccountClientRefundAccount>;
345
- /** The token mint used for payments */
346
- paymentToken: Address<TAccountPaymentToken>;
347
- authority: TransactionSigner<TAccountAuthority>;
411
+ escrowVault: Address<TAccountEscrowVault>;
412
+ agentTokenAccount: Address<TAccountAgentTokenAccount>;
413
+ client: TransactionSigner<TAccountClient>;
348
414
  tokenProgram?: Address<TAccountTokenProgram>;
349
- cancellationReason: CancelEscrowInstructionDataArgs["cancellationReason"];
350
415
  };
351
- declare function getCancelEscrowInstruction<TAccountEscrow extends string, TAccountReentrancyGuard extends string, TAccountEscrowTokenAccount extends string, TAccountClientRefundAccount extends string, TAccountPaymentToken extends string, TAccountAuthority extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: CancelEscrowInput<TAccountEscrow, TAccountReentrancyGuard, TAccountEscrowTokenAccount, TAccountClientRefundAccount, TAccountPaymentToken, TAccountAuthority, TAccountTokenProgram>, config?: {
416
+ declare function getApproveDeliveryInstruction<TAccountEscrow extends string, TAccountEscrowVault extends string, TAccountAgentTokenAccount extends string, TAccountClient extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: ApproveDeliveryInput<TAccountEscrow, TAccountEscrowVault, TAccountAgentTokenAccount, TAccountClient, TAccountTokenProgram>, config?: {
352
417
  programAddress?: TProgramAddress;
353
- }): CancelEscrowInstruction<TProgramAddress, TAccountEscrow, TAccountReentrancyGuard, TAccountEscrowTokenAccount, TAccountClientRefundAccount, TAccountPaymentToken, TAccountAuthority, TAccountTokenProgram>;
418
+ }): ApproveDeliveryInstruction<TProgramAddress, TAccountEscrow, TAccountEscrowVault, TAccountAgentTokenAccount, TAccountClient, TAccountTokenProgram>;
354
419
 
355
420
  /**
356
421
  * This code was AUTOGENERATED using the Codama library.
@@ -360,32 +425,33 @@ declare function getCancelEscrowInstruction<TAccountEscrow extends string, TAcco
360
425
  * @see https://github.com/codama-idl/codama
361
426
  */
362
427
 
363
- type CompleteEscrowInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountEscrow extends string | AccountMeta<string> = string, TAccountReentrancyGuard extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountEscrowTokenAccount extends string | AccountMeta<string> = string, TAccountAgentTokenAccount extends string | AccountMeta<string> = string, TAccountAuthority extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
428
+ type ArbitrateDisputeInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountEscrow extends string | AccountMeta<string> = string, TAccountEscrowVault extends string | AccountMeta<string> = string, TAccountAgentTokenAccount extends string | AccountMeta<string> = string, TAccountClientTokenAccount extends string | AccountMeta<string> = string, TAccountAgentStaking extends string | AccountMeta<string> = string, TAccountArbitrator extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
364
429
  TAccountEscrow extends string ? WritableAccount<TAccountEscrow> : TAccountEscrow,
365
- TAccountReentrancyGuard extends string ? WritableAccount<TAccountReentrancyGuard> : TAccountReentrancyGuard,
366
- TAccountAgent extends string ? WritableAccount<TAccountAgent> : TAccountAgent,
367
- TAccountEscrowTokenAccount extends string ? WritableAccount<TAccountEscrowTokenAccount> : TAccountEscrowTokenAccount,
430
+ TAccountEscrowVault extends string ? WritableAccount<TAccountEscrowVault> : TAccountEscrowVault,
368
431
  TAccountAgentTokenAccount extends string ? WritableAccount<TAccountAgentTokenAccount> : TAccountAgentTokenAccount,
369
- TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
432
+ TAccountClientTokenAccount extends string ? WritableAccount<TAccountClientTokenAccount> : TAccountClientTokenAccount,
433
+ TAccountAgentStaking extends string ? WritableAccount<TAccountAgentStaking> : TAccountAgentStaking,
434
+ TAccountArbitrator extends string ? ReadonlySignerAccount<TAccountArbitrator> & AccountSignerMeta<TAccountArbitrator> : TAccountArbitrator,
370
435
  TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
371
436
  ...TRemainingAccounts
372
437
  ]>;
373
- type CompleteEscrowInstructionDataArgs = {
374
- resolutionNotes: OptionOrNullable<string>;
438
+ type ArbitrateDisputeInstructionDataArgs = {
439
+ decision: ArbitratorDecisionArgs;
375
440
  };
376
- type CompleteEscrowInput<TAccountEscrow extends string = string, TAccountReentrancyGuard extends string = string, TAccountAgent extends string = string, TAccountEscrowTokenAccount extends string = string, TAccountAgentTokenAccount extends string = string, TAccountAuthority extends string = string, TAccountTokenProgram extends string = string> = {
441
+ type ArbitrateDisputeInput<TAccountEscrow extends string = string, TAccountEscrowVault extends string = string, TAccountAgentTokenAccount extends string = string, TAccountClientTokenAccount extends string = string, TAccountAgentStaking extends string = string, TAccountArbitrator extends string = string, TAccountTokenProgram extends string = string> = {
377
442
  escrow: Address<TAccountEscrow>;
378
- reentrancyGuard: Address<TAccountReentrancyGuard>;
379
- agent: Address<TAccountAgent>;
380
- escrowTokenAccount: Address<TAccountEscrowTokenAccount>;
443
+ escrowVault: Address<TAccountEscrowVault>;
381
444
  agentTokenAccount: Address<TAccountAgentTokenAccount>;
382
- authority: TransactionSigner<TAccountAuthority>;
445
+ clientTokenAccount: Address<TAccountClientTokenAccount>;
446
+ /** Agent's staking account (for potential slashing) */
447
+ agentStaking: Address<TAccountAgentStaking>;
448
+ arbitrator: TransactionSigner<TAccountArbitrator>;
383
449
  tokenProgram?: Address<TAccountTokenProgram>;
384
- resolutionNotes: CompleteEscrowInstructionDataArgs["resolutionNotes"];
450
+ decision: ArbitrateDisputeInstructionDataArgs["decision"];
385
451
  };
386
- declare function getCompleteEscrowInstruction<TAccountEscrow extends string, TAccountReentrancyGuard extends string, TAccountAgent extends string, TAccountEscrowTokenAccount extends string, TAccountAgentTokenAccount extends string, TAccountAuthority extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: CompleteEscrowInput<TAccountEscrow, TAccountReentrancyGuard, TAccountAgent, TAccountEscrowTokenAccount, TAccountAgentTokenAccount, TAccountAuthority, TAccountTokenProgram>, config?: {
452
+ declare function getArbitrateDisputeInstruction<TAccountEscrow extends string, TAccountEscrowVault extends string, TAccountAgentTokenAccount extends string, TAccountClientTokenAccount extends string, TAccountAgentStaking extends string, TAccountArbitrator extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: ArbitrateDisputeInput<TAccountEscrow, TAccountEscrowVault, TAccountAgentTokenAccount, TAccountClientTokenAccount, TAccountAgentStaking, TAccountArbitrator, TAccountTokenProgram>, config?: {
387
453
  programAddress?: TProgramAddress;
388
- }): CompleteEscrowInstruction<TProgramAddress, TAccountEscrow, TAccountReentrancyGuard, TAccountAgent, TAccountEscrowTokenAccount, TAccountAgentTokenAccount, TAccountAuthority, TAccountTokenProgram>;
454
+ }): ArbitrateDisputeInstruction<TProgramAddress, TAccountEscrow, TAccountEscrowVault, TAccountAgentTokenAccount, TAccountClientTokenAccount, TAccountAgentStaking, TAccountArbitrator, TAccountTokenProgram>;
389
455
 
390
456
  /**
391
457
  * This code was AUTOGENERATED using the Codama library.
@@ -395,34 +461,80 @@ declare function getCompleteEscrowInstruction<TAccountEscrow extends string, TAc
395
461
  * @see https://github.com/codama-idl/codama
396
462
  */
397
463
 
398
- type CreateEnhancedChannelInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountChannel extends string | AccountMeta<string> = string, TAccountReentrancyGuard extends string | AccountMeta<string> = string, TAccountCreator extends string | AccountMeta<string> = string, TAccountCreatorAgent extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
399
- TAccountChannel extends string ? WritableAccount<TAccountChannel> : TAccountChannel,
400
- TAccountReentrancyGuard extends string ? WritableAccount<TAccountReentrancyGuard> : TAccountReentrancyGuard,
401
- TAccountCreator extends string ? WritableSignerAccount<TAccountCreator> & AccountSignerMeta<TAccountCreator> : TAccountCreator,
402
- TAccountCreatorAgent extends string ? ReadonlyAccount<TAccountCreatorAgent> : TAccountCreatorAgent,
464
+ type ClaimGhostInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountAgentAccount extends string | AccountMeta<string> = string, TAccountDidDocument extends string | AccountMeta<string> = string, TAccountSasAttestation extends string | AccountMeta<string> = string, TAccountClaimer extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
465
+ TAccountAgentAccount extends string ? WritableAccount<TAccountAgentAccount> : TAccountAgentAccount,
466
+ TAccountDidDocument extends string ? WritableAccount<TAccountDidDocument> : TAccountDidDocument,
467
+ TAccountSasAttestation extends string ? ReadonlyAccount<TAccountSasAttestation> : TAccountSasAttestation,
468
+ TAccountClaimer extends string ? WritableSignerAccount<TAccountClaimer> & AccountSignerMeta<TAccountClaimer> : TAccountClaimer,
469
+ TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
470
+ ...TRemainingAccounts
471
+ ]>;
472
+ type ClaimGhostInstructionDataArgs = {
473
+ sasCredential: Address;
474
+ sasSchema: Address;
475
+ ipfsMetadataUri: OptionOrNullable<string>;
476
+ network: string;
477
+ };
478
+ type ClaimGhostInput<TAccountAgentAccount extends string = string, TAccountDidDocument extends string = string, TAccountSasAttestation extends string = string, TAccountClaimer extends string = string, TAccountSystemProgram extends string = string> = {
479
+ agentAccount: Address<TAccountAgentAccount>;
480
+ /**
481
+ * DID document to create for this Ghost
482
+ * Seeds: [b"did_document", agent_account.x402_payment_address.as_ref()]
483
+ */
484
+ didDocument: Address<TAccountDidDocument>;
485
+ /**
486
+ * SAS Attestation proving ownership of x402_payment_address
487
+ * PDA: [b"attestation", sas_credential, sas_schema, x402_payment_address]
488
+ */
489
+ sasAttestation: Address<TAccountSasAttestation>;
490
+ /** The claimer must have created a SAS attestation proving they own x402_payment_address */
491
+ claimer: TransactionSigner<TAccountClaimer>;
492
+ systemProgram?: Address<TAccountSystemProgram>;
493
+ sasCredential: ClaimGhostInstructionDataArgs["sasCredential"];
494
+ sasSchema: ClaimGhostInstructionDataArgs["sasSchema"];
495
+ ipfsMetadataUri: ClaimGhostInstructionDataArgs["ipfsMetadataUri"];
496
+ network: ClaimGhostInstructionDataArgs["network"];
497
+ };
498
+ declare function getClaimGhostInstruction<TAccountAgentAccount extends string, TAccountDidDocument extends string, TAccountSasAttestation extends string, TAccountClaimer extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: ClaimGhostInput<TAccountAgentAccount, TAccountDidDocument, TAccountSasAttestation, TAccountClaimer, TAccountSystemProgram>, config?: {
499
+ programAddress?: TProgramAddress;
500
+ }): ClaimGhostInstruction<TProgramAddress, TAccountAgentAccount, TAccountDidDocument, TAccountSasAttestation, TAccountClaimer, TAccountSystemProgram>;
501
+
502
+ /**
503
+ * This code was AUTOGENERATED using the Codama library.
504
+ * Please DO NOT EDIT THIS FILE, instead use visitors
505
+ * to add features, then rerun Codama to update it.
506
+ *
507
+ * @see https://github.com/codama-idl/codama
508
+ */
509
+
510
+ type CreateDidDocumentInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountDidDocument extends string | AccountMeta<string> = string, TAccountController extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TAccountClock extends string | AccountMeta<string> = "SysvarC1ock11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
511
+ TAccountDidDocument extends string ? WritableAccount<TAccountDidDocument> : TAccountDidDocument,
512
+ TAccountController extends string ? WritableSignerAccount<TAccountController> & AccountSignerMeta<TAccountController> : TAccountController,
403
513
  TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
514
+ TAccountClock extends string ? ReadonlyAccount<TAccountClock> : TAccountClock,
404
515
  ...TRemainingAccounts
405
516
  ]>;
406
- type CreateEnhancedChannelInstructionDataArgs = {
407
- channelId: string;
408
- participants: Array<Address>;
409
- channelType: ChannelTypeArgs;
410
- metadata: ChannelMetadataArgs;
517
+ type CreateDidDocumentInstructionDataArgs = {
518
+ didString: string;
519
+ verificationMethods: Array<VerificationMethodArgs>;
520
+ serviceEndpoints: Array<ServiceEndpointArgs>;
411
521
  };
412
- type CreateEnhancedChannelAsyncInput<TAccountChannel extends string = string, TAccountReentrancyGuard extends string = string, TAccountCreator extends string = string, TAccountCreatorAgent extends string = string, TAccountSystemProgram extends string = string> = {
413
- channel?: Address<TAccountChannel>;
414
- reentrancyGuard?: Address<TAccountReentrancyGuard>;
415
- creator: TransactionSigner<TAccountCreator>;
416
- creatorAgent: Address<TAccountCreatorAgent>;
522
+ type CreateDidDocumentAsyncInput<TAccountDidDocument extends string = string, TAccountController extends string = string, TAccountSystemProgram extends string = string, TAccountClock extends string = string> = {
523
+ /** DID document account with canonical PDA */
524
+ didDocument?: Address<TAccountDidDocument>;
525
+ /** Controller of the DID (owner) */
526
+ controller: TransactionSigner<TAccountController>;
527
+ /** System program for account creation */
417
528
  systemProgram?: Address<TAccountSystemProgram>;
418
- channelId: CreateEnhancedChannelInstructionDataArgs["channelId"];
419
- participants: CreateEnhancedChannelInstructionDataArgs["participants"];
420
- channelType: CreateEnhancedChannelInstructionDataArgs["channelType"];
421
- metadata: CreateEnhancedChannelInstructionDataArgs["metadata"];
529
+ /** Clock sysvar for timestamp validation */
530
+ clock?: Address<TAccountClock>;
531
+ didString: CreateDidDocumentInstructionDataArgs["didString"];
532
+ verificationMethods: CreateDidDocumentInstructionDataArgs["verificationMethods"];
533
+ serviceEndpoints: CreateDidDocumentInstructionDataArgs["serviceEndpoints"];
422
534
  };
423
- declare function getCreateEnhancedChannelInstructionAsync<TAccountChannel extends string, TAccountReentrancyGuard extends string, TAccountCreator extends string, TAccountCreatorAgent extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: CreateEnhancedChannelAsyncInput<TAccountChannel, TAccountReentrancyGuard, TAccountCreator, TAccountCreatorAgent, TAccountSystemProgram>, config?: {
535
+ declare function getCreateDidDocumentInstructionAsync<TAccountDidDocument extends string, TAccountController extends string, TAccountSystemProgram extends string, TAccountClock extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: CreateDidDocumentAsyncInput<TAccountDidDocument, TAccountController, TAccountSystemProgram, TAccountClock>, config?: {
424
536
  programAddress?: TProgramAddress;
425
- }): Promise<CreateEnhancedChannelInstruction<TProgramAddress, TAccountChannel, TAccountReentrancyGuard, TAccountCreator, TAccountCreatorAgent, TAccountSystemProgram>>;
537
+ }): Promise<CreateDidDocumentInstruction<TProgramAddress, TAccountDidDocument, TAccountController, TAccountSystemProgram, TAccountClock>>;
426
538
 
427
539
  /**
428
540
  * This code was AUTOGENERATED using the Codama library.
@@ -432,48 +544,66 @@ declare function getCreateEnhancedChannelInstructionAsync<TAccountChannel extend
432
544
  * @see https://github.com/codama-idl/codama
433
545
  */
434
546
 
435
- type CreateEscrowInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountEscrow extends string | AccountMeta<string> = string, TAccountReentrancyGuard extends string | AccountMeta<string> = string, TAccountClient extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountClientTokenAccount extends string | AccountMeta<string> = string, TAccountEscrowTokenAccount extends string | AccountMeta<string> = string, TAccountPaymentToken extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TAccountAssociatedTokenProgram extends string | AccountMeta<string> = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
547
+ type CreateEscrowInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountEscrow extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountClientTokenAccount extends string | AccountMeta<string> = string, TAccountEscrowVault extends string | AccountMeta<string> = string, TAccountTokenMint extends string | AccountMeta<string> = string, TAccountClient extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
436
548
  TAccountEscrow extends string ? WritableAccount<TAccountEscrow> : TAccountEscrow,
437
- TAccountReentrancyGuard extends string ? WritableAccount<TAccountReentrancyGuard> : TAccountReentrancyGuard,
438
- TAccountClient extends string ? WritableSignerAccount<TAccountClient> & AccountSignerMeta<TAccountClient> : TAccountClient,
439
549
  TAccountAgent extends string ? ReadonlyAccount<TAccountAgent> : TAccountAgent,
440
550
  TAccountClientTokenAccount extends string ? WritableAccount<TAccountClientTokenAccount> : TAccountClientTokenAccount,
441
- TAccountEscrowTokenAccount extends string ? WritableAccount<TAccountEscrowTokenAccount> : TAccountEscrowTokenAccount,
442
- TAccountPaymentToken extends string ? ReadonlyAccount<TAccountPaymentToken> : TAccountPaymentToken,
551
+ TAccountEscrowVault extends string ? WritableAccount<TAccountEscrowVault> : TAccountEscrowVault,
552
+ TAccountTokenMint extends string ? ReadonlyAccount<TAccountTokenMint> : TAccountTokenMint,
553
+ TAccountClient extends string ? WritableSignerAccount<TAccountClient> & AccountSignerMeta<TAccountClient> : TAccountClient,
443
554
  TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
444
- TAccountAssociatedTokenProgram extends string ? ReadonlyAccount<TAccountAssociatedTokenProgram> : TAccountAssociatedTokenProgram,
445
555
  TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
446
556
  ...TRemainingAccounts
447
557
  ]>;
448
558
  type CreateEscrowInstructionDataArgs = {
449
- taskId: string;
559
+ escrowId: number | bigint;
450
560
  amount: number | bigint;
451
- expiresAt: number | bigint;
452
- transferHook: OptionOrNullable<Address>;
453
- isConfidential: boolean;
561
+ jobDescription: string;
562
+ deadline: number | bigint;
454
563
  };
455
- type CreateEscrowAsyncInput<TAccountEscrow extends string = string, TAccountReentrancyGuard extends string = string, TAccountClient extends string = string, TAccountAgent extends string = string, TAccountClientTokenAccount extends string = string, TAccountEscrowTokenAccount extends string = string, TAccountPaymentToken extends string = string, TAccountTokenProgram extends string = string, TAccountAssociatedTokenProgram extends string = string, TAccountSystemProgram extends string = string> = {
564
+ type CreateEscrowAsyncInput<TAccountEscrow extends string = string, TAccountAgent extends string = string, TAccountClientTokenAccount extends string = string, TAccountEscrowVault extends string = string, TAccountTokenMint extends string = string, TAccountClient extends string = string, TAccountTokenProgram extends string = string, TAccountSystemProgram extends string = string> = {
456
565
  escrow?: Address<TAccountEscrow>;
457
- reentrancyGuard?: Address<TAccountReentrancyGuard>;
458
- client: TransactionSigner<TAccountClient>;
459
566
  agent: Address<TAccountAgent>;
460
- /** Client's token account - created if it doesn't exist */
461
- clientTokenAccount?: Address<TAccountClientTokenAccount>;
462
- /** Escrow's token account - always created fresh */
463
- escrowTokenAccount?: Address<TAccountEscrowTokenAccount>;
464
- paymentToken: Address<TAccountPaymentToken>;
567
+ clientTokenAccount: Address<TAccountClientTokenAccount>;
568
+ escrowVault: Address<TAccountEscrowVault>;
569
+ tokenMint: Address<TAccountTokenMint>;
570
+ client: TransactionSigner<TAccountClient>;
465
571
  tokenProgram?: Address<TAccountTokenProgram>;
466
- associatedTokenProgram?: Address<TAccountAssociatedTokenProgram>;
467
572
  systemProgram?: Address<TAccountSystemProgram>;
468
- taskId: CreateEscrowInstructionDataArgs["taskId"];
573
+ escrowId: CreateEscrowInstructionDataArgs["escrowId"];
469
574
  amount: CreateEscrowInstructionDataArgs["amount"];
470
- expiresAt: CreateEscrowInstructionDataArgs["expiresAt"];
471
- transferHook: CreateEscrowInstructionDataArgs["transferHook"];
472
- isConfidential: CreateEscrowInstructionDataArgs["isConfidential"];
575
+ jobDescription: CreateEscrowInstructionDataArgs["jobDescription"];
576
+ deadline: CreateEscrowInstructionDataArgs["deadline"];
577
+ };
578
+ declare function getCreateEscrowInstructionAsync<TAccountEscrow extends string, TAccountAgent extends string, TAccountClientTokenAccount extends string, TAccountEscrowVault extends string, TAccountTokenMint extends string, TAccountClient extends string, TAccountTokenProgram extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: CreateEscrowAsyncInput<TAccountEscrow, TAccountAgent, TAccountClientTokenAccount, TAccountEscrowVault, TAccountTokenMint, TAccountClient, TAccountTokenProgram, TAccountSystemProgram>, config?: {
579
+ programAddress?: TProgramAddress;
580
+ }): Promise<CreateEscrowInstruction<TProgramAddress, TAccountEscrow, TAccountAgent, TAccountClientTokenAccount, TAccountEscrowVault, TAccountTokenMint, TAccountClient, TAccountTokenProgram, TAccountSystemProgram>>;
581
+
582
+ /**
583
+ * This code was AUTOGENERATED using the Codama library.
584
+ * Please DO NOT EDIT THIS FILE, instead use visitors
585
+ * to add features, then rerun Codama to update it.
586
+ *
587
+ * @see https://github.com/codama-idl/codama
588
+ */
589
+
590
+ type DeactivateDidDocumentInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountDidDocument extends string | AccountMeta<string> = string, TAccountController extends string | AccountMeta<string> = string, TAccountClock extends string | AccountMeta<string> = "SysvarC1ock11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
591
+ TAccountDidDocument extends string ? WritableAccount<TAccountDidDocument> : TAccountDidDocument,
592
+ TAccountController extends string ? WritableSignerAccount<TAccountController> & AccountSignerMeta<TAccountController> : TAccountController,
593
+ TAccountClock extends string ? ReadonlyAccount<TAccountClock> : TAccountClock,
594
+ ...TRemainingAccounts
595
+ ]>;
596
+ type DeactivateDidDocumentAsyncInput<TAccountDidDocument extends string = string, TAccountController extends string = string, TAccountClock extends string = string> = {
597
+ /** DID document account with canonical PDA validation */
598
+ didDocument?: Address<TAccountDidDocument>;
599
+ /** Controller of the DID (must match document controller) */
600
+ controller: TransactionSigner<TAccountController>;
601
+ /** Clock sysvar for timestamp validation */
602
+ clock?: Address<TAccountClock>;
473
603
  };
474
- declare function getCreateEscrowInstructionAsync<TAccountEscrow extends string, TAccountReentrancyGuard extends string, TAccountClient extends string, TAccountAgent extends string, TAccountClientTokenAccount extends string, TAccountEscrowTokenAccount extends string, TAccountPaymentToken extends string, TAccountTokenProgram extends string, TAccountAssociatedTokenProgram extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: CreateEscrowAsyncInput<TAccountEscrow, TAccountReentrancyGuard, TAccountClient, TAccountAgent, TAccountClientTokenAccount, TAccountEscrowTokenAccount, TAccountPaymentToken, TAccountTokenProgram, TAccountAssociatedTokenProgram, TAccountSystemProgram>, config?: {
604
+ declare function getDeactivateDidDocumentInstructionAsync<TAccountDidDocument extends string, TAccountController extends string, TAccountClock extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: DeactivateDidDocumentAsyncInput<TAccountDidDocument, TAccountController, TAccountClock>, config?: {
475
605
  programAddress?: TProgramAddress;
476
- }): Promise<CreateEscrowInstruction<TProgramAddress, TAccountEscrow, TAccountReentrancyGuard, TAccountClient, TAccountAgent, TAccountClientTokenAccount, TAccountEscrowTokenAccount, TAccountPaymentToken, TAccountTokenProgram, TAccountAssociatedTokenProgram, TAccountSystemProgram>>;
606
+ }): Promise<DeactivateDidDocumentInstruction<TProgramAddress, TAccountDidDocument, TAccountController, TAccountClock>>;
477
607
 
478
608
  /**
479
609
  * This code was AUTOGENERATED using the Codama library.
@@ -483,24 +613,51 @@ declare function getCreateEscrowInstructionAsync<TAccountEscrow extends string,
483
613
  * @see https://github.com/codama-idl/codama
484
614
  */
485
615
 
486
- type DisputeEscrowInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountEscrow extends string | AccountMeta<string> = string, TAccountReentrancyGuard extends string | AccountMeta<string> = string, TAccountAuthority extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
616
+ type FileDisputeInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountEscrow extends string | AccountMeta<string> = string, TAccountClient extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
487
617
  TAccountEscrow extends string ? WritableAccount<TAccountEscrow> : TAccountEscrow,
488
- TAccountReentrancyGuard extends string ? WritableAccount<TAccountReentrancyGuard> : TAccountReentrancyGuard,
489
- TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
618
+ TAccountClient extends string ? ReadonlySignerAccount<TAccountClient> & AccountSignerMeta<TAccountClient> : TAccountClient,
490
619
  ...TRemainingAccounts
491
620
  ]>;
492
- type DisputeEscrowInstructionDataArgs = {
493
- disputeReason: string;
621
+ type FileDisputeInstructionDataArgs = {
622
+ reason: string;
494
623
  };
495
- type DisputeEscrowInput<TAccountEscrow extends string = string, TAccountReentrancyGuard extends string = string, TAccountAuthority extends string = string> = {
624
+ type FileDisputeInput<TAccountEscrow extends string = string, TAccountClient extends string = string> = {
496
625
  escrow: Address<TAccountEscrow>;
497
- reentrancyGuard: Address<TAccountReentrancyGuard>;
626
+ client: TransactionSigner<TAccountClient>;
627
+ reason: FileDisputeInstructionDataArgs["reason"];
628
+ };
629
+ declare function getFileDisputeInstruction<TAccountEscrow extends string, TAccountClient extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: FileDisputeInput<TAccountEscrow, TAccountClient>, config?: {
630
+ programAddress?: TProgramAddress;
631
+ }): FileDisputeInstruction<TProgramAddress, TAccountEscrow, TAccountClient>;
632
+
633
+ /**
634
+ * This code was AUTOGENERATED using the Codama library.
635
+ * Please DO NOT EDIT THIS FILE, instead use visitors
636
+ * to add features, then rerun Codama to update it.
637
+ *
638
+ * @see https://github.com/codama-idl/codama
639
+ */
640
+
641
+ type InitializeStakingConfigInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountStakingConfig extends string | AccountMeta<string> = string, TAccountAuthority extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
642
+ TAccountStakingConfig extends string ? WritableAccount<TAccountStakingConfig> : TAccountStakingConfig,
643
+ TAccountAuthority extends string ? WritableSignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
644
+ TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
645
+ ...TRemainingAccounts
646
+ ]>;
647
+ type InitializeStakingConfigInstructionDataArgs = {
648
+ minStake: number | bigint;
649
+ treasury: Address;
650
+ };
651
+ type InitializeStakingConfigAsyncInput<TAccountStakingConfig extends string = string, TAccountAuthority extends string = string, TAccountSystemProgram extends string = string> = {
652
+ stakingConfig?: Address<TAccountStakingConfig>;
498
653
  authority: TransactionSigner<TAccountAuthority>;
499
- disputeReason: DisputeEscrowInstructionDataArgs["disputeReason"];
654
+ systemProgram?: Address<TAccountSystemProgram>;
655
+ minStake: InitializeStakingConfigInstructionDataArgs["minStake"];
656
+ treasury: InitializeStakingConfigInstructionDataArgs["treasury"];
500
657
  };
501
- declare function getDisputeEscrowInstruction<TAccountEscrow extends string, TAccountReentrancyGuard extends string, TAccountAuthority extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: DisputeEscrowInput<TAccountEscrow, TAccountReentrancyGuard, TAccountAuthority>, config?: {
658
+ declare function getInitializeStakingConfigInstructionAsync<TAccountStakingConfig extends string, TAccountAuthority extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: InitializeStakingConfigAsyncInput<TAccountStakingConfig, TAccountAuthority, TAccountSystemProgram>, config?: {
502
659
  programAddress?: TProgramAddress;
503
- }): DisputeEscrowInstruction<TProgramAddress, TAccountEscrow, TAccountReentrancyGuard, TAccountAuthority>;
660
+ }): Promise<InitializeStakingConfigInstruction<TProgramAddress, TAccountStakingConfig, TAccountAuthority, TAccountSystemProgram>>;
504
661
 
505
662
  /**
506
663
  * This code was AUTOGENERATED using the Codama library.
@@ -510,22 +667,46 @@ declare function getDisputeEscrowInstruction<TAccountEscrow extends string, TAcc
510
667
  * @see https://github.com/codama-idl/codama
511
668
  */
512
669
 
513
- type JoinChannelInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountChannel extends string | AccountMeta<string> = string, TAccountReentrancyGuard extends string | AccountMeta<string> = string, TAccountUser extends string | AccountMeta<string> = string, TAccountUserAgent extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
514
- TAccountChannel extends string ? WritableAccount<TAccountChannel> : TAccountChannel,
515
- TAccountReentrancyGuard extends string ? WritableAccount<TAccountReentrancyGuard> : TAccountReentrancyGuard,
516
- TAccountUser extends string ? WritableSignerAccount<TAccountUser> & AccountSignerMeta<TAccountUser> : TAccountUser,
517
- TAccountUserAgent extends string ? ReadonlyAccount<TAccountUserAgent> : TAccountUserAgent,
670
+ type RegisterAgentInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountAgentAccount extends string | AccountMeta<string> = string, TAccountStakingAccount extends string | AccountMeta<string> = string, TAccountSigner extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TAccountClock extends string | AccountMeta<string> = "SysvarC1ock11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
671
+ TAccountAgentAccount extends string ? WritableAccount<TAccountAgentAccount> : TAccountAgentAccount,
672
+ TAccountStakingAccount extends string ? ReadonlyAccount<TAccountStakingAccount> : TAccountStakingAccount,
673
+ TAccountSigner extends string ? WritableSignerAccount<TAccountSigner> & AccountSignerMeta<TAccountSigner> : TAccountSigner,
674
+ TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
675
+ TAccountClock extends string ? ReadonlyAccount<TAccountClock> : TAccountClock,
518
676
  ...TRemainingAccounts
519
677
  ]>;
520
- type JoinChannelInput<TAccountChannel extends string = string, TAccountReentrancyGuard extends string = string, TAccountUser extends string = string, TAccountUserAgent extends string = string> = {
521
- channel: Address<TAccountChannel>;
522
- reentrancyGuard: Address<TAccountReentrancyGuard>;
523
- user: TransactionSigner<TAccountUser>;
524
- userAgent: Address<TAccountUserAgent>;
678
+ type RegisterAgentInstructionDataArgs = {
679
+ agentType: number;
680
+ name: string;
681
+ description: string;
682
+ metadataUri: string;
683
+ agentId: string;
684
+ pricingModel: PricingModelArgs;
685
+ };
686
+ type RegisterAgentAsyncInput<TAccountAgentAccount extends string = string, TAccountStakingAccount extends string = string, TAccountSigner extends string = string, TAccountSystemProgram extends string = string, TAccountClock extends string = string> = {
687
+ /** Agent account with enhanced 2025 PDA security */
688
+ agentAccount?: Address<TAccountAgentAccount>;
689
+ /** Staking account - REQUIRED for Sybil resistance (must have >= 1K GHOST staked) */
690
+ stakingAccount?: Address<TAccountStakingAccount>;
691
+ /**
692
+ * User registry with enhanced validation
693
+ * Authority with enhanced verification
694
+ */
695
+ signer: TransactionSigner<TAccountSigner>;
696
+ /** System program for account creation */
697
+ systemProgram?: Address<TAccountSystemProgram>;
698
+ /** Clock sysvar for timestamp validation */
699
+ clock?: Address<TAccountClock>;
700
+ agentType: RegisterAgentInstructionDataArgs["agentType"];
701
+ name: RegisterAgentInstructionDataArgs["name"];
702
+ description: RegisterAgentInstructionDataArgs["description"];
703
+ metadataUri: RegisterAgentInstructionDataArgs["metadataUri"];
704
+ agentId: RegisterAgentInstructionDataArgs["agentId"];
705
+ pricingModel: RegisterAgentInstructionDataArgs["pricingModel"];
525
706
  };
526
- declare function getJoinChannelInstruction<TAccountChannel extends string, TAccountReentrancyGuard extends string, TAccountUser extends string, TAccountUserAgent extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: JoinChannelInput<TAccountChannel, TAccountReentrancyGuard, TAccountUser, TAccountUserAgent>, config?: {
707
+ declare function getRegisterAgentInstructionAsync<TAccountAgentAccount extends string, TAccountStakingAccount extends string, TAccountSigner extends string, TAccountSystemProgram extends string, TAccountClock extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: RegisterAgentAsyncInput<TAccountAgentAccount, TAccountStakingAccount, TAccountSigner, TAccountSystemProgram, TAccountClock>, config?: {
527
708
  programAddress?: TProgramAddress;
528
- }): JoinChannelInstruction<TProgramAddress, TAccountChannel, TAccountReentrancyGuard, TAccountUser, TAccountUserAgent>;
709
+ }): Promise<RegisterAgentInstruction<TProgramAddress, TAccountAgentAccount, TAccountStakingAccount, TAccountSigner, TAccountSystemProgram, TAccountClock>>;
529
710
 
530
711
  /**
531
712
  * This code was AUTOGENERATED using the Codama library.
@@ -535,20 +716,20 @@ declare function getJoinChannelInstruction<TAccountChannel extends string, TAcco
535
716
  * @see https://github.com/codama-idl/codama
536
717
  */
537
718
 
538
- type LeaveChannelInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountChannel extends string | AccountMeta<string> = string, TAccountReentrancyGuard extends string | AccountMeta<string> = string, TAccountUser extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
539
- TAccountChannel extends string ? WritableAccount<TAccountChannel> : TAccountChannel,
540
- TAccountReentrancyGuard extends string ? WritableAccount<TAccountReentrancyGuard> : TAccountReentrancyGuard,
541
- TAccountUser extends string ? WritableSignerAccount<TAccountUser> & AccountSignerMeta<TAccountUser> : TAccountUser,
719
+ type ResolveDidDocumentInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountDidDocument extends string | AccountMeta<string> = string, TAccountDidController extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
720
+ TAccountDidDocument extends string ? ReadonlyAccount<TAccountDidDocument> : TAccountDidDocument,
721
+ TAccountDidController extends string ? ReadonlyAccount<TAccountDidController> : TAccountDidController,
542
722
  ...TRemainingAccounts
543
723
  ]>;
544
- type LeaveChannelInput<TAccountChannel extends string = string, TAccountReentrancyGuard extends string = string, TAccountUser extends string = string> = {
545
- channel: Address<TAccountChannel>;
546
- reentrancyGuard: Address<TAccountReentrancyGuard>;
547
- user: TransactionSigner<TAccountUser>;
724
+ type ResolveDidDocumentAsyncInput<TAccountDidDocument extends string = string, TAccountDidController extends string = string> = {
725
+ /** DID document account */
726
+ didDocument?: Address<TAccountDidDocument>;
727
+ /** Controller public key (used for PDA derivation) */
728
+ didController: Address<TAccountDidController>;
548
729
  };
549
- declare function getLeaveChannelInstruction<TAccountChannel extends string, TAccountReentrancyGuard extends string, TAccountUser extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: LeaveChannelInput<TAccountChannel, TAccountReentrancyGuard, TAccountUser>, config?: {
730
+ declare function getResolveDidDocumentInstructionAsync<TAccountDidDocument extends string, TAccountDidController extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: ResolveDidDocumentAsyncInput<TAccountDidDocument, TAccountDidController>, config?: {
550
731
  programAddress?: TProgramAddress;
551
- }): LeaveChannelInstruction<TProgramAddress, TAccountChannel, TAccountReentrancyGuard, TAccountUser>;
732
+ }): Promise<ResolveDidDocumentInstruction<TProgramAddress, TAccountDidDocument, TAccountDidController>>;
552
733
 
553
734
  /**
554
735
  * This code was AUTOGENERATED using the Codama library.
@@ -558,36 +739,34 @@ declare function getLeaveChannelInstruction<TAccountChannel extends string, TAcc
558
739
  * @see https://github.com/codama-idl/codama
559
740
  */
560
741
 
561
- type ProcessPartialRefundInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountEscrow extends string | AccountMeta<string> = string, TAccountReentrancyGuard extends string | AccountMeta<string> = string, TAccountEscrowTokenAccount extends string | AccountMeta<string> = string, TAccountClientRefundAccount extends string | AccountMeta<string> = string, TAccountAgentPaymentAccount extends string | AccountMeta<string> = string, TAccountPaymentToken extends string | AccountMeta<string> = string, TAccountAuthority extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
562
- TAccountEscrow extends string ? WritableAccount<TAccountEscrow> : TAccountEscrow,
563
- TAccountReentrancyGuard extends string ? WritableAccount<TAccountReentrancyGuard> : TAccountReentrancyGuard,
564
- TAccountEscrowTokenAccount extends string ? WritableAccount<TAccountEscrowTokenAccount> : TAccountEscrowTokenAccount,
565
- TAccountClientRefundAccount extends string ? WritableAccount<TAccountClientRefundAccount> : TAccountClientRefundAccount,
566
- TAccountAgentPaymentAccount extends string ? WritableAccount<TAccountAgentPaymentAccount> : TAccountAgentPaymentAccount,
567
- TAccountPaymentToken extends string ? ReadonlyAccount<TAccountPaymentToken> : TAccountPaymentToken,
742
+ type SlashStakeInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountStakingAccount extends string | AccountMeta<string> = string, TAccountStakingConfig extends string | AccountMeta<string> = string, TAccountStakingVault extends string | AccountMeta<string> = string, TAccountTreasury extends string | AccountMeta<string> = string, TAccountAuthority extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
743
+ TAccountStakingAccount extends string ? WritableAccount<TAccountStakingAccount> : TAccountStakingAccount,
744
+ TAccountStakingConfig extends string ? ReadonlyAccount<TAccountStakingConfig> : TAccountStakingConfig,
745
+ TAccountStakingVault extends string ? WritableAccount<TAccountStakingVault> : TAccountStakingVault,
746
+ TAccountTreasury extends string ? WritableAccount<TAccountTreasury> : TAccountTreasury,
568
747
  TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
569
748
  TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
570
749
  ...TRemainingAccounts
571
750
  ]>;
572
- type ProcessPartialRefundInstructionDataArgs = {
573
- clientRefundPercentage: number;
751
+ type SlashStakeInstructionDataArgs = {
752
+ owner: Address;
753
+ reason: SlashReasonArgs;
754
+ customAmount: OptionOrNullable<number | bigint>;
574
755
  };
575
- type ProcessPartialRefundInput<TAccountEscrow extends string = string, TAccountReentrancyGuard extends string = string, TAccountEscrowTokenAccount extends string = string, TAccountClientRefundAccount extends string = string, TAccountAgentPaymentAccount extends string = string, TAccountPaymentToken extends string = string, TAccountAuthority extends string = string, TAccountTokenProgram extends string = string> = {
576
- escrow: Address<TAccountEscrow>;
577
- reentrancyGuard: Address<TAccountReentrancyGuard>;
578
- escrowTokenAccount: Address<TAccountEscrowTokenAccount>;
579
- clientRefundAccount: Address<TAccountClientRefundAccount>;
580
- agentPaymentAccount: Address<TAccountAgentPaymentAccount>;
581
- /** The token mint used for payments */
582
- paymentToken: Address<TAccountPaymentToken>;
583
- /** Authority to approve partial refunds (dispute resolver/admin) */
756
+ type SlashStakeAsyncInput<TAccountStakingAccount extends string = string, TAccountStakingConfig extends string = string, TAccountStakingVault extends string = string, TAccountTreasury extends string = string, TAccountAuthority extends string = string, TAccountTokenProgram extends string = string> = {
757
+ stakingAccount?: Address<TAccountStakingAccount>;
758
+ stakingConfig?: Address<TAccountStakingConfig>;
759
+ stakingVault?: Address<TAccountStakingVault>;
760
+ treasury: Address<TAccountTreasury>;
584
761
  authority: TransactionSigner<TAccountAuthority>;
585
762
  tokenProgram?: Address<TAccountTokenProgram>;
586
- clientRefundPercentage: ProcessPartialRefundInstructionDataArgs["clientRefundPercentage"];
763
+ owner: SlashStakeInstructionDataArgs["owner"];
764
+ reason: SlashStakeInstructionDataArgs["reason"];
765
+ customAmount: SlashStakeInstructionDataArgs["customAmount"];
587
766
  };
588
- declare function getProcessPartialRefundInstruction<TAccountEscrow extends string, TAccountReentrancyGuard extends string, TAccountEscrowTokenAccount extends string, TAccountClientRefundAccount extends string, TAccountAgentPaymentAccount extends string, TAccountPaymentToken extends string, TAccountAuthority extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: ProcessPartialRefundInput<TAccountEscrow, TAccountReentrancyGuard, TAccountEscrowTokenAccount, TAccountClientRefundAccount, TAccountAgentPaymentAccount, TAccountPaymentToken, TAccountAuthority, TAccountTokenProgram>, config?: {
767
+ declare function getSlashStakeInstructionAsync<TAccountStakingAccount extends string, TAccountStakingConfig extends string, TAccountStakingVault extends string, TAccountTreasury extends string, TAccountAuthority extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: SlashStakeAsyncInput<TAccountStakingAccount, TAccountStakingConfig, TAccountStakingVault, TAccountTreasury, TAccountAuthority, TAccountTokenProgram>, config?: {
589
768
  programAddress?: TProgramAddress;
590
- }): ProcessPartialRefundInstruction<TProgramAddress, TAccountEscrow, TAccountReentrancyGuard, TAccountEscrowTokenAccount, TAccountClientRefundAccount, TAccountAgentPaymentAccount, TAccountPaymentToken, TAccountAuthority, TAccountTokenProgram>;
769
+ }): Promise<SlashStakeInstruction<TProgramAddress, TAccountStakingAccount, TAccountStakingConfig, TAccountStakingVault, TAccountTreasury, TAccountAuthority, TAccountTokenProgram>>;
591
770
 
592
771
  /**
593
772
  * This code was AUTOGENERATED using the Codama library.
@@ -597,38 +776,42 @@ declare function getProcessPartialRefundInstruction<TAccountEscrow extends strin
597
776
  * @see https://github.com/codama-idl/codama
598
777
  */
599
778
 
600
- type ProcessPaymentInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountPayment extends string | AccountMeta<string> = string, TAccountWorkOrder extends string | AccountMeta<string> = string, TAccountProviderAgent extends string | AccountMeta<string> = string, TAccountPayer extends string | AccountMeta<string> = string, TAccountPayerTokenAccount extends string | AccountMeta<string> = string, TAccountProviderTokenAccount extends string | AccountMeta<string> = string, TAccountTokenMint extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
601
- TAccountPayment extends string ? WritableAccount<TAccountPayment> : TAccountPayment,
602
- TAccountWorkOrder extends string ? WritableAccount<TAccountWorkOrder> : TAccountWorkOrder,
603
- TAccountProviderAgent extends string ? WritableAccount<TAccountProviderAgent> : TAccountProviderAgent,
604
- TAccountPayer extends string ? WritableSignerAccount<TAccountPayer> & AccountSignerMeta<TAccountPayer> : TAccountPayer,
605
- TAccountPayerTokenAccount extends string ? WritableAccount<TAccountPayerTokenAccount> : TAccountPayerTokenAccount,
606
- TAccountProviderTokenAccount extends string ? WritableAccount<TAccountProviderTokenAccount> : TAccountProviderTokenAccount,
607
- TAccountTokenMint extends string ? ReadonlyAccount<TAccountTokenMint> : TAccountTokenMint,
779
+ type StakeGhostInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountStakingAccount extends string | AccountMeta<string> = string, TAccountOwnerTokenAccount extends string | AccountMeta<string> = string, TAccountStakingVault extends string | AccountMeta<string> = string, TAccountStakingConfig extends string | AccountMeta<string> = string, TAccountGhostMint extends string | AccountMeta<string> = string, TAccountOwner extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TAccountRent extends string | AccountMeta<string> = "SysvarRent111111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
780
+ TAccountStakingAccount extends string ? WritableAccount<TAccountStakingAccount> : TAccountStakingAccount,
781
+ TAccountOwnerTokenAccount extends string ? WritableAccount<TAccountOwnerTokenAccount> : TAccountOwnerTokenAccount,
782
+ TAccountStakingVault extends string ? WritableAccount<TAccountStakingVault> : TAccountStakingVault,
783
+ TAccountStakingConfig extends string ? ReadonlyAccount<TAccountStakingConfig> : TAccountStakingConfig,
784
+ TAccountGhostMint extends string ? ReadonlyAccount<TAccountGhostMint> : TAccountGhostMint,
785
+ TAccountOwner extends string ? WritableSignerAccount<TAccountOwner> & AccountSignerMeta<TAccountOwner> : TAccountOwner,
608
786
  TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
609
787
  TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
788
+ TAccountRent extends string ? ReadonlyAccount<TAccountRent> : TAccountRent,
610
789
  ...TRemainingAccounts
611
790
  ]>;
612
- type ProcessPaymentInstructionDataArgs = {
791
+ type StakeGhostInstructionDataArgs = {
613
792
  amount: number | bigint;
614
- useConfidentialTransfer: boolean;
793
+ lockDuration: number | bigint;
615
794
  };
616
- type ProcessPaymentInput<TAccountPayment extends string = string, TAccountWorkOrder extends string = string, TAccountProviderAgent extends string = string, TAccountPayer extends string = string, TAccountPayerTokenAccount extends string = string, TAccountProviderTokenAccount extends string = string, TAccountTokenMint extends string = string, TAccountTokenProgram extends string = string, TAccountSystemProgram extends string = string> = {
617
- payment: Address<TAccountPayment>;
618
- workOrder: Address<TAccountWorkOrder>;
619
- providerAgent: Address<TAccountProviderAgent>;
620
- payer: TransactionSigner<TAccountPayer>;
621
- payerTokenAccount: Address<TAccountPayerTokenAccount>;
622
- providerTokenAccount: Address<TAccountProviderTokenAccount>;
623
- tokenMint: Address<TAccountTokenMint>;
795
+ type StakeGhostAsyncInput<TAccountStakingAccount extends string = string, TAccountOwnerTokenAccount extends string = string, TAccountStakingVault extends string = string, TAccountStakingConfig extends string = string, TAccountGhostMint extends string = string, TAccountOwner extends string = string, TAccountTokenProgram extends string = string, TAccountSystemProgram extends string = string, TAccountRent extends string = string> = {
796
+ stakingAccount?: Address<TAccountStakingAccount>;
797
+ ownerTokenAccount: Address<TAccountOwnerTokenAccount>;
798
+ /**
799
+ * Staking vault to hold all staked GHOST tokens
800
+ * Automatically initialized on first stake using init_if_needed
801
+ */
802
+ stakingVault?: Address<TAccountStakingVault>;
803
+ stakingConfig: Address<TAccountStakingConfig>;
804
+ ghostMint: Address<TAccountGhostMint>;
805
+ owner: TransactionSigner<TAccountOwner>;
624
806
  tokenProgram?: Address<TAccountTokenProgram>;
625
807
  systemProgram?: Address<TAccountSystemProgram>;
626
- amount: ProcessPaymentInstructionDataArgs["amount"];
627
- useConfidentialTransfer: ProcessPaymentInstructionDataArgs["useConfidentialTransfer"];
808
+ rent?: Address<TAccountRent>;
809
+ amount: StakeGhostInstructionDataArgs["amount"];
810
+ lockDuration: StakeGhostInstructionDataArgs["lockDuration"];
628
811
  };
629
- declare function getProcessPaymentInstruction<TAccountPayment extends string, TAccountWorkOrder extends string, TAccountProviderAgent extends string, TAccountPayer extends string, TAccountPayerTokenAccount extends string, TAccountProviderTokenAccount extends string, TAccountTokenMint extends string, TAccountTokenProgram extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: ProcessPaymentInput<TAccountPayment, TAccountWorkOrder, TAccountProviderAgent, TAccountPayer, TAccountPayerTokenAccount, TAccountProviderTokenAccount, TAccountTokenMint, TAccountTokenProgram, TAccountSystemProgram>, config?: {
812
+ declare function getStakeGhostInstructionAsync<TAccountStakingAccount extends string, TAccountOwnerTokenAccount extends string, TAccountStakingVault extends string, TAccountStakingConfig extends string, TAccountGhostMint extends string, TAccountOwner extends string, TAccountTokenProgram extends string, TAccountSystemProgram extends string, TAccountRent extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: StakeGhostAsyncInput<TAccountStakingAccount, TAccountOwnerTokenAccount, TAccountStakingVault, TAccountStakingConfig, TAccountGhostMint, TAccountOwner, TAccountTokenProgram, TAccountSystemProgram, TAccountRent>, config?: {
630
813
  programAddress?: TProgramAddress;
631
- }): ProcessPaymentInstruction<TProgramAddress, TAccountPayment, TAccountWorkOrder, TAccountProviderAgent, TAccountPayer, TAccountPayerTokenAccount, TAccountProviderTokenAccount, TAccountTokenMint, TAccountTokenProgram, TAccountSystemProgram>;
814
+ }): Promise<StakeGhostInstruction<TProgramAddress, TAccountStakingAccount, TAccountOwnerTokenAccount, TAccountStakingVault, TAccountStakingConfig, TAccountGhostMint, TAccountOwner, TAccountTokenProgram, TAccountSystemProgram, TAccountRent>>;
632
815
 
633
816
  /**
634
817
  * This code was AUTOGENERATED using the Codama library.
@@ -638,41 +821,24 @@ declare function getProcessPaymentInstruction<TAccountPayment extends string, TA
638
821
  * @see https://github.com/codama-idl/codama
639
822
  */
640
823
 
641
- type RegisterAgentInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountAgentAccount extends string | AccountMeta<string> = string, TAccountSigner extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TAccountClock extends string | AccountMeta<string> = "SysvarC1ock11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
642
- TAccountAgentAccount extends string ? WritableAccount<TAccountAgentAccount> : TAccountAgentAccount,
643
- TAccountSigner extends string ? WritableSignerAccount<TAccountSigner> & AccountSignerMeta<TAccountSigner> : TAccountSigner,
644
- TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
645
- TAccountClock extends string ? ReadonlyAccount<TAccountClock> : TAccountClock,
824
+ type SubmitDeliveryInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountEscrow extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountAgentOwner extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
825
+ TAccountEscrow extends string ? WritableAccount<TAccountEscrow> : TAccountEscrow,
826
+ TAccountAgent extends string ? ReadonlyAccount<TAccountAgent> : TAccountAgent,
827
+ TAccountAgentOwner extends string ? ReadonlySignerAccount<TAccountAgentOwner> & AccountSignerMeta<TAccountAgentOwner> : TAccountAgentOwner,
646
828
  ...TRemainingAccounts
647
829
  ]>;
648
- type RegisterAgentInstructionDataArgs = {
649
- agentType: number;
650
- name: string;
651
- description: string;
652
- metadataUri: string;
653
- agentId: string;
830
+ type SubmitDeliveryInstructionDataArgs = {
831
+ deliveryProof: string;
654
832
  };
655
- type RegisterAgentAsyncInput<TAccountAgentAccount extends string = string, TAccountSigner extends string = string, TAccountSystemProgram extends string = string, TAccountClock extends string = string> = {
656
- /** Agent account with enhanced 2025 PDA security */
657
- agentAccount?: Address<TAccountAgentAccount>;
658
- /**
659
- * User registry with enhanced validation
660
- * Authority with enhanced verification
661
- */
662
- signer: TransactionSigner<TAccountSigner>;
663
- /** System program for account creation */
664
- systemProgram?: Address<TAccountSystemProgram>;
665
- /** Clock sysvar for timestamp validation */
666
- clock?: Address<TAccountClock>;
667
- agentType: RegisterAgentInstructionDataArgs["agentType"];
668
- name: RegisterAgentInstructionDataArgs["name"];
669
- description: RegisterAgentInstructionDataArgs["description"];
670
- metadataUri: RegisterAgentInstructionDataArgs["metadataUri"];
671
- agentId: RegisterAgentInstructionDataArgs["agentId"];
833
+ type SubmitDeliveryInput<TAccountEscrow extends string = string, TAccountAgent extends string = string, TAccountAgentOwner extends string = string> = {
834
+ escrow: Address<TAccountEscrow>;
835
+ agent: Address<TAccountAgent>;
836
+ agentOwner: TransactionSigner<TAccountAgentOwner>;
837
+ deliveryProof: SubmitDeliveryInstructionDataArgs["deliveryProof"];
672
838
  };
673
- declare function getRegisterAgentInstructionAsync<TAccountAgentAccount extends string, TAccountSigner extends string, TAccountSystemProgram extends string, TAccountClock extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: RegisterAgentAsyncInput<TAccountAgentAccount, TAccountSigner, TAccountSystemProgram, TAccountClock>, config?: {
839
+ declare function getSubmitDeliveryInstruction<TAccountEscrow extends string, TAccountAgent extends string, TAccountAgentOwner extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: SubmitDeliveryInput<TAccountEscrow, TAccountAgent, TAccountAgentOwner>, config?: {
674
840
  programAddress?: TProgramAddress;
675
- }): Promise<RegisterAgentInstruction<TProgramAddress, TAccountAgentAccount, TAccountSigner, TAccountSystemProgram, TAccountClock>>;
841
+ }): SubmitDeliveryInstruction<TProgramAddress, TAccountEscrow, TAccountAgent, TAccountAgentOwner>;
676
842
 
677
843
  /**
678
844
  * This code was AUTOGENERATED using the Codama library.
@@ -682,36 +848,62 @@ declare function getRegisterAgentInstructionAsync<TAccountAgentAccount extends s
682
848
  * @see https://github.com/codama-idl/codama
683
849
  */
684
850
 
685
- type SendEnhancedMessageInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountMessage extends string | AccountMeta<string> = string, TAccountChannel extends string | AccountMeta<string> = string, TAccountReentrancyGuard extends string | AccountMeta<string> = string, TAccountSender extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
686
- TAccountMessage extends string ? WritableAccount<TAccountMessage> : TAccountMessage,
687
- TAccountChannel extends string ? WritableAccount<TAccountChannel> : TAccountChannel,
688
- TAccountReentrancyGuard extends string ? WritableAccount<TAccountReentrancyGuard> : TAccountReentrancyGuard,
689
- TAccountSender extends string ? WritableSignerAccount<TAccountSender> & AccountSignerMeta<TAccountSender> : TAccountSender,
690
- TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
851
+ type UnstakeGhostInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountStakingAccount extends string | AccountMeta<string> = string, TAccountStakingConfig extends string | AccountMeta<string> = string, TAccountStakingVault extends string | AccountMeta<string> = string, TAccountOwnerTokenAccount extends string | AccountMeta<string> = string, TAccountOwner extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
852
+ TAccountStakingAccount extends string ? WritableAccount<TAccountStakingAccount> : TAccountStakingAccount,
853
+ TAccountStakingConfig extends string ? ReadonlyAccount<TAccountStakingConfig> : TAccountStakingConfig,
854
+ TAccountStakingVault extends string ? WritableAccount<TAccountStakingVault> : TAccountStakingVault,
855
+ TAccountOwnerTokenAccount extends string ? WritableAccount<TAccountOwnerTokenAccount> : TAccountOwnerTokenAccount,
856
+ TAccountOwner extends string ? WritableSignerAccount<TAccountOwner> & AccountSignerMeta<TAccountOwner> : TAccountOwner,
857
+ TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
691
858
  ...TRemainingAccounts
692
859
  ]>;
693
- type SendEnhancedMessageInstructionDataArgs = {
694
- messageId: string;
695
- content: string;
696
- messageType: MessageTypeArgs;
697
- metadata: MessageMetadataArgs;
698
- isEncrypted: boolean;
860
+ type UnstakeGhostAsyncInput<TAccountStakingAccount extends string = string, TAccountStakingConfig extends string = string, TAccountStakingVault extends string = string, TAccountOwnerTokenAccount extends string = string, TAccountOwner extends string = string, TAccountTokenProgram extends string = string> = {
861
+ stakingAccount?: Address<TAccountStakingAccount>;
862
+ stakingConfig?: Address<TAccountStakingConfig>;
863
+ stakingVault?: Address<TAccountStakingVault>;
864
+ ownerTokenAccount: Address<TAccountOwnerTokenAccount>;
865
+ owner: TransactionSigner<TAccountOwner>;
866
+ tokenProgram?: Address<TAccountTokenProgram>;
699
867
  };
700
- type SendEnhancedMessageAsyncInput<TAccountMessage extends string = string, TAccountChannel extends string = string, TAccountReentrancyGuard extends string = string, TAccountSender extends string = string, TAccountSystemProgram extends string = string> = {
701
- message?: Address<TAccountMessage>;
702
- channel: Address<TAccountChannel>;
703
- reentrancyGuard?: Address<TAccountReentrancyGuard>;
704
- sender: TransactionSigner<TAccountSender>;
705
- systemProgram?: Address<TAccountSystemProgram>;
706
- messageId: SendEnhancedMessageInstructionDataArgs["messageId"];
707
- content: SendEnhancedMessageInstructionDataArgs["content"];
708
- messageType: SendEnhancedMessageInstructionDataArgs["messageType"];
709
- metadata: SendEnhancedMessageInstructionDataArgs["metadata"];
710
- isEncrypted: SendEnhancedMessageInstructionDataArgs["isEncrypted"];
868
+ declare function getUnstakeGhostInstructionAsync<TAccountStakingAccount extends string, TAccountStakingConfig extends string, TAccountStakingVault extends string, TAccountOwnerTokenAccount extends string, TAccountOwner extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: UnstakeGhostAsyncInput<TAccountStakingAccount, TAccountStakingConfig, TAccountStakingVault, TAccountOwnerTokenAccount, TAccountOwner, TAccountTokenProgram>, config?: {
869
+ programAddress?: TProgramAddress;
870
+ }): Promise<UnstakeGhostInstruction<TProgramAddress, TAccountStakingAccount, TAccountStakingConfig, TAccountStakingVault, TAccountOwnerTokenAccount, TAccountOwner, TAccountTokenProgram>>;
871
+
872
+ /**
873
+ * This code was AUTOGENERATED using the Codama library.
874
+ * Please DO NOT EDIT THIS FILE, instead use visitors
875
+ * to add features, then rerun Codama to update it.
876
+ *
877
+ * @see https://github.com/codama-idl/codama
878
+ */
879
+
880
+ type UpdateDidDocumentInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountDidDocument extends string | AccountMeta<string> = string, TAccountController extends string | AccountMeta<string> = string, TAccountClock extends string | AccountMeta<string> = "SysvarC1ock11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
881
+ TAccountDidDocument extends string ? WritableAccount<TAccountDidDocument> : TAccountDidDocument,
882
+ TAccountController extends string ? WritableSignerAccount<TAccountController> & AccountSignerMeta<TAccountController> : TAccountController,
883
+ TAccountClock extends string ? ReadonlyAccount<TAccountClock> : TAccountClock,
884
+ ...TRemainingAccounts
885
+ ]>;
886
+ type UpdateDidDocumentInstructionDataArgs = {
887
+ addVerificationMethod: OptionOrNullable<VerificationMethodArgs>;
888
+ removeVerificationMethodId: OptionOrNullable<string>;
889
+ addServiceEndpoint: OptionOrNullable<ServiceEndpointArgs>;
890
+ removeServiceEndpointId: OptionOrNullable<string>;
891
+ };
892
+ type UpdateDidDocumentAsyncInput<TAccountDidDocument extends string = string, TAccountController extends string = string, TAccountClock extends string = string> = {
893
+ /** DID document account with canonical PDA validation */
894
+ didDocument?: Address<TAccountDidDocument>;
895
+ /** Controller of the DID (must match document controller) */
896
+ controller: TransactionSigner<TAccountController>;
897
+ /** Clock sysvar for timestamp validation */
898
+ clock?: Address<TAccountClock>;
899
+ addVerificationMethod: UpdateDidDocumentInstructionDataArgs["addVerificationMethod"];
900
+ removeVerificationMethodId: UpdateDidDocumentInstructionDataArgs["removeVerificationMethodId"];
901
+ addServiceEndpoint: UpdateDidDocumentInstructionDataArgs["addServiceEndpoint"];
902
+ removeServiceEndpointId: UpdateDidDocumentInstructionDataArgs["removeServiceEndpointId"];
711
903
  };
712
- declare function getSendEnhancedMessageInstructionAsync<TAccountMessage extends string, TAccountChannel extends string, TAccountReentrancyGuard extends string, TAccountSender extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: SendEnhancedMessageAsyncInput<TAccountMessage, TAccountChannel, TAccountReentrancyGuard, TAccountSender, TAccountSystemProgram>, config?: {
904
+ declare function getUpdateDidDocumentInstructionAsync<TAccountDidDocument extends string, TAccountController extends string, TAccountClock extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: UpdateDidDocumentAsyncInput<TAccountDidDocument, TAccountController, TAccountClock>, config?: {
713
905
  programAddress?: TProgramAddress;
714
- }): Promise<SendEnhancedMessageInstruction<TProgramAddress, TAccountMessage, TAccountChannel, TAccountReentrancyGuard, TAccountSender, TAccountSystemProgram>>;
906
+ }): Promise<UpdateDidDocumentInstruction<TProgramAddress, TAccountDidDocument, TAccountController, TAccountClock>>;
715
907
 
716
908
  /**
717
909
  * This code was AUTOGENERATED using the Codama library.
@@ -721,24 +913,36 @@ declare function getSendEnhancedMessageInstructionAsync<TAccountMessage extends
721
913
  * @see https://github.com/codama-idl/codama
722
914
  */
723
915
 
724
- type UpdateChannelSettingsInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountChannel extends string | AccountMeta<string> = string, TAccountReentrancyGuard extends string | AccountMeta<string> = string, TAccountAuthority extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
725
- TAccountChannel extends string ? WritableAccount<TAccountChannel> : TAccountChannel,
726
- TAccountReentrancyGuard extends string ? WritableAccount<TAccountReentrancyGuard> : TAccountReentrancyGuard,
916
+ type UpdateReputationTagsInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountReputationMetrics extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountAuthority extends string | AccountMeta<string> = string, TAccountClock extends string | AccountMeta<string> = "SysvarC1ock11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
917
+ TAccountReputationMetrics extends string ? WritableAccount<TAccountReputationMetrics> : TAccountReputationMetrics,
918
+ TAccountAgent extends string ? WritableAccount<TAccountAgent> : TAccountAgent,
727
919
  TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
920
+ TAccountClock extends string ? ReadonlyAccount<TAccountClock> : TAccountClock,
728
921
  ...TRemainingAccounts
729
922
  ]>;
730
- type UpdateChannelSettingsInstructionDataArgs = {
731
- newMetadata: ChannelMetadataArgs;
923
+ type UpdateReputationTagsInstructionDataArgs = {
924
+ skillTags: Array<string>;
925
+ behaviorTags: Array<string>;
926
+ complianceTags: Array<string>;
927
+ tagScores: Array<TagScoreArgs>;
732
928
  };
733
- type UpdateChannelSettingsInput<TAccountChannel extends string = string, TAccountReentrancyGuard extends string = string, TAccountAuthority extends string = string> = {
734
- channel: Address<TAccountChannel>;
735
- reentrancyGuard: Address<TAccountReentrancyGuard>;
929
+ type UpdateReputationTagsAsyncInput<TAccountReputationMetrics extends string = string, TAccountAgent extends string = string, TAccountAuthority extends string = string, TAccountClock extends string = string> = {
930
+ /** Reputation metrics account */
931
+ reputationMetrics?: Address<TAccountReputationMetrics>;
932
+ /** Agent account */
933
+ agent: Address<TAccountAgent>;
934
+ /** Authority (can be the agent owner or authorized updater) */
736
935
  authority: TransactionSigner<TAccountAuthority>;
737
- newMetadata: UpdateChannelSettingsInstructionDataArgs["newMetadata"];
936
+ /** Clock for timestamps */
937
+ clock?: Address<TAccountClock>;
938
+ skillTags: UpdateReputationTagsInstructionDataArgs["skillTags"];
939
+ behaviorTags: UpdateReputationTagsInstructionDataArgs["behaviorTags"];
940
+ complianceTags: UpdateReputationTagsInstructionDataArgs["complianceTags"];
941
+ tagScores: UpdateReputationTagsInstructionDataArgs["tagScores"];
738
942
  };
739
- declare function getUpdateChannelSettingsInstruction<TAccountChannel extends string, TAccountReentrancyGuard extends string, TAccountAuthority extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: UpdateChannelSettingsInput<TAccountChannel, TAccountReentrancyGuard, TAccountAuthority>, config?: {
943
+ declare function getUpdateReputationTagsInstructionAsync<TAccountReputationMetrics extends string, TAccountAgent extends string, TAccountAuthority extends string, TAccountClock extends string, TProgramAddress extends Address = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS>(input: UpdateReputationTagsAsyncInput<TAccountReputationMetrics, TAccountAgent, TAccountAuthority, TAccountClock>, config?: {
740
944
  programAddress?: TProgramAddress;
741
- }): UpdateChannelSettingsInstruction<TProgramAddress, TAccountChannel, TAccountReentrancyGuard, TAccountAuthority>;
945
+ }): Promise<UpdateReputationTagsInstruction<TProgramAddress, TAccountReputationMetrics, TAccountAgent, TAccountAuthority, TAccountClock>>;
742
946
 
743
947
  /**
744
948
  * RPC Type Definitions for Solana Web3.js v2
@@ -836,12 +1040,164 @@ interface SendTransactionOptions {
836
1040
  minContextSlot?: Slot;
837
1041
  }
838
1042
 
839
- interface RpcClientConfig {
840
- endpoint: string;
841
- wsEndpoint?: string;
842
- commitment?: Commitment;
843
- maxRetries?: number;
844
- retryDelay?: number;
1043
+ /**
1044
+ * API Response Types for GhostSpeak Public API
1045
+ *
1046
+ * These types match the REST API responses from packages/api
1047
+ */
1048
+ interface ApiGhost {
1049
+ address: string;
1050
+ owner: string | null;
1051
+ status: string;
1052
+ firstTxSignature: string;
1053
+ firstSeenTimestamp: number;
1054
+ discoverySource: string;
1055
+ claimedAt: number | null;
1056
+ agentId: string;
1057
+ name: string;
1058
+ description: string;
1059
+ metadataUri: string;
1060
+ serviceEndpoint: string;
1061
+ externalIdentifiers: Array<{
1062
+ platform: string;
1063
+ externalId: string;
1064
+ verified: boolean;
1065
+ verifiedAt: number;
1066
+ }>;
1067
+ ghostScore: number;
1068
+ reputationScore: number;
1069
+ reputationComponents: Array<{
1070
+ source: string;
1071
+ score: number;
1072
+ weight: number;
1073
+ lastUpdated: number;
1074
+ }>;
1075
+ didAddress: string | null;
1076
+ credentials: string[];
1077
+ isActive: boolean;
1078
+ isVerified: boolean;
1079
+ verificationTimestamp: number;
1080
+ createdAt: number;
1081
+ updatedAt: number;
1082
+ }
1083
+ interface ApiGhostScore {
1084
+ address: string;
1085
+ score: number;
1086
+ maxScore: number;
1087
+ components: Array<{
1088
+ source: string;
1089
+ score: number;
1090
+ weight: number;
1091
+ lastUpdated: number;
1092
+ }>;
1093
+ lastUpdated: number;
1094
+ }
1095
+ interface ApiExternalIdLookup {
1096
+ mapping: {
1097
+ platform: string;
1098
+ externalId: string;
1099
+ ghostAddress: string;
1100
+ verified: boolean;
1101
+ verifiedAt: number | null;
1102
+ createdAt: number;
1103
+ };
1104
+ ghost: ApiGhost | null;
1105
+ }
1106
+
1107
+ /**
1108
+ * Calculate visible score based on privacy settings
1109
+ *
1110
+ * @param score - Actual reputation score
1111
+ * @param privacyMode - Privacy mode setting
1112
+ * @param hasAccess - Whether viewer has full access
1113
+ * @returns Visible score data
1114
+ */
1115
+ declare function calculateVisibleScore(score: number, privacyMode: PrivacyMode, hasAccess: boolean): {
1116
+ exactScore?: number;
1117
+ tier?: ReputationTier;
1118
+ scoreRange?: ScoreRange;
1119
+ };
1120
+ /**
1121
+ * Get reputation tier from score
1122
+ *
1123
+ * @param score - Reputation score (0-10000)
1124
+ * @returns Reputation tier
1125
+ */
1126
+ declare function getReputationTier(score: number): ReputationTier;
1127
+ /**
1128
+ * Get score range bucket from score
1129
+ *
1130
+ * @param score - Reputation score (0-10000)
1131
+ * @returns Score range bucket
1132
+ */
1133
+ declare function getScoreRange(score: number): ScoreRange;
1134
+ /**
1135
+ * Check if viewer has access to private data
1136
+ *
1137
+ * @param viewerAddress - Address of the viewer
1138
+ * @param settings - Privacy settings
1139
+ * @param agentAddress - Agent address (viewer is agent)
1140
+ * @returns Whether viewer has access
1141
+ */
1142
+ declare function canViewerAccess(viewerAddress: Address$1, settings: PrivacySettings, agentAddress: Address$1): boolean;
1143
+ /**
1144
+ * Filter reputation metrics by visibility settings
1145
+ *
1146
+ * @param reputationData - Full reputation data
1147
+ * @param metricVisibility - Metric visibility settings
1148
+ * @param hasAccess - Whether viewer has full access
1149
+ * @returns Filtered visible reputation
1150
+ */
1151
+ declare function filterMetricsByVisibility(reputationData: {
1152
+ agent: Address$1;
1153
+ overallScore: number;
1154
+ totalJobsCompleted: number;
1155
+ totalJobsFailed: number;
1156
+ avgResponseTime: number;
1157
+ disputesAgainst: number;
1158
+ disputesResolved: number;
1159
+ totalEarnings?: number;
1160
+ avgRating?: number;
1161
+ badges?: string[];
1162
+ }, metricVisibility: MetricVisibility, hasAccess: boolean): Partial<VisibleReputation>;
1163
+ /**
1164
+ * Create default metric visibility settings
1165
+ *
1166
+ * @param mode - Privacy mode
1167
+ * @returns Default metric visibility
1168
+ */
1169
+ declare function getDefaultMetricVisibility(mode: PrivacyMode): MetricVisibility;
1170
+ /**
1171
+ * Validate privacy settings
1172
+ *
1173
+ * @param settings - Privacy settings to validate
1174
+ * @returns Validation result with errors if any
1175
+ */
1176
+ declare function validatePrivacySettings(settings: PrivacySettings): {
1177
+ valid: boolean;
1178
+ errors: string[];
1179
+ };
1180
+ /**
1181
+ * Get tier display name
1182
+ *
1183
+ * @param tier - Reputation tier
1184
+ * @returns Display name
1185
+ */
1186
+ declare function getTierDisplayName(tier: ReputationTier): string;
1187
+ /**
1188
+ * Get range display string
1189
+ *
1190
+ * @param range - Score range
1191
+ * @returns Display string
1192
+ */
1193
+ declare function getRangeDisplayString(range: ScoreRange): string;
1194
+
1195
+ interface RpcClientConfig {
1196
+ endpoint: string;
1197
+ wsEndpoint?: string;
1198
+ commitment?: Commitment;
1199
+ maxRetries?: number;
1200
+ retryDelay?: number;
845
1201
  timeout?: number;
846
1202
  }
847
1203
  /**
@@ -920,1312 +1276,638 @@ declare class RpcClient {
920
1276
  }
921
1277
 
922
1278
  /**
923
- * x402 Payment Protocol Client for Solana
1279
+ * Batch Operations - Efficient multi-account fetching
924
1280
  *
925
- * Implements the x402 open payment standard for AI agent commerce.
926
- * Reference: https://www.x402.org
1281
+ * Utilities for batching RPC calls to reduce network overhead.
1282
+ * Uses Solana's getMultipleAccounts with 100-account limit.
927
1283
  *
928
- * @module X402Client
1284
+ * @module batch-operations
929
1285
  */
930
1286
 
931
- interface X402PaymentRequest {
932
- recipient: Address$1;
933
- amount: bigint;
934
- token: Address$1;
935
- description: string;
936
- metadata?: Record<string, string>;
937
- expiresAt?: number;
938
- requiresReceipt?: boolean;
939
- }
940
- interface X402PaymentReceipt {
941
- signature: Signature;
942
- recipient: Address$1;
943
- amount: bigint;
944
- token: Address$1;
945
- timestamp: number;
946
- metadata?: Record<string, string>;
947
- blockTime?: number;
948
- slot?: bigint;
949
- }
950
- interface X402PaymentHeaders {
951
- 'X-Payment-Address': string;
952
- 'X-Payment-Amount': string;
953
- 'X-Payment-Token': string;
954
- 'X-Payment-Blockchain': 'solana';
955
- 'X-Payment-Description'?: string;
956
- 'X-Payment-Expires-At'?: string;
957
- }
958
- interface X402VerificationResult {
959
- valid: boolean;
960
- receipt?: X402PaymentReceipt;
961
- error?: string;
962
- }
963
- declare class X402Client extends EventEmitter {
964
- private rpc;
965
- private wallet?;
966
- constructor(rpc: Rpc<SolanaRpcApi & GetTransactionApi>, wallet?: TransactionSigner | undefined);
967
- /**
968
- * Create an x402 payment request
969
- * Returns HTTP 402 compatible headers
970
- */
971
- createPaymentRequest(params: {
972
- amount: bigint;
973
- token: Address$1;
974
- description: string;
975
- expiresAt?: number;
976
- metadata?: Record<string, string>;
977
- }): X402PaymentRequest;
978
- /**
979
- * Create HTTP 402 response headers
980
- */
981
- createPaymentHeaders(request: X402PaymentRequest): X402PaymentHeaders;
982
- /**
983
- * Execute an x402 payment
984
- */
985
- pay(request: X402PaymentRequest): Promise<X402PaymentReceipt>;
986
- /**
987
- * Verify an x402 payment
988
- */
989
- verifyPayment(signature: Signature): Promise<X402VerificationResult>;
990
- /**
991
- * Verify payment for specific recipient and amount
992
- */
993
- verifyPaymentDetails(params: {
994
- signature: Signature;
995
- expectedRecipient: Address$1;
996
- expectedAmount: bigint;
997
- expectedToken: Address$1;
998
- }): Promise<X402VerificationResult>;
999
- /**
1000
- * Get payment status
1001
- */
1002
- getPaymentStatus(signature: Signature): Promise<{
1003
- status: 'pending' | 'confirmed' | 'finalized' | 'failed' | 'not_found';
1004
- confirmations?: number;
1005
- }>;
1006
- private createTransferInstruction;
1007
- private createMemoInstruction;
1008
- private getAssociatedTokenAddress;
1009
- private parseTransactionReceipt;
1010
- /**
1011
- * Send and confirm transaction manually (simplified implementation)
1012
- * This is a workaround for the missing rpcSubscriptions dependency
1013
- */
1014
- private sendAndConfirmTransactionManually;
1015
- }
1016
- declare function createX402Client(rpcUrl: string, wallet?: TransactionSigner): X402Client;
1017
-
1018
1287
  /**
1019
- * HTTP 402 Middleware for AI Agent Services
1020
- *
1021
- * Implements the x402 payment protocol as Express/Fastify middleware.
1022
- * Enables pay-per-request API endpoints.
1023
- *
1024
- * @module X402Middleware
1288
+ * Batch progress callback
1025
1289
  */
1026
-
1027
- type Request = {
1028
- headers: Record<string, string | string[] | undefined>;
1029
- body?: unknown;
1030
- query?: unknown;
1031
- params?: unknown;
1032
- url?: string;
1033
- ip?: string;
1034
- [key: string]: unknown;
1035
- };
1036
- type Response$1 = {
1037
- status(code: number): Response$1;
1038
- json(body: unknown): Response$1;
1039
- set(headers: Record<string, string>): Response$1;
1040
- send(body?: unknown): Response$1;
1041
- [key: string]: unknown;
1042
- };
1043
- type NextFunction = () => void;
1044
- type FastifyRequest = {
1045
- headers: Record<string, string | string[] | undefined>;
1046
- body?: unknown;
1047
- query?: unknown;
1048
- params?: unknown;
1049
- url?: string;
1050
- ip?: string;
1051
- [key: string]: unknown;
1052
- };
1053
- type FastifyReply = {
1054
- code(statusCode: number): FastifyReply;
1055
- send(payload?: unknown): FastifyReply;
1056
- header(name: string, value: string): FastifyReply;
1057
- headers(headers: Record<string, string>): FastifyReply;
1058
- [key: string]: unknown;
1059
- };
1060
- type FastifyInstance = {
1061
- addHook(name: string, hook: (request: FastifyRequest, reply: FastifyReply) => Promise<void>): void;
1062
- [key: string]: unknown;
1063
- };
1064
- interface X402MiddlewareOptions {
1065
- x402Client: X402Client;
1066
- requiredPayment: bigint;
1067
- token: Address$1;
1068
- description: string;
1069
- agentId?: string;
1070
- recordPaymentOnChain?: boolean;
1071
- allowBypass?: boolean;
1072
- bypassAddresses?: Address$1[];
1073
- preventDuplicatePayments?: boolean;
1074
- signatureCacheTTL?: number;
1075
- enforceExpiration?: boolean;
1076
- lookupCallerIdentity?: boolean;
1077
- rpcEndpoint?: string;
1078
- programId?: Address$1;
1079
- onPaymentVerified?: (signature: string, req: Request) => Promise<void>;
1080
- onPaymentFailed?: (error: string, req: Request) => Promise<void>;
1081
- onReputationUpdateFailed?: (error: Error) => void;
1082
- }
1290
+ type BatchProgressCallback = (completed: number, total: number) => void;
1083
1291
  /**
1084
- * Caller identity information for authenticated agents
1292
+ * Batch fetch configuration
1085
1293
  */
1086
- interface X402CallerIdentity {
1087
- type: 'agent' | 'unknown';
1088
- address: Address$1;
1089
- agent?: {
1090
- name: string;
1091
- owner: Address$1;
1092
- reputation_score: number;
1093
- is_verified: boolean;
1094
- capabilities: string[];
1095
- framework_origin: string;
1096
- x402_enabled: boolean;
1097
- };
1098
- }
1099
- interface X402RequestWithPayment extends Request {
1100
- x402Payment?: {
1101
- signature: string;
1102
- verified: boolean;
1103
- amount: bigint;
1104
- token: Address$1;
1105
- responseTimeMs?: number;
1106
- timestamp: number;
1107
- caller?: X402CallerIdentity;
1108
- };
1109
- }
1110
- interface X402FastifyRequest extends FastifyRequest {
1111
- x402Payment?: {
1112
- signature: string;
1113
- verified: boolean;
1114
- amount: bigint;
1115
- token: Address$1;
1116
- };
1294
+ interface BatchFetchConfig {
1295
+ /** Progress callback for large batches */
1296
+ onProgress?: BatchProgressCallback;
1297
+ /** Batch size (default: 100, max: 100) */
1298
+ batchSize?: number;
1117
1299
  }
1118
1300
  /**
1119
- * Express middleware for x402 payment verification
1301
+ * Batch fetch multiple accounts with automatic chunking
1302
+ *
1303
+ * Features:
1304
+ * - Automatic batching (100 accounts per RPC call)
1305
+ * - Parallel batch execution
1306
+ * - Progress callback support
1307
+ * - Preserves order
1308
+ *
1309
+ * @param rpc - RPC client
1310
+ * @param addresses - Account addresses to fetch
1311
+ * @param config - Batch configuration
1312
+ * @returns Array of accounts (in same order as input)
1120
1313
  *
1121
1314
  * @example
1122
1315
  * ```typescript
1123
- * import express from 'express'
1124
- * import { createX402Middleware } from '@ghostspeak/sdk'
1125
- *
1126
- * const app = express()
1127
- *
1128
- * app.get('/api/agent/query',
1129
- * createX402Middleware({
1130
- * x402Client: client,
1131
- * requiredPayment: 1000n, // 0.001 USDC
1132
- * token: USDC_ADDRESS,
1133
- * description: 'AI agent query'
1134
- * }),
1135
- * async (req, res) => {
1136
- * // Payment verified, process request
1137
- * const result = await processQuery(req.query)
1138
- * res.json(result)
1316
+ * const addresses = [...1000 agent addresses...]
1317
+ * const accounts = await batchGetAccounts(rpc, addresses, {
1318
+ * onProgress: (completed, total) => {
1319
+ * console.log(`Fetched ${completed}/${total} accounts`)
1139
1320
  * }
1140
- * )
1321
+ * })
1141
1322
  * ```
1142
1323
  */
1143
- declare function createX402Middleware(options: X402MiddlewareOptions): (req: X402RequestWithPayment, res: Response$1, next: NextFunction) => Promise<void>;
1324
+ declare function batchGetAccounts<T>(rpc: ExtendedRpcApi, addresses: Address$1[], config?: BatchFetchConfig): Promise<(T | null)[]>;
1144
1325
  /**
1145
- * Fastify plugin for x402 payment verification
1326
+ * Batch fetch with filtering (only non-null accounts)
1327
+ *
1328
+ * Useful when you expect some addresses to not exist.
1329
+ *
1330
+ * @param rpc - RPC client
1331
+ * @param addresses - Account addresses to fetch
1332
+ * @param config - Batch configuration
1333
+ * @returns Array of non-null accounts with their addresses
1146
1334
  *
1147
1335
  * @example
1148
1336
  * ```typescript
1149
- * import Fastify from 'fastify'
1150
- * import { x402FastifyPlugin } from '@ghostspeak/sdk'
1151
- *
1152
- * const fastify = Fastify()
1153
- *
1154
- * fastify.register(x402FastifyPlugin, {
1155
- * x402Client: client,
1156
- * routes: {
1157
- * '/api/agent/query': {
1158
- * payment: 1000n,
1159
- * token: USDC_ADDRESS,
1160
- * description: 'AI agent query'
1161
- * }
1162
- * }
1163
- * })
1337
+ * const addresses = [...agent addresses...]
1338
+ * const existing = await batchGetExistingAccounts(rpc, addresses)
1339
+ * // Returns only accounts that exist: [{ address, account }, ...]
1164
1340
  * ```
1165
1341
  */
1166
- declare function x402FastifyPlugin(fastify: FastifyInstance, options: {
1167
- x402Client: X402Client;
1168
- routes: Record<string, {
1169
- payment: bigint;
1170
- token: Address$1;
1171
- description: string;
1172
- }>;
1173
- }): void;
1174
- /**
1175
- * Decorator to add rate limiting based on x402 payments
1176
- */
1177
- declare function withX402RateLimit(options: {
1178
- maxRequestsPerMinute: number;
1179
- paymentRequired: bigint;
1180
- }): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
1181
-
1342
+ declare function batchGetExistingAccounts<T>(rpc: ExtendedRpcApi, addresses: Address$1[], config?: BatchFetchConfig): Promise<Array<{
1343
+ address: Address$1;
1344
+ account: T;
1345
+ }>>;
1182
1346
  /**
1183
- * x402 Facilitator Registry
1184
- *
1185
- * Manages x402 payment facilitators across multiple blockchain networks.
1186
- * Facilitators are payment processors that handle x402 transaction verification
1187
- * and settlement, enabling cross-chain interoperability.
1347
+ * Batch fetch with mapping
1188
1348
  *
1189
- * @module x402/FacilitatorRegistry
1190
- */
1191
- /**
1192
- * Supported blockchain networks for x402 payments
1193
- */
1194
- declare enum Network {
1195
- SOLANA = "solana",
1196
- BASE = "base",
1197
- POLYGON = "polygon",
1198
- ETHEREUM = "ethereum",
1199
- ARBITRUM = "arbitrum"
1200
- }
1201
-
1202
- /**
1203
- * Enhanced x402 Response Schema
1349
+ * Fetches accounts and immediately maps them to a transformed type.
1204
1350
  *
1205
- * Extended x402 protocol schema with AI integration fields.
1206
- * Enables AI models to understand and use x402 resources as tools.
1351
+ * @param rpc - RPC client
1352
+ * @param addresses - Account addresses to fetch
1353
+ * @param mapper - Transform function (account, address, index) => result
1354
+ * @param config - Batch configuration
1355
+ * @returns Array of mapped results
1207
1356
  *
1208
- * @module x402/schemas/enhanced-x402
1209
- */
1210
-
1211
- /**
1212
- * Payment scheme types
1213
- */
1214
- type PaymentScheme = 'exact' | 'upto' | 'base' | 'tiered';
1215
- /**
1216
- * Standard x402 payment requirement
1357
+ * @example
1358
+ * ```typescript
1359
+ * const agentSummaries = await batchGetAndMap(
1360
+ * rpc,
1361
+ * agentAddresses,
1362
+ * (account, address) => ({
1363
+ * address,
1364
+ * name: account.data.name,
1365
+ * reputation: account.data.totalScore
1366
+ * })
1367
+ * )
1368
+ * ```
1217
1369
  */
1218
- interface X402PaymentRequirement {
1219
- /** Payment scheme: exact, upto, base, tiered */
1220
- scheme: PaymentScheme;
1221
- /** Blockchain network */
1222
- network: Network;
1223
- /** Maximum amount required (in smallest unit) */
1224
- maxAmountRequired: string;
1225
- /** Resource identifier (usually the URL) */
1226
- resource?: string;
1227
- /** Human-readable description */
1228
- description?: string;
1229
- /** Expected response MIME type */
1230
- mimeType?: string;
1231
- /** Address to pay (facilitator or direct) */
1232
- payTo: string;
1233
- /** Maximum time to complete payment */
1234
- maxTimeoutSeconds?: number;
1235
- /** Token/asset address */
1236
- asset: string;
1237
- /** Additional facilitator-specific data */
1238
- extra?: Record<string, unknown>;
1239
- }
1240
-
1370
+ declare function batchGetAndMap<T, R>(rpc: ExtendedRpcApi, addresses: Address$1[], mapper: (account: T | null, address: Address$1, index: number) => R, config?: BatchFetchConfig): Promise<R[]>;
1241
1371
  /**
1242
- * Fetch with x402 Payment
1372
+ * Batch fetch with retry logic
1243
1373
  *
1244
- * Wraps the standard fetch API to automatically handle x402 payment flows.
1245
- * When a 402 response is received, creates and submits payment, then retries.
1374
+ * Retries failed batches with exponential backoff.
1246
1375
  *
1247
- * @module x402/fetchWithPayment
1248
- */
1249
-
1250
- /**
1251
- * Options for fetchWithX402Payment
1252
- */
1253
- interface FetchWithPaymentOptions extends RequestInit {
1254
- /** Maximum amount willing to pay (in smallest unit) */
1255
- maxPayment?: bigint;
1256
- /** Preferred network for payment */
1257
- preferredNetwork?: Network;
1258
- /** Preferred token address */
1259
- preferredToken?: string;
1260
- /** Timeout for the request in ms */
1261
- timeout?: number;
1262
- /** Number of retries for payment */
1263
- retries?: number;
1264
- /** Callback when payment is made */
1265
- onPayment?: (payment: PaymentInfo) => void;
1266
- /** Callback for 402 response before payment */
1267
- onPaymentRequired?: (requirements: X402PaymentRequirement[]) => void;
1268
- /** Skip payment and return 402 response */
1269
- dryRun?: boolean;
1270
- }
1271
- /**
1272
- * Payment information from a successful payment
1273
- */
1274
- interface PaymentInfo {
1275
- signature: string;
1276
- amount: bigint;
1277
- recipient: string;
1278
- token: string;
1279
- network: Network;
1280
- timestamp: number;
1281
- }
1282
- /**
1283
- * Extended response with payment info
1284
- */
1285
- interface X402Response extends Response {
1286
- paymentInfo?: PaymentInfo;
1287
- x402Requirements?: X402PaymentRequirement[];
1288
- }
1289
- /**
1290
- * Payment header creator function type
1291
- */
1292
- type PaymentHeaderCreator = (requirement: X402PaymentRequirement, wallet: TransactionSigner) => Promise<string>;
1293
- /**
1294
- * Fetch with payment client options
1295
- */
1296
- interface FetchWithPaymentClientOptions {
1297
- wallet: TransactionSigner;
1298
- createPaymentHeader: PaymentHeaderCreator;
1299
- maxPayment?: bigint;
1300
- preferredNetwork?: Network;
1301
- preferredToken?: string;
1302
- timeout?: number;
1303
- retries?: number;
1304
- userAgent?: string;
1305
- }
1306
- /**
1307
- * Client for making x402-enabled HTTP requests
1376
+ * @param rpc - RPC client
1377
+ * @param addresses - Account addresses to fetch
1378
+ * @param config - Batch configuration
1379
+ * @param maxRetries - Maximum retry attempts (default: 3)
1380
+ * @returns Array of accounts
1308
1381
  */
1309
- declare class FetchWithPaymentClient extends EventEmitter {
1310
- private readonly wallet;
1311
- private readonly createPaymentHeader;
1312
- private readonly maxPayment;
1313
- private readonly preferredNetwork?;
1314
- private readonly preferredToken?;
1315
- private readonly timeout;
1316
- private readonly retries;
1317
- private readonly userAgent;
1318
- constructor(options: FetchWithPaymentClientOptions);
1319
- /**
1320
- * Make an x402-enabled fetch request
1321
- */
1322
- fetch(url: string, options?: FetchWithPaymentOptions): Promise<X402Response>;
1323
- /**
1324
- * Internal fetch with payment logic
1325
- */
1326
- private fetchWithPayment;
1327
- /**
1328
- * Select the best payment requirement based on options
1329
- */
1330
- private selectPaymentRequirement;
1331
- }
1382
+ declare function batchGetAccountsWithRetry<T>(rpc: ExtendedRpcApi, addresses: Address$1[], config?: BatchFetchConfig, maxRetries?: number): Promise<(T | null)[]>;
1332
1383
  /**
1333
- * Make an x402-enabled fetch request
1384
+ * Create a batch fetcher with reusable configuration
1334
1385
  *
1335
- * This function automatically handles 402 Payment Required responses
1336
- * by creating a payment and retrying the request.
1386
+ * Factory pattern for creating pre-configured batch fetchers.
1337
1387
  *
1338
- * @example
1339
- * ```typescript
1340
- * const response = await fetchWithX402Payment(
1341
- * 'https://api.example.com/generate',
1342
- * {
1343
- * method: 'POST',
1344
- * headers: { 'Content-Type': 'application/json' },
1345
- * body: JSON.stringify({ prompt: 'Hello' })
1346
- * },
1347
- * wallet,
1348
- * createPaymentHeader,
1349
- * { maxPayment: 1000000n } // 1 USDC
1350
- * );
1351
- *
1352
- * const data = await response.json();
1353
- * console.log('Payment:', response.paymentInfo);
1354
- * ```
1355
- */
1356
- declare function fetchWithX402Payment(url: string, options: RequestInit, wallet: TransactionSigner, createPaymentHeader: PaymentHeaderCreator, paymentOptions?: Omit<FetchWithPaymentOptions, keyof RequestInit>): Promise<X402Response>;
1357
- /**
1358
- * Create a wrapped fetch function with x402 payment support
1388
+ * @param rpc - RPC client
1389
+ * @param defaultConfig - Default batch configuration
1390
+ * @returns Batch fetcher functions
1359
1391
  *
1360
1392
  * @example
1361
1393
  * ```typescript
1362
- * const x402Fetch = wrapFetchWithPayment(wallet, createPaymentHeader, {
1363
- * maxPayment: 1000000n
1364
- * });
1365
- *
1366
- * const response = await x402Fetch('https://api.example.com/generate', {
1367
- * method: 'POST',
1368
- * body: JSON.stringify({ prompt: 'Hello' })
1369
- * });
1370
- * ```
1371
- */
1372
- declare function wrapFetchWithPayment(wallet: TransactionSigner, createPaymentHeader: PaymentHeaderCreator, defaultOptions?: Partial<FetchWithPaymentClientOptions>): (url: string, options?: FetchWithPaymentOptions) => Promise<X402Response>;
1373
-
1374
- /**
1375
- * Real-time Analytics Streaming Module
1376
- *
1377
- * Provides WebSocket-based streaming of analytics events and metrics
1378
- * for real-time dashboards and monitoring systems.
1379
- */
1380
-
1381
- type Connection$1 = any;
1382
-
1383
- interface AnalyticsStreamOptions {
1384
- programId: Address;
1385
- commitment?: Commitment$1;
1386
- includeHistorical?: boolean;
1387
- metricsInterval?: number;
1388
- eventTypes?: string[];
1389
- reconnectInterval?: number;
1390
- maxReconnectAttempts?: number;
1391
- }
1392
- /**
1393
- * Real-time analytics streaming client
1394
+ * const fetcher = createBatchFetcher(rpc, {
1395
+ * batchSize: 50,
1396
+ * onProgress: (c, t) => console.log(`${c}/${t}`)
1397
+ * })
1394
1398
  *
1395
- * Provides WebSocket streaming of analytics events and aggregated metrics
1396
- * for building real-time dashboards and monitoring systems.
1399
+ * const accounts = await fetcher.getAccounts(addresses)
1400
+ * const existing = await fetcher.getExisting(addresses)
1401
+ * ```
1397
1402
  */
1398
- declare class AnalyticsStreamer extends EventEmitter {
1399
- private options;
1400
- private connection;
1401
- private programId;
1402
- private wsSubscriptionId?;
1403
- private metricsTimer?;
1404
- private reconnectAttempts;
1405
- private isActive;
1406
- private eventBuffer;
1407
- private lastMetricsTimestamp;
1408
- constructor(connection: Connection$1, options: AnalyticsStreamOptions);
1409
- /**
1410
- * Start streaming analytics events and metrics
1411
- */
1412
- start(): Promise<void>;
1413
- /**
1414
- * Stop streaming
1415
- */
1416
- stop(): Promise<void>;
1403
+ declare function createBatchFetcher(rpc: ExtendedRpcApi, defaultConfig?: BatchFetchConfig): {
1417
1404
  /**
1418
- * Subscribe to program events via WebSocket
1405
+ * Fetch multiple accounts
1419
1406
  */
1420
- private subscribeToEvents;
1407
+ getAccounts: <T>(addresses: Address$1[], config?: BatchFetchConfig) => Promise<(T | null)[]>;
1421
1408
  /**
1422
- * Process incoming logs and extract events
1409
+ * Fetch only existing accounts
1423
1410
  */
1424
- private processLogs;
1425
- /**
1426
- * Parse events from program logs
1427
- */
1428
- private parseEventsFromLogs;
1429
- /**
1430
- * Decode event data from base64
1431
- */
1432
- private decodeEventData;
1433
- /**
1434
- * Check if event is an analytics event
1435
- */
1436
- private isAnalyticsEvent;
1437
- /**
1438
- * Emit typed analytics event
1439
- */
1440
- private emitAnalyticsEvent;
1441
- /**
1442
- * Buffer events for metrics aggregation
1443
- */
1444
- private bufferEvent;
1445
- /**
1446
- * Start periodic metrics aggregation
1447
- */
1448
- private startMetricsAggregation;
1449
- /**
1450
- * Aggregate buffered events into metrics
1451
- */
1452
- private aggregateAndEmitMetrics;
1411
+ getExisting: <T>(addresses: Address$1[], config?: BatchFetchConfig) => Promise<{
1412
+ address: Address$1;
1413
+ account: T;
1414
+ }[]>;
1453
1415
  /**
1454
- * Fetch historical analytics data
1416
+ * Fetch and map accounts
1455
1417
  */
1456
- private fetchHistoricalData;
1418
+ getAndMap: <T, R>(addresses: Address$1[], mapper: (account: T | null, address: Address$1, index: number) => R, config?: BatchFetchConfig) => Promise<R[]>;
1457
1419
  /**
1458
- * Handle reconnection on disconnect
1420
+ * Fetch with retry logic
1459
1421
  */
1460
- private handleReconnect;
1461
- private getEventType;
1462
- private parseEventData;
1463
- }
1422
+ getWithRetry: <T>(addresses: Address$1[], config?: BatchFetchConfig, maxRetries?: number) => Promise<(T | null)[]>;
1423
+ };
1464
1424
 
1465
1425
  /**
1466
- * Analytics Aggregation Module
1426
+ * ExternalIdResolver - Cross-Platform Identity Lookup
1467
1427
  *
1468
- * Provides time-series data aggregation, statistical analysis,
1469
- * and metric computation for analytics dashboards.
1428
+ * Resolves platform-specific IDs (PayAI, ElizaOS, etc.) to Ghost addresses
1429
+ * Uses GhostSpeak Public API for fast lookups
1470
1430
  */
1471
1431
 
1472
- interface TimeSeriesPoint {
1473
- timestamp: bigint;
1474
- value: number;
1475
- }
1476
- declare enum AggregationWindow {
1477
- Minute = 60,
1478
- FiveMinutes = 300,
1479
- FifteenMinutes = 900,
1480
- Hour = 3600,
1481
- Day = 86400,
1482
- Week = 604800,
1483
- Month = 2592000
1484
- }
1485
- interface AggregatedMetrics {
1486
- window: AggregationWindow;
1487
- startTime: bigint;
1488
- endTime: bigint;
1489
- dataPoints: number;
1490
- agents: {
1491
- totalActive: number;
1492
- newRegistrations: number;
1493
- averageRevenue: bigint;
1494
- topPerformers: {
1495
- agent: Address;
1496
- score: number;
1497
- }[];
1498
- };
1499
- transactions: {
1500
- totalCount: number;
1501
- totalVolume: bigint;
1502
- averageValue: bigint;
1503
- successRate: number;
1504
- volumeByType: Map<string, bigint>;
1505
- };
1506
- performance: {
1507
- averageResponseTime: number;
1508
- p95ResponseTime: number;
1509
- p99ResponseTime: number;
1510
- throughput: number;
1511
- errorRate: number;
1512
- };
1513
- marketplace: {
1514
- listingsCreated: number;
1515
- salesCompleted: number;
1516
- totalSalesVolume: bigint;
1517
- averagePrice: bigint;
1518
- popularCategories: {
1519
- category: string;
1520
- count: number;
1521
- }[];
1522
- };
1523
- network: {
1524
- peakActiveAgents: number;
1525
- averageActiveAgents: number;
1526
- totalTransactionThroughput: bigint;
1527
- averageLatency: number;
1528
- healthScore: number;
1529
- };
1432
+ interface ApiResolverConfig {
1433
+ apiUrl?: string;
1434
+ cluster?: 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet';
1530
1435
  }
1531
- /**
1532
- * Real-time analytics aggregator
1533
- *
1534
- * Aggregates streaming analytics events into time-series metrics
1535
- * with configurable time windows and statistical analysis.
1536
- */
1537
- declare class AnalyticsAggregator {
1538
- private windows;
1539
- private eventsByWindow;
1540
- private timeSeriesData;
1541
- private agentMetrics;
1542
- constructor(windows?: AggregationWindow[]);
1543
- /**
1544
- * Process incoming agent analytics event
1545
- */
1546
- processAgentEvent(event: AgentAnalyticsEvent): void;
1436
+ declare class ExternalIdResolver {
1437
+ private apiUrl;
1438
+ constructor(config?: ApiResolverConfig);
1547
1439
  /**
1548
- * Process transaction analytics event
1440
+ * Resolve external ID to Ghost address
1441
+ *
1442
+ * @example
1443
+ * const address = await resolver.resolve('payai', 'agent-123');
1549
1444
  */
1550
- processTransactionEvent(event: TransactionAnalyticsEvent): void;
1445
+ resolve(platform: string, externalId: string): Promise<Address$1>;
1551
1446
  /**
1552
- * Process marketplace activity event
1447
+ * Lookup external ID with full Ghost data
1448
+ *
1449
+ * @example
1450
+ * const { mapping, ghost } = await resolver.lookup('payai', 'agent-123');
1553
1451
  */
1554
- processMarketplaceEvent(event: MarketplaceActivityEvent): void;
1452
+ lookup(platform: string, externalId: string): Promise<ApiExternalIdLookup>;
1555
1453
  /**
1556
- * Process network health event
1454
+ * Get Ghost by Solana address via API
1455
+ *
1456
+ * Faster than on-chain lookup for read operations
1557
1457
  */
1558
- processNetworkHealthEvent(event: NetworkHealthEvent): void;
1458
+ getGhost(ghostAddress: Address$1 | string): Promise<ApiGhost>;
1559
1459
  /**
1560
- * Process service performance event
1460
+ * Get Ghost Score via API
1561
1461
  */
1562
- processServicePerformanceEvent(event: ServicePerformanceEvent): void;
1462
+ getGhostScore(ghostAddress: Address$1 | string): Promise<ApiGhostScore>;
1563
1463
  /**
1564
- * Process economic metrics event
1464
+ * Get detailed reputation breakdown via API
1565
1465
  */
1566
- processEconomicMetricsEvent(event: EconomicMetricsEvent): void;
1466
+ getGhostReputation(ghostAddress: Address$1 | string): Promise<any>;
1567
1467
  /**
1568
- * Get aggregated metrics for a time window
1468
+ * Batch resolve multiple external IDs
1569
1469
  */
1570
- getAggregatedMetrics(window: AggregationWindow, endTime?: bigint): AggregatedMetrics;
1470
+ resolveBatch(identifiers: Array<{
1471
+ platform: string;
1472
+ externalId: string;
1473
+ }>): Promise<Array<Address$1 | null>>;
1571
1474
  /**
1572
- * Get time series data for a metric
1475
+ * Check if external ID exists
1573
1476
  */
1574
- getTimeSeries(metric: string, startTime: bigint, endTime: bigint, interval?: number): TimeSeriesPoint[];
1477
+ exists(platform: string, externalId: string): Promise<boolean>;
1575
1478
  /**
1576
- * Get current top agents by performance
1479
+ * Get all external IDs for a Ghost
1480
+ *
1481
+ * Fetches Ghost data and returns external identifiers
1577
1482
  */
1578
- getTopAgents(limit?: number): {
1579
- agent: Address;
1580
- revenue: bigint;
1581
- transactions: number;
1582
- successRate: number;
1583
- score: number;
1584
- }[];
1483
+ getExternalIds(ghostAddress: Address$1 | string): Promise<Array<{
1484
+ platform: string;
1485
+ externalId: string;
1486
+ verified: boolean;
1487
+ verifiedAt: number;
1488
+ }>>;
1585
1489
  /**
1586
- * Clear old data outside retention window
1490
+ * Search for Ghost by partial platform ID
1491
+ *
1492
+ * Note: This is a client-side filter, not server-side search
1493
+ * For production, implement server-side search endpoint
1587
1494
  */
1588
- pruneOldData(retentionSeconds: number): void;
1589
- private storeEventInWindows;
1590
- private updateTimeSeries;
1591
- private calculatePercentile;
1592
- private calculateHealthScore;
1593
- private downsampleTimeSeries;
1594
- private getDataPointCount;
1495
+ searchByExternalId(platform: string, partialId: string): Promise<ApiExternalIdLookup[]>;
1595
1496
  /**
1596
- * Add a metric data point to the aggregator
1497
+ * Set custom API URL
1597
1498
  */
1598
- addMetric(metricName: string, value: number, timestamp?: bigint): void;
1499
+ setApiUrl(apiUrl: string): void;
1599
1500
  /**
1600
- * Get aggregated metrics for the default time window
1501
+ * Get current API URL
1601
1502
  */
1602
- aggregate(): AggregatedMetrics;
1503
+ getApiUrl(): string;
1603
1504
  /**
1604
- * Get all available metrics from time series data
1505
+ * Check API health
1605
1506
  */
1606
- getAllMetrics(): TimeSeriesPoint[];
1507
+ checkHealth(): Promise<{
1508
+ status: string;
1509
+ network: string;
1510
+ rpc: {
1511
+ connected: boolean;
1512
+ latency: number;
1513
+ };
1514
+ }>;
1607
1515
  }
1608
1516
 
1609
1517
  /**
1610
- * x402 Analytics Integration
1518
+ * X402 Transaction Indexer
1519
+ *
1520
+ * Polls Solana blockchain for x402 payment transactions to eliminate
1521
+ * webhook dependency and enable historical reputation backfilling.
1611
1522
  *
1612
- * Provides real-time analytics and metrics tracking for x402 payment transactions,
1613
- * integrating with the GhostSpeak analytics system.
1523
+ * x402 payments are SPL token transfers (USDC) to PayAI facilitator addresses.
1524
+ * This indexer discovers these transfers and extracts payment metadata.
1614
1525
  *
1615
- * @module x402/analytics
1526
+ * @module modules/indexer
1616
1527
  */
1617
1528
 
1618
1529
  /**
1619
- * x402 payment event data
1530
+ * Parsed x402 payment data from on-chain transaction
1620
1531
  */
1621
- interface X402PaymentEvent {
1532
+ interface X402PaymentData {
1533
+ /** Transaction signature (on-chain proof) */
1622
1534
  signature: string;
1623
- timestamp: bigint;
1535
+ /** Merchant (agent) receiving payment */
1536
+ merchant: Address;
1537
+ /** Payer sending payment */
1624
1538
  payer: Address;
1625
- recipient: Address;
1626
- amount: bigint;
1627
- token: Address;
1628
- agent?: Address;
1629
- status: 'pending' | 'confirmed' | 'failed';
1539
+ /** Payment amount in token base units (e.g., micro-USDC) */
1540
+ amount: string;
1541
+ /** Payment success status */
1542
+ success: boolean;
1543
+ /** Block timestamp */
1544
+ timestamp: Date;
1545
+ /** Solana network */
1546
+ network: 'solana' | 'solana-devnet';
1547
+ /** Response time in milliseconds (if available from memo) */
1548
+ responseTimeMs?: number;
1549
+ /** Additional metadata from transaction memo */
1630
1550
  metadata?: Record<string, unknown>;
1631
1551
  }
1632
1552
  /**
1633
- * x402 transaction metrics
1553
+ * Transaction signature with metadata
1634
1554
  */
1635
- interface X402TransactionMetrics {
1636
- period: {
1637
- start: bigint;
1638
- end: bigint;
1639
- };
1640
- payments: {
1641
- total: number;
1642
- successful: number;
1643
- failed: number;
1644
- pending: number;
1645
- };
1646
- volume: {
1647
- total: bigint;
1648
- average: bigint;
1649
- byToken: Map<Address, bigint>;
1650
- };
1651
- agents: {
1652
- totalActive: number;
1653
- topEarners: Array<{
1654
- agent: Address;
1655
- earnings: bigint;
1656
- callCount: number;
1657
- }>;
1658
- };
1659
- performance: {
1660
- averageConfirmationTime: number;
1661
- successRate: number;
1662
- errorRate: number;
1663
- };
1555
+ interface SignatureInfo {
1556
+ signature: Signature;
1557
+ slot: bigint;
1558
+ blockTime: bigint | null;
1559
+ err: unknown | null;
1664
1560
  }
1665
1561
  /**
1666
- * x402 analytics options
1562
+ * Indexer configuration
1667
1563
  */
1668
- interface X402AnalyticsOptions {
1669
- enableRealtime?: boolean;
1670
- metricsInterval?: number;
1671
- retentionPeriod?: number;
1672
- onPayment?: (event: X402PaymentEvent) => void;
1673
- onMetrics?: (metrics: X402TransactionMetrics) => void;
1674
- onError?: (error: Error) => void;
1564
+ interface X402IndexerConfig {
1565
+ /** Solana RPC client */
1566
+ rpc: Rpc<GetSignaturesForAddressApi & GetTransactionApi>;
1567
+ /** PayAI facilitator address to monitor */
1568
+ facilitatorAddress: Address;
1569
+ /** Network identifier */
1570
+ network?: 'solana' | 'solana-devnet';
1571
+ /** Maximum transactions per poll */
1572
+ batchSize?: number;
1675
1573
  }
1676
1574
  /**
1677
- * x402 Analytics Tracker
1575
+ * X402 Transaction Indexer
1576
+ *
1577
+ * Discovers x402 payments by monitoring SPL token transfers
1578
+ * to PayAI facilitator addresses on Solana.
1579
+ *
1580
+ * @example
1581
+ * ```typescript
1582
+ * const indexer = new X402TransactionIndexer({
1583
+ * rpc: createSolanaRpc('https://api.devnet.solana.com'),
1584
+ * facilitatorAddress: address('PayAI...'),
1585
+ * network: 'solana-devnet',
1586
+ * })
1678
1587
  *
1679
- * Tracks and aggregates x402 payment transactions for real-time analytics,
1680
- * monitoring, and dashboard visualization.
1588
+ * // Poll for new transactions
1589
+ * const payments = await indexer.pollTransactions()
1590
+ * ```
1681
1591
  */
1682
- declare class X402AnalyticsTracker extends EventEmitter {
1683
- private options;
1684
- private paymentEvents;
1685
- private agentEarnings;
1686
- private agentCallCounts;
1687
- private tokenVolumes;
1688
- private metricsTimer?;
1689
- private isActive;
1690
- private analyticsStreamer?;
1691
- private analyticsAggregator?;
1692
- constructor(options?: X402AnalyticsOptions);
1693
- /**
1694
- * Start analytics tracking
1695
- */
1696
- start(): void;
1697
- /**
1698
- * Stop analytics tracking
1699
- */
1700
- stop(): void;
1701
- /**
1702
- * Record a new x402 payment event
1703
- */
1704
- recordPayment(event: X402PaymentEvent): void;
1705
- /**
1706
- * Record payment from transaction signature
1707
- */
1708
- recordPaymentFromSignature(signature: string, payer: Address, recipient: Address, amount: bigint, token: Address, agent?: Address): Promise<void>;
1709
- /**
1710
- * Update payment status
1711
- */
1712
- updatePaymentStatus(signature: string, status: 'confirmed' | 'failed', metadata?: Record<string, unknown>): void;
1713
- /**
1714
- * Get current metrics
1715
- */
1716
- getMetrics(periodSeconds?: number): X402TransactionMetrics;
1717
- /**
1718
- * Get agent earnings
1719
- */
1720
- getAgentEarnings(agent: Address): {
1721
- totalEarnings: bigint;
1722
- totalCalls: number;
1723
- averagePerCall: bigint;
1724
- };
1592
+ declare class X402TransactionIndexer {
1593
+ private readonly rpc;
1594
+ private readonly facilitatorAddress;
1595
+ private readonly network;
1596
+ private readonly batchSize;
1597
+ constructor(config: X402IndexerConfig);
1725
1598
  /**
1726
- * Get token volume
1727
- */
1728
- getTokenVolume(token: Address): bigint;
1729
- /**
1730
- * Get payment history for agent
1731
- */
1732
- getAgentPaymentHistory(agent: Address, limit?: number): X402PaymentEvent[];
1733
- /**
1734
- * Get recent payments
1735
- */
1736
- getRecentPayments(limit?: number): X402PaymentEvent[];
1737
- /**
1738
- * Integrate with existing analytics streamer
1599
+ * Poll for new x402 transactions since last sync
1600
+ *
1601
+ * @param lastSignature - Last processed signature (for pagination)
1602
+ * @param limit - Maximum transactions to fetch
1603
+ * @returns Array of parsed x402 payment data
1739
1604
  */
1740
- integrateWithStreamer(streamer: AnalyticsStreamer): void;
1605
+ pollTransactions(lastSignature?: Signature, limit?: number): Promise<X402PaymentData[]>;
1741
1606
  /**
1742
- * Integrate with existing analytics aggregator
1607
+ * Parse a specific transaction signature
1608
+ *
1609
+ * @param signature - Transaction signature to parse
1610
+ * @returns Parsed x402 payment data or null if not an x402 payment
1743
1611
  */
1744
- integrateWithAggregator(aggregator: AnalyticsAggregator): void;
1612
+ parseTransaction(sig: Signature | string): Promise<X402PaymentData | null>;
1745
1613
  /**
1746
- * Get aggregated metrics from integrated aggregator
1614
+ * Fetch transaction signatures for the facilitator address
1747
1615
  */
1748
- getAggregatedMetrics(): AggregatedMetrics | null;
1749
- private aggregateAndEmitMetrics;
1750
- private pruneOldEvents;
1751
- private getOldestEventTimestamp;
1752
- private isX402Transaction;
1753
- private recordPaymentFromAnalyticsEvent;
1754
- private handleError;
1616
+ private getSignatures;
1755
1617
  /**
1756
- * Clear all tracked data
1618
+ * Check if transaction is an x402 payment
1619
+ *
1620
+ * x402 payments are characterized by:
1621
+ * - SPL token transfer (TokenProgram or Token2022Program)
1622
+ * - Transfer TO the facilitator address
1623
+ * - Optional memo instruction with payment metadata
1757
1624
  */
1758
- clearData(): void;
1625
+ private isX402Payment;
1759
1626
  /**
1760
- * Get tracker statistics
1627
+ * Extract payment data from transaction
1761
1628
  */
1762
- getStats(): {
1763
- eventsTracked: number;
1764
- agentsTracked: number;
1765
- tokensTracked: number;
1766
- isActive: boolean;
1767
- };
1629
+ private extractPaymentData;
1768
1630
  }
1769
- /**
1770
- * Create x402 analytics tracker instance
1771
- */
1772
- declare function createX402AnalyticsTracker(options?: X402AnalyticsOptions): X402AnalyticsTracker;
1773
1631
 
1774
1632
  /**
1775
- * x402 Payment Streaming for Long-Running Tasks
1633
+ * Reputation Source Adapter Interface
1776
1634
  *
1777
- * Enables continuous micropayment streams for long-running agent tasks,
1778
- * supporting milestone-based payments and automatic stream management.
1779
- */
1780
-
1781
- type Connection = any;
1782
- /**
1783
- * Payment stream configuration
1635
+ * Base interface for all reputation data sources (PayAI, GitHub, custom webhooks, etc.)
1636
+ * Each adapter normalizes external data to a standard format for aggregation.
1784
1637
  */
1785
- interface PaymentStreamConfig {
1786
- /** Agent receiving payments */
1787
- agentAddress: Address;
1788
- /** Client making payments */
1789
- clientAddress: Address;
1790
- /** Token mint for payments */
1791
- tokenMint: Address;
1792
- /** Total stream amount */
1793
- totalAmount: bigint;
1794
- /** Payment interval in milliseconds */
1795
- intervalMs: number;
1796
- /** Amount per interval */
1797
- amountPerInterval: bigint;
1798
- /** Stream duration in milliseconds */
1799
- durationMs: number;
1800
- /** Optional milestones for conditional releases */
1801
- milestones?: PaymentMilestone[];
1802
- /** Auto-resume on failure */
1803
- autoResume?: boolean;
1804
- }
1805
1638
  /**
1806
- * Payment milestone for conditional releases
1639
+ * Supported reputation sources
1807
1640
  */
1808
- interface PaymentMilestone {
1809
- /** Milestone ID */
1810
- id: string;
1811
- /** Milestone description */
1812
- description: string;
1813
- /** Amount to release at this milestone */
1814
- amount: bigint;
1815
- /** Completion condition callback */
1816
- condition: () => Promise<boolean>;
1817
- /** Completed flag */
1818
- completed: boolean;
1819
- /** Completion timestamp */
1820
- completedAt?: number;
1641
+ declare enum ReputationSource {
1642
+ PayAI = "payai",
1643
+ DirectSolana = "direct-solana",
1644
+ GitHub = "github",
1645
+ Twitter = "twitter",
1646
+ CustomWebhook = "custom-webhook",
1647
+ OnChainHistory = "onchain-history"
1821
1648
  }
1822
1649
  /**
1823
- * Payment stream state
1650
+ * Configuration for a reputation source
1824
1651
  */
1825
- interface PaymentStream {
1826
- /** Stream ID */
1827
- id: string;
1828
- /** Configuration */
1829
- config: PaymentStreamConfig;
1830
- /** Current status */
1831
- status: 'active' | 'paused' | 'completed' | 'cancelled' | 'failed';
1832
- /** Amount paid so far */
1833
- amountPaid: bigint;
1834
- /** Payments made */
1835
- payments: StreamPayment[];
1836
- /** Start timestamp */
1837
- startedAt: number;
1838
- /** End timestamp */
1839
- endedAt?: number;
1840
- /** Last payment timestamp */
1841
- lastPaymentAt?: number;
1842
- /** Next payment due at */
1843
- nextPaymentAt?: number;
1844
- /** Error if failed */
1845
- error?: Error;
1652
+ interface ReputationSourceConfig {
1653
+ /** Source identifier */
1654
+ source: ReputationSource;
1655
+ /** Weight in basis points (0-10000) */
1656
+ weight: number;
1657
+ /** Reliability score in basis points (0-10000) */
1658
+ reliability: number;
1659
+ /** Source-specific configuration (API keys, URLs, etc.) */
1660
+ config: Record<string, any>;
1661
+ /** Whether this source is enabled */
1662
+ enabled: boolean;
1846
1663
  }
1847
1664
  /**
1848
- * Individual stream payment
1665
+ * Normalized reputation data from a source
1849
1666
  */
1850
- interface StreamPayment {
1851
- /** Payment timestamp */
1852
- timestamp: number;
1853
- /** Amount paid */
1854
- amount: bigint;
1855
- /** Transaction signature */
1856
- signature: Signature;
1857
- /** Associated milestone ID */
1858
- milestoneId?: string;
1859
- /** Success flag */
1860
- success: boolean;
1861
- /** Error if failed */
1862
- error?: Error;
1667
+ interface SourceReputationData {
1668
+ /** Source identifier */
1669
+ source: ReputationSource;
1670
+ /** Reputation score (0-1000) */
1671
+ score: number;
1672
+ /** Number of data points contributing to score */
1673
+ dataPoints: number;
1674
+ /** Reliability of this data (0-1) */
1675
+ reliability: number;
1676
+ /** Raw data from source (for debugging/audit) */
1677
+ rawData: any;
1678
+ /** Timestamp when data was fetched */
1679
+ timestamp: Date;
1863
1680
  }
1864
1681
  /**
1865
- * Payment Streaming Manager
1866
- *
1867
- * Manages continuous x402 payment streams for long-running tasks
1682
+ * Base interface for reputation source adapters
1868
1683
  */
1869
- declare class PaymentStreamingManager extends EventEmitter {
1870
- private streams;
1871
- private intervals;
1872
- private x402Client;
1873
- private connection;
1874
- constructor(x402Client: X402Client, connection: Connection);
1684
+ interface ReputationSourceAdapter {
1685
+ /** Source identifier */
1686
+ readonly source: ReputationSource;
1875
1687
  /**
1876
- * Create a new payment stream
1688
+ * Fetch reputation data for an agent
1689
+ *
1690
+ * @param agentId - Agent identifier (public key or external ID)
1691
+ * @returns Normalized reputation data
1877
1692
  */
1878
- createStream(config: PaymentStreamConfig): Promise<PaymentStream>;
1693
+ fetchReputationData(agentId: string): Promise<SourceReputationData>;
1879
1694
  /**
1880
- * Pause a payment stream
1695
+ * Validate raw data from source
1696
+ *
1697
+ * @param data - Raw data to validate
1698
+ * @returns True if data is valid
1881
1699
  */
1882
- pauseStream(streamId: string): void;
1700
+ validateData(data: any): boolean;
1883
1701
  /**
1884
- * Resume a paused payment stream
1702
+ * Normalize raw score to 0-1000 scale
1703
+ *
1704
+ * @param rawScore - Raw score from source
1705
+ * @returns Normalized score (0-1000)
1885
1706
  */
1886
- resumeStream(streamId: string): void;
1707
+ normalizeScore(rawScore: any): number;
1887
1708
  /**
1888
- * Cancel a payment stream
1709
+ * Calculate reliability score for this data point
1710
+ *
1711
+ * @param data - Source data
1712
+ * @returns Reliability (0-1)
1889
1713
  */
1890
- cancelStream(streamId: string): void;
1714
+ calculateReliability(data: any): number;
1715
+ }
1716
+ /**
1717
+ * Abstract base class for reputation adapters
1718
+ */
1719
+ declare abstract class BaseReputationAdapter implements ReputationSourceAdapter {
1720
+ protected config: ReputationSourceConfig;
1721
+ constructor(config: ReputationSourceConfig);
1722
+ abstract get source(): ReputationSource;
1723
+ abstract fetchReputationData(agentId: string): Promise<SourceReputationData>;
1724
+ abstract validateData(data: any): boolean;
1725
+ abstract normalizeScore(rawScore: any): number;
1891
1726
  /**
1892
- * Get stream by ID
1727
+ * Default reliability calculation uses configured reliability
1893
1728
  */
1894
- getStream(streamId: string): PaymentStream | undefined;
1729
+ calculateReliability(_data: any): number;
1895
1730
  /**
1896
- * Get all streams
1731
+ * Check if adapter is enabled
1897
1732
  */
1898
- getAllStreams(): PaymentStream[];
1733
+ isEnabled(): boolean;
1899
1734
  /**
1900
- * Get active streams
1735
+ * Get adapter weight in basis points
1901
1736
  */
1902
- getActiveStreams(): PaymentStream[];
1737
+ getWeight(): number;
1903
1738
  /**
1904
- * Complete a milestone
1739
+ * Validate score is in valid range (0-1000)
1905
1740
  */
1906
- completeMilestone(streamId: string, milestoneId: string): Promise<void>;
1741
+ protected validateScoreRange(score: number): boolean;
1907
1742
  /**
1908
- * Cleanup: Stop all streams and clear intervals
1743
+ * Clamp score to valid range
1909
1744
  */
1910
- cleanup(): void;
1911
- private generateStreamId;
1912
- private validateStreamConfig;
1913
- private startStreamInterval;
1914
- private stopStreamInterval;
1915
- private processPayment;
1916
- private makePayment;
1917
- private completeStream;
1745
+ protected clampScore(score: number): number;
1918
1746
  }
1919
1747
 
1920
1748
  /**
1921
- * A2A (Agent-to-Agent) Communication Client
1749
+ * Multi-Source Reputation Aggregator
1922
1750
  *
1923
- * High-level SDK for agent-to-agent communication on the GhostSpeak protocol.
1924
- * Enables agents to create sessions, send messages, and update status.
1751
+ * Aggregates reputation data from multiple sources (PayAI, GitHub, custom webhooks)
1752
+ * with weighted scoring, conflict detection, and reliability-based adjustments.
1925
1753
  *
1926
- * @module protocols/A2AClient
1754
+ * Based on MUSCLE multi-source oracle pattern with reputation-based source selection.
1927
1755
  */
1928
1756
 
1929
- interface A2ASessionConfig {
1930
- responder: Address;
1931
- sessionType: string;
1932
- metadata?: string;
1933
- expiresIn?: number;
1934
- }
1935
- interface A2AMessageParams {
1936
- sessionAddress: Address;
1937
- content: string;
1938
- messageType?: string;
1939
- }
1940
- interface A2AStatusUpdate {
1941
- status: string;
1942
- capabilities?: string[];
1943
- availability?: boolean;
1944
- }
1945
- interface A2AClientOptions {
1946
- rpcEndpoint: string;
1947
- programId?: Address;
1757
+ /**
1758
+ * Aggregated reputation result
1759
+ */
1760
+ interface AggregatedReputation {
1761
+ /** Agent address */
1762
+ agentId: Address$1 | string;
1763
+ /** Weighted aggregate score (0-1000) */
1764
+ aggregateScore: number;
1765
+ /** Individual source scores */
1766
+ sourceScores: SourceScoreBreakdown[];
1767
+ /** Whether conflicts were detected */
1768
+ hasConflicts: boolean;
1769
+ /** Conflict descriptions */
1770
+ conflicts: string[];
1771
+ /** Total number of data points across all sources */
1772
+ totalDataPoints: number;
1773
+ /** Timestamp of aggregation */
1774
+ timestamp: Date;
1948
1775
  }
1949
- interface A2ASessionDetails extends A2ASession {
1950
- address: Address;
1776
+ /**
1777
+ * Individual source score breakdown
1778
+ */
1779
+ interface SourceScoreBreakdown {
1780
+ /** Source identifier */
1781
+ source: ReputationSource;
1782
+ /** Raw score from source (0-1000) */
1783
+ score: number;
1784
+ /** Source weight (0-10000 basis points) */
1785
+ weight: number;
1786
+ /** Source reliability (0-10000 basis points) */
1787
+ reliability: number;
1788
+ /** Number of data points */
1789
+ dataPoints: number;
1790
+ /** Weighted contribution to final score */
1791
+ contribution: number;
1792
+ /** Last updated timestamp */
1793
+ lastUpdated: Date;
1951
1794
  }
1952
1795
  /**
1953
- * A2A Communication Client
1954
- *
1955
- * Provides high-level methods for agent-to-agent communication:
1956
- * - Create communication sessions
1957
- * - Send messages between agents
1958
- * - Update agent status
1959
- * - Query session state
1960
- *
1961
- * @example
1962
- * ```typescript
1963
- * const a2aClient = new A2AClient({
1964
- * rpcEndpoint: 'https://api.devnet.solana.com',
1965
- * wallet
1966
- * })
1967
- *
1968
- * // Create session with another agent
1969
- * const session = await a2aClient.createSession({
1970
- * responder: otherAgentAddress,
1971
- * sessionType: 'collaboration',
1972
- * metadata: 'Working on data analysis task'
1973
- * })
1974
- *
1975
- * // Send message
1976
- * await a2aClient.sendMessage({
1977
- * sessionAddress: session.address,
1978
- * content: 'I have completed processing the dataset',
1979
- * messageType: 'update'
1980
- * })
1981
- *
1982
- * // Update status
1983
- * await a2aClient.updateStatus({
1984
- * status: 'available',
1985
- * capabilities: ['data_analysis', 'ml_inference'],
1986
- * availability: true
1987
- * })
1988
- * ```
1796
+ * Multi-source reputation aggregator
1989
1797
  */
1990
- declare class A2AClient extends EventEmitter {
1991
- private rpc;
1992
- private programId;
1993
- private wallet;
1994
- constructor(options: A2AClientOptions, wallet: TransactionSigner);
1798
+ declare class MultiSourceAggregator {
1799
+ private adapters;
1800
+ private configs;
1801
+ /** Conflict threshold (30% variance) */
1802
+ private readonly CONFLICT_THRESHOLD;
1995
1803
  /**
1996
- * Create a new A2A communication session
1997
- *
1998
- * Establishes a secure communication channel between two agents.
1999
- *
2000
- * @param config - Session configuration
2001
- * @returns Session details including address
2002
- *
2003
- * @example
2004
- * ```typescript
2005
- * const session = await a2aClient.createSession({
2006
- * responder: 'AgentBpubkey...',
2007
- * sessionType: 'data_processing',
2008
- * metadata: 'Processing financial data',
2009
- * expiresIn: 7200 // 2 hours
2010
- * })
2011
- * console.log('Session created:', session.address)
2012
- * ```
2013
- */
2014
- createSession(config: A2ASessionConfig): Promise<A2ASessionDetails>;
2015
- /**
2016
- * Send a message in an A2A session
2017
- *
2018
- * Sends structured messages between agents with automatic context management.
2019
- *
2020
- * @param params - Message parameters
2021
- * @returns Transaction signature
2022
- *
2023
- * @example
2024
- * ```typescript
2025
- * await a2aClient.sendMessage({
2026
- * sessionAddress: session.address,
2027
- * content: 'Processing complete. Results: {...}',
2028
- * messageType: 'result'
2029
- * })
2030
- * ```
1804
+ * Create a new multi-source aggregator
2031
1805
  */
2032
- sendMessage(params: A2AMessageParams): Promise<Signature>;
1806
+ constructor();
2033
1807
  /**
2034
- * Update agent status
2035
- *
2036
- * Updates agent availability, capabilities, and status for discovery.
1808
+ * Add a reputation source
2037
1809
  *
2038
- * @param update - Status update
2039
- * @returns Transaction signature
2040
- *
2041
- * @example
2042
- * ```typescript
2043
- * await a2aClient.updateStatus({
2044
- * status: 'busy',
2045
- * capabilities: ['nlp', 'translation'],
2046
- * availability: false
2047
- * })
2048
- * ```
1810
+ * @param adapter - Reputation source adapter
1811
+ * @param config - Source configuration
2049
1812
  */
2050
- updateStatus(update: A2AStatusUpdate): Promise<Signature>;
1813
+ addSource(adapter: ReputationSourceAdapter, config: ReputationSourceConfig): void;
2051
1814
  /**
2052
- * Get session details
1815
+ * Remove a reputation source
2053
1816
  *
2054
- * Fetches current session state from on-chain.
1817
+ * @param source - Source to remove
1818
+ */
1819
+ removeSource(source: ReputationSource): void;
1820
+ /**
1821
+ * Update source weight
2055
1822
  *
2056
- * @param sessionAddress - Session PDA address
2057
- * @returns Session details
1823
+ * @param source - Source to update
1824
+ * @param weight - New weight in basis points (0-10000)
2058
1825
  */
2059
- getSession(sessionAddress: Address): Promise<A2ASessionDetails | null>;
1826
+ updateSourceWeight(source: ReputationSource, weight: number): void;
2060
1827
  /**
2061
- * Get message by address
1828
+ * Update source reliability
2062
1829
  *
2063
- * @param messageAddress - Message PDA address
2064
- * @returns Message data
1830
+ * @param source - Source to update
1831
+ * @param reliability - New reliability in basis points (0-10000)
2065
1832
  */
2066
- getMessage(messageAddress: Address): Promise<A2AMessage | null>;
1833
+ updateSourceReliability(source: ReputationSource, reliability: number): void;
2067
1834
  /**
2068
- * Get agent status
1835
+ * Aggregate reputation from all sources
2069
1836
  *
2070
- * @param statusAddress - Status PDA address
2071
- * @returns Status data
2072
- */
2073
- getStatus(statusAddress: Address): Promise<A2AStatus | null>;
2074
- private sendTransaction;
2075
- private confirmTransaction;
2076
- private deriveMessageAddress;
2077
- private deriveStatusAddress;
2078
- }
2079
- /**
2080
- * Create an A2A Client instance
2081
- *
2082
- * @param options - Client configuration
2083
- * @param wallet - Transaction signer (agent wallet)
2084
- * @returns A2AClient instance
2085
- */
2086
- declare function createA2AClient(options: A2AClientOptions, wallet: TransactionSigner): A2AClient;
2087
-
2088
- /**
2089
- * H2A (Human-to-Agent) Communication Client
2090
- *
2091
- * High-level SDK for human-to-agent communication on the GhostSpeak protocol.
2092
- * Enables humans to hire agents, send service requests, and communicate with agents.
2093
- *
2094
- * @module protocols/H2AClient
2095
- *
2096
- * NOTE: This client currently requires IDL regeneration to include H2A instruction builders.
2097
- * The Rust instructions exist in programs/src/instructions/h2a_protocol.rs but haven't
2098
- * been generated to TypeScript yet. Run `bun run codama` to regenerate.
2099
- */
2100
-
2101
- interface H2ASessionConfig {
2102
- agentAddress: Address;
2103
- sessionType: string;
2104
- metadata?: string;
2105
- expiresIn?: number;
2106
- }
2107
- interface H2AMessageParams {
2108
- sessionAddress: Address;
2109
- content: string;
2110
- messageType?: string;
2111
- attachments?: string[];
2112
- }
2113
- interface H2AServiceRequest extends H2AMessageParams {
2114
- paymentAmount?: bigint;
2115
- deadline?: number;
2116
- }
2117
- interface H2AClientOptions {
2118
- rpcEndpoint: string;
2119
- programId?: Address;
2120
- }
2121
- /**
2122
- * H2A Communication Client
2123
- *
2124
- * Provides high-level methods for human-to-agent communication:
2125
- * - Create communication sessions with agents
2126
- * - Send service requests to agents
2127
- * - Send messages and receive updates
2128
- * - Attach files and rich content
2129
- *
2130
- * @example
2131
- * ```typescript
2132
- * const h2aClient = new H2AClient({
2133
- * rpcEndpoint: 'https://api.devnet.solana.com'
2134
- * }, humanWallet)
2135
- *
2136
- * // Create session with an agent
2137
- * const session = await h2aClient.createSession({
2138
- * agentAddress: 'Agent123...',
2139
- * sessionType: 'data_analysis',
2140
- * metadata: 'Need financial data analysis'
2141
- * })
2142
- *
2143
- * // Send service request
2144
- * await h2aClient.sendServiceRequest({
2145
- * sessionAddress: session.address,
2146
- * content: 'Please analyze Q4 2024 revenue data',
2147
- * attachments: ['ipfs://QmDataset123'],
2148
- * paymentAmount: 5_000_000n, // 5 USDC
2149
- * deadline: Date.now() / 1000 + 86400 // 24 hours
2150
- * })
2151
- * ```
2152
- */
2153
- declare class H2AClient extends EventEmitter {
2154
- private rpc;
2155
- private programId;
2156
- private wallet;
2157
- constructor(options: H2AClientOptions, wallet: TransactionSigner);
1837
+ * @param agentId - Agent identifier
1838
+ * @returns Aggregated reputation data
1839
+ */
1840
+ aggregateReputation(agentId: Address$1 | string): Promise<AggregatedReputation>;
2158
1841
  /**
2159
- * Create a new communication session with an agent
1842
+ * Calculate weighted aggregate score
2160
1843
  *
2161
- * Establishes a communication channel between a human and an agent.
1844
+ * Formula: Σ(score × weight × reliability) / Σ(weight × reliability)
2162
1845
  *
2163
- * @param config - Session configuration
2164
- * @returns Session details including address
1846
+ * @param sourceDataList - Data from all sources
1847
+ * @returns Weighted aggregate score (0-1000)
1848
+ */
1849
+ calculateWeightedScore(sourceDataList: SourceReputationData[]): number;
1850
+ /**
1851
+ * Detect conflicts between sources
2165
1852
  *
2166
- * @throws {Error} Currently not implemented - requires IDL regeneration
1853
+ * Flags conflicts if max_score - min_score > 30%
2167
1854
  *
2168
- * @example
2169
- * ```typescript
2170
- * const session = await h2aClient.createSession({
2171
- * agentAddress: 'Agent123...',
2172
- * sessionType: 'content_writing',
2173
- * metadata: 'Blog post about AI agents',
2174
- * expiresIn: 7200 // 2 hours
2175
- * })
2176
- * ```
2177
- */
2178
- createSession(config: H2ASessionConfig): Promise<{
2179
- address: Address;
2180
- signature: Signature;
2181
- }>;
1855
+ * @param sourceDataList - Data from all sources
1856
+ * @returns Conflict detection result
1857
+ */
1858
+ detectConflicts(sourceDataList: SourceReputationData[]): {
1859
+ hasConflicts: boolean;
1860
+ conflicts: string[];
1861
+ };
2182
1862
  /**
2183
- * Send a service request to an agent
1863
+ * Build source score breakdowns
2184
1864
  *
2185
- * Sends a work request to an agent with optional payment commitment.
1865
+ * @param sourceDataList - Data from all sources
1866
+ * @returns Source score breakdowns
1867
+ */
1868
+ private buildSourceBreakdowns;
1869
+ /**
1870
+ * Calculate normalization factor for weighted scoring
1871
+ */
1872
+ private calculateNormalizationFactor;
1873
+ /**
1874
+ * Get detailed source breakdown for an agent
2186
1875
  *
2187
- * @param request - Service request parameters
2188
- * @returns Transaction signature
1876
+ * @param agentId - Agent identifier
1877
+ * @returns Source breakdowns with full details
1878
+ */
1879
+ getSourceBreakdown(agentId: Address$1 | string): Promise<SourceScoreBreakdown[]>;
1880
+ /**
1881
+ * Get list of registered sources
1882
+ */
1883
+ getRegisteredSources(): ReputationSource[];
1884
+ /**
1885
+ * Get source configuration
2189
1886
  *
2190
- * @example
2191
- * ```typescript
2192
- * await h2aClient.sendServiceRequest({
2193
- * sessionAddress: session.address,
2194
- * content: 'Generate 10 social media posts about web3',
2195
- * messageType: 'service_request',
2196
- * attachments: ['ipfs://QmBrandGuidelines'],
2197
- * paymentAmount: 10_000_000n, // 10 USDC
2198
- * deadline: Date.now() / 1000 + 172800 // 48 hours
2199
- * })
2200
- * ```
2201
- */
2202
- sendServiceRequest(request: H2AServiceRequest): Promise<Signature>;
2203
- /**
2204
- * Send a message in an existing session
1887
+ * @param source - Source identifier
1888
+ * @returns Source configuration or undefined
1889
+ */
1890
+ getSourceConfig(source: ReputationSource): ReputationSourceConfig | undefined;
1891
+ /**
1892
+ * Enable a source
2205
1893
  *
2206
- * Sends a message to an agent with support for file attachments.
1894
+ * @param source - Source to enable
1895
+ */
1896
+ enableSource(source: ReputationSource): void;
1897
+ /**
1898
+ * Disable a source
2207
1899
  *
2208
- * @param params - Message parameters
2209
- * @returns Transaction signature
1900
+ * @param source - Source to disable
2210
1901
  */
2211
- sendMessage(params: H2AMessageParams): Promise<Signature>;
1902
+ disableSource(source: ReputationSource): void;
2212
1903
  /**
2213
- * Get session details
1904
+ * Check if source is enabled
2214
1905
  *
2215
- * @param sessionAddress - Session PDA address
1906
+ * @param source - Source to check
1907
+ * @returns True if enabled
2216
1908
  */
2217
- getSession(sessionAddress: Address): Promise<CommunicationSessionData>;
2218
- private sendTransaction;
2219
- private confirmTransaction;
1909
+ isSourceEnabled(source: ReputationSource): boolean;
2220
1910
  }
2221
- /**
2222
- * Create an H2A Client instance
2223
- *
2224
- * @param options - Client configuration
2225
- * @param wallet - Transaction signer (human wallet)
2226
- * @returns H2AClient instance
2227
- */
2228
- declare function createH2AClient(options: H2AClientOptions, wallet: TransactionSigner): H2AClient;
2229
1911
 
2230
1912
  /**
2231
1913
  * This file is auto-generated by scripts/generate-mappings.ts
@@ -2240,7 +1922,6 @@ interface AccountInfo$1 {
2240
1922
  address?: string;
2241
1923
  pda?: {
2242
1924
  seeds: unknown[];
2243
- program?: unknown;
2244
1925
  };
2245
1926
  }
2246
1927
  interface ExpectedAccount {
@@ -2895,11 +2576,11 @@ interface FeatureStatus {
2895
2576
  * @param featureGate - Feature gate public key to check
2896
2577
  * @returns Feature activation status
2897
2578
  */
2898
- declare function checkFeatureGate(rpc: Rpc$1<GetAccountInfoApi>, featureGate: Address): Promise<FeatureStatus>;
2579
+ declare function checkFeatureGate(rpc: Rpc<GetAccountInfoApi>, featureGate: Address): Promise<FeatureStatus>;
2899
2580
  /**
2900
2581
  * Clear the feature gate cache
2901
2582
  * Useful for testing or forcing fresh checks
2902
2583
  */
2903
2584
  declare function clearFeatureGateCache(): void;
2904
2585
 
2905
- export { A2AClient, CircuitBreaker, ClientEncryptionService, ContentStorageResult, DEFAULT_IPFS_CONFIG, DEFAULT_RETRY_CONFIG, FEATURE_GATES, FallbackHandler, type FeatureStatus, FetchWithPaymentClient, type FetchWithPaymentOptions, type FundingResult, type FundingStrategyOptions, GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, H2AClient, INSTRUCTION_MAPPINGS, IPFSClient, IPFSConfig, IPFSContentMetadata, IPFSError, IPFSErrorHandler, IPFSOperationError, IPFSOperationResult, IPFSProvider, IPFSUploadOptions, IPFSUtils, InstructionValidationError, LocalStorageProvider, ParticipantType, PaymentStreamingManager, type PrivacyManifest, PrivateDataQuery, type PrivateDataReference, PrivateMetadataStorage, RetryHandler, RpcClient, type StorageProvider, type StoredPrivateData, TEST_IPFS_CONFIG, WalletFundingService, X402AnalyticsTracker, type X402CallerIdentity, X402Client, type X402FastifyRequest, type X402MiddlewareOptions, type X402RequestWithPayment, type X402Response, checkFeatureGate, clearFeatureGateCache, createA2AClient, createAccountMismatchError, createH2AClient, createIPFSErrorHandler, createIPFSUtils, createMetadataUri, createPrivacyManifest, createTestIPFSConfig, createX402AnalyticsTracker, createX402Client, createX402Middleware, debugInstructionCall, defaultFundingService, determineStorageMethod, enhanceErrorMessage, ensureMinimumBalance, estimateStorageCost, fetchWithX402Payment, fundWallet, generateAccountValidationError, getAccountRequirements, getAddMessageReactionInstruction, getCancelEscrowInstruction, getCompleteEscrowInstruction, getCreateEnhancedChannelInstructionAsync, getCreateEscrowInstructionAsync, getDisputeEscrowInstruction, getInstructionMapping, getJoinChannelInstruction, getLeaveChannelInstruction, getPDAAccounts, getProcessPartialRefundInstruction, getProcessPaymentInstruction, getRegisterAgentInstructionAsync, getRequiredSigners, getSendEnhancedMessageInstructionAsync, getUpdateChannelSettingsInstruction, getWritableAccounts, isIPFSError, isKnownInstruction, validateInstructionAccounts, withIPFSErrorHandling, withX402RateLimit, wrapFetchWithPayment, x402FastifyPlugin };
2586
+ export { type AggregatedReputation, type ApiResolverConfig, type ArbitratorDecision, BaseReputationAdapter, type BatchFetchConfig, type BatchProgressCallback, CircuitBreaker, ClientEncryptionService, ContentStorageResult, DEFAULT_IPFS_CONFIG, DEFAULT_RETRY_CONFIG, type DeliverySubmittedEvent, type DisputeFiledEvent, type DisputeResolvedEvent, type EscrowCompletedEvent, type EscrowCreatedEvent, EscrowStatus, ExtendedRpcApi, ExternalIdResolver, FEATURE_GATES, FallbackHandler, type FeatureStatus, type FundingResult, type FundingStrategyOptions, GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, type GhostProtectEscrow, type GhostSlashedEvent, type GhostStakedEvent, type GhostUnstakedEvent, INSTRUCTION_MAPPINGS, IPFSClient, IPFSConfig, IPFSContentMetadata, IPFSError, IPFSErrorHandler, IPFSOperationError, IPFSOperationResult, IPFSProvider, IPFSUploadOptions, IPFSUtils, InstructionValidationError, LocalStorageProvider, MetricVisibility, MultiSourceAggregator, type PrivacyManifest, PrivacyMode, PrivacySettings, PrivateDataQuery, type PrivateDataReference, PrivateMetadataStorage, ReputationSource, type ReputationSourceAdapter, type ReputationSourceConfig, type ReputationTagsUpdatedEvent, RetryHandler, RpcClient, ScoreRange, type SignatureInfo, SlashReason, type SourceReputationData, type SourceScoreBreakdown, type StorageProvider, type StoredPrivateData, TEST_IPFS_CONFIG, type TagDecayAppliedEvent, type TagScore, VisibleReputation, WalletFundingService, type X402IndexerConfig, type X402PaymentData, X402TransactionIndexer, batchGetAccounts, batchGetAccountsWithRetry, batchGetAndMap, batchGetExistingAccounts, calculateVisibleScore, canViewerAccess, checkFeatureGate, clearFeatureGateCache, createAccountMismatchError, createBatchFetcher, createIPFSErrorHandler, createIPFSUtils, createMetadataUri, createPrivacyManifest, createTestIPFSConfig, debugInstructionCall, defaultFundingService, determineStorageMethod, enhanceErrorMessage, ensureMinimumBalance, estimateStorageCost, filterMetricsByVisibility, fundWallet, generateAccountValidationError, getAccountRequirements, getApproveDeliveryInstruction, getArbitrateDisputeInstruction, getClaimGhostInstruction, getCreateDidDocumentInstructionAsync, getCreateEscrowInstructionAsync, getDeactivateDidDocumentInstructionAsync, getDefaultMetricVisibility, getFileDisputeInstruction, getGhostProtectEscrowDecoder, getInitializeStakingConfigInstructionAsync, getInstructionMapping, getPDAAccounts, getRangeDisplayString, getRegisterAgentInstructionAsync, getReputationTier, getRequiredSigners, getResolveDidDocumentInstructionAsync, getScoreRange, getSlashStakeInstructionAsync, getStakeGhostInstructionAsync, getSubmitDeliveryInstruction, getTierDisplayName, getUnstakeGhostInstructionAsync, getUpdateDidDocumentInstructionAsync, getUpdateReputationTagsInstructionAsync, getWritableAccounts, isIPFSError, isKnownInstruction, validateInstructionAccounts, validatePrivacySettings, withIPFSErrorHandling };