@ghostspeak/sdk 2.0.7 → 2.0.10
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 +145 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/{GhostSpeakClient-CWmGaM9Q.d.ts → GhostSpeakClient-qdLGyuDp.d.ts} +11 -7
- package/dist/{StakingModule-C5rzuOWb.d.ts → StakingModule-CPhp_ZY0.d.ts} +263 -343
- package/dist/{agent-5YLZ7DAC.js → agent-S42FIMR7.js} +3 -3
- package/dist/{agent-5YLZ7DAC.js.map → agent-S42FIMR7.js.map} +1 -1
- package/dist/browser-D1TpjbjZ.d.ts +234 -0
- package/dist/browser.d.ts +4 -64
- package/dist/browser.js +9 -9
- package/dist/{chunk-SFTSZ3LC.js → chunk-46QWY3MG.js} +3 -3
- package/dist/{chunk-SFTSZ3LC.js.map → chunk-46QWY3MG.js.map} +1 -1
- package/dist/{chunk-IHVDQ4YI.js → chunk-5QZVFUXB.js} +201 -256
- package/dist/chunk-5QZVFUXB.js.map +1 -0
- package/dist/{chunk-E3FD2CNY.js → chunk-5SS3OL4B.js} +20 -24
- package/dist/chunk-5SS3OL4B.js.map +1 -0
- package/dist/{chunk-SZGFSCNU.js → chunk-63A7F2YP.js} +504 -326
- package/dist/chunk-63A7F2YP.js.map +1 -0
- package/dist/{chunk-JV2SWONF.js → chunk-A7ALCVUI.js} +3 -3
- package/dist/{chunk-JV2SWONF.js.map → chunk-A7ALCVUI.js.map} +1 -1
- package/dist/{chunk-AL3HQN73.js → chunk-AWMGX3OX.js} +172 -112
- package/dist/chunk-AWMGX3OX.js.map +1 -0
- package/dist/{chunk-G7S6B6WB.js → chunk-EU6PHSM5.js} +7 -7
- package/dist/{chunk-G7S6B6WB.js.map → chunk-EU6PHSM5.js.map} +1 -1
- package/dist/{chunk-C5CDA3WX.js → chunk-HIDBANFS.js} +529 -4
- package/dist/chunk-HIDBANFS.js.map +1 -0
- package/dist/{chunk-S74EH3KD.js → chunk-IQM5RASO.js} +637 -25
- package/dist/chunk-IQM5RASO.js.map +1 -0
- package/dist/{chunk-KB6CKIUK.js → chunk-QLRWUHN2.js} +3 -3
- package/dist/{chunk-KB6CKIUK.js.map → chunk-QLRWUHN2.js.map} +1 -1
- package/dist/{chunk-BQDGRTVP.js → chunk-QWQTPTZ4.js} +39 -51
- package/dist/chunk-QWQTPTZ4.js.map +1 -0
- package/dist/client.d.ts +3 -4
- package/dist/client.js +10 -10
- package/dist/{createAgentAuthorization-ULG47ZJI.js → createAgentAuthorization-KGZNXZBT.js} +4 -4
- package/dist/{createAgentAuthorization-ULG47ZJI.js.map → createAgentAuthorization-KGZNXZBT.js.map} +1 -1
- package/dist/generated-QJREJQ2C.js +9 -0
- package/dist/{generated-EG5USUFG.js.map → generated-QJREJQ2C.js.map} +1 -1
- package/dist/index.d.ts +345 -236
- package/dist/index.js +372 -537
- package/dist/index.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/minimal/core-minimal.d.ts +266 -189
- package/dist/minimal/core-minimal.js +6 -6
- package/dist/minimal/core-minimal.js.map +1 -1
- package/dist/{revokeAuthorization-OK7E7OK3.js → revokeAuthorization-2ZRO6GUZ.js} +4 -4
- package/dist/{revokeAuthorization-OK7E7OK3.js.map → revokeAuthorization-2ZRO6GUZ.js.map} +1 -1
- package/dist/{signature-verification-DGxR4aYQ.d.ts → signature-verification-BDzoR1MG.d.ts} +0 -5
- package/dist/{updateReputationWithAuth-Y4ONEVSP.js → updateReputationWithAuth-PCEUOCFV.js} +4 -4
- package/dist/{updateReputationWithAuth-Y4ONEVSP.js.map → updateReputationWithAuth-PCEUOCFV.js.map} +1 -1
- package/dist/utils.d.ts +143 -2
- package/dist/utils.js +10 -10
- package/dist/utils.js.map +1 -1
- package/package.json +5 -3
- package/dist/chunk-AL3HQN73.js.map +0 -1
- package/dist/chunk-BQDGRTVP.js.map +0 -1
- package/dist/chunk-C5CDA3WX.js.map +0 -1
- package/dist/chunk-E3FD2CNY.js.map +0 -1
- package/dist/chunk-IHVDQ4YI.js.map +0 -1
- package/dist/chunk-S74EH3KD.js.map +0 -1
- package/dist/chunk-SZGFSCNU.js.map +0 -1
- package/dist/generated-EG5USUFG.js +0 -9
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Address, Option, ReadonlyUint8Array, AccountMeta, Instruction, InstructionWithData, InstructionWithAccounts, WritableAccount, WritableSignerAccount, AccountSignerMeta, ReadonlyAccount, Commitment as Commitment$1, Rpc, GetLatestBlockhashApi, SendTransactionApi, GetAccountInfoApi, SimulateTransactionApi, GetFeeForMessageApi, GetProgramAccountsApi, GetEpochInfoApi, GetSignatureStatusesApi, GetMultipleAccountsApi, RpcSubscriptions, SignatureNotificationsApi, SlotNotificationsApi, AccountRole, TransactionSigner, Signature as Signature$1 } from '@solana/kit';
|
|
2
2
|
import { Address as Address$1 } from '@solana/addresses';
|
|
3
|
-
import { EventEmitter } from 'node:events';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* This code was AUTOGENERATED using the Codama library.
|
|
@@ -19,6 +18,22 @@ declare enum AccessTier {
|
|
|
19
18
|
Whale = 4
|
|
20
19
|
}
|
|
21
20
|
|
|
21
|
+
/**
|
|
22
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
23
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
24
|
+
* to add features, then rerun Codama to update it.
|
|
25
|
+
*
|
|
26
|
+
* @see https://github.com/codama-idl/codama
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/** Agent lifecycle status (Ghost Identity) */
|
|
30
|
+
declare enum AgentStatus {
|
|
31
|
+
Unregistered = 0,
|
|
32
|
+
Registered = 1,
|
|
33
|
+
Claimed = 2,
|
|
34
|
+
Verified = 3
|
|
35
|
+
}
|
|
36
|
+
|
|
22
37
|
/**
|
|
23
38
|
* This code was AUTOGENERATED using the Codama library.
|
|
24
39
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -150,6 +165,22 @@ type ExecutionParamsArgs = {
|
|
|
150
165
|
executionAuthority: Address;
|
|
151
166
|
};
|
|
152
167
|
|
|
168
|
+
/**
|
|
169
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
170
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
171
|
+
* to add features, then rerun Codama to update it.
|
|
172
|
+
*
|
|
173
|
+
* @see https://github.com/codama-idl/codama
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
/** Cross-platform identity mapping */
|
|
177
|
+
type ExternalIdentifier = {
|
|
178
|
+
platform: string;
|
|
179
|
+
externalId: string;
|
|
180
|
+
verified: boolean;
|
|
181
|
+
verifiedAt: bigint;
|
|
182
|
+
};
|
|
183
|
+
|
|
153
184
|
/**
|
|
154
185
|
* This code was AUTOGENERATED using the Codama library.
|
|
155
186
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -370,6 +401,43 @@ type QuorumRequirements = {
|
|
|
370
401
|
quorumMethod: QuorumMethod;
|
|
371
402
|
};
|
|
372
403
|
|
|
404
|
+
/**
|
|
405
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
406
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
407
|
+
* to add features, then rerun Codama to update it.
|
|
408
|
+
*
|
|
409
|
+
* @see https://github.com/codama-idl/codama
|
|
410
|
+
*/
|
|
411
|
+
|
|
412
|
+
/** Reputation component for multi-source Ghost Score */
|
|
413
|
+
type ReputationComponent = {
|
|
414
|
+
sourceType: ReputationSourceType;
|
|
415
|
+
score: bigint;
|
|
416
|
+
weight: number;
|
|
417
|
+
lastUpdated: bigint;
|
|
418
|
+
dataPoints: bigint;
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
423
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
424
|
+
* to add features, then rerun Codama to update it.
|
|
425
|
+
*
|
|
426
|
+
* @see https://github.com/codama-idl/codama
|
|
427
|
+
*/
|
|
428
|
+
|
|
429
|
+
/** Multi-source reputation types for Ghost Score */
|
|
430
|
+
declare enum ReputationSourceType {
|
|
431
|
+
AccountAge = 0,
|
|
432
|
+
X402Transactions = 1,
|
|
433
|
+
UserReviews = 2,
|
|
434
|
+
ElizaOSReputation = 3,
|
|
435
|
+
CrossmintVerification = 4,
|
|
436
|
+
EndpointReliability = 5,
|
|
437
|
+
JobCompletions = 6,
|
|
438
|
+
SkillEndorsements = 7
|
|
439
|
+
}
|
|
440
|
+
|
|
373
441
|
/**
|
|
374
442
|
* This code was AUTOGENERATED using the Codama library.
|
|
375
443
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -449,8 +517,13 @@ type VotingResults = {
|
|
|
449
517
|
|
|
450
518
|
type Agent$1 = {
|
|
451
519
|
discriminator: ReadonlyUint8Array;
|
|
452
|
-
owner: Address
|
|
520
|
+
owner: Option<Address>;
|
|
521
|
+
status: AgentStatus;
|
|
453
522
|
agentId: string;
|
|
523
|
+
firstTxSignature: string;
|
|
524
|
+
firstSeenTimestamp: bigint;
|
|
525
|
+
discoverySource: string;
|
|
526
|
+
claimedAt: Option<bigint>;
|
|
454
527
|
agentType: number;
|
|
455
528
|
name: string;
|
|
456
529
|
description: string;
|
|
@@ -486,6 +559,11 @@ type Agent$1 = {
|
|
|
486
559
|
x402TotalPayments: bigint;
|
|
487
560
|
x402TotalCalls: bigint;
|
|
488
561
|
lastPaymentTimestamp: bigint;
|
|
562
|
+
externalIdentifiers: Array<ExternalIdentifier>;
|
|
563
|
+
ghostScore: bigint;
|
|
564
|
+
reputationComponents: Array<ReputationComponent>;
|
|
565
|
+
didAddress: Option<Address>;
|
|
566
|
+
credentials: Array<Address>;
|
|
489
567
|
apiSpecUri: string;
|
|
490
568
|
apiVersion: string;
|
|
491
569
|
bump: number;
|
|
@@ -623,89 +701,6 @@ type InitializeGovernanceProposalInstruction<TProgram extends string = typeof GH
|
|
|
623
701
|
...TRemainingAccounts
|
|
624
702
|
]>;
|
|
625
703
|
|
|
626
|
-
/**
|
|
627
|
-
* PayAI Integration Types
|
|
628
|
-
*
|
|
629
|
-
* Type definitions for PayAI x402 facilitator integration,
|
|
630
|
-
* including webhook payloads and client configuration.
|
|
631
|
-
*
|
|
632
|
-
* @module payai/types
|
|
633
|
-
* @see https://docs.payai.network/x402/introduction
|
|
634
|
-
*/
|
|
635
|
-
|
|
636
|
-
/**
|
|
637
|
-
* PayAI supported networks
|
|
638
|
-
*/
|
|
639
|
-
type PayAINetwork = 'solana' | 'base' | 'ethereum' | 'polygon' | 'arbitrum';
|
|
640
|
-
/**
|
|
641
|
-
* PayAI client configuration
|
|
642
|
-
*/
|
|
643
|
-
interface PayAIClientConfig {
|
|
644
|
-
/** PayAI facilitator URL (default: https://facilitator.payai.network) */
|
|
645
|
-
facilitatorUrl?: string;
|
|
646
|
-
/** Solana RPC endpoint */
|
|
647
|
-
rpcUrl: string;
|
|
648
|
-
/** User wallet for signing payments */
|
|
649
|
-
wallet?: {
|
|
650
|
-
publicKey: string;
|
|
651
|
-
signTransaction: (tx: unknown) => Promise<unknown>;
|
|
652
|
-
};
|
|
653
|
-
/** Request timeout in milliseconds */
|
|
654
|
-
timeout?: number;
|
|
655
|
-
/** Retry configuration */
|
|
656
|
-
retry?: {
|
|
657
|
-
attempts: number;
|
|
658
|
-
delayMs: number;
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
/**
|
|
662
|
-
* x402 payment requirement from a resource
|
|
663
|
-
*/
|
|
664
|
-
interface PayAIPaymentRequirement {
|
|
665
|
-
/** Payment scheme (e.g., 'exact') */
|
|
666
|
-
scheme: string;
|
|
667
|
-
/** Blockchain network */
|
|
668
|
-
network: PayAINetwork;
|
|
669
|
-
/** Maximum amount required in smallest unit */
|
|
670
|
-
maxAmountRequired: string;
|
|
671
|
-
/** Resource URL */
|
|
672
|
-
resource: string;
|
|
673
|
-
/** Description of the resource */
|
|
674
|
-
description?: string;
|
|
675
|
-
/** MIME type of the response */
|
|
676
|
-
mimeType?: string;
|
|
677
|
-
/** Recipient address */
|
|
678
|
-
payTo: string;
|
|
679
|
-
/** Token/asset address */
|
|
680
|
-
asset: string;
|
|
681
|
-
/** Maximum timeout in seconds */
|
|
682
|
-
maxTimeoutSeconds?: number;
|
|
683
|
-
/** Additional data */
|
|
684
|
-
extra?: Record<string, unknown>;
|
|
685
|
-
}
|
|
686
|
-
/**
|
|
687
|
-
* Data to record for reputation tracking
|
|
688
|
-
* Extracted from PayAI webhook payloads
|
|
689
|
-
*/
|
|
690
|
-
interface PayAIReputationRecord {
|
|
691
|
-
/** Agent/Merchant address on Solana */
|
|
692
|
-
agentAddress: Address$1;
|
|
693
|
-
/** Payment signature for verification */
|
|
694
|
-
paymentSignature: string;
|
|
695
|
-
/** Payment amount */
|
|
696
|
-
amount: bigint;
|
|
697
|
-
/** Whether the service was successful */
|
|
698
|
-
success: boolean;
|
|
699
|
-
/** Response time in milliseconds */
|
|
700
|
-
responseTimeMs: number;
|
|
701
|
-
/** Payer address */
|
|
702
|
-
payerAddress: string;
|
|
703
|
-
/** Timestamp of payment */
|
|
704
|
-
timestamp: Date;
|
|
705
|
-
/** Network the payment was on */
|
|
706
|
-
network: PayAINetwork;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
704
|
/**
|
|
710
705
|
* CacheManager - Slot-aware RPC result caching
|
|
711
706
|
*
|
|
@@ -1318,8 +1313,6 @@ interface GhostSpeakConfig {
|
|
|
1318
1313
|
ipfsConfig?: IPFSConfig;
|
|
1319
1314
|
/** Credential configuration for Crossmint sync */
|
|
1320
1315
|
credentials?: CredentialConfig;
|
|
1321
|
-
/** PayAI configuration */
|
|
1322
|
-
payai?: Partial<PayAIClientConfig>;
|
|
1323
1316
|
}
|
|
1324
1317
|
interface CredentialConfig {
|
|
1325
1318
|
crossmintApiKey?: string;
|
|
@@ -1808,6 +1801,183 @@ declare class AgentModule extends BaseModule {
|
|
|
1808
1801
|
private get compressionProgramId();
|
|
1809
1802
|
}
|
|
1810
1803
|
|
|
1804
|
+
/**
|
|
1805
|
+
* Ghost Module - Claim and manage external AI agents
|
|
1806
|
+
*
|
|
1807
|
+
* This module provides methods for claiming "Ghost" agents (external agents
|
|
1808
|
+
* registered on x402 facilitators like PayAI) using the Solana Attestation
|
|
1809
|
+
* Service (SAS) for trustless ownership verification.
|
|
1810
|
+
*/
|
|
1811
|
+
|
|
1812
|
+
/**
|
|
1813
|
+
* Network identifier for DID generation
|
|
1814
|
+
*/
|
|
1815
|
+
type Network = 'devnet' | 'testnet' | 'mainnet-beta' | 'localnet';
|
|
1816
|
+
/**
|
|
1817
|
+
* Parameters for claiming a Ghost
|
|
1818
|
+
*/
|
|
1819
|
+
interface ClaimGhostParams {
|
|
1820
|
+
/** Agent account address (the external agent to claim) */
|
|
1821
|
+
agentAddress: Address$1;
|
|
1822
|
+
/** x402 payment address of the agent (used for PDA derivation) */
|
|
1823
|
+
x402PaymentAddress: Address$1;
|
|
1824
|
+
/** SAS Credential address (issuer) */
|
|
1825
|
+
sasCredential: Address$1;
|
|
1826
|
+
/** SAS Schema address (defines attestation structure) */
|
|
1827
|
+
sasSchema: Address$1;
|
|
1828
|
+
/** Network identifier for DID (e.g., "devnet", "mainnet-beta") */
|
|
1829
|
+
network: Network;
|
|
1830
|
+
/** Optional IPFS metadata URI (ipfs://...) */
|
|
1831
|
+
ipfsMetadataUri?: string;
|
|
1832
|
+
/** Optional GitHub username for social proof */
|
|
1833
|
+
githubUsername?: string;
|
|
1834
|
+
/** Optional Twitter handle for social proof */
|
|
1835
|
+
twitterHandle?: string;
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* Result of preparing a Ghost claim
|
|
1839
|
+
*/
|
|
1840
|
+
interface PreparedClaimResult {
|
|
1841
|
+
/** Derived attestation PDA */
|
|
1842
|
+
attestationPda: Address$1;
|
|
1843
|
+
/** Derived DID document PDA */
|
|
1844
|
+
didDocumentPda: Address$1;
|
|
1845
|
+
/** Attestation bump seed */
|
|
1846
|
+
attestationBump: number;
|
|
1847
|
+
/** DID document bump seed */
|
|
1848
|
+
didDocumentBump: number;
|
|
1849
|
+
}
|
|
1850
|
+
/**
|
|
1851
|
+
* Ghost Module - Manage external agent claims
|
|
1852
|
+
*/
|
|
1853
|
+
declare class GhostModule extends BaseModule {
|
|
1854
|
+
constructor(config: GhostSpeakConfig);
|
|
1855
|
+
/**
|
|
1856
|
+
* Claim ownership of a Ghost using SAS attestation
|
|
1857
|
+
*
|
|
1858
|
+
* This method performs the complete claim flow:
|
|
1859
|
+
* 1. Derives required PDAs (attestation, DID document)
|
|
1860
|
+
* 2. Builds the claim_ghost instruction
|
|
1861
|
+
* 3. Executes the transaction
|
|
1862
|
+
*
|
|
1863
|
+
* **Prerequisites:**
|
|
1864
|
+
* - The claimer must have already created a SAS attestation proving ownership
|
|
1865
|
+
* of the agent's x402_payment_address
|
|
1866
|
+
* - The agent must be in Unregistered or Registered status (not already claimed)
|
|
1867
|
+
*
|
|
1868
|
+
* **Results:**
|
|
1869
|
+
* - Agent status transitions to Claimed
|
|
1870
|
+
* - DID document is auto-created with did:sol:<network>:<address>
|
|
1871
|
+
* - Claimer becomes the owner of the agent
|
|
1872
|
+
*
|
|
1873
|
+
* @param claimer - Transaction signer (must own the SAS attestation)
|
|
1874
|
+
* @param params - Claim parameters
|
|
1875
|
+
* @returns Transaction signature
|
|
1876
|
+
*
|
|
1877
|
+
* @example
|
|
1878
|
+
* ```typescript
|
|
1879
|
+
* const signature = await client.ghosts.claim(signer, {
|
|
1880
|
+
* agentAddress: 'GhostAgent123...',
|
|
1881
|
+
* x402PaymentAddress: 'PaymentAddr456...',
|
|
1882
|
+
* sasCredential: 'SASCredential789...',
|
|
1883
|
+
* sasSchema: 'SASSchema012...',
|
|
1884
|
+
* network: 'devnet',
|
|
1885
|
+
* ipfsMetadataUri: 'ipfs://QmHash...',
|
|
1886
|
+
* githubUsername: 'myusername'
|
|
1887
|
+
* })
|
|
1888
|
+
* ```
|
|
1889
|
+
*/
|
|
1890
|
+
claim(claimer: TransactionSigner, params: ClaimGhostParams): Promise<string>;
|
|
1891
|
+
/**
|
|
1892
|
+
* Prepare a Ghost claim by deriving all required PDAs
|
|
1893
|
+
*
|
|
1894
|
+
* This is useful for:
|
|
1895
|
+
* - Pre-flight validation (checking if PDAs are correct)
|
|
1896
|
+
* - Building custom transactions with manual PDA management
|
|
1897
|
+
* - Debugging claim issues
|
|
1898
|
+
*
|
|
1899
|
+
* @param params - Claim parameters
|
|
1900
|
+
* @returns Prepared claim data with derived PDAs
|
|
1901
|
+
*
|
|
1902
|
+
* @example
|
|
1903
|
+
* ```typescript
|
|
1904
|
+
* const prepared = await client.ghosts.prepareClaim({
|
|
1905
|
+
* agentAddress: 'GhostAgent123...',
|
|
1906
|
+
* x402PaymentAddress: 'PaymentAddr456...',
|
|
1907
|
+
* sasCredential: 'SASCredential789...',
|
|
1908
|
+
* sasSchema: 'SASSchema012...',
|
|
1909
|
+
* network: 'devnet'
|
|
1910
|
+
* })
|
|
1911
|
+
*
|
|
1912
|
+
* console.log('Attestation PDA:', prepared.attestationPda)
|
|
1913
|
+
* console.log('DID Document PDA:', prepared.didDocumentPda)
|
|
1914
|
+
* ```
|
|
1915
|
+
*/
|
|
1916
|
+
prepareClaim(params: ClaimGhostParams): Promise<PreparedClaimResult>;
|
|
1917
|
+
/**
|
|
1918
|
+
* Get Ghost agent account
|
|
1919
|
+
*
|
|
1920
|
+
* @param address - Agent account address
|
|
1921
|
+
* @returns Agent account data or null if not found
|
|
1922
|
+
*/
|
|
1923
|
+
getGhostAgent(address: Address$1): Promise<Agent$1 | null>;
|
|
1924
|
+
/**
|
|
1925
|
+
* Get all Ghost agents (agents with type 10 - external x402 agents)
|
|
1926
|
+
*
|
|
1927
|
+
* @returns Array of Ghost agents
|
|
1928
|
+
*/
|
|
1929
|
+
getAllGhosts(): Promise<{
|
|
1930
|
+
address: Address$1;
|
|
1931
|
+
data: Agent$1;
|
|
1932
|
+
}[]>;
|
|
1933
|
+
/**
|
|
1934
|
+
* Get Ghost agents by type
|
|
1935
|
+
*
|
|
1936
|
+
* @param agentType - Agent type filter (default: 10 for x402 ghosts)
|
|
1937
|
+
* @returns Array of matching Ghost agents
|
|
1938
|
+
*/
|
|
1939
|
+
getGhostsByType(agentType?: number): Promise<{
|
|
1940
|
+
address: Address$1;
|
|
1941
|
+
data: Agent$1;
|
|
1942
|
+
}[]>;
|
|
1943
|
+
/**
|
|
1944
|
+
* Get claimed Ghosts by owner
|
|
1945
|
+
*
|
|
1946
|
+
* @param owner - Owner address
|
|
1947
|
+
* @returns Array of Ghost agents owned by the address
|
|
1948
|
+
*/
|
|
1949
|
+
getClaimedGhosts(owner: Address$1): Promise<{
|
|
1950
|
+
address: Address$1;
|
|
1951
|
+
data: Agent$1;
|
|
1952
|
+
}[]>;
|
|
1953
|
+
/**
|
|
1954
|
+
* Validate claim parameters
|
|
1955
|
+
*
|
|
1956
|
+
* Performs pre-flight checks to ensure claim will succeed:
|
|
1957
|
+
* - Agent exists and is in correct status
|
|
1958
|
+
* - Agent is not already claimed
|
|
1959
|
+
* - PDAs are correctly derived
|
|
1960
|
+
*
|
|
1961
|
+
* @param params - Claim parameters
|
|
1962
|
+
* @returns Validation result with error messages if any
|
|
1963
|
+
*/
|
|
1964
|
+
validateClaim(params: ClaimGhostParams): Promise<{
|
|
1965
|
+
valid: boolean;
|
|
1966
|
+
errors: string[];
|
|
1967
|
+
warnings: string[];
|
|
1968
|
+
}>;
|
|
1969
|
+
/**
|
|
1970
|
+
* Derive DID document PDA
|
|
1971
|
+
*
|
|
1972
|
+
* Pattern: ['did_document', x402_payment_address]
|
|
1973
|
+
*
|
|
1974
|
+
* @param x402PaymentAddress - Agent's x402 payment address
|
|
1975
|
+
* @returns [DID document PDA, bump]
|
|
1976
|
+
*/
|
|
1977
|
+
private deriveDidDocumentPda;
|
|
1978
|
+
private get systemProgramId();
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1811
1981
|
/**
|
|
1812
1982
|
* Governance management module
|
|
1813
1983
|
*
|
|
@@ -2402,98 +2572,6 @@ declare class UnifiedCredentialService {
|
|
|
2402
2572
|
}): Promise<IssuedCredentialResult>;
|
|
2403
2573
|
}
|
|
2404
2574
|
|
|
2405
|
-
/**
|
|
2406
|
-
* PayAI x402 Client
|
|
2407
|
-
*
|
|
2408
|
-
* Client for making x402 payments through the PayAI facilitator.
|
|
2409
|
-
* Wraps the standard fetch API with automatic payment handling.
|
|
2410
|
-
*
|
|
2411
|
-
* @module payai/PayAIClient
|
|
2412
|
-
* @see https://docs.payai.network/x402/introduction
|
|
2413
|
-
*/
|
|
2414
|
-
|
|
2415
|
-
declare class PayAIClient extends EventEmitter {
|
|
2416
|
-
private readonly config;
|
|
2417
|
-
private readonly localRecords;
|
|
2418
|
-
constructor(config: PayAIClientConfig);
|
|
2419
|
-
/**
|
|
2420
|
-
* Make a fetch request with automatic x402 payment handling
|
|
2421
|
-
*
|
|
2422
|
-
* @param url - The resource URL
|
|
2423
|
-
* @param init - Fetch options
|
|
2424
|
-
* @returns Response from the resource
|
|
2425
|
-
*/
|
|
2426
|
-
fetch(url: string, init?: RequestInit): Promise<Response>;
|
|
2427
|
-
/**
|
|
2428
|
-
* Verify a payment through the PayAI facilitator
|
|
2429
|
-
*
|
|
2430
|
-
* @param paymentHeader - The payment header/payload
|
|
2431
|
-
* @param requirement - The payment requirement
|
|
2432
|
-
* @returns Verification result
|
|
2433
|
-
*/
|
|
2434
|
-
verifyPayment(paymentHeader: string, requirement: PayAIPaymentRequirement): Promise<{
|
|
2435
|
-
valid: boolean;
|
|
2436
|
-
payer?: string;
|
|
2437
|
-
error?: string;
|
|
2438
|
-
}>;
|
|
2439
|
-
/**
|
|
2440
|
-
* Settle a payment through the PayAI facilitator
|
|
2441
|
-
*
|
|
2442
|
-
* @param paymentHeader - The payment header/payload
|
|
2443
|
-
* @param requirement - The payment requirement
|
|
2444
|
-
* @returns Settlement result
|
|
2445
|
-
*/
|
|
2446
|
-
settlePayment(paymentHeader: string, requirement: PayAIPaymentRequirement): Promise<{
|
|
2447
|
-
success: boolean;
|
|
2448
|
-
transaction?: string;
|
|
2449
|
-
error?: string;
|
|
2450
|
-
}>;
|
|
2451
|
-
/**
|
|
2452
|
-
* List available resources from the PayAI facilitator
|
|
2453
|
-
*
|
|
2454
|
-
* @param options - Filter options
|
|
2455
|
-
* @returns List of available resources
|
|
2456
|
-
*/
|
|
2457
|
-
listResources(options?: {
|
|
2458
|
-
network?: PayAINetwork;
|
|
2459
|
-
capability?: string;
|
|
2460
|
-
maxPrice?: number;
|
|
2461
|
-
}): Promise<{
|
|
2462
|
-
resources: Array<{
|
|
2463
|
-
url: string;
|
|
2464
|
-
description?: string;
|
|
2465
|
-
accepts: PayAIPaymentRequirement[];
|
|
2466
|
-
tags?: string[];
|
|
2467
|
-
}>;
|
|
2468
|
-
}>;
|
|
2469
|
-
/**
|
|
2470
|
-
* Get locally tracked reputation records
|
|
2471
|
-
* (For payments made through this client instance)
|
|
2472
|
-
*/
|
|
2473
|
-
getLocalReputationRecords(): PayAIReputationRecord[];
|
|
2474
|
-
/**
|
|
2475
|
-
* Clear local reputation records
|
|
2476
|
-
*/
|
|
2477
|
-
clearLocalReputationRecords(): void;
|
|
2478
|
-
/**
|
|
2479
|
-
* Select the best payment option from requirements
|
|
2480
|
-
*/
|
|
2481
|
-
private selectPaymentOption;
|
|
2482
|
-
/**
|
|
2483
|
-
* Make payment and retry the original request
|
|
2484
|
-
*/
|
|
2485
|
-
private makePaymentAndRetry;
|
|
2486
|
-
/**
|
|
2487
|
-
* Create a payment header for a requirement
|
|
2488
|
-
* (In production, this would sign a real Solana transaction)
|
|
2489
|
-
*/
|
|
2490
|
-
private createPaymentHeader;
|
|
2491
|
-
/**
|
|
2492
|
-
* Fetch with timeout
|
|
2493
|
-
*/
|
|
2494
|
-
private fetchWithTimeout;
|
|
2495
|
-
}
|
|
2496
|
-
|
|
2497
2575
|
/**
|
|
2498
2576
|
* Reputation tier levels
|
|
2499
2577
|
*/
|
|
@@ -3194,11 +3272,6 @@ interface CreateAuthorizationParams {
|
|
|
3194
3272
|
nonce?: string;
|
|
3195
3273
|
/** Optional metadata */
|
|
3196
3274
|
metadata?: AuthorizationMetadata;
|
|
3197
|
-
/**
|
|
3198
|
-
* Whether to store authorization on-chain (default: false)
|
|
3199
|
-
* @deprecated Use onChainStorage.enabled instead
|
|
3200
|
-
*/
|
|
3201
|
-
storeOnChain?: boolean;
|
|
3202
3275
|
/**
|
|
3203
3276
|
* On-chain storage configuration
|
|
3204
3277
|
* If not provided, defaults to off-chain (free) storage
|
|
@@ -3589,6 +3662,14 @@ declare class GhostSpeakClient {
|
|
|
3589
3662
|
* Direct access to Agent Module for read operations
|
|
3590
3663
|
*/
|
|
3591
3664
|
get agents(): AgentModule;
|
|
3665
|
+
/**
|
|
3666
|
+
* Direct access to Ghost Module for claiming external agents
|
|
3667
|
+
*
|
|
3668
|
+
* Ghosts are external AI agents (type 10) that exist on x402 facilitators.
|
|
3669
|
+
* They can be claimed using Solana Attestation Service (SAS)
|
|
3670
|
+
* for trustless ownership verification.
|
|
3671
|
+
*/
|
|
3672
|
+
get ghosts(): GhostModule;
|
|
3592
3673
|
/**
|
|
3593
3674
|
* Direct access to Governance Module for read operations
|
|
3594
3675
|
*/
|
|
@@ -3601,10 +3682,6 @@ declare class GhostSpeakClient {
|
|
|
3601
3682
|
* Agent operations
|
|
3602
3683
|
*/
|
|
3603
3684
|
agent(): AgentBuilder;
|
|
3604
|
-
/**
|
|
3605
|
-
* PayAI operations (x402 payments)
|
|
3606
|
-
*/
|
|
3607
|
-
payai(): PayAIClient;
|
|
3608
3685
|
/**
|
|
3609
3686
|
* Reputation operations
|
|
3610
3687
|
*/
|
|
@@ -3619,7 +3696,7 @@ declare class GhostSpeakClient {
|
|
|
3619
3696
|
/**
|
|
3620
3697
|
* Multi-Source Reputation Aggregator (Pillar 3: External Sources)
|
|
3621
3698
|
*
|
|
3622
|
-
* Aggregate reputation data from multiple sources (
|
|
3699
|
+
* Aggregate reputation data from multiple sources (x402, GitHub, custom webhooks)
|
|
3623
3700
|
* with weighted scoring and conflict detection.
|
|
3624
3701
|
*/
|
|
3625
3702
|
reputationAggregator(): any;
|