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