@ghostspeak/sdk 2.0.7 → 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 +145 -2
- package/dist/{GhostSpeakClient-CWmGaM9Q.d.ts → GhostSpeakClient-bnXwUPHI.d.ts} +10 -6
- package/dist/{StakingModule-C5rzuOWb.d.ts → StakingModule-DunDShLq.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-CI5_6Gzk.d.ts +234 -0
- package/dist/browser.d.ts +3 -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-G7S6B6WB.js → chunk-5QBSC4T4.js} +7 -7
- package/dist/{chunk-G7S6B6WB.js.map → chunk-5QBSC4T4.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-6XCCMJ6M.js} +19 -23
- package/dist/chunk-6XCCMJ6M.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-S74EH3KD.js → chunk-IQM5RASO.js} +637 -25
- package/dist/chunk-IQM5RASO.js.map +1 -0
- package/dist/{chunk-SZGFSCNU.js → chunk-JYXSOXCP.js} +467 -299
- package/dist/chunk-JYXSOXCP.js.map +1 -0
- package/dist/{chunk-C5CDA3WX.js → chunk-OXA7MECJ.js} +476 -3
- package/dist/chunk-OXA7MECJ.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/client.d.ts +2 -3
- package/dist/client.js +9 -9
- 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 +209 -231
- package/dist/index.js +231 -521
- package/dist/index.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/minimal/core-minimal.d.ts +266 -184
- 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/{updateReputationWithAuth-Y4ONEVSP.js → updateReputationWithAuth-PCEUOCFV.js} +4 -4
- package/dist/{updateReputationWithAuth-Y4ONEVSP.js.map → updateReputationWithAuth-PCEUOCFV.js.map} +1 -1
- package/dist/utils.js +9 -9
- package/package.json +4 -4
- package/dist/chunk-AL3HQN73.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,7 +1,6 @@
|
|
|
1
1
|
import { Address as Address$1 } from '@solana/addresses';
|
|
2
|
-
import { ReadonlyUint8Array,
|
|
2
|
+
import { ReadonlyUint8Array, Option, Address, Decoder, EncodedAccount, Account, MaybeEncodedAccount, MaybeAccount, fetchEncodedAccount, FetchAccountConfig, FixedSizeDecoder, 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';
|
|
3
3
|
import { I as IPFSConfig, G as GovernanceProposal, n as ProposalTypeArgs, E as ExecutionParamsArgs, o as CategoryReputation, B as BadgeType, J as JobPerformance, a as ReputationCalculationResult, p as ReputationTier, b as ReputationMetrics, c as TagScore, q as TagCategory, d as TagFilters, e as TagQueryResult } from './reputation-types-Yebf0Rm_.js';
|
|
4
|
-
import { EventEmitter } from 'node:events';
|
|
5
4
|
import { ParticipantType } from './types.js';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -21,6 +20,38 @@ declare enum AccessTier {
|
|
|
21
20
|
Whale = 4
|
|
22
21
|
}
|
|
23
22
|
|
|
23
|
+
/**
|
|
24
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
25
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
26
|
+
* to add features, then rerun Codama to update it.
|
|
27
|
+
*
|
|
28
|
+
* @see https://github.com/codama-idl/codama
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/** Agent lifecycle status (Ghost Identity) */
|
|
32
|
+
declare enum AgentStatus {
|
|
33
|
+
Unregistered = 0,
|
|
34
|
+
Registered = 1,
|
|
35
|
+
Claimed = 2,
|
|
36
|
+
Verified = 3
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
41
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
42
|
+
* to add features, then rerun Codama to update it.
|
|
43
|
+
*
|
|
44
|
+
* @see https://github.com/codama-idl/codama
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/** Cross-platform identity mapping */
|
|
48
|
+
type ExternalIdentifier = {
|
|
49
|
+
platform: string;
|
|
50
|
+
externalId: string;
|
|
51
|
+
verified: boolean;
|
|
52
|
+
verifiedAt: bigint;
|
|
53
|
+
};
|
|
54
|
+
|
|
24
55
|
/**
|
|
25
56
|
* This code was AUTOGENERATED using the Codama library.
|
|
26
57
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -88,6 +119,43 @@ declare enum PricingModel$1 {
|
|
|
88
119
|
}
|
|
89
120
|
type PricingModelArgs = PricingModel$1;
|
|
90
121
|
|
|
122
|
+
/**
|
|
123
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
124
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
125
|
+
* to add features, then rerun Codama to update it.
|
|
126
|
+
*
|
|
127
|
+
* @see https://github.com/codama-idl/codama
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
/** Reputation component for multi-source Ghost Score */
|
|
131
|
+
type ReputationComponent = {
|
|
132
|
+
sourceType: ReputationSourceType;
|
|
133
|
+
score: bigint;
|
|
134
|
+
weight: number;
|
|
135
|
+
lastUpdated: bigint;
|
|
136
|
+
dataPoints: bigint;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
141
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
142
|
+
* to add features, then rerun Codama to update it.
|
|
143
|
+
*
|
|
144
|
+
* @see https://github.com/codama-idl/codama
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
/** Multi-source reputation types for Ghost Score */
|
|
148
|
+
declare enum ReputationSourceType {
|
|
149
|
+
AccountAge = 0,
|
|
150
|
+
X402Transactions = 1,
|
|
151
|
+
UserReviews = 2,
|
|
152
|
+
ElizaOSReputation = 3,
|
|
153
|
+
CrossmintVerification = 4,
|
|
154
|
+
EndpointReliability = 5,
|
|
155
|
+
JobCompletions = 6,
|
|
156
|
+
SkillEndorsements = 7
|
|
157
|
+
}
|
|
158
|
+
|
|
91
159
|
/**
|
|
92
160
|
* This code was AUTOGENERATED using the Codama library.
|
|
93
161
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -98,8 +166,13 @@ type PricingModelArgs = PricingModel$1;
|
|
|
98
166
|
|
|
99
167
|
type Agent = {
|
|
100
168
|
discriminator: ReadonlyUint8Array;
|
|
101
|
-
owner: Address
|
|
169
|
+
owner: Option<Address>;
|
|
170
|
+
status: AgentStatus;
|
|
102
171
|
agentId: string;
|
|
172
|
+
firstTxSignature: string;
|
|
173
|
+
firstSeenTimestamp: bigint;
|
|
174
|
+
discoverySource: string;
|
|
175
|
+
claimedAt: Option<bigint>;
|
|
103
176
|
agentType: number;
|
|
104
177
|
name: string;
|
|
105
178
|
description: string;
|
|
@@ -135,12 +208,21 @@ type Agent = {
|
|
|
135
208
|
x402TotalPayments: bigint;
|
|
136
209
|
x402TotalCalls: bigint;
|
|
137
210
|
lastPaymentTimestamp: bigint;
|
|
211
|
+
externalIdentifiers: Array<ExternalIdentifier>;
|
|
212
|
+
ghostScore: bigint;
|
|
213
|
+
reputationComponents: Array<ReputationComponent>;
|
|
214
|
+
didAddress: Option<Address>;
|
|
215
|
+
credentials: Array<Address>;
|
|
138
216
|
apiSpecUri: string;
|
|
139
217
|
apiVersion: string;
|
|
140
218
|
bump: number;
|
|
141
219
|
};
|
|
142
220
|
/** Gets the decoder for {@link Agent} account data. */
|
|
143
221
|
declare function getAgentDecoder(): Decoder<Agent>;
|
|
222
|
+
declare function decodeAgent<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<Agent, TAddress>;
|
|
223
|
+
declare function decodeAgent<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<Agent, TAddress>;
|
|
224
|
+
declare function fetchAgent<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<Agent, TAddress>>;
|
|
225
|
+
declare function fetchMaybeAgent<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<Agent, TAddress>>;
|
|
144
226
|
|
|
145
227
|
/**
|
|
146
228
|
* This code was AUTOGENERATED using the Codama library.
|
|
@@ -236,227 +318,6 @@ type InitializeGovernanceProposalInstruction<TProgram extends string = typeof GH
|
|
|
236
318
|
...TRemainingAccounts
|
|
237
319
|
]>;
|
|
238
320
|
|
|
239
|
-
/**
|
|
240
|
-
* PayAI Integration Types
|
|
241
|
-
*
|
|
242
|
-
* Type definitions for PayAI x402 facilitator integration,
|
|
243
|
-
* including webhook payloads and client configuration.
|
|
244
|
-
*
|
|
245
|
-
* @module payai/types
|
|
246
|
-
* @see https://docs.payai.network/x402/introduction
|
|
247
|
-
*/
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* PayAI webhook event types
|
|
251
|
-
*/
|
|
252
|
-
type PayAIWebhookEventType = 'payment.verified' | 'payment.settled' | 'payment.failed' | 'payment.refunded';
|
|
253
|
-
/**
|
|
254
|
-
* PayAI payment status
|
|
255
|
-
*/
|
|
256
|
-
type PayAIPaymentStatus = 'pending' | 'verified' | 'settled' | 'failed' | 'refunded';
|
|
257
|
-
/**
|
|
258
|
-
* PayAI supported networks
|
|
259
|
-
*/
|
|
260
|
-
type PayAINetwork = 'solana' | 'base' | 'ethereum' | 'polygon' | 'arbitrum';
|
|
261
|
-
/**
|
|
262
|
-
* PayAI webhook payload for payment events
|
|
263
|
-
* This is sent to your webhook endpoint after payment verification/settlement
|
|
264
|
-
*/
|
|
265
|
-
interface PayAIWebhookPayload {
|
|
266
|
-
/** Unique event ID */
|
|
267
|
-
id: string;
|
|
268
|
-
/** Event type */
|
|
269
|
-
type: PayAIWebhookEventType;
|
|
270
|
-
/** Timestamp of the event (ISO 8601) */
|
|
271
|
-
timestamp: string;
|
|
272
|
-
/** Payment data */
|
|
273
|
-
data: PayAIPaymentData;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Payment data included in webhook payload
|
|
277
|
-
*/
|
|
278
|
-
interface PayAIPaymentData {
|
|
279
|
-
/** Unique payment ID from PayAI */
|
|
280
|
-
paymentId: string;
|
|
281
|
-
/** Transaction signature on-chain */
|
|
282
|
-
transactionSignature: string;
|
|
283
|
-
/** Blockchain network */
|
|
284
|
-
network: PayAINetwork;
|
|
285
|
-
/** Payer wallet address */
|
|
286
|
-
payer: string;
|
|
287
|
-
/** Merchant/Agent wallet address (payTo) */
|
|
288
|
-
merchant: string;
|
|
289
|
-
/** Payment amount in smallest unit (e.g., lamports for SOL, base units for USDC) */
|
|
290
|
-
amount: string;
|
|
291
|
-
/** Token/asset address */
|
|
292
|
-
asset: string;
|
|
293
|
-
/** Token symbol (e.g., 'USDC') */
|
|
294
|
-
assetSymbol: string;
|
|
295
|
-
/** Payment status */
|
|
296
|
-
status: PayAIPaymentStatus;
|
|
297
|
-
/** Resource URL that was paid for */
|
|
298
|
-
resource: string;
|
|
299
|
-
/** Response time in milliseconds (from request to response) */
|
|
300
|
-
responseTimeMs?: number;
|
|
301
|
-
/** HTTP status code of the resource response */
|
|
302
|
-
httpStatusCode?: number;
|
|
303
|
-
/** Whether the resource request was successful */
|
|
304
|
-
success?: boolean;
|
|
305
|
-
/** Timestamp when payment was verified */
|
|
306
|
-
verifiedAt?: string;
|
|
307
|
-
/** Timestamp when payment was settled */
|
|
308
|
-
settledAt?: string;
|
|
309
|
-
/** Additional metadata from the payment request */
|
|
310
|
-
metadata?: Record<string, unknown>;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Webhook verification result
|
|
314
|
-
*/
|
|
315
|
-
interface PayAIWebhookVerification {
|
|
316
|
-
valid: boolean;
|
|
317
|
-
error?: string;
|
|
318
|
-
payload?: PayAIWebhookPayload;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* PayAI client configuration
|
|
322
|
-
*/
|
|
323
|
-
interface PayAIClientConfig {
|
|
324
|
-
/** PayAI facilitator URL (default: https://facilitator.payai.network) */
|
|
325
|
-
facilitatorUrl?: string;
|
|
326
|
-
/** Solana RPC endpoint */
|
|
327
|
-
rpcUrl: string;
|
|
328
|
-
/** User wallet for signing payments */
|
|
329
|
-
wallet?: {
|
|
330
|
-
publicKey: string;
|
|
331
|
-
signTransaction: (tx: unknown) => Promise<unknown>;
|
|
332
|
-
};
|
|
333
|
-
/** Request timeout in milliseconds */
|
|
334
|
-
timeout?: number;
|
|
335
|
-
/** Retry configuration */
|
|
336
|
-
retry?: {
|
|
337
|
-
attempts: number;
|
|
338
|
-
delayMs: number;
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* x402 payment requirement from a resource
|
|
343
|
-
*/
|
|
344
|
-
interface PayAIPaymentRequirement {
|
|
345
|
-
/** Payment scheme (e.g., 'exact') */
|
|
346
|
-
scheme: string;
|
|
347
|
-
/** Blockchain network */
|
|
348
|
-
network: PayAINetwork;
|
|
349
|
-
/** Maximum amount required in smallest unit */
|
|
350
|
-
maxAmountRequired: string;
|
|
351
|
-
/** Resource URL */
|
|
352
|
-
resource: string;
|
|
353
|
-
/** Description of the resource */
|
|
354
|
-
description?: string;
|
|
355
|
-
/** MIME type of the response */
|
|
356
|
-
mimeType?: string;
|
|
357
|
-
/** Recipient address */
|
|
358
|
-
payTo: string;
|
|
359
|
-
/** Token/asset address */
|
|
360
|
-
asset: string;
|
|
361
|
-
/** Maximum timeout in seconds */
|
|
362
|
-
maxTimeoutSeconds?: number;
|
|
363
|
-
/** Additional data */
|
|
364
|
-
extra?: Record<string, unknown>;
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Payment response from PayAI facilitator
|
|
368
|
-
*/
|
|
369
|
-
interface PayAIPaymentResponse {
|
|
370
|
-
/** Whether payment was successful */
|
|
371
|
-
success: boolean;
|
|
372
|
-
/** Transaction signature */
|
|
373
|
-
transactionSignature?: string;
|
|
374
|
-
/** Error message if failed */
|
|
375
|
-
error?: string;
|
|
376
|
-
/** Payment ID for tracking */
|
|
377
|
-
paymentId?: string;
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Data to record for reputation tracking
|
|
381
|
-
* Extracted from PayAI webhook payloads
|
|
382
|
-
*/
|
|
383
|
-
interface PayAIReputationRecord {
|
|
384
|
-
/** Agent/Merchant address on Solana */
|
|
385
|
-
agentAddress: Address$1;
|
|
386
|
-
/** Payment signature for verification */
|
|
387
|
-
paymentSignature: string;
|
|
388
|
-
/** Payment amount */
|
|
389
|
-
amount: bigint;
|
|
390
|
-
/** Whether the service was successful */
|
|
391
|
-
success: boolean;
|
|
392
|
-
/** Response time in milliseconds */
|
|
393
|
-
responseTimeMs: number;
|
|
394
|
-
/** Payer address */
|
|
395
|
-
payerAddress: string;
|
|
396
|
-
/** Timestamp of payment */
|
|
397
|
-
timestamp: Date;
|
|
398
|
-
/** Network the payment was on */
|
|
399
|
-
network: PayAINetwork;
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* Agent registration data for PayAI marketplace sync
|
|
403
|
-
*/
|
|
404
|
-
interface PayAIAgentRegistration {
|
|
405
|
-
/** Agent's Solana address */
|
|
406
|
-
agentAddress: Address$1;
|
|
407
|
-
/** Service endpoint URL (x402-enabled) */
|
|
408
|
-
serviceEndpoint: string;
|
|
409
|
-
/** Agent capabilities/tags */
|
|
410
|
-
capabilities: string[];
|
|
411
|
-
/** Accepted payment tokens */
|
|
412
|
-
acceptedTokens: string[];
|
|
413
|
-
/** Pricing information */
|
|
414
|
-
pricing?: {
|
|
415
|
-
minPrice: string;
|
|
416
|
-
maxPrice: string;
|
|
417
|
-
currency: string;
|
|
418
|
-
};
|
|
419
|
-
/** Agent metadata */
|
|
420
|
-
metadata?: {
|
|
421
|
-
name?: string;
|
|
422
|
-
description?: string;
|
|
423
|
-
logo?: string;
|
|
424
|
-
website?: string;
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Webhook handler options
|
|
429
|
-
*/
|
|
430
|
-
interface PayAIWebhookHandlerOptions {
|
|
431
|
-
/** Secret for verifying webhook signatures */
|
|
432
|
-
webhookSecret?: string;
|
|
433
|
-
/** Whether to verify webhook signatures (default: true in production) */
|
|
434
|
-
verifySignatures?: boolean;
|
|
435
|
-
/** Callback for handling verified payment events */
|
|
436
|
-
onPaymentVerified?: (data: PayAIPaymentData) => Promise<void>;
|
|
437
|
-
/** Callback for handling settled payment events */
|
|
438
|
-
onPaymentSettled?: (data: PayAIPaymentData) => Promise<void>;
|
|
439
|
-
/** Callback for handling failed payment events */
|
|
440
|
-
onPaymentFailed?: (data: PayAIPaymentData) => Promise<void>;
|
|
441
|
-
/** Callback for recording to reputation */
|
|
442
|
-
onRecordReputation?: (record: PayAIReputationRecord) => Promise<void>;
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Webhook processing result
|
|
446
|
-
*/
|
|
447
|
-
interface PayAIWebhookResult {
|
|
448
|
-
/** Whether processing was successful */
|
|
449
|
-
success: boolean;
|
|
450
|
-
/** Event type that was processed */
|
|
451
|
-
eventType?: PayAIWebhookEventType;
|
|
452
|
-
/** Error message if failed */
|
|
453
|
-
error?: string;
|
|
454
|
-
/** Whether reputation was recorded */
|
|
455
|
-
reputationRecorded?: boolean;
|
|
456
|
-
/** Processed payment ID */
|
|
457
|
-
paymentId?: string;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
321
|
/**
|
|
461
322
|
* CacheManager - Slot-aware RPC result caching
|
|
462
323
|
*
|
|
@@ -591,8 +452,6 @@ interface GhostSpeakConfig {
|
|
|
591
452
|
ipfsConfig?: IPFSConfig;
|
|
592
453
|
/** Credential configuration for Crossmint sync */
|
|
593
454
|
credentials?: CredentialConfig;
|
|
594
|
-
/** PayAI configuration */
|
|
595
|
-
payai?: Partial<PayAIClientConfig>;
|
|
596
455
|
}
|
|
597
456
|
interface CredentialConfig {
|
|
598
457
|
crossmintApiKey?: string;
|
|
@@ -1185,6 +1044,183 @@ declare class AgentModule extends BaseModule {
|
|
|
1185
1044
|
private get compressionProgramId();
|
|
1186
1045
|
}
|
|
1187
1046
|
|
|
1047
|
+
/**
|
|
1048
|
+
* Ghost Module - Claim and manage external AI agents
|
|
1049
|
+
*
|
|
1050
|
+
* This module provides methods for claiming "Ghost" agents (external agents
|
|
1051
|
+
* registered on x402 facilitators like PayAI) using the Solana Attestation
|
|
1052
|
+
* Service (SAS) for trustless ownership verification.
|
|
1053
|
+
*/
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* Network identifier for DID generation
|
|
1057
|
+
*/
|
|
1058
|
+
type Network = 'devnet' | 'testnet' | 'mainnet-beta' | 'localnet';
|
|
1059
|
+
/**
|
|
1060
|
+
* Parameters for claiming a Ghost
|
|
1061
|
+
*/
|
|
1062
|
+
interface ClaimGhostParams {
|
|
1063
|
+
/** Agent account address (the external agent to claim) */
|
|
1064
|
+
agentAddress: Address$1;
|
|
1065
|
+
/** x402 payment address of the agent (used for PDA derivation) */
|
|
1066
|
+
x402PaymentAddress: Address$1;
|
|
1067
|
+
/** SAS Credential address (issuer) */
|
|
1068
|
+
sasCredential: Address$1;
|
|
1069
|
+
/** SAS Schema address (defines attestation structure) */
|
|
1070
|
+
sasSchema: Address$1;
|
|
1071
|
+
/** Network identifier for DID (e.g., "devnet", "mainnet-beta") */
|
|
1072
|
+
network: Network;
|
|
1073
|
+
/** Optional IPFS metadata URI (ipfs://...) */
|
|
1074
|
+
ipfsMetadataUri?: string;
|
|
1075
|
+
/** Optional GitHub username for social proof */
|
|
1076
|
+
githubUsername?: string;
|
|
1077
|
+
/** Optional Twitter handle for social proof */
|
|
1078
|
+
twitterHandle?: string;
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Result of preparing a Ghost claim
|
|
1082
|
+
*/
|
|
1083
|
+
interface PreparedClaimResult {
|
|
1084
|
+
/** Derived attestation PDA */
|
|
1085
|
+
attestationPda: Address$1;
|
|
1086
|
+
/** Derived DID document PDA */
|
|
1087
|
+
didDocumentPda: Address$1;
|
|
1088
|
+
/** Attestation bump seed */
|
|
1089
|
+
attestationBump: number;
|
|
1090
|
+
/** DID document bump seed */
|
|
1091
|
+
didDocumentBump: number;
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Ghost Module - Manage external agent claims
|
|
1095
|
+
*/
|
|
1096
|
+
declare class GhostModule extends BaseModule {
|
|
1097
|
+
constructor(config: GhostSpeakConfig);
|
|
1098
|
+
/**
|
|
1099
|
+
* Claim ownership of a Ghost using SAS attestation
|
|
1100
|
+
*
|
|
1101
|
+
* This method performs the complete claim flow:
|
|
1102
|
+
* 1. Derives required PDAs (attestation, DID document)
|
|
1103
|
+
* 2. Builds the claim_ghost instruction
|
|
1104
|
+
* 3. Executes the transaction
|
|
1105
|
+
*
|
|
1106
|
+
* **Prerequisites:**
|
|
1107
|
+
* - The claimer must have already created a SAS attestation proving ownership
|
|
1108
|
+
* of the agent's x402_payment_address
|
|
1109
|
+
* - The agent must be in Unregistered or Registered status (not already claimed)
|
|
1110
|
+
*
|
|
1111
|
+
* **Results:**
|
|
1112
|
+
* - Agent status transitions to Claimed
|
|
1113
|
+
* - DID document is auto-created with did:sol:<network>:<address>
|
|
1114
|
+
* - Claimer becomes the owner of the agent
|
|
1115
|
+
*
|
|
1116
|
+
* @param claimer - Transaction signer (must own the SAS attestation)
|
|
1117
|
+
* @param params - Claim parameters
|
|
1118
|
+
* @returns Transaction signature
|
|
1119
|
+
*
|
|
1120
|
+
* @example
|
|
1121
|
+
* ```typescript
|
|
1122
|
+
* const signature = await client.ghosts.claim(signer, {
|
|
1123
|
+
* agentAddress: 'GhostAgent123...',
|
|
1124
|
+
* x402PaymentAddress: 'PaymentAddr456...',
|
|
1125
|
+
* sasCredential: 'SASCredential789...',
|
|
1126
|
+
* sasSchema: 'SASSchema012...',
|
|
1127
|
+
* network: 'devnet',
|
|
1128
|
+
* ipfsMetadataUri: 'ipfs://QmHash...',
|
|
1129
|
+
* githubUsername: 'myusername'
|
|
1130
|
+
* })
|
|
1131
|
+
* ```
|
|
1132
|
+
*/
|
|
1133
|
+
claim(claimer: TransactionSigner, params: ClaimGhostParams): Promise<string>;
|
|
1134
|
+
/**
|
|
1135
|
+
* Prepare a Ghost claim by deriving all required PDAs
|
|
1136
|
+
*
|
|
1137
|
+
* This is useful for:
|
|
1138
|
+
* - Pre-flight validation (checking if PDAs are correct)
|
|
1139
|
+
* - Building custom transactions with manual PDA management
|
|
1140
|
+
* - Debugging claim issues
|
|
1141
|
+
*
|
|
1142
|
+
* @param params - Claim parameters
|
|
1143
|
+
* @returns Prepared claim data with derived PDAs
|
|
1144
|
+
*
|
|
1145
|
+
* @example
|
|
1146
|
+
* ```typescript
|
|
1147
|
+
* const prepared = await client.ghosts.prepareClaim({
|
|
1148
|
+
* agentAddress: 'GhostAgent123...',
|
|
1149
|
+
* x402PaymentAddress: 'PaymentAddr456...',
|
|
1150
|
+
* sasCredential: 'SASCredential789...',
|
|
1151
|
+
* sasSchema: 'SASSchema012...',
|
|
1152
|
+
* network: 'devnet'
|
|
1153
|
+
* })
|
|
1154
|
+
*
|
|
1155
|
+
* console.log('Attestation PDA:', prepared.attestationPda)
|
|
1156
|
+
* console.log('DID Document PDA:', prepared.didDocumentPda)
|
|
1157
|
+
* ```
|
|
1158
|
+
*/
|
|
1159
|
+
prepareClaim(params: ClaimGhostParams): Promise<PreparedClaimResult>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Get Ghost agent account
|
|
1162
|
+
*
|
|
1163
|
+
* @param address - Agent account address
|
|
1164
|
+
* @returns Agent account data or null if not found
|
|
1165
|
+
*/
|
|
1166
|
+
getGhostAgent(address: Address$1): Promise<Agent | null>;
|
|
1167
|
+
/**
|
|
1168
|
+
* Get all Ghost agents (agents with type 10 - external x402 agents)
|
|
1169
|
+
*
|
|
1170
|
+
* @returns Array of Ghost agents
|
|
1171
|
+
*/
|
|
1172
|
+
getAllGhosts(): Promise<{
|
|
1173
|
+
address: Address$1;
|
|
1174
|
+
data: Agent;
|
|
1175
|
+
}[]>;
|
|
1176
|
+
/**
|
|
1177
|
+
* Get Ghost agents by type
|
|
1178
|
+
*
|
|
1179
|
+
* @param agentType - Agent type filter (default: 10 for x402 ghosts)
|
|
1180
|
+
* @returns Array of matching Ghost agents
|
|
1181
|
+
*/
|
|
1182
|
+
getGhostsByType(agentType?: number): Promise<{
|
|
1183
|
+
address: Address$1;
|
|
1184
|
+
data: Agent;
|
|
1185
|
+
}[]>;
|
|
1186
|
+
/**
|
|
1187
|
+
* Get claimed Ghosts by owner
|
|
1188
|
+
*
|
|
1189
|
+
* @param owner - Owner address
|
|
1190
|
+
* @returns Array of Ghost agents owned by the address
|
|
1191
|
+
*/
|
|
1192
|
+
getClaimedGhosts(owner: Address$1): Promise<{
|
|
1193
|
+
address: Address$1;
|
|
1194
|
+
data: Agent;
|
|
1195
|
+
}[]>;
|
|
1196
|
+
/**
|
|
1197
|
+
* Validate claim parameters
|
|
1198
|
+
*
|
|
1199
|
+
* Performs pre-flight checks to ensure claim will succeed:
|
|
1200
|
+
* - Agent exists and is in correct status
|
|
1201
|
+
* - Agent is not already claimed
|
|
1202
|
+
* - PDAs are correctly derived
|
|
1203
|
+
*
|
|
1204
|
+
* @param params - Claim parameters
|
|
1205
|
+
* @returns Validation result with error messages if any
|
|
1206
|
+
*/
|
|
1207
|
+
validateClaim(params: ClaimGhostParams): Promise<{
|
|
1208
|
+
valid: boolean;
|
|
1209
|
+
errors: string[];
|
|
1210
|
+
warnings: string[];
|
|
1211
|
+
}>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Derive DID document PDA
|
|
1214
|
+
*
|
|
1215
|
+
* Pattern: ['did_document', x402_payment_address]
|
|
1216
|
+
*
|
|
1217
|
+
* @param x402PaymentAddress - Agent's x402 payment address
|
|
1218
|
+
* @returns [DID document PDA, bump]
|
|
1219
|
+
*/
|
|
1220
|
+
private deriveDidDocumentPda;
|
|
1221
|
+
private get systemProgramId();
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1188
1224
|
interface ProposalType {
|
|
1189
1225
|
kind: 'ConfigChange' | 'Treasury' | 'Protocol' | 'Emergency';
|
|
1190
1226
|
data?: Record<string, unknown>;
|
|
@@ -2046,122 +2082,6 @@ declare class CredentialModule {
|
|
|
2046
2082
|
}): string;
|
|
2047
2083
|
}
|
|
2048
2084
|
|
|
2049
|
-
/**
|
|
2050
|
-
* PayAI x402 Client
|
|
2051
|
-
*
|
|
2052
|
-
* Client for making x402 payments through the PayAI facilitator.
|
|
2053
|
-
* Wraps the standard fetch API with automatic payment handling.
|
|
2054
|
-
*
|
|
2055
|
-
* @module payai/PayAIClient
|
|
2056
|
-
* @see https://docs.payai.network/x402/introduction
|
|
2057
|
-
*/
|
|
2058
|
-
|
|
2059
|
-
/**
|
|
2060
|
-
* Check if a response requires payment
|
|
2061
|
-
*/
|
|
2062
|
-
declare function isPaymentRequired(response: Response): boolean;
|
|
2063
|
-
/**
|
|
2064
|
-
* Extract payment requirements from a 402 response
|
|
2065
|
-
*/
|
|
2066
|
-
declare function extractPaymentRequirements(response: Response): Promise<PayAIPaymentRequirement[]>;
|
|
2067
|
-
declare class PayAIClient extends EventEmitter {
|
|
2068
|
-
private readonly config;
|
|
2069
|
-
private readonly localRecords;
|
|
2070
|
-
constructor(config: PayAIClientConfig);
|
|
2071
|
-
/**
|
|
2072
|
-
* Make a fetch request with automatic x402 payment handling
|
|
2073
|
-
*
|
|
2074
|
-
* @param url - The resource URL
|
|
2075
|
-
* @param init - Fetch options
|
|
2076
|
-
* @returns Response from the resource
|
|
2077
|
-
*/
|
|
2078
|
-
fetch(url: string, init?: RequestInit): Promise<Response>;
|
|
2079
|
-
/**
|
|
2080
|
-
* Verify a payment through the PayAI facilitator
|
|
2081
|
-
*
|
|
2082
|
-
* @param paymentHeader - The payment header/payload
|
|
2083
|
-
* @param requirement - The payment requirement
|
|
2084
|
-
* @returns Verification result
|
|
2085
|
-
*/
|
|
2086
|
-
verifyPayment(paymentHeader: string, requirement: PayAIPaymentRequirement): Promise<{
|
|
2087
|
-
valid: boolean;
|
|
2088
|
-
payer?: string;
|
|
2089
|
-
error?: string;
|
|
2090
|
-
}>;
|
|
2091
|
-
/**
|
|
2092
|
-
* Settle a payment through the PayAI facilitator
|
|
2093
|
-
*
|
|
2094
|
-
* @param paymentHeader - The payment header/payload
|
|
2095
|
-
* @param requirement - The payment requirement
|
|
2096
|
-
* @returns Settlement result
|
|
2097
|
-
*/
|
|
2098
|
-
settlePayment(paymentHeader: string, requirement: PayAIPaymentRequirement): Promise<{
|
|
2099
|
-
success: boolean;
|
|
2100
|
-
transaction?: string;
|
|
2101
|
-
error?: string;
|
|
2102
|
-
}>;
|
|
2103
|
-
/**
|
|
2104
|
-
* List available resources from the PayAI facilitator
|
|
2105
|
-
*
|
|
2106
|
-
* @param options - Filter options
|
|
2107
|
-
* @returns List of available resources
|
|
2108
|
-
*/
|
|
2109
|
-
listResources(options?: {
|
|
2110
|
-
network?: PayAINetwork;
|
|
2111
|
-
capability?: string;
|
|
2112
|
-
maxPrice?: number;
|
|
2113
|
-
}): Promise<{
|
|
2114
|
-
resources: Array<{
|
|
2115
|
-
url: string;
|
|
2116
|
-
description?: string;
|
|
2117
|
-
accepts: PayAIPaymentRequirement[];
|
|
2118
|
-
tags?: string[];
|
|
2119
|
-
}>;
|
|
2120
|
-
}>;
|
|
2121
|
-
/**
|
|
2122
|
-
* Get locally tracked reputation records
|
|
2123
|
-
* (For payments made through this client instance)
|
|
2124
|
-
*/
|
|
2125
|
-
getLocalReputationRecords(): PayAIReputationRecord[];
|
|
2126
|
-
/**
|
|
2127
|
-
* Clear local reputation records
|
|
2128
|
-
*/
|
|
2129
|
-
clearLocalReputationRecords(): void;
|
|
2130
|
-
/**
|
|
2131
|
-
* Select the best payment option from requirements
|
|
2132
|
-
*/
|
|
2133
|
-
private selectPaymentOption;
|
|
2134
|
-
/**
|
|
2135
|
-
* Make payment and retry the original request
|
|
2136
|
-
*/
|
|
2137
|
-
private makePaymentAndRetry;
|
|
2138
|
-
/**
|
|
2139
|
-
* Create a payment header for a requirement
|
|
2140
|
-
* (In production, this would sign a real Solana transaction)
|
|
2141
|
-
*/
|
|
2142
|
-
private createPaymentHeader;
|
|
2143
|
-
/**
|
|
2144
|
-
* Fetch with timeout
|
|
2145
|
-
*/
|
|
2146
|
-
private fetchWithTimeout;
|
|
2147
|
-
}
|
|
2148
|
-
/**
|
|
2149
|
-
* Create a new PayAI client
|
|
2150
|
-
*
|
|
2151
|
-
* @param config - Client configuration
|
|
2152
|
-
* @returns Configured PayAI client
|
|
2153
|
-
*/
|
|
2154
|
-
declare function createPayAIClient(config: PayAIClientConfig): PayAIClient;
|
|
2155
|
-
/**
|
|
2156
|
-
* Make a single x402 payment request through PayAI
|
|
2157
|
-
*
|
|
2158
|
-
* @param url - Resource URL
|
|
2159
|
-
* @param config - Client configuration
|
|
2160
|
-
* @param init - Fetch options
|
|
2161
|
-
* @returns Response from the resource
|
|
2162
|
-
*/
|
|
2163
|
-
declare function payAIFetch(url: string, config: PayAIClientConfig, init?: RequestInit): Promise<Response>;
|
|
2164
|
-
|
|
2165
2085
|
/**
|
|
2166
2086
|
* Simplified reputation data for module use
|
|
2167
2087
|
*/
|
|
@@ -2523,4 +2443,4 @@ declare class StakingModule extends BaseModule {
|
|
|
2523
2443
|
getStakingConfig(stakingConfigAddress: Address$1): Promise<StakingConfig | null>;
|
|
2524
2444
|
}
|
|
2525
2445
|
|
|
2526
|
-
export { type
|
|
2446
|
+
export { type DeactivateDidDocumentParams as $, AgentModule as A, BaseModule as B, CacheManager as C, DidModule as D, type ExtendedRpcApi as E, isDidActive as F, type GhostSpeakConfig as G, getMethodsForRelationship as H, InstructionBuilder as I, canPerformAction as J, didDocumentToJson as K, getNetworkFromDid as L, MultisigModule as M, type Network as N, getIdentifierFromDid as O, type PricingModelArgs as P, type DidDocument as Q, ReputationModule as R, StakingModule as S, type VerificationMethod as T, type ServiceEndpoint as U, VerificationMethodType as V, type W3CVerifiableCredential as W, type DidResolutionMetadata as X, type W3CDidDocument as Y, type CreateDidDocumentParams as Z, type UpdateDidDocumentParams as _, GhostModule as a, type ResolveDidDocumentParams as a0, type ReputationData as a1, type PayAIReputationRecordInput as a2, type AgentWithAddress as a3, type AgentRegistrationData as a4, type AgentAccount as a5, PricingModel as a6, GhostSpeakError as a7, type RegisterAgentParams as a8, type RpcResponse as a9, type RpcAccountInfo as aa, type RpcProgramAccount as ab, type RpcProgramAccountsResponse as ac, type RpcAccountInfoResponse as ad, type RpcMultipleAccountsResponse as ae, type TransactionResponse as af, type SimulatedTransactionResponse as ag, type SolanaRpcClient as ah, type EmergencyConfig as ai, type Commitment as aj, type RetryConfig as ak, type RpcApi as al, type RpcSubscriptionApi as am, type StakingAccount as an, type StakingConfig as ao, getAgentDecoder as ap, decodeAgent as aq, fetchAgent as ar, fetchMaybeAgent as as, getStakingAccountDecoder as at, getStakingConfigDecoder as au, type Agent as av, GovernanceModule as b, AccessTier as c, GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS as d, type CacheConfig as e, type ClaimGhostParams as f, type PreparedClaimResult as g, type CreateProposalParams as h, type ProposalType as i, type ExecutionParams as j, CredentialModule as k, CredentialKind as l, CredentialStatus as m, type Credential as n, type CredentialTemplate as o, VerificationRelationship as p, ServiceEndpointType as q, DidError as r, DidErrorClass as s, deriveDidDocumentPda as t, generateDidString as u, validateDidString as v, parseDidString as w, exportAsW3CDidDocument as x, createEd25519VerificationMethod as y, createServiceEndpoint as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AGENT_DISCRIMINATOR, decodeAgent, fetchAgent, fetchAllAgent, fetchAllMaybeAgent, fetchMaybeAgent, getAgentCodec, getAgentDecoder, getAgentDiscriminatorBytes, getAgentEncoder } from './chunk-
|
|
1
|
+
export { AGENT_DISCRIMINATOR, decodeAgent, fetchAgent, fetchAllAgent, fetchAllMaybeAgent, fetchMaybeAgent, getAgentCodec, getAgentDecoder, getAgentDiscriminatorBytes, getAgentEncoder } from './chunk-5QZVFUXB.js';
|
|
2
2
|
import './chunk-UP2VWCW5.js';
|
|
3
|
-
//# sourceMappingURL=agent-
|
|
4
|
-
//# sourceMappingURL=agent-
|
|
3
|
+
//# sourceMappingURL=agent-S42FIMR7.js.map
|
|
4
|
+
//# sourceMappingURL=agent-S42FIMR7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-S42FIMR7.js"}
|