@ghostspeak/sdk 2.0.5 → 2.0.7

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