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