@ghostspeak/sdk 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +152 -30
  2. package/dist/GhostSpeakClient-CWmGaM9Q.d.ts +1007 -0
  3. package/dist/StakingModule-C5rzuOWb.d.ts +2526 -0
  4. package/dist/{agent-M74TCRON.js → agent-5YLZ7DAC.js} +4 -4
  5. package/dist/{agent-M74TCRON.js.map → agent-5YLZ7DAC.js.map} +1 -1
  6. package/dist/batch-operations-45CQFEID.js +4 -0
  7. package/dist/batch-operations-45CQFEID.js.map +1 -0
  8. package/dist/browser.d.ts +45 -554
  9. package/dist/browser.js +15 -842
  10. package/dist/browser.js.map +1 -1
  11. package/dist/chunk-AL3HQN73.js +754 -0
  12. package/dist/chunk-AL3HQN73.js.map +1 -0
  13. package/dist/chunk-BF3IQ35I.js +284 -0
  14. package/dist/chunk-BF3IQ35I.js.map +1 -0
  15. package/dist/chunk-BQDGRTVP.js +168 -0
  16. package/dist/chunk-BQDGRTVP.js.map +1 -0
  17. package/dist/chunk-C5CDA3WX.js +7314 -0
  18. package/dist/chunk-C5CDA3WX.js.map +1 -0
  19. package/dist/chunk-E3FD2CNY.js +1869 -0
  20. package/dist/chunk-E3FD2CNY.js.map +1 -0
  21. package/dist/{chunk-F3DZMBUA.js → chunk-G7S6B6WB.js} +327 -493
  22. package/dist/chunk-G7S6B6WB.js.map +1 -0
  23. package/dist/chunk-IHVDQ4YI.js +4231 -0
  24. package/dist/chunk-IHVDQ4YI.js.map +1 -0
  25. package/dist/chunk-JV2SWONF.js +98 -0
  26. package/dist/chunk-JV2SWONF.js.map +1 -0
  27. package/dist/chunk-KB6CKIUK.js +231 -0
  28. package/dist/chunk-KB6CKIUK.js.map +1 -0
  29. package/dist/chunk-S74EH3KD.js +7890 -0
  30. package/dist/chunk-S74EH3KD.js.map +1 -0
  31. package/dist/chunk-SFTSZ3LC.js +156 -0
  32. package/dist/chunk-SFTSZ3LC.js.map +1 -0
  33. package/dist/chunk-SKMJJ3Q6.js +125 -0
  34. package/dist/chunk-SKMJJ3Q6.js.map +1 -0
  35. package/dist/chunk-SZGFSCNU.js +3682 -0
  36. package/dist/chunk-SZGFSCNU.js.map +1 -0
  37. package/dist/chunk-TTB4OS2D.js +69 -0
  38. package/dist/chunk-TTB4OS2D.js.map +1 -0
  39. package/dist/chunk-UP2VWCW5.js +33 -0
  40. package/dist/{chunk-NSBPE2FW.js.map → chunk-UP2VWCW5.js.map} +1 -1
  41. package/dist/{chunk-UJUGGLMT.js → chunk-VQZQCHUT.js} +5 -5
  42. package/dist/{chunk-UJUGGLMT.js.map → chunk-VQZQCHUT.js.map} +1 -1
  43. package/dist/client.d.ts +5 -4
  44. package/dist/client.js +11 -10
  45. package/dist/createAgentAuthorization-ULG47ZJI.js +5 -0
  46. package/dist/createAgentAuthorization-ULG47ZJI.js.map +1 -0
  47. package/dist/credentials.js +1 -1
  48. package/dist/crypto.js +2 -2
  49. package/dist/errors.js +1 -1
  50. package/dist/feature-flags-B1g0DCPe.d.ts +1181 -0
  51. package/dist/generated-EG5USUFG.js +9 -0
  52. package/dist/{generated-VNLHMR6Y.js.map → generated-EG5USUFG.js.map} +1 -1
  53. package/dist/{ghostspeak_wasm-SB2RPJ3D.js → ghostspeak_wasm-F227HOSM.js} +3 -3
  54. package/dist/{ghostspeak_wasm-SB2RPJ3D.js.map → ghostspeak_wasm-F227HOSM.js.map} +1 -1
  55. package/dist/index.d.ts +1209 -1506
  56. package/dist/index.js +600 -3532
  57. package/dist/index.js.map +1 -1
  58. package/dist/metafile-esm.json +1 -1
  59. package/dist/minimal/core-minimal.d.ts +2383 -1264
  60. package/dist/minimal/core-minimal.js +9 -9
  61. package/dist/minimal/core-minimal.js.map +1 -1
  62. package/dist/nacl-fast-W5BJ3KZ2.js +2229 -0
  63. package/dist/nacl-fast-W5BJ3KZ2.js.map +1 -0
  64. package/dist/pda-4KP7CURF.js +4 -0
  65. package/dist/pda-4KP7CURF.js.map +1 -0
  66. package/dist/pda-Ce7VYg4T.d.ts +25 -0
  67. package/dist/reputation-types-Yebf0Rm_.d.ts +1071 -0
  68. package/dist/revokeAuthorization-OK7E7OK3.js +5 -0
  69. package/dist/revokeAuthorization-OK7E7OK3.js.map +1 -0
  70. package/dist/signature-verification-DGxR4aYQ.d.ts +448 -0
  71. package/dist/types.js +1 -1
  72. package/dist/updateReputationWithAuth-Y4ONEVSP.js +5 -0
  73. package/dist/updateReputationWithAuth-Y4ONEVSP.js.map +1 -0
  74. package/dist/utils.d.ts +69 -203
  75. package/dist/utils.js +15 -153
  76. package/dist/utils.js.map +1 -1
  77. package/package.json +24 -31
  78. package/dist/.tsbuildinfo +0 -1
  79. package/dist/GhostSpeakClient-D_66Uzsf.d.ts +0 -707
  80. package/dist/GovernanceModule-DQYYys-H.d.ts +0 -1766
  81. package/dist/chunk-APCKGD23.js +0 -1328
  82. package/dist/chunk-APCKGD23.js.map +0 -1
  83. package/dist/chunk-ASQXX4IT.js +0 -572
  84. package/dist/chunk-ASQXX4IT.js.map +0 -1
  85. package/dist/chunk-COGZFWOT.js +0 -19657
  86. package/dist/chunk-COGZFWOT.js.map +0 -1
  87. package/dist/chunk-F3DZMBUA.js.map +0 -1
  88. package/dist/chunk-GMHIUK2R.js +0 -7526
  89. package/dist/chunk-GMHIUK2R.js.map +0 -1
  90. package/dist/chunk-IAWBZYPE.js +0 -356
  91. package/dist/chunk-IAWBZYPE.js.map +0 -1
  92. package/dist/chunk-NSBPE2FW.js +0 -15
  93. package/dist/chunk-OWYHJG6H.js +0 -13311
  94. package/dist/chunk-OWYHJG6H.js.map +0 -1
  95. package/dist/chunk-RDDPOFR5.js +0 -3
  96. package/dist/chunk-RDDPOFR5.js.map +0 -1
  97. package/dist/chunk-RERCHKZP.js +0 -35
  98. package/dist/chunk-RERCHKZP.js.map +0 -1
  99. package/dist/chunk-TVVGXYCI.js +0 -2887
  100. package/dist/chunk-TVVGXYCI.js.map +0 -1
  101. package/dist/chunk-ZGP5552B.js +0 -377
  102. package/dist/chunk-ZGP5552B.js.map +0 -1
  103. package/dist/chunk-ZWOYNHVK.js +0 -196
  104. package/dist/chunk-ZWOYNHVK.js.map +0 -1
  105. package/dist/dist/.tsbuildinfo +0 -1
  106. package/dist/elgamal-VZLWB3XK.js +0 -5
  107. package/dist/elgamal-VZLWB3XK.js.map +0 -1
  108. package/dist/feature-flags-V722ZuXO.d.ts +0 -3512
  109. package/dist/generated-VNLHMR6Y.js +0 -5
  110. package/dist/ipfs-types-BOt9ZNg4.d.ts +0 -592
  111. package/dist/multisigConfig-BzEhy6jy.d.ts +0 -58
  112. package/dist/pda-B_nS8SbD.d.ts +0 -114
  113. package/dist/pda-S4BFJVGE.js +0 -4
  114. package/dist/pda-S4BFJVGE.js.map +0 -1
  115. package/dist/system-addresses-BFNLEbFx.d.ts +0 -857
  116. package/dist/token-2022-rpc-RALH4RK7.js +0 -593
  117. package/dist/token-2022-rpc-RALH4RK7.js.map +0 -1
@@ -1,5 +1,6 @@
1
- import { Address, Option, ReadonlyUint8Array, AccountMeta, Instruction, InstructionWithData, InstructionWithAccounts, WritableAccount, WritableSignerAccount, AccountSignerMeta, ReadonlyAccount, ReadonlySignerAccount, Rpc, GetLatestBlockhashApi, SendTransactionApi, GetAccountInfoApi, SimulateTransactionApi, GetFeeForMessageApi, GetProgramAccountsApi, GetEpochInfoApi, GetSignatureStatusesApi, GetMultipleAccountsApi, RpcSubscriptions, SignatureNotificationsApi, SlotNotificationsApi, AccountRole, TransactionSigner, Signature as Signature$1 } from '@solana/kit';
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';
3
4
 
4
5
  /**
5
6
  * This code was AUTOGENERATED using the Codama library.
@@ -9,70 +10,13 @@ import { Address as Address$1 } from '@solana/addresses';
9
10
  * @see https://github.com/codama-idl/codama
10
11
  */
11
12
 
12
- declare enum AccountState {
13
- Uninitialized = 0,
14
- Initialized = 1,
15
- Frozen = 2
16
- }
17
-
18
- /**
19
- * This code was AUTOGENERATED using the Codama library.
20
- * Please DO NOT EDIT THIS FILE, instead use visitors
21
- * to add features, then rerun Codama to update it.
22
- *
23
- * @see https://github.com/codama-idl/codama
24
- */
25
-
26
- declare enum ApplicationStatus {
27
- Submitted = 0,
28
- Accepted = 1,
29
- Rejected = 2,
30
- Withdrawn = 3
31
- }
32
-
33
- /**
34
- * This code was AUTOGENERATED using the Codama library.
35
- * Please DO NOT EDIT THIS FILE, instead use visitors
36
- * to add features, then rerun Codama to update it.
37
- *
38
- * @see https://github.com/codama-idl/codama
39
- */
40
-
41
- type AuctionBid = {
42
- bidder: Address;
43
- amount: bigint;
44
- timestamp: bigint;
45
- isWinning: boolean;
46
- };
47
-
48
- /**
49
- * This code was AUTOGENERATED using the Codama library.
50
- * Please DO NOT EDIT THIS FILE, instead use visitors
51
- * to add features, then rerun Codama to update it.
52
- *
53
- * @see https://github.com/codama-idl/codama
54
- */
55
-
56
- declare enum AuctionStatus {
57
- Active = 0,
58
- Ended = 1,
59
- Cancelled = 2,
60
- Settled = 3
61
- }
62
-
63
- /**
64
- * This code was AUTOGENERATED using the Codama library.
65
- * Please DO NOT EDIT THIS FILE, instead use visitors
66
- * to add features, then rerun Codama to update it.
67
- *
68
- * @see https://github.com/codama-idl/codama
69
- */
70
-
71
- declare enum AuctionType {
72
- English = 0,
73
- Dutch = 1,
74
- SealedBid = 2,
75
- Vickrey = 3
13
+ /** Access tiers based on GHOST token stake amount */
14
+ declare enum AccessTier {
15
+ None = 0,
16
+ Basic = 1,
17
+ Verified = 2,
18
+ Pro = 3,
19
+ Whale = 4
76
20
  }
77
21
 
78
22
  /**
@@ -134,35 +78,6 @@ type DelegationScope = {
134
78
  __kind: "Limited";
135
79
  };
136
80
 
137
- /**
138
- * This code was AUTOGENERATED using the Codama library.
139
- * Please DO NOT EDIT THIS FILE, instead use visitors
140
- * to add features, then rerun Codama to update it.
141
- *
142
- * @see https://github.com/codama-idl/codama
143
- */
144
-
145
- type DutchAuctionConfig = {
146
- decayType: DutchAuctionDecayType;
147
- priceStepCount: number;
148
- stepDuration: bigint;
149
- decayRateBasisPoints: number;
150
- };
151
-
152
- /**
153
- * This code was AUTOGENERATED using the Codama library.
154
- * Please DO NOT EDIT THIS FILE, instead use visitors
155
- * to add features, then rerun Codama to update it.
156
- *
157
- * @see https://github.com/codama-idl/codama
158
- */
159
-
160
- declare enum DutchAuctionDecayType {
161
- Linear = 0,
162
- Exponential = 1,
163
- Stepped = 2
164
- }
165
-
166
81
  /**
167
82
  * This code was AUTOGENERATED using the Codama library.
168
83
  * Please DO NOT EDIT THIS FILE, instead use visitors
@@ -235,6 +150,72 @@ type ExecutionParamsArgs = {
235
150
  executionAuthority: Address;
236
151
  };
237
152
 
153
+ /**
154
+ * This code was AUTOGENERATED using the Codama library.
155
+ * Please DO NOT EDIT THIS FILE, instead use visitors
156
+ * to add features, then rerun Codama to update it.
157
+ *
158
+ * @see https://github.com/codama-idl/codama
159
+ */
160
+
161
+ /**
162
+ * MultisigType defines the governance layer a multisig belongs to.
163
+ * Different types have different permissions and requirements.
164
+ */
165
+ declare enum MultisigType {
166
+ Protocol = 0,
167
+ Dao = 1,
168
+ Dispute = 2,
169
+ AgentConsortium = 3,
170
+ AgentTreasury = 4,
171
+ Custom = 5
172
+ }
173
+ type MultisigTypeArgs = MultisigType;
174
+
175
+ /**
176
+ * This code was AUTOGENERATED using the Codama library.
177
+ * Please DO NOT EDIT THIS FILE, instead use visitors
178
+ * to add features, then rerun Codama to update it.
179
+ *
180
+ * @see https://github.com/codama-idl/codama
181
+ */
182
+
183
+ type MultisigTypeConfigArgs = {
184
+ /** The multisig type */
185
+ multisigType: MultisigTypeArgs;
186
+ /** Required timelock duration in seconds (0 = no timelock) */
187
+ timelockSeconds: number | bigint;
188
+ /** Minimum number of signers allowed */
189
+ minSigners: number;
190
+ /** Maximum number of signers allowed */
191
+ maxSigners: number;
192
+ /** Minimum reputation score required (0-10000 basis points) */
193
+ minReputationScore: number;
194
+ /** Whether signers must hold governance tokens */
195
+ requiresTokenHoldings: boolean;
196
+ /** Minimum token balance required (if requires_token_holdings) */
197
+ minTokenBalance: number | bigint;
198
+ };
199
+
200
+ /**
201
+ * This code was AUTOGENERATED using the Codama library.
202
+ * Please DO NOT EDIT THIS FILE, instead use visitors
203
+ * to add features, then rerun Codama to update it.
204
+ *
205
+ * @see https://github.com/codama-idl/codama
206
+ */
207
+
208
+ declare enum PricingModel {
209
+ Fixed = 0,
210
+ Hourly = 1,
211
+ PerTask = 2,
212
+ Subscription = 3,
213
+ Auction = 4,
214
+ Dynamic = 5,
215
+ RevenueShare = 6,
216
+ Tiered = 7
217
+ }
218
+
238
219
  /**
239
220
  * This code was AUTOGENERATED using the Codama library.
240
221
  * Please DO NOT EDIT THIS FILE, instead use visitors
@@ -351,22 +332,6 @@ declare enum ProposalType {
351
332
  }
352
333
  type ProposalTypeArgs = ProposalType;
353
334
 
354
- /**
355
- * This code was AUTOGENERATED using the Codama library.
356
- * Please DO NOT EDIT THIS FILE, instead use visitors
357
- * to add features, then rerun Codama to update it.
358
- *
359
- * @see https://github.com/codama-idl/codama
360
- */
361
-
362
- declare enum PurchaseStatus {
363
- Pending = 0,
364
- Confirmed = 1,
365
- Completed = 2,
366
- Cancelled = 3,
367
- Paid = 4
368
- }
369
-
370
335
  /**
371
336
  * This code was AUTOGENERATED using the Codama library.
372
337
  * Please DO NOT EDIT THIS FILE, instead use visitors
@@ -405,36 +370,6 @@ type QuorumRequirements = {
405
370
  quorumMethod: QuorumMethod;
406
371
  };
407
372
 
408
- /**
409
- * This code was AUTOGENERATED using the Codama library.
410
- * Please DO NOT EDIT THIS FILE, instead use visitors
411
- * to add features, then rerun Codama to update it.
412
- *
413
- * @see https://github.com/codama-idl/codama
414
- */
415
-
416
- /** Types of transactions that can be executed */
417
- declare enum TransactionType {
418
- Transfer = 0,
419
- Withdrawal = 1,
420
- EscrowRelease = 2,
421
- ProposalCreation = 3,
422
- VoteExecution = 4,
423
- ParameterUpdate = 5,
424
- SignerAddition = 6,
425
- SignerRemoval = 7,
426
- ThresholdUpdate = 8,
427
- ConfigUpdate = 9,
428
- EmergencyFreeze = 10,
429
- EmergencyUnfreeze = 11,
430
- SecurityPolicyUpdate = 12,
431
- ProtocolUpgrade = 13,
432
- FeatureToggle = 14,
433
- RiskParameterUpdate = 15,
434
- CustomInstruction = 16
435
- }
436
- type TransactionTypeArgs = TransactionType;
437
-
438
373
  /**
439
374
  * This code was AUTOGENERATED using the Codama library.
440
375
  * Please DO NOT EDIT THIS FILE, instead use visitors
@@ -504,21 +439,6 @@ type VotingResults = {
504
439
  approvalThresholdMet: boolean;
505
440
  };
506
441
 
507
- /**
508
- * This code was AUTOGENERATED by scripts/generate-missing-types.ts
509
- */
510
-
511
- type MultisigConfigArgs = {
512
- max_signers: number;
513
- default_timeout: number | bigint;
514
- allow_emergency_override: boolean;
515
- emergency_threshold: Option<number>;
516
- auto_execute: boolean;
517
- signer_change_threshold: number;
518
- allowed_transaction_types: Array<TransactionTypeArgs>;
519
- daily_limits: Array<readonly [string, number | bigint]>;
520
- };
521
-
522
442
  /**
523
443
  * This code was AUTOGENERATED using the Codama library.
524
444
  * Please DO NOT EDIT THIS FILE, instead use visitors
@@ -527,32 +447,47 @@ type MultisigConfigArgs = {
527
447
  * @see https://github.com/codama-idl/codama
528
448
  */
529
449
 
530
- type AuctionMarketplace = {
450
+ type Agent$1 = {
531
451
  discriminator: ReadonlyUint8Array;
532
- auction: Address;
533
- agent: Address;
534
- creator: Address;
535
- auctionType: AuctionType;
536
- startingPrice: bigint;
537
- reservePrice: bigint;
538
- isReserveHidden: boolean;
539
- reserveMet: boolean;
540
- currentPrice: bigint;
541
- currentWinner: Option<Address>;
542
- winner: Option<Address>;
543
- auctionEndTime: bigint;
544
- minimumBidIncrement: bigint;
545
- totalBids: number;
546
- status: AuctionStatus;
547
- bids: Array<AuctionBid>;
452
+ owner: Address;
453
+ agentId: string;
454
+ agentType: number;
455
+ name: string;
456
+ description: string;
457
+ capabilities: Array<string>;
458
+ pricingModel: PricingModel;
459
+ reputationScore: number;
460
+ totalJobsCompleted: number;
461
+ totalEarnings: bigint;
462
+ isActive: boolean;
548
463
  createdAt: bigint;
549
- endedAt: Option<bigint>;
464
+ updatedAt: bigint;
465
+ originalPrice: bigint;
466
+ genomeHash: string;
467
+ isReplicable: boolean;
468
+ replicationFee: bigint;
469
+ serviceEndpoint: string;
470
+ isVerified: boolean;
471
+ verificationTimestamp: bigint;
550
472
  metadataUri: string;
551
- dutchConfig: Option<DutchAuctionConfig>;
552
- extensionCount: number;
553
- originalEndTime: bigint;
554
- reservePriceLocked: boolean;
555
- reserveShortfallNotified: boolean;
473
+ frameworkOrigin: string;
474
+ supportedTokens: Array<Address>;
475
+ cnftMint: Option<Address>;
476
+ merkleTree: Option<Address>;
477
+ supportsA2a: boolean;
478
+ transferHook: Option<Address>;
479
+ parentAgent: Option<Address>;
480
+ generation: number;
481
+ x402Enabled: boolean;
482
+ x402PaymentAddress: Address;
483
+ x402AcceptedTokens: Array<Address>;
484
+ x402PricePerCall: bigint;
485
+ x402ServiceEndpoint: string;
486
+ x402TotalPayments: bigint;
487
+ x402TotalCalls: bigint;
488
+ lastPaymentTimestamp: bigint;
489
+ apiSpecUri: string;
490
+ apiVersion: string;
556
491
  bump: number;
557
492
  };
558
493
 
@@ -606,75 +541,35 @@ type GovernanceProposal = {
606
541
  * @see https://github.com/codama-idl/codama
607
542
  */
608
543
 
609
- type JobApplication = {
610
- discriminator: ReadonlyUint8Array;
611
- jobPosting: Address;
612
- agent: Address;
613
- agentOwner: Address;
614
- coverLetter: string;
615
- proposedRate: bigint;
616
- estimatedDelivery: bigint;
617
- portfolioItems: Array<string>;
618
- status: ApplicationStatus;
619
- appliedAt: bigint;
620
- bump: number;
621
- };
622
-
623
- /**
624
- * This code was AUTOGENERATED using the Codama library.
625
- * Please DO NOT EDIT THIS FILE, instead use visitors
626
- * to add features, then rerun Codama to update it.
627
- *
628
- * @see https://github.com/codama-idl/codama
629
- */
630
-
631
- type JobPosting = {
632
- discriminator: ReadonlyUint8Array;
633
- employer: Address;
634
- title: string;
635
- description: string;
636
- requirements: Array<string>;
637
- budget: bigint;
638
- deadline: bigint;
639
- skillsNeeded: Array<string>;
640
- budgetMin: bigint;
641
- budgetMax: bigint;
642
- paymentToken: Address;
643
- jobType: string;
644
- experienceLevel: string;
645
- isActive: boolean;
646
- applicationsCount: number;
647
- createdAt: bigint;
648
- updatedAt: bigint;
649
- bump: number;
650
- };
651
-
652
- /**
653
- * This code was AUTOGENERATED using the Codama library.
654
- * Please DO NOT EDIT THIS FILE, instead use visitors
655
- * to add features, then rerun Codama to update it.
656
- *
657
- * @see https://github.com/codama-idl/codama
658
- */
659
-
660
- type ServiceListing = {
544
+ type StakingAccount = {
661
545
  discriminator: ReadonlyUint8Array;
662
- agent: Address;
546
+ /** Owner of this staking account (can register multiple agents) */
663
547
  owner: Address;
664
- title: string;
665
- description: string;
666
- price: bigint;
667
- tokenMint: Address;
668
- serviceType: string;
669
- paymentToken: Address;
670
- estimatedDelivery: bigint;
671
- tags: Array<string>;
672
- isActive: boolean;
673
- totalOrders: number;
674
- rating: number;
675
- createdAt: bigint;
676
- updatedAt: bigint;
677
- transferHook: Option<Address>;
548
+ /** Amount of GHOST tokens staked */
549
+ amountStaked: bigint;
550
+ /** Timestamp when staking started */
551
+ stakedAt: bigint;
552
+ /** Lock duration in seconds (minimum 30 days) */
553
+ lockDuration: bigint;
554
+ /** Timestamp when unlock is available */
555
+ unlockAt: bigint;
556
+ /** Reputation boost percentage (in basis points, e.g., 500 = 5%) */
557
+ reputationBoostBps: number;
558
+ /** Whether agent has "Verified" badge */
559
+ hasVerifiedBadge: boolean;
560
+ /** Whether agent has premium listing benefits */
561
+ hasPremiumBenefits: boolean;
562
+ /** Total slashed amount (never recoverable) */
563
+ totalSlashed: bigint;
564
+ /** Current access tier based on stake amount */
565
+ tier: AccessTier;
566
+ /** Daily API calls remaining (resets every 24h) */
567
+ apiCallsRemaining: number;
568
+ /** Last API quota reset timestamp */
569
+ lastQuotaReset: bigint;
570
+ /** Voting power for governance (equals amount_staked) */
571
+ votingPower: bigint;
572
+ /** Bump for PDA */
678
573
  bump: number;
679
574
  };
680
575
 
@@ -686,22 +581,20 @@ type ServiceListing = {
686
581
  * @see https://github.com/codama-idl/codama
687
582
  */
688
583
 
689
- type ServicePurchase = {
584
+ type StakingConfig = {
690
585
  discriminator: ReadonlyUint8Array;
691
- customer: Address;
692
- agent: Address;
693
- listing: Address;
694
- listingId: bigint;
695
- quantity: number;
696
- requirements: Array<string>;
697
- customInstructions: string;
698
- deadline: bigint;
699
- paymentAmount: bigint;
700
- paymentToken: Address;
701
- status: PurchaseStatus;
702
- purchasedAt: bigint;
703
- updatedAt: bigint;
704
- transferHookApplied: boolean;
586
+ /** Authority who can update staking parameters */
587
+ authority: Address;
588
+ /** Minimum stake amount (1,000 GHOST) */
589
+ minStake: bigint;
590
+ /** Minimum lock duration (30 days in seconds) */
591
+ minLockDuration: bigint;
592
+ /** Slash percentage for fraud (50% = 5000 bps) */
593
+ fraudSlashBps: number;
594
+ /** Slash percentage for dispute loss (10% = 1000 bps) */
595
+ disputeSlashBps: number;
596
+ /** Treasury account for slashed tokens */
597
+ treasury: Address;
705
598
  bump: number;
706
599
  };
707
600
 
@@ -713,7 +606,7 @@ type ServicePurchase = {
713
606
  * @see https://github.com/codama-idl/codama
714
607
  */
715
608
 
716
- declare const GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS: Address<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">;
609
+ declare const GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS: Address<"4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB">;
717
610
 
718
611
  /**
719
612
  * This code was AUTOGENERATED using the Codama library.
@@ -723,320 +616,200 @@ declare const GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS: Address<"GpvFxus2eecFKcqa2
723
616
  * @see https://github.com/codama-idl/codama
724
617
  */
725
618
 
726
- type AcceptJobApplicationInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountJobContract extends string | AccountMeta<string> = string, TAccountJobPosting extends string | AccountMeta<string> = string, TAccountJobApplication extends string | AccountMeta<string> = string, TAccountEmployer extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
727
- TAccountJobContract extends string ? WritableAccount<TAccountJobContract> : TAccountJobContract,
728
- TAccountJobPosting extends string ? WritableAccount<TAccountJobPosting> : TAccountJobPosting,
729
- TAccountJobApplication extends string ? WritableAccount<TAccountJobApplication> : TAccountJobApplication,
730
- TAccountEmployer extends string ? WritableSignerAccount<TAccountEmployer> & AccountSignerMeta<TAccountEmployer> : TAccountEmployer,
619
+ type InitializeGovernanceProposalInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountProposal extends string | AccountMeta<string> = string, TAccountProposer extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
620
+ TAccountProposal extends string ? WritableAccount<TAccountProposal> : TAccountProposal,
621
+ TAccountProposer extends string ? WritableSignerAccount<TAccountProposer> & AccountSignerMeta<TAccountProposer> : TAccountProposer,
731
622
  TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
732
623
  ...TRemainingAccounts
733
624
  ]>;
734
625
 
735
626
  /**
736
- * This code was AUTOGENERATED using the Codama library.
737
- * Please DO NOT EDIT THIS FILE, instead use visitors
738
- * to add features, then rerun Codama to update it.
627
+ * PayAI Integration Types
739
628
  *
740
- * @see https://github.com/codama-idl/codama
741
- */
742
-
743
- type ApplyToJobInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountJobApplication extends string | AccountMeta<string> = string, TAccountJobPosting extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountAgentOwner extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
744
- TAccountJobApplication extends string ? WritableAccount<TAccountJobApplication> : TAccountJobApplication,
745
- TAccountJobPosting extends string ? WritableAccount<TAccountJobPosting> : TAccountJobPosting,
746
- TAccountAgent extends string ? ReadonlyAccount<TAccountAgent> : TAccountAgent,
747
- TAccountAgentOwner extends string ? WritableSignerAccount<TAccountAgentOwner> & AccountSignerMeta<TAccountAgentOwner> : TAccountAgentOwner,
748
- TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
749
- ...TRemainingAccounts
750
- ]>;
751
-
752
- /**
753
- * This code was AUTOGENERATED using the Codama library.
754
- * Please DO NOT EDIT THIS FILE, instead use visitors
755
- * to add features, then rerun Codama to update it.
629
+ * Type definitions for PayAI x402 facilitator integration,
630
+ * including webhook payloads and client configuration.
756
631
  *
757
- * @see https://github.com/codama-idl/codama
632
+ * @module payai/types
633
+ * @see https://docs.payai.network/x402/introduction
758
634
  */
759
635
 
760
- type ApproveExtensionInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountExtension 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<[
761
- TAccountExtension extends string ? WritableAccount<TAccountExtension> : TAccountExtension,
762
- TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
763
- TAccountClock extends string ? ReadonlyAccount<TAccountClock> : TAccountClock,
764
- ...TRemainingAccounts
765
- ]>;
766
-
767
636
  /**
768
- * This code was AUTOGENERATED using the Codama library.
769
- * Please DO NOT EDIT THIS FILE, instead use visitors
770
- * to add features, then rerun Codama to update it.
771
- *
772
- * @see https://github.com/codama-idl/codama
637
+ * PayAI supported networks
773
638
  */
774
-
775
- type CastVoteInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountProposal extends string | AccountMeta<string> = string, TAccountVoter extends string | AccountMeta<string> = string, TAccountVoterTokenAccount extends string | AccountMeta<string> = string, TAccountDelegateTokenAccount extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
776
- TAccountProposal extends string ? WritableAccount<TAccountProposal> : TAccountProposal,
777
- TAccountVoter extends string ? WritableSignerAccount<TAccountVoter> & AccountSignerMeta<TAccountVoter> : TAccountVoter,
778
- TAccountVoterTokenAccount extends string ? ReadonlyAccount<TAccountVoterTokenAccount> : TAccountVoterTokenAccount,
779
- TAccountDelegateTokenAccount extends string ? ReadonlyAccount<TAccountDelegateTokenAccount> : TAccountDelegateTokenAccount,
780
- ...TRemainingAccounts
781
- ]>;
782
-
639
+ type PayAINetwork = 'solana' | 'base' | 'ethereum' | 'polygon' | 'arbitrum';
783
640
  /**
784
- * This code was AUTOGENERATED using the Codama library.
785
- * Please DO NOT EDIT THIS FILE, instead use visitors
786
- * to add features, then rerun Codama to update it.
787
- *
788
- * @see https://github.com/codama-idl/codama
641
+ * PayAI client configuration
789
642
  */
790
-
791
- type CreateJobPostingInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountJobPosting extends string | AccountMeta<string> = string, TAccountEmployer extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
792
- TAccountJobPosting extends string ? WritableAccount<TAccountJobPosting> : TAccountJobPosting,
793
- TAccountEmployer extends string ? WritableSignerAccount<TAccountEmployer> & AccountSignerMeta<TAccountEmployer> : TAccountEmployer,
794
- TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
795
- ...TRemainingAccounts
796
- ]>;
797
-
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
+ }
798
661
  /**
799
- * This code was AUTOGENERATED using the Codama library.
800
- * Please DO NOT EDIT THIS FILE, instead use visitors
801
- * to add features, then rerun Codama to update it.
802
- *
803
- * @see https://github.com/codama-idl/codama
804
- */
805
-
806
- type CreateServiceAuctionInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountAuction extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountUserRegistry extends string | AccountMeta<string> = string, TAccountCreator 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<[
807
- TAccountAuction extends string ? WritableAccount<TAccountAuction> : TAccountAuction,
808
- TAccountAgent extends string ? ReadonlyAccount<TAccountAgent> : TAccountAgent,
809
- TAccountUserRegistry extends string ? ReadonlyAccount<TAccountUserRegistry> : TAccountUserRegistry,
810
- TAccountCreator extends string ? WritableSignerAccount<TAccountCreator> & AccountSignerMeta<TAccountCreator> : TAccountCreator,
811
- TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
812
- TAccountClock extends string ? ReadonlyAccount<TAccountClock> : TAccountClock,
813
- ...TRemainingAccounts
814
- ]>;
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
+ }
815
708
 
816
709
  /**
817
- * This code was AUTOGENERATED using the Codama library.
818
- * Please DO NOT EDIT THIS FILE, instead use visitors
819
- * to add features, then rerun Codama to update it.
710
+ * CacheManager - Slot-aware RPC result caching
820
711
  *
821
- * @see https://github.com/codama-idl/codama
822
- */
823
-
824
- type CreateServiceListingInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountServiceListing extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountUserRegistry extends string | AccountMeta<string> = string, TAccountCreator 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<[
825
- TAccountServiceListing extends string ? WritableAccount<TAccountServiceListing> : TAccountServiceListing,
826
- TAccountAgent extends string ? ReadonlyAccount<TAccountAgent> : TAccountAgent,
827
- TAccountUserRegistry extends string ? WritableAccount<TAccountUserRegistry> : TAccountUserRegistry,
828
- TAccountCreator extends string ? WritableSignerAccount<TAccountCreator> & AccountSignerMeta<TAccountCreator> : TAccountCreator,
829
- TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
830
- TAccountClock extends string ? ReadonlyAccount<TAccountClock> : TAccountClock,
831
- ...TRemainingAccounts
832
- ]>;
833
-
834
- /**
835
- * This code was AUTOGENERATED using the Codama library.
836
- * Please DO NOT EDIT THIS FILE, instead use visitors
837
- * to add features, then rerun Codama to update it.
712
+ * Reduces RPC calls by caching account data and PDA derivations
713
+ * with commitment-level aware TTLs.
838
714
  *
839
- * @see https://github.com/codama-idl/codama
715
+ * @module CacheManager
840
716
  */
841
717
 
842
- type CreateToken2022MintInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountAuthority extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountMint extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TAccountRent extends string | AccountMeta<string> = "SysvarRent111111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
843
- TAccountAuthority extends string ? WritableSignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
844
- TAccountAgent extends string ? ReadonlyAccount<TAccountAgent> : TAccountAgent,
845
- TAccountMint extends string ? WritableSignerAccount<TAccountMint> & AccountSignerMeta<TAccountMint> : TAccountMint,
846
- TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
847
- TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
848
- TAccountRent extends string ? ReadonlyAccount<TAccountRent> : TAccountRent,
849
- ...TRemainingAccounts
850
- ]>;
851
-
852
718
  /**
853
- * This code was AUTOGENERATED using the Codama library.
854
- * Please DO NOT EDIT THIS FILE, instead use visitors
855
- * to add features, then rerun Codama to update it.
856
- *
857
- * @see https://github.com/codama-idl/codama
719
+ * Cache configuration options
858
720
  */
859
-
860
- type DelegateVoteInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountProposal extends string | AccountMeta<string> = string, TAccountDelegator extends string | AccountMeta<string> = string, TAccountDelegate extends string | AccountMeta<string> = string, TAccountDelegatorTokenAccount extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
861
- TAccountProposal extends string ? WritableAccount<TAccountProposal> : TAccountProposal,
862
- TAccountDelegator extends string ? WritableSignerAccount<TAccountDelegator> & AccountSignerMeta<TAccountDelegator> : TAccountDelegator,
863
- TAccountDelegate extends string ? ReadonlyAccount<TAccountDelegate> : TAccountDelegate,
864
- TAccountDelegatorTokenAccount extends string ? ReadonlyAccount<TAccountDelegatorTokenAccount> : TAccountDelegatorTokenAccount,
865
- ...TRemainingAccounts
866
- ]>;
867
-
721
+ interface CacheConfig {
722
+ /** Enable caching (default: false, opt-in) */
723
+ enabled?: boolean;
724
+ /** Maximum cache entries (default: 1000) */
725
+ maxSize?: number;
726
+ /** Custom TTL overrides (milliseconds) */
727
+ ttlOverrides?: {
728
+ processed?: number;
729
+ confirmed?: number;
730
+ finalized?: number;
731
+ };
732
+ }
868
733
  /**
869
- * This code was AUTOGENERATED using the Codama library.
870
- * Please DO NOT EDIT THIS FILE, instead use visitors
871
- * to add features, then rerun Codama to update it.
872
- *
873
- * @see https://github.com/codama-idl/codama
874
- */
875
-
876
- type ExecuteProposalInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountProposal extends string | AccountMeta<string> = string, TAccountExecutor extends string | AccountMeta<string> = string, TAccountTargetProgram extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
877
- TAccountProposal extends string ? WritableAccount<TAccountProposal> : TAccountProposal,
878
- TAccountExecutor extends string ? WritableSignerAccount<TAccountExecutor> & AccountSignerMeta<TAccountExecutor> : TAccountExecutor,
879
- TAccountTargetProgram extends string ? ReadonlyAccount<TAccountTargetProgram> : TAccountTargetProgram,
880
- ...TRemainingAccounts
881
- ]>;
882
-
883
- /**
884
- * This code was AUTOGENERATED using the Codama library.
885
- * Please DO NOT EDIT THIS FILE, instead use visitors
886
- * to add features, then rerun Codama to update it.
887
- *
888
- * @see https://github.com/codama-idl/codama
889
- */
890
-
891
- type FinalizeAuctionInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountAuction 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<[
892
- TAccountAuction extends string ? WritableAccount<TAccountAuction> : TAccountAuction,
893
- TAccountAuthority extends string ? WritableSignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
894
- TAccountClock extends string ? ReadonlyAccount<TAccountClock> : TAccountClock,
895
- ...TRemainingAccounts
896
- ]>;
897
-
898
- /**
899
- * This code was AUTOGENERATED using the Codama library.
900
- * Please DO NOT EDIT THIS FILE, instead use visitors
901
- * to add features, then rerun Codama to update it.
902
- *
903
- * @see https://github.com/codama-idl/codama
904
- */
905
-
906
- type InitializeConfidentialTransferMintInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountAuthority extends string | AccountMeta<string> = string, TAccountMint extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
907
- TAccountAuthority extends string ? WritableSignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
908
- TAccountMint extends string ? WritableAccount<TAccountMint> : TAccountMint,
909
- TAccountAgent extends string ? ReadonlyAccount<TAccountAgent> : TAccountAgent,
910
- TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
911
- ...TRemainingAccounts
912
- ]>;
913
-
914
- /**
915
- * This code was AUTOGENERATED using the Codama library.
916
- * Please DO NOT EDIT THIS FILE, instead use visitors
917
- * to add features, then rerun Codama to update it.
918
- *
919
- * @see https://github.com/codama-idl/codama
920
- */
921
-
922
- type InitializeDefaultAccountStateInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountAuthority extends string | AccountMeta<string> = string, TAccountMint extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
923
- TAccountAuthority extends string ? WritableSignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
924
- TAccountMint extends string ? WritableAccount<TAccountMint> : TAccountMint,
925
- TAccountAgent extends string ? ReadonlyAccount<TAccountAgent> : TAccountAgent,
926
- TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
927
- ...TRemainingAccounts
928
- ]>;
929
-
930
- /**
931
- * This code was AUTOGENERATED using the Codama library.
932
- * Please DO NOT EDIT THIS FILE, instead use visitors
933
- * to add features, then rerun Codama to update it.
934
- *
935
- * @see https://github.com/codama-idl/codama
936
- */
937
-
938
- type InitializeGovernanceProposalInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountProposal extends string | AccountMeta<string> = string, TAccountProposer extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
939
- TAccountProposal extends string ? WritableAccount<TAccountProposal> : TAccountProposal,
940
- TAccountProposer extends string ? WritableSignerAccount<TAccountProposer> & AccountSignerMeta<TAccountProposer> : TAccountProposer,
941
- TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
942
- ...TRemainingAccounts
943
- ]>;
944
-
945
- /**
946
- * This code was AUTOGENERATED using the Codama library.
947
- * Please DO NOT EDIT THIS FILE, instead use visitors
948
- * to add features, then rerun Codama to update it.
949
- *
950
- * @see https://github.com/codama-idl/codama
951
- */
952
-
953
- type InitializeInterestBearingConfigInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountAuthority extends string | AccountMeta<string> = string, TAccountMint extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountRateAuthority extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
954
- TAccountAuthority extends string ? WritableSignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
955
- TAccountMint extends string ? WritableAccount<TAccountMint> : TAccountMint,
956
- TAccountAgent extends string ? ReadonlyAccount<TAccountAgent> : TAccountAgent,
957
- TAccountRateAuthority extends string ? ReadonlyAccount<TAccountRateAuthority> : TAccountRateAuthority,
958
- TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
959
- ...TRemainingAccounts
960
- ]>;
961
-
962
- /**
963
- * This code was AUTOGENERATED using the Codama library.
964
- * Please DO NOT EDIT THIS FILE, instead use visitors
965
- * to add features, then rerun Codama to update it.
966
- *
967
- * @see https://github.com/codama-idl/codama
968
- */
969
-
970
- type InitializeMintCloseAuthorityInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountAuthority extends string | AccountMeta<string> = string, TAccountMint extends string | AccountMeta<string> = string, TAccountAgent extends string | AccountMeta<string> = string, TAccountCloseAuthority extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
971
- TAccountAuthority extends string ? WritableSignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
972
- TAccountMint extends string ? WritableAccount<TAccountMint> : TAccountMint,
973
- TAccountAgent extends string ? ReadonlyAccount<TAccountAgent> : TAccountAgent,
974
- TAccountCloseAuthority extends string ? ReadonlyAccount<TAccountCloseAuthority> : TAccountCloseAuthority,
975
- TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
976
- ...TRemainingAccounts
977
- ]>;
978
-
979
- /**
980
- * This code was AUTOGENERATED using the Codama library.
981
- * Please DO NOT EDIT THIS FILE, instead use visitors
982
- * to add features, then rerun Codama to update it.
983
- *
984
- * @see https://github.com/codama-idl/codama
985
- */
986
-
987
- type PlaceAuctionBidInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountAuction extends string | AccountMeta<string> = string, TAccountUserRegistry extends string | AccountMeta<string> = string, TAccountBidder 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<[
988
- TAccountAuction extends string ? WritableAccount<TAccountAuction> : TAccountAuction,
989
- TAccountUserRegistry extends string ? ReadonlyAccount<TAccountUserRegistry> : TAccountUserRegistry,
990
- TAccountBidder extends string ? WritableSignerAccount<TAccountBidder> & AccountSignerMeta<TAccountBidder> : TAccountBidder,
991
- TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
992
- TAccountClock extends string ? ReadonlyAccount<TAccountClock> : TAccountClock,
993
- ...TRemainingAccounts
994
- ]>;
995
-
996
- /**
997
- * This code was AUTOGENERATED using the Codama library.
998
- * Please DO NOT EDIT THIS FILE, instead use visitors
999
- * to add features, then rerun Codama to update it.
1000
- *
1001
- * @see https://github.com/codama-idl/codama
1002
- */
1003
-
1004
- type PurchaseServiceInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountServicePurchase extends string | AccountMeta<string> = string, TAccountServiceListing extends string | AccountMeta<string> = string, TAccountBuyer extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
1005
- TAccountServicePurchase extends string ? WritableAccount<TAccountServicePurchase> : TAccountServicePurchase,
1006
- TAccountServiceListing extends string ? WritableAccount<TAccountServiceListing> : TAccountServiceListing,
1007
- TAccountBuyer extends string ? WritableSignerAccount<TAccountBuyer> & AccountSignerMeta<TAccountBuyer> : TAccountBuyer,
1008
- TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
1009
- ...TRemainingAccounts
1010
- ]>;
1011
-
1012
- /**
1013
- * This code was AUTOGENERATED using the Codama library.
1014
- * Please DO NOT EDIT THIS FILE, instead use visitors
1015
- * to add features, then rerun Codama to update it.
1016
- *
1017
- * @see https://github.com/codama-idl/codama
1018
- */
1019
-
1020
- type TallyVotesInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountProposal extends string | AccountMeta<string> = string, TAccountAuthority extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
1021
- TAccountProposal extends string ? WritableAccount<TAccountProposal> : TAccountProposal,
1022
- TAccountAuthority extends string ? WritableSignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
1023
- ...TRemainingAccounts
1024
- ]>;
1025
-
1026
- /**
1027
- * This code was AUTOGENERATED using the Codama library.
1028
- * Please DO NOT EDIT THIS FILE, instead use visitors
1029
- * to add features, then rerun Codama to update it.
734
+ * CacheManager handles slot-aware caching for RPC results
1030
735
  *
1031
- * @see https://github.com/codama-idl/codama
1032
- */
1033
-
1034
- type UpdateAgentServiceInstruction<TProgram extends string = typeof GHOSTSPEAK_MARKETPLACE_PROGRAM_ADDRESS, TAccountAgent extends string | AccountMeta<string> = string, TAccountOwner extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
1035
- TAccountAgent extends string ? WritableAccount<TAccountAgent> : TAccountAgent,
1036
- TAccountOwner extends string ? WritableSignerAccount<TAccountOwner> & AccountSignerMeta<TAccountOwner> : TAccountOwner,
1037
- TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
1038
- ...TRemainingAccounts
1039
- ]>;
736
+ * Features:
737
+ * - Commitment-level TTLs (finalized=30s, confirmed=2s, processed=500ms)
738
+ * - Indefinite PDA caching (deterministic addresses)
739
+ * - LRU eviction policy
740
+ * - Opt-in (disabled by default)
741
+ */
742
+ declare class CacheManager {
743
+ private accountCache;
744
+ private pdaCache;
745
+ private config;
746
+ private ttls;
747
+ constructor(config?: CacheConfig);
748
+ /**
749
+ * Check if caching is enabled
750
+ */
751
+ isEnabled(): boolean;
752
+ /**
753
+ * Get cached account data
754
+ *
755
+ * @param address - Account address
756
+ * @param commitment - Commitment level
757
+ * @param currentSlot - Current blockchain slot (for staleness check)
758
+ * @returns Cached data or undefined
759
+ */
760
+ getAccount<T>(address: Address$1, commitment: Commitment$1, currentSlot?: number): T | undefined;
761
+ /**
762
+ * Cache account data
763
+ *
764
+ * @param address - Account address
765
+ * @param data - Account data to cache
766
+ * @param commitment - Commitment level
767
+ * @param slot - Blockchain slot when data was fetched
768
+ */
769
+ setAccount<T>(address: Address$1, data: T, commitment: Commitment$1, slot: number): void;
770
+ /**
771
+ * Get cached PDA
772
+ *
773
+ * PDAs are cached indefinitely as they're deterministic.
774
+ *
775
+ * @param seeds - Serialized seed components
776
+ * @returns Cached PDA or undefined
777
+ */
778
+ getPDA(seeds: string): Address$1 | undefined;
779
+ /**
780
+ * Cache PDA derivation
781
+ *
782
+ * @param seeds - Serialized seed components (use JSON.stringify for consistency)
783
+ * @param pda - Derived PDA address
784
+ */
785
+ setPDA(seeds: string, pda: Address$1): void;
786
+ /**
787
+ * Invalidate account cache entry
788
+ *
789
+ * @param address - Account address to invalidate
790
+ * @param commitment - Optional commitment level (invalidates all if not specified)
791
+ */
792
+ invalidateAccount(address: Address$1, commitment?: Commitment$1): void;
793
+ /**
794
+ * Clear all caches
795
+ */
796
+ clear(): void;
797
+ /**
798
+ * Get cache statistics
799
+ *
800
+ * @returns Cache size and hit/miss stats
801
+ */
802
+ getStats(): {
803
+ accountCache: {
804
+ size: number;
805
+ max: number;
806
+ };
807
+ pdaCache: {
808
+ size: number;
809
+ max: number;
810
+ };
811
+ };
812
+ }
1040
813
 
1041
814
  /**
1042
815
  * IPFS configuration and types for GhostSpeak SDK
@@ -1086,6 +859,282 @@ interface IPFSConfig {
1086
859
  cacheTTL?: number;
1087
860
  }
1088
861
 
862
+ /**
863
+ * Reputation Tags System
864
+ *
865
+ * Granular tagging system for agent reputation with confidence scoring.
866
+ * Tags are automatically assigned based on metrics and evidence strength.
867
+ *
868
+ * Three tag categories:
869
+ * - Skill Tags: Technical capabilities and domain expertise
870
+ * - Behavior Tags: Service quality patterns and reliability
871
+ * - Compliance Tags: Regulatory and security compliance status
872
+ */
873
+ /**
874
+ * Tag confidence score (basis points)
875
+ * 0-10000 where 10000 = 100% confidence
876
+ */
877
+ interface TagScore {
878
+ /** Tag identifier (e.g., "fast-responder", "defi-expert") */
879
+ tagName: string;
880
+ /** Confidence level in basis points (0-10000) */
881
+ confidence: number;
882
+ /** Number of supporting data points */
883
+ evidenceCount: number;
884
+ /** Timestamp when tag was last updated */
885
+ lastUpdated: number;
886
+ }
887
+ /**
888
+ * Tag categories for organization
889
+ */
890
+ declare enum TagCategory {
891
+ Skill = "skill",
892
+ Behavior = "behavior",
893
+ Compliance = "compliance"
894
+ }
895
+ /**
896
+ * Reputation metrics for tag evaluation
897
+ */
898
+ interface ReputationMetrics {
899
+ successfulPayments: bigint;
900
+ failedPayments: bigint;
901
+ totalResponseTime: bigint;
902
+ responseTimeCount: bigint;
903
+ totalDisputes: number;
904
+ disputesResolved: number;
905
+ totalRating: number;
906
+ totalRatingsCount: number;
907
+ createdAt: number;
908
+ updatedAt: number;
909
+ avgResponseTime: number;
910
+ successRate: number;
911
+ avgRating: number;
912
+ disputeResolutionRate: number;
913
+ }
914
+ /**
915
+ * Tag filtering options
916
+ */
917
+ interface TagFilters {
918
+ /** Filter by category */
919
+ category?: TagCategory;
920
+ /** Minimum confidence threshold */
921
+ minConfidence?: number;
922
+ /** Maximum age in seconds */
923
+ maxAge?: number;
924
+ /** Include only active tags */
925
+ activeOnly?: boolean;
926
+ }
927
+ /**
928
+ * Tag query result
929
+ */
930
+ interface TagQueryResult {
931
+ /** All tags */
932
+ allTags: string[];
933
+ /** Skill tags */
934
+ skillTags: string[];
935
+ /** Behavior tags */
936
+ behaviorTags: string[];
937
+ /** Compliance tags */
938
+ complianceTags: string[];
939
+ /** Tag scores */
940
+ tagScores: TagScore[];
941
+ /** Last updated timestamp */
942
+ lastUpdated: number;
943
+ }
944
+
945
+ /**
946
+ * Privacy mode for reputation display
947
+ *
948
+ * Determines how much reputation information is publicly visible.
949
+ */
950
+ declare enum PrivacyMode {
951
+ /** Full disclosure - all reputation data is public */
952
+ Public = "Public",
953
+ /** Show only reputation tier (Bronze/Silver/Gold/Platinum) */
954
+ TierOnly = "TierOnly",
955
+ /** Show score range bucket (e.g., 750-850) */
956
+ RangeOnly = "RangeOnly",
957
+ /** Custom selective disclosure */
958
+ Custom = "Custom",
959
+ /** Fully confidential - ZK proofs required */
960
+ Confidential = "Confidential"
961
+ }
962
+ /**
963
+ * Visibility level for individual metrics
964
+ */
965
+ declare enum VisibilityLevel {
966
+ /** Visible to everyone */
967
+ Public = "Public",
968
+ /** Visible only to authorized viewers */
969
+ Private = "Private",
970
+ /** Visible only with ZK proof */
971
+ ZKProof = "ZKProof"
972
+ }
973
+ /**
974
+ * Reputation tier levels (for tier-only privacy mode)
975
+ */
976
+ declare enum ReputationTier$1 {
977
+ None = "None",
978
+ Bronze = "Bronze",
979
+ Silver = "Silver",
980
+ Gold = "Gold",
981
+ Platinum = "Platinum"
982
+ }
983
+ /**
984
+ * Score range buckets (for range-only privacy mode)
985
+ */
986
+ declare enum ScoreRange {
987
+ VeryLow = "VeryLow",// 0-2000
988
+ Low = "Low",// 2000-5000
989
+ Medium = "Medium",// 5000-7500
990
+ High = "High",// 7500-9000
991
+ VeryHigh = "VeryHigh"
992
+ }
993
+ /**
994
+ * Selective disclosure settings for individual metrics
995
+ */
996
+ interface MetricVisibility {
997
+ /** Show exact Ghost Score */
998
+ showScore: VisibilityLevel;
999
+ /** Show total jobs completed */
1000
+ showJobsCompleted: VisibilityLevel;
1001
+ /** Show success rate percentage */
1002
+ showSuccessRate: VisibilityLevel;
1003
+ /** Show average response time */
1004
+ showResponseTime: VisibilityLevel;
1005
+ /** Show dispute statistics */
1006
+ showDisputes: VisibilityLevel;
1007
+ /** Show earnings/payment data */
1008
+ showEarnings: VisibilityLevel;
1009
+ /** Show client ratings */
1010
+ showRatings: VisibilityLevel;
1011
+ /** Show badges earned */
1012
+ showBadges: VisibilityLevel;
1013
+ }
1014
+ /**
1015
+ * Privacy settings for an agent's reputation
1016
+ */
1017
+ interface PrivacySettings {
1018
+ /** Agent public key */
1019
+ agent: Address$1;
1020
+ /** Current privacy mode */
1021
+ mode: PrivacyMode;
1022
+ /** Metric-specific visibility settings */
1023
+ metricVisibility: MetricVisibility;
1024
+ /** List of addresses with viewing permission */
1025
+ authorizedViewers: Address$1[];
1026
+ /** Auto-grant access to clients who pay */
1027
+ autoGrantClients: boolean;
1028
+ /** Last updated timestamp */
1029
+ updatedAt: number;
1030
+ }
1031
+ /**
1032
+ * Privacy preset configurations
1033
+ */
1034
+ interface PrivacyPreset {
1035
+ /** Preset name */
1036
+ name: string;
1037
+ /** Privacy mode */
1038
+ mode: PrivacyMode;
1039
+ /** Metric visibility settings */
1040
+ metricVisibility: MetricVisibility;
1041
+ /** Auto-grant to clients */
1042
+ autoGrantClients: boolean;
1043
+ }
1044
+ /**
1045
+ * Visible reputation data (filtered by privacy settings)
1046
+ *
1047
+ * This is the client-side type returned when fetching reputation
1048
+ * with privacy filters applied.
1049
+ */
1050
+ interface VisibleReputation {
1051
+ /** Agent public key */
1052
+ agent: Address$1;
1053
+ /** Privacy mode applied */
1054
+ privacyMode: PrivacyMode;
1055
+ /** Exact score (only if visible) */
1056
+ exactScore?: number;
1057
+ /** Reputation tier (always visible in TierOnly mode) */
1058
+ tier?: ReputationTier$1;
1059
+ /** Score range (visible in RangeOnly mode) */
1060
+ scoreRange?: ScoreRange;
1061
+ /** Total jobs completed (if visible) */
1062
+ totalJobsCompleted?: number;
1063
+ /** Success rate percentage (if visible) */
1064
+ successRate?: number;
1065
+ /** Average response time in ms (if visible) */
1066
+ avgResponseTime?: number;
1067
+ /** Dispute statistics (if visible) */
1068
+ disputes?: {
1069
+ total: number;
1070
+ resolved: number;
1071
+ };
1072
+ /** Total earnings (if visible) */
1073
+ totalEarnings?: number;
1074
+ /** Average rating (if visible) */
1075
+ avgRating?: number;
1076
+ /** Badges earned (if visible) */
1077
+ badges?: string[];
1078
+ /** Whether viewer has full access */
1079
+ hasFullAccess: boolean;
1080
+ }
1081
+ /**
1082
+ * Parameters for initializing privacy settings
1083
+ */
1084
+ interface InitializePrivacyParams {
1085
+ /** Agent address to enable privacy for */
1086
+ agentAddress: Address$1;
1087
+ /** Initial privacy mode */
1088
+ mode?: PrivacyMode;
1089
+ /** Metric visibility settings */
1090
+ metricVisibility?: MetricVisibility;
1091
+ }
1092
+ /**
1093
+ * Parameters for updating privacy mode
1094
+ */
1095
+ interface UpdatePrivacyModeParams {
1096
+ /** Agent address */
1097
+ agentAddress: Address$1;
1098
+ /** New privacy mode */
1099
+ mode: PrivacyMode;
1100
+ }
1101
+ /**
1102
+ * Parameters for setting metric visibility
1103
+ */
1104
+ interface SetMetricVisibilityParams {
1105
+ /** Agent address */
1106
+ agentAddress: Address$1;
1107
+ /** Metric visibility settings */
1108
+ metricVisibility: MetricVisibility;
1109
+ }
1110
+ /**
1111
+ * Parameters for granting viewer access
1112
+ */
1113
+ interface GrantAccessParams {
1114
+ /** Agent address */
1115
+ agentAddress: Address$1;
1116
+ /** Viewer address to grant access */
1117
+ viewer: Address$1;
1118
+ }
1119
+ /**
1120
+ * Parameters for revoking viewer access
1121
+ */
1122
+ interface RevokeAccessParams {
1123
+ /** Agent address */
1124
+ agentAddress: Address$1;
1125
+ /** Viewer address to revoke access */
1126
+ viewer: Address$1;
1127
+ }
1128
+ /**
1129
+ * Parameters for applying a privacy preset
1130
+ */
1131
+ interface ApplyPresetParams {
1132
+ /** Agent address */
1133
+ agentAddress: Address$1;
1134
+ /** Preset to apply */
1135
+ preset: PrivacyPreset;
1136
+ }
1137
+
1089
1138
  /**
1090
1139
  * Comprehensive Type System for GhostSpeak SDK
1091
1140
  *
@@ -1256,12 +1305,21 @@ interface GhostSpeakConfig {
1256
1305
  cluster?: 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet';
1257
1306
  rpcEndpoint?: string;
1258
1307
  wsEndpoint?: string;
1308
+ /** Optional logger for debug output */
1309
+ logger?: {
1310
+ info: (...args: unknown[]) => void;
1311
+ error: (...args: unknown[]) => void;
1312
+ };
1313
+ /** Cache configuration for RPC result caching */
1314
+ cache?: CacheConfig;
1259
1315
  /** Token 2022 configuration options */
1260
1316
  token2022?: Token2022Config;
1261
1317
  /** IPFS configuration for large content storage */
1262
1318
  ipfsConfig?: IPFSConfig;
1263
1319
  /** Credential configuration for Crossmint sync */
1264
1320
  credentials?: CredentialConfig;
1321
+ /** PayAI configuration */
1322
+ payai?: Partial<PayAIClientConfig>;
1265
1323
  }
1266
1324
  interface CredentialConfig {
1267
1325
  crossmintApiKey?: string;
@@ -1480,6 +1538,11 @@ type IInstruction = Instruction;
1480
1538
  declare abstract class BaseModule {
1481
1539
  protected builder: InstructionBuilder;
1482
1540
  protected config: GhostSpeakConfig;
1541
+ protected logger?: {
1542
+ info: (...args: unknown[]) => void;
1543
+ error: (...args: unknown[]) => void;
1544
+ };
1545
+ protected cacheManager: CacheManager;
1483
1546
  private _debugMode;
1484
1547
  constructor(config: GhostSpeakConfig);
1485
1548
  /**
@@ -1523,11 +1586,11 @@ declare abstract class BaseModule {
1523
1586
  */
1524
1587
  analyze(instructionName: string, instructionGetter: () => Promise<IInstruction> | IInstruction): Promise<unknown>;
1525
1588
  /**
1526
- * Get decoded account
1589
+ * Get decoded account (with optional caching)
1527
1590
  */
1528
1591
  protected getAccount<T>(address: Address$1, decoderImportName: string): Promise<T | null>;
1529
1592
  /**
1530
- * Get multiple decoded accounts
1593
+ * Get multiple decoded accounts (with optional caching)
1531
1594
  */
1532
1595
  protected getAccounts<T>(addresses: Address$1[], decoderImportName: string): Promise<(T | null)[]>;
1533
1596
  /**
@@ -1561,408 +1624,188 @@ declare abstract class BaseModule {
1561
1624
  * Get commitment level (public accessor)
1562
1625
  */
1563
1626
  getCommitment(): Commitment;
1564
- }
1565
-
1566
- interface Token2022MintData {
1567
- mintAuthority: Address$1 | null;
1568
- supply: bigint;
1569
- decimals: number;
1570
- isInitialized: boolean;
1571
- freezeAuthority: Address$1 | null;
1572
- extensions?: Extension[];
1573
- }
1574
- interface Extension {
1575
- extensionType: string;
1576
- data: Uint8Array;
1577
- }
1578
- /**
1579
- * Token-2022 management module
1580
- *
1581
- * Provides high-level access to Token-2022 operations including:
1582
- * - Mint creation with extensions
1583
- * - Transfer fee configuration
1584
- * - Confidential transfer setup
1585
- * - Interest bearing configuration
1586
- * - Default account state management
1587
- */
1588
- declare class Token2022Module extends BaseModule {
1589
- /**
1590
- * Get create Token-2022 mint instruction
1591
- */
1592
- getCreateToken2022MintInstruction(params: {
1593
- authority: TransactionSigner;
1594
- agent?: Address$1;
1595
- mint: TransactionSigner;
1596
- decimals: number;
1597
- freezeAuthority: Address$1 | null;
1598
- enableTransferFee: boolean;
1599
- enableConfidentialTransfers: boolean;
1600
- enableInterestBearing: boolean;
1601
- transferFeeBasisPoints?: number | null;
1602
- maximumFee?: bigint | null;
1603
- transferFeeAuthority?: Address$1 | null;
1604
- withdrawWithheldAuthority?: Address$1 | null;
1605
- autoApproveNewAccounts?: boolean | null;
1606
- auditorElgamalPubkey?: ReadonlyUint8Array | null;
1607
- interestRate?: number | null;
1608
- rateAuthority?: Address$1 | null;
1609
- closeAuthority?: Address$1 | null;
1610
- defaultAccountState?: AccountState | null;
1611
- }): Promise<CreateToken2022MintInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, string, string, []>>;
1612
- /**
1613
- * Get initialize confidential transfer mint instruction
1614
- */
1615
- getInitializeConfidentialTransferMintInstruction(params: {
1616
- authority: TransactionSigner;
1617
- mint: Address$1;
1618
- autoApproveNewAccounts: boolean;
1619
- auditorElgamalPubkey: ReadonlyUint8Array | null;
1620
- }): Promise<InitializeConfidentialTransferMintInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, []>>;
1621
- /**
1622
- * Get initialize interest bearing config instruction
1623
- */
1624
- getInitializeInterestBearingConfigInstruction(params: {
1625
- mint: Address$1;
1626
- authority: TransactionSigner;
1627
- rate: number;
1628
- rateAuthority: Address$1;
1629
- }): Promise<InitializeInterestBearingConfigInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, string, []>>;
1630
- /**
1631
- * Get initialize mint close authority instruction
1632
- */
1633
- getInitializeMintCloseAuthorityInstruction(params: {
1634
- mint: Address$1;
1635
- authority: TransactionSigner;
1636
- closeAuthority: Address$1;
1637
- }): Promise<InitializeMintCloseAuthorityInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, string, []>>;
1638
- /**
1639
- * Get initialize default account state instruction
1640
- */
1641
- getInitializeDefaultAccountStateInstruction(params: {
1642
- mint: Address$1;
1643
- authority: TransactionSigner;
1644
- state: AccountState;
1645
- }): Promise<InitializeDefaultAccountStateInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, []>>;
1646
- /**
1647
- * Get approve extension instruction
1648
- */
1649
- getApproveExtensionInstruction(params: {
1650
- mint: Address$1;
1651
- authority: TransactionSigner;
1652
- extension: Address$1;
1653
- }): ApproveExtensionInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, []>;
1654
- /**
1655
- * Create a basic Token-2022 mint
1656
- */
1657
- createMint(params: {
1658
- signer: TransactionSigner;
1659
- agentAddress: Address$1;
1660
- decimals: number;
1661
- freezeAuthority?: Address$1;
1662
- }): Promise<string>;
1663
- createMintWithTransferFees(params: {
1664
- signer: TransactionSigner;
1665
- agentAddress: Address$1;
1666
- decimals: number;
1667
- transferFeeBasisPoints: number;
1668
- maxFee: bigint;
1669
- withdrawWithheldAuthority?: Address$1;
1670
- }): Promise<string>;
1671
- createMintWithConfidentialTransfers(params: {
1672
- signer: TransactionSigner;
1673
- agentAddress: Address$1;
1674
- decimals: number;
1675
- auditorElgamalPubkey?: ReadonlyUint8Array;
1676
- autoApproveNewAccounts?: boolean;
1677
- }): Promise<string>;
1678
- createMintWithInterestBearing(params: {
1679
- signer: TransactionSigner;
1680
- agentAddress: Address$1;
1681
- decimals: number;
1682
- interestRate: number;
1683
- rateAuthority?: Address$1;
1684
- }): Promise<string>;
1685
1627
  /**
1686
- * Create a full-featured Token-2022 mint with all extensions
1628
+ * Invalidate cache for specific account
1687
1629
  */
1688
- createAdvancedMint(params: {
1689
- signer: TransactionSigner;
1690
- agentAddress: Address$1;
1691
- decimals: number;
1692
- transferFeeBasisPoints: number;
1693
- maxFee: bigint;
1694
- interestRate: number;
1695
- autoApproveConfidential?: boolean;
1696
- defaultAccountState?: AccountState;
1697
- }): Promise<string>;
1698
- /**
1699
- * Get Token-2022 mint account
1700
- */
1701
- getMint(address: Address$1): Promise<Token2022MintData | null>;
1630
+ invalidateCache(address: Address$1): void;
1702
1631
  /**
1703
- * Get all Token-2022 mints created by this program
1632
+ * Clear all caches
1704
1633
  */
1705
- getAllMints(): Promise<{
1706
- address: Address$1;
1707
- data: Token2022MintData;
1708
- }[]>;
1634
+ clearCache(): void;
1709
1635
  /**
1710
- * Get mints by authority
1636
+ * Get cache statistics
1711
1637
  */
1712
- getMintsByAuthority(authority: Address$1): Promise<{
1713
- address: Address$1;
1714
- data: Token2022MintData;
1715
- }[]>;
1716
- private generateKeypair;
1717
- private executeMultiple;
1638
+ getCacheStats(): {
1639
+ accountCache: {
1640
+ size: number;
1641
+ max: number;
1642
+ };
1643
+ pdaCache: {
1644
+ size: number;
1645
+ max: number;
1646
+ };
1647
+ };
1718
1648
  }
1719
1649
 
1720
1650
  /**
1721
- * Marketplace management module
1722
- *
1723
- * Provides high-level access to marketplace operations including:
1724
- * - Service listings and purchases
1725
- * - Job postings and applications
1726
- * - Service auctions and bidding
1727
- * - Marketplace queries and filtering
1651
+ * Simplified agent management using unified instruction pattern
1728
1652
  */
1729
- declare class MarketplaceModule extends BaseModule {
1653
+ declare class AgentModule extends BaseModule {
1654
+ private ipfsUtils;
1655
+ constructor(config: GhostSpeakConfig & {
1656
+ ipfsConfig?: IPFSConfig;
1657
+ });
1730
1658
  /**
1731
- * Get create service listing instruction
1659
+ * Register a new agent
1732
1660
  */
1733
- getCreateServiceListingInstruction(params: {
1734
- agent: Address$1;
1735
- creator: TransactionSigner;
1736
- title: string;
1737
- description: string;
1738
- price: bigint;
1739
- tokenMint: Address$1;
1740
- serviceType: string;
1741
- paymentToken: Address$1;
1742
- estimatedDelivery: number;
1743
- tags: string[];
1744
- listingId: string;
1745
- }): Promise<CreateServiceListingInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, string, string, []>>;
1746
- /**
1747
- * Get purchase service instruction
1748
- */
1749
- getPurchaseServiceInstruction(params: {
1750
- serviceListing: Address$1;
1751
- servicePurchase: Address$1;
1752
- buyer: TransactionSigner;
1753
- listingId: number;
1754
- quantity: number;
1755
- requirements: string[];
1756
- customInstructions: string;
1757
- deadline: number;
1758
- }): PurchaseServiceInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, []>;
1759
- /**
1760
- * Get create job posting instruction
1761
- */
1762
- getCreateJobPostingInstruction(params: {
1763
- jobPosting?: Address$1;
1764
- employer: TransactionSigner;
1765
- title: string;
1661
+ register(signer: TransactionSigner, params: {
1662
+ agentType: number;
1663
+ name: string;
1766
1664
  description: string;
1767
- requirements: string[];
1768
- budget: number | bigint;
1769
- deadline: number | bigint;
1770
- skillsNeeded: string[];
1771
- budgetMin: number | bigint;
1772
- budgetMax: number | bigint;
1773
- paymentToken: Address$1;
1774
- jobType: string;
1775
- experienceLevel: string;
1776
- }): Promise<CreateJobPostingInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, []>>;
1777
- /**
1778
- * Get apply to job instruction
1779
- */
1780
- getApplyToJobInstruction(params: {
1781
- jobApplication?: Address$1;
1782
- jobPosting: Address$1;
1783
- agent: Address$1;
1784
- agentOwner: TransactionSigner;
1785
- coverLetter: string;
1786
- proposedPrice: number | bigint;
1787
- estimatedDuration: number;
1788
- proposedRate: number | bigint;
1789
- estimatedDelivery: number | bigint;
1790
- portfolioItems: string[];
1791
- }): Promise<ApplyToJobInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, string, []>>;
1792
- /**
1793
- * Get accept job application instruction
1794
- */
1795
- getAcceptJobApplicationInstruction(params: {
1796
- jobContract?: Address$1;
1797
- jobPosting: Address$1;
1798
- jobApplication: Address$1;
1799
- employer: TransactionSigner;
1800
- }): Promise<AcceptJobApplicationInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, string, []>>;
1801
- /**
1802
- * Get create service auction instruction
1803
- */
1804
- getCreateServiceAuctionInstruction(params: {
1805
- auction?: Address$1;
1806
- agent: Address$1;
1807
- userRegistry: Address$1;
1808
- creator: TransactionSigner;
1809
- systemProgram?: Address$1;
1810
- clock?: Address$1;
1811
- auctionType: AuctionType;
1812
- startingPrice: bigint;
1813
- reservePrice: bigint;
1814
- isReserveHidden: boolean;
1815
- currentBid: bigint;
1816
- currentBidder: Address$1 | null;
1817
- auctionEndTime: bigint;
1818
- minimumBidIncrement: bigint;
1819
- totalBids: number;
1820
- dutchConfig: DutchAuctionConfig | null;
1821
- }): Promise<CreateServiceAuctionInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, string, string, []>>;
1822
- /**
1823
- * Get place auction bid instruction
1824
- */
1825
- getPlaceAuctionBidInstruction(params: {
1826
- auction: Address$1;
1827
- userRegistry: Address$1;
1828
- bidder: TransactionSigner;
1829
- systemProgram?: Address$1;
1830
- clock?: Address$1;
1831
- bidAmount: bigint;
1832
- }): PlaceAuctionBidInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, string, []>;
1833
- /**
1834
- * Get finalize auction instruction
1835
- */
1836
- getFinalizeAuctionInstruction(params: {
1837
- auction: Address$1;
1838
- authority: TransactionSigner;
1839
- clock?: Address$1;
1840
- }): FinalizeAuctionInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, []>;
1841
- /**
1842
- * Get update agent service instruction
1843
- */
1844
- getUpdateAgentServiceInstruction(params: {
1845
- agent: Address$1;
1846
- owner: TransactionSigner;
1847
- systemProgram?: Address$1;
1848
- agentPubkey: Address$1;
1849
- serviceEndpoint: string;
1850
- isActive: boolean;
1851
- lastUpdated: bigint;
1852
1665
  metadataUri: string;
1853
- capabilities: string[];
1854
- }): UpdateAgentServiceInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, []>;
1666
+ agentId: string;
1667
+ pricingModel?: PricingModel;
1668
+ skipSimulation?: boolean;
1669
+ }): Promise<string>;
1855
1670
  /**
1856
- * Execute create service listing with convenience wrapper
1671
+ * Register a compressed agent (5000x cheaper)
1857
1672
  */
1858
- createServiceListing(params: {
1859
- signer: TransactionSigner;
1860
- agentAddress: Address$1;
1861
- title: string;
1673
+ registerCompressed(signer: TransactionSigner, params: {
1674
+ agentType: number;
1675
+ name: string;
1862
1676
  description: string;
1863
- pricePerHour: bigint;
1864
- category: string;
1865
- capabilities: string[];
1677
+ metadataUri: string;
1678
+ agentId: string;
1679
+ merkleTree: Address$1;
1680
+ treeConfig?: Address$1;
1681
+ pricingModel?: PricingModel;
1866
1682
  }): Promise<string>;
1867
1683
  /**
1868
- * Execute create job posting with convenience wrapper
1684
+ * Update agent metadata
1869
1685
  */
1870
- createJobPosting(params: {
1871
- signer: TransactionSigner;
1872
- title: string;
1873
- description: string;
1874
- budget: bigint;
1875
- duration: number;
1876
- requiredSkills: string[];
1877
- category: string;
1686
+ update(signer: TransactionSigner, params: {
1687
+ agentAddress: Address$1;
1688
+ metadataUri: string;
1689
+ agentType: number;
1690
+ agentId: string;
1691
+ name?: string | null;
1692
+ description?: string | null;
1693
+ pricingModel?: PricingModel;
1878
1694
  }): Promise<string>;
1879
1695
  /**
1880
- * Execute create service auction with convenience wrapper
1696
+ * Verify an agent
1881
1697
  */
1882
- createServiceAuction(params: {
1883
- signer: TransactionSigner;
1884
- serviceListingAddress: Address$1;
1885
- startingPrice: bigint;
1886
- reservePrice: bigint;
1887
- duration: number;
1888
- auctionType: 'english' | 'dutch';
1698
+ verify(signer: TransactionSigner, params: {
1699
+ agentAddress: Address$1;
1700
+ agentPubkey: Address$1;
1701
+ serviceEndpoint: string;
1702
+ supportedCapabilities: Array<number | bigint>;
1703
+ verifiedAt: number | bigint;
1889
1704
  }): Promise<string>;
1890
1705
  /**
1891
- * Get service listing account
1706
+ * Deactivate an agent
1892
1707
  */
1893
- getServiceListing(address: Address$1): Promise<ServiceListing | null>;
1708
+ deactivate(signer: TransactionSigner, params: {
1709
+ agentAddress: Address$1;
1710
+ agentId: string;
1711
+ }): Promise<string>;
1894
1712
  /**
1895
- * Get job posting account
1713
+ * Activate an agent
1896
1714
  */
1897
- getJobPosting(address: Address$1): Promise<JobPosting | null>;
1715
+ activate(signer: TransactionSigner, params: {
1716
+ agentAddress: Address$1;
1717
+ agentId: string;
1718
+ }): Promise<string>;
1898
1719
  /**
1899
- * Get job application account
1720
+ * Get agent account
1900
1721
  */
1901
- getJobApplication(address: Address$1): Promise<JobApplication | null>;
1722
+ getAgentAccount(address: Address$1): Promise<Agent$1 | null>;
1902
1723
  /**
1903
- * Get auction account
1724
+ * Get all agents
1904
1725
  */
1905
- getAuction(address: Address$1): Promise<AuctionMarketplace | null>;
1726
+ getAllAgents(): Promise<{
1727
+ address: Address$1;
1728
+ data: Agent$1;
1729
+ }[]>;
1906
1730
  /**
1907
- * Get service purchase account
1731
+ * Get agents by type
1908
1732
  */
1909
- getServicePurchase(address: Address$1): Promise<ServicePurchase | null>;
1910
- /**
1911
- * Get all service listings
1912
- */
1913
- getAllServiceListings(): Promise<{
1914
- address: Address$1;
1915
- data: ServiceListing;
1916
- }[]>;
1917
- /**
1918
- * Get service listings by provider
1919
- */
1920
- getServiceListingsByProvider(provider: Address$1): Promise<{
1921
- address: Address$1;
1922
- data: ServiceListing;
1923
- }[]>;
1924
- /**
1925
- * Get all job postings
1926
- */
1927
- getAllJobPostings(): Promise<{
1733
+ getAgentsByType(agentType: number): Promise<{
1928
1734
  address: Address$1;
1929
- data: JobPosting;
1735
+ data: Agent$1;
1930
1736
  }[]>;
1931
1737
  /**
1932
- * Get job postings by client
1738
+ * Get user's agents
1933
1739
  */
1934
- getJobPostingsByClient(client: Address$1): Promise<{
1740
+ getUserAgents(authority: Address$1): Promise<{
1935
1741
  address: Address$1;
1936
- data: JobPosting;
1742
+ data: Agent$1;
1937
1743
  }[]>;
1938
1744
  /**
1939
- * Get applications for a job posting
1745
+ * Batch get multiple agent accounts
1746
+ *
1747
+ * Uses efficient batching (100 accounts per RPC call) with optional caching.
1748
+ *
1749
+ * @param addresses - Agent addresses to fetch
1750
+ * @param onProgress - Optional progress callback
1751
+ * @returns Array of agent accounts (null for non-existent)
1752
+ *
1753
+ * @example
1754
+ * ```typescript
1755
+ * const agents = await client.agents.batchGetAgents(
1756
+ * ['agent1...', 'agent2...', 'agent3...'],
1757
+ * (completed, total) => console.log(`${completed}/${total}`)
1758
+ * )
1759
+ * ```
1940
1760
  */
1941
- getJobApplications(jobPostingAddress: Address$1): Promise<{
1942
- address: Address$1;
1943
- data: JobApplication;
1944
- }[]>;
1761
+ batchGetAgents(addresses: Address$1[], onProgress?: (completed: number, total: number) => void): Promise<(Agent$1 | null)[]>;
1945
1762
  /**
1946
- * Get all auctions
1763
+ * Batch get only existing agent accounts
1764
+ *
1765
+ * Filters out non-existent addresses.
1766
+ *
1767
+ * @param addresses - Agent addresses to fetch
1768
+ * @param onProgress - Optional progress callback
1769
+ * @returns Array of existing agents with their addresses
1770
+ *
1771
+ * @example
1772
+ * ```typescript
1773
+ * const existingAgents = await client.agents.batchGetExistingAgents(['addr1', 'addr2'])
1774
+ * // Returns: [{ address: 'addr1', account: Agent }, ...]
1775
+ * ```
1947
1776
  */
1948
- getAllAuctions(): Promise<{
1777
+ batchGetExistingAgents(addresses: Address$1[], onProgress?: (completed: number, total: number) => void): Promise<Array<{
1949
1778
  address: Address$1;
1950
- data: AuctionMarketplace;
1951
- }[]>;
1952
- /**
1953
- * Get service listing by ID (alias for getServiceListing)
1954
- */
1955
- getServiceById(address: Address$1): Promise<ServiceListing | null>;
1779
+ account: Agent$1;
1780
+ }>>;
1956
1781
  /**
1957
- * Execute purchase service with convenience wrapper
1958
- */
1959
- purchase(signer: TransactionSigner, params: {
1960
- listingId: string;
1961
- amount: bigint;
1962
- }): Promise<string>;
1963
- private deriveJobPostingPda;
1964
- private deriveAuctionPda;
1965
- private get nativeMint();
1782
+ * Batch get and map agents to a simplified format
1783
+ *
1784
+ * Useful for creating agent summaries or lists.
1785
+ *
1786
+ * @param addresses - Agent addresses to fetch
1787
+ * @param mapper - Transform function
1788
+ * @returns Array of mapped results
1789
+ *
1790
+ * @example
1791
+ * ```typescript
1792
+ * const summaries = await client.agents.batchGetAndMapAgents(
1793
+ * addresses,
1794
+ * (agent, address) => agent ? {
1795
+ * address,
1796
+ * name: agent.name,
1797
+ * type: agent.agentType,
1798
+ * active: agent.isActive
1799
+ * } : null
1800
+ * )
1801
+ * ```
1802
+ */
1803
+ batchGetAndMapAgents<R>(addresses: Address$1[], mapper: (agent: Agent$1 | null, address: Address$1, index: number) => R): Promise<R[]>;
1804
+ private deriveAgentPda;
1805
+ private deriveUserRegistryPda;
1806
+ private deriveTreeConfigPda;
1807
+ private get systemProgramId();
1808
+ private get compressionProgramId();
1966
1809
  }
1967
1810
 
1968
1811
  /**
@@ -1970,9 +1813,8 @@ declare class MarketplaceModule extends BaseModule {
1970
1813
  *
1971
1814
  * Provides high-level access to governance operations including:
1972
1815
  * - Proposal creation and management
1973
- * - Voting and delegation
1974
- * - Proposal execution
1975
- * - Vote tallying and results
1816
+ *
1817
+ * NOTE: Voting, delegation, and execution are handled through protocol_config + multisig
1976
1818
  */
1977
1819
  declare class GovernanceModule extends BaseModule {
1978
1820
  /**
@@ -1986,45 +1828,7 @@ declare class GovernanceModule extends BaseModule {
1986
1828
  proposalType: any;
1987
1829
  executionParams: any;
1988
1830
  proposalId: number | bigint;
1989
- }): Promise<InitializeGovernanceProposalInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, []>>;
1990
- /**
1991
- * Get cast vote instruction
1992
- */
1993
- getCastVoteInstruction(params: {
1994
- proposal: Address$1;
1995
- voter: TransactionSigner;
1996
- voterTokenAccount: Address$1;
1997
- delegateTokenAccount?: Address$1;
1998
- voteChoice: VoteChoice;
1999
- reasoning: string | null;
2000
- }): CastVoteInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, []>;
2001
- /**
2002
- * Get delegate vote instruction
2003
- */
2004
- getDelegateVoteInstruction(params: {
2005
- proposal?: Address$1;
2006
- delegator: TransactionSigner;
2007
- delegate: Address$1;
2008
- delegatorTokenAccount: Address$1;
2009
- proposalId: number | bigint;
2010
- scope: any;
2011
- expiresAt: number | bigint | null;
2012
- }): DelegateVoteInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, string, []>;
2013
- /**
2014
- * Get execute proposal instruction
2015
- */
2016
- getExecuteProposalInstruction(params: {
2017
- proposal: Address$1;
2018
- executor: TransactionSigner;
2019
- targetProgram: Address$1;
2020
- }): ExecuteProposalInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, string, []>;
2021
- /**
2022
- * Get tally votes instruction
2023
- */
2024
- getTallyVotesInstruction(params: {
2025
- proposal: Address$1;
2026
- authority: TransactionSigner;
2027
- }): TallyVotesInstruction<Address$1<"GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9">, string, string, []>;
1831
+ }): Promise<InitializeGovernanceProposalInstruction<Address$1<"4wHjA2a5YC4twZb4NQpwZpixo5FgxxzuJUrCG7UnF9pB">, string, string, string, []>>;
2028
1832
  /**
2029
1833
  * Create a new governance proposal
2030
1834
  */
@@ -2036,40 +1840,6 @@ declare class GovernanceModule extends BaseModule {
2036
1840
  votingDuration: number;
2037
1841
  executionDelay?: number;
2038
1842
  }): Promise<string>;
2039
- /**
2040
- * Cast a vote on a proposal
2041
- */
2042
- vote(params: {
2043
- signer: TransactionSigner;
2044
- proposalAddress: Address$1;
2045
- choice: 'yes' | 'no' | 'abstain';
2046
- reasoning?: string;
2047
- tokenAccount: Address$1;
2048
- }): Promise<string>;
2049
- /**
2050
- * Delegate voting power to another address
2051
- */
2052
- delegateVotingPower(params: {
2053
- signer: TransactionSigner;
2054
- delegate: Address$1;
2055
- amount: bigint;
2056
- tokenAccount: Address$1;
2057
- }): Promise<string>;
2058
- /**
2059
- * Execute a passed proposal
2060
- */
2061
- executeProposal(params: {
2062
- signer: TransactionSigner;
2063
- proposalAddress: Address$1;
2064
- proposalId: string;
2065
- }): Promise<string>;
2066
- /**
2067
- * Tally votes for a proposal
2068
- */
2069
- tallyVotes(params: {
2070
- signer: TransactionSigner;
2071
- proposalAddress: Address$1;
2072
- }): Promise<string>;
2073
1843
  /**
2074
1844
  * Get governance proposal account
2075
1845
  */
@@ -2096,14 +1866,13 @@ declare class GovernanceModule extends BaseModule {
2096
1866
  data: GovernanceProposal;
2097
1867
  }[]>;
2098
1868
  private deriveProposalPda;
2099
- private mapVoteChoice;
2100
1869
  }
2101
1870
 
2102
1871
  interface CreateMultisigParams {
2103
1872
  multisigId: bigint;
2104
1873
  threshold: number;
2105
1874
  signers: Address$1[];
2106
- config?: Partial<MultisigConfigArgs>;
1875
+ config?: Partial<MultisigTypeConfigArgs>;
2107
1876
  owner: TransactionSigner;
2108
1877
  }
2109
1878
  interface MultisigProposalParams {
@@ -2115,13 +1884,6 @@ interface MultisigProposalParams {
2115
1884
  proposalId: bigint;
2116
1885
  proposer: TransactionSigner;
2117
1886
  }
2118
- interface ApproveProposalParams {
2119
- proposalAddress: Address$1;
2120
- voter: TransactionSigner;
2121
- voterTokenAccount: Address$1;
2122
- reasoning?: string;
2123
- voteChoice?: VoteChoice;
2124
- }
2125
1887
  interface ExecuteProposalParams {
2126
1888
  proposalAddress: Address$1;
2127
1889
  executor: TransactionSigner;
@@ -2139,11 +1901,7 @@ declare class MultisigModule extends BaseModule {
2139
1901
  */
2140
1902
  createProposal(params: MultisigProposalParams): Promise<string>;
2141
1903
  /**
2142
- * Approve (Vote on) a proposal
2143
- */
2144
- approveProposal(params: ApproveProposalParams): Promise<string>;
2145
- /**
2146
- * Execute a proposal
1904
+ * Execute a proposal (Note: Approval/voting removed, use protocol_config instead)
2147
1905
  */
2148
1906
  executeProposal(params: ExecuteProposalParams): Promise<string>;
2149
1907
  }
@@ -2154,11 +1912,405 @@ interface CrossmintClientOptions {
2154
1912
  chain?: 'base-sepolia' | 'polygon-amoy' | 'ethereum-sepolia' | 'base' | 'polygon' | 'ethereum';
2155
1913
  }
2156
1914
 
1915
+ /**
1916
+ * GhostSpeak DID (Decentralized Identifier) Types
1917
+ *
1918
+ * Implements the did:sol method for Solana-based DIDs following W3C standards.
1919
+ * Based on Identity.com's did:sol specification v3.0.
1920
+ */
1921
+
1922
+ /**
1923
+ * Verification method type for DIDs
1924
+ */
1925
+ declare enum VerificationMethodType {
1926
+ /** Ed25519 verification key (Solana native) */
1927
+ Ed25519VerificationKey2020 = "Ed25519VerificationKey2020",
1928
+ /** X25519 key agreement for encryption */
1929
+ X25519KeyAgreementKey2020 = "X25519KeyAgreementKey2020",
1930
+ /** Secp256k1 verification key (Ethereum compatibility) */
1931
+ EcdsaSecp256k1VerificationKey2019 = "EcdsaSecp256k1VerificationKey2019"
1932
+ }
1933
+ /**
1934
+ * Verification relationship types
1935
+ */
1936
+ declare enum VerificationRelationship {
1937
+ /** Key can authenticate as the DID */
1938
+ Authentication = "authentication",
1939
+ /** Key can assert claims (issue credentials) */
1940
+ AssertionMethod = "assertionMethod",
1941
+ /** Key can perform key agreement (encryption) */
1942
+ KeyAgreement = "keyAgreement",
1943
+ /** Key can invoke capabilities (update DID document) */
1944
+ CapabilityInvocation = "capabilityInvocation",
1945
+ /** Key can delegate capabilities */
1946
+ CapabilityDelegation = "capabilityDelegation"
1947
+ }
1948
+ /**
1949
+ * Service endpoint type
1950
+ */
1951
+ declare enum ServiceEndpointType {
1952
+ /** AI agent service endpoint */
1953
+ AIAgentService = "AIAgentService",
1954
+ /** Messaging service endpoint (DIDComm) */
1955
+ DIDCommMessaging = "DIDCommMessaging",
1956
+ /** Credential repository */
1957
+ CredentialRepository = "CredentialRepository",
1958
+ /** Linked domains verification */
1959
+ LinkedDomains = "LinkedDomains",
1960
+ /** Custom service type */
1961
+ Custom = "Custom"
1962
+ }
1963
+ /**
1964
+ * Verification method for DID document
1965
+ *
1966
+ * Represents a cryptographic key that can be used to verify
1967
+ * signatures or perform other cryptographic operations
1968
+ */
1969
+ interface VerificationMethod {
1970
+ /** Method identifier (e.g., "key-1") */
1971
+ id: string;
1972
+ /** Type of verification method */
1973
+ methodType: VerificationMethodType;
1974
+ /** DID of the controller (usually the DID itself) */
1975
+ controller: string;
1976
+ /** Public key in multibase format (base58btc) */
1977
+ publicKeyMultibase: string;
1978
+ /** Verification relationships this key has */
1979
+ relationships: VerificationRelationship[];
1980
+ /** Creation timestamp */
1981
+ createdAt: number;
1982
+ /** Revoked flag */
1983
+ revoked: boolean;
1984
+ }
1985
+ /**
1986
+ * Service endpoint in DID document
1987
+ */
1988
+ interface ServiceEndpoint {
1989
+ /** Service identifier (e.g., "agent-api") */
1990
+ id: string;
1991
+ /** Type of service */
1992
+ serviceType: ServiceEndpointType;
1993
+ /** Service endpoint URI */
1994
+ serviceEndpoint: string;
1995
+ /** Optional description */
1996
+ description: string;
1997
+ }
1998
+ /**
1999
+ * DID Document - main account for storing decentralized identifiers
2000
+ *
2001
+ * Follows W3C DID Core specification and did:sol method
2002
+ */
2003
+ interface DidDocument {
2004
+ /** The DID string (e.g., "did:sol:devnet:HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH") */
2005
+ did: string;
2006
+ /** Controller of the DID (can update the document) */
2007
+ controller: Address$1;
2008
+ /** Verification methods (public keys) */
2009
+ verificationMethods: VerificationMethod[];
2010
+ /** Service endpoints */
2011
+ serviceEndpoints: ServiceEndpoint[];
2012
+ /** Context URIs (for W3C compatibility) */
2013
+ context: string[];
2014
+ /** Also known as (alternative DIDs) */
2015
+ alsoKnownAs: string[];
2016
+ /** DID document creation timestamp */
2017
+ createdAt: number;
2018
+ /** Last update timestamp */
2019
+ updatedAt: number;
2020
+ /** Version number (incremented on each update) */
2021
+ version: number;
2022
+ /** Deactivated flag */
2023
+ deactivated: boolean;
2024
+ /** Deactivation timestamp (if deactivated) */
2025
+ deactivatedAt?: number;
2026
+ /** PDA bump */
2027
+ bump: number;
2028
+ }
2029
+ /**
2030
+ * W3C DID Document format for export
2031
+ * Compliant with W3C DID Core specification
2032
+ */
2033
+ interface W3CDidDocument {
2034
+ '@context': string[];
2035
+ id: string;
2036
+ controller?: string | string[];
2037
+ verificationMethod: Array<{
2038
+ id: string;
2039
+ type: string;
2040
+ controller: string;
2041
+ publicKeyMultibase: string;
2042
+ }>;
2043
+ authentication?: Array<string | {
2044
+ id: string;
2045
+ type: string;
2046
+ controller: string;
2047
+ publicKeyMultibase: string;
2048
+ }>;
2049
+ assertionMethod?: string[];
2050
+ keyAgreement?: string[];
2051
+ capabilityInvocation?: string[];
2052
+ capabilityDelegation?: string[];
2053
+ service?: Array<{
2054
+ id: string;
2055
+ type: string;
2056
+ serviceEndpoint: string;
2057
+ description?: string;
2058
+ }>;
2059
+ alsoKnownAs?: string[];
2060
+ }
2061
+ /**
2062
+ * Parameters for creating a DID document
2063
+ */
2064
+ interface CreateDidDocumentParams {
2065
+ /** Controller public key */
2066
+ controller: Address$1;
2067
+ /** Initial verification methods */
2068
+ verificationMethods?: VerificationMethod[];
2069
+ /** Initial service endpoints */
2070
+ serviceEndpoints?: ServiceEndpoint[];
2071
+ /** Network (mainnet, devnet, testnet) */
2072
+ network?: 'mainnet' | 'devnet' | 'testnet';
2073
+ }
2074
+ /**
2075
+ * Parameters for updating a DID document
2076
+ */
2077
+ interface UpdateDidDocumentParams {
2078
+ /** DID document address */
2079
+ didDocument: Address$1;
2080
+ /** Verification method to add */
2081
+ addVerificationMethod?: VerificationMethod;
2082
+ /** Verification method ID to remove */
2083
+ removeVerificationMethodId?: string;
2084
+ /** Service endpoint to add */
2085
+ addServiceEndpoint?: ServiceEndpoint;
2086
+ /** Service endpoint ID to remove */
2087
+ removeServiceEndpointId?: string;
2088
+ }
2089
+ /**
2090
+ * Parameters for deactivating a DID document
2091
+ */
2092
+ interface DeactivateDidDocumentParams {
2093
+ /** DID document address */
2094
+ didDocument: Address$1;
2095
+ }
2096
+
2097
+ /**
2098
+ * GhostSpeak DID Helpers
2099
+ *
2100
+ * Utility functions for DID operations, validation, and W3C export
2101
+ */
2102
+
2103
+ /**
2104
+ * Create a default Ed25519 verification method
2105
+ *
2106
+ * @param id - Method identifier (e.g., "key-1")
2107
+ * @param controller - Controller DID
2108
+ * @param publicKey - Public key (Address or base58 string)
2109
+ * @param relationships - Verification relationships
2110
+ * @returns Verification method object
2111
+ */
2112
+ declare function createEd25519VerificationMethod(id: string, controller: string, publicKey: Address$1 | string, relationships?: VerificationRelationship[]): VerificationMethod;
2113
+ /**
2114
+ * Create a service endpoint
2115
+ *
2116
+ * @param id - Service identifier (e.g., "agent-api")
2117
+ * @param serviceType - Type of service
2118
+ * @param serviceEndpoint - Service endpoint URI
2119
+ * @param description - Optional description
2120
+ * @returns Service endpoint object
2121
+ */
2122
+ declare function createServiceEndpoint(id: string, serviceType: string, serviceEndpoint: string, description?: string): ServiceEndpoint;
2123
+
2124
+ /**
2125
+ * GhostSpeak DID Module
2126
+ *
2127
+ * Provides functionality for managing Decentralized Identifiers (DIDs)
2128
+ * following the W3C DID Core specification and did:sol method.
2129
+ */
2130
+
2131
+ /**
2132
+ * DidModule - Manage decentralized identifiers on Solana
2133
+ *
2134
+ * @example
2135
+ * ```typescript
2136
+ * const client = new GhostSpeakClient({ cluster: 'devnet' })
2137
+ * const did = client.did
2138
+ *
2139
+ * // Create a DID
2140
+ * const signature = await did.create(signer, {
2141
+ * controller: signer.address,
2142
+ * network: 'devnet'
2143
+ * })
2144
+ *
2145
+ * // Resolve a DID
2146
+ * const didDoc = await did.resolve(signer.address)
2147
+ *
2148
+ * // Export as W3C format
2149
+ * const w3c = await did.exportW3C(signer.address)
2150
+ * ```
2151
+ */
2152
+ declare class DidModule extends BaseModule {
2153
+ constructor(config: GhostSpeakConfig);
2154
+ /**
2155
+ * Create a new DID document
2156
+ *
2157
+ * @param signer - Transaction signer (will be the controller)
2158
+ * @param params - DID creation parameters
2159
+ * @returns Transaction signature
2160
+ *
2161
+ * @example
2162
+ * ```typescript
2163
+ * const signature = await didModule.create(signer, {
2164
+ * controller: signer.address,
2165
+ * network: 'devnet',
2166
+ * verificationMethods: [{
2167
+ * id: 'key-1',
2168
+ * methodType: VerificationMethodType.Ed25519VerificationKey2020,
2169
+ * controller: 'did:sol:devnet:...',
2170
+ * publicKeyMultibase: 'z...',
2171
+ * relationships: [VerificationRelationship.Authentication],
2172
+ * createdAt: Date.now() / 1000,
2173
+ * revoked: false
2174
+ * }]
2175
+ * })
2176
+ * ```
2177
+ */
2178
+ create(signer: TransactionSigner, params: CreateDidDocumentParams): Promise<string>;
2179
+ /**
2180
+ * Update an existing DID document
2181
+ *
2182
+ * @param signer - Transaction signer (must be the controller)
2183
+ * @param params - Update parameters
2184
+ * @returns Transaction signature
2185
+ *
2186
+ * @example
2187
+ * ```typescript
2188
+ * const signature = await didModule.update(signer, {
2189
+ * didDocument: didPda,
2190
+ * addVerificationMethod: {
2191
+ * id: 'key-2',
2192
+ * methodType: VerificationMethodType.X25519KeyAgreementKey2020,
2193
+ * controller: 'did:sol:devnet:...',
2194
+ * publicKeyMultibase: 'z...',
2195
+ * relationships: [VerificationRelationship.KeyAgreement],
2196
+ * createdAt: Date.now() / 1000,
2197
+ * revoked: false
2198
+ * }
2199
+ * })
2200
+ * ```
2201
+ */
2202
+ update(signer: TransactionSigner, params: UpdateDidDocumentParams): Promise<string>;
2203
+ /**
2204
+ * Deactivate a DID document (irreversible)
2205
+ *
2206
+ * @param signer - Transaction signer (must be the controller)
2207
+ * @param params - Deactivation parameters
2208
+ * @returns Transaction signature
2209
+ *
2210
+ * @example
2211
+ * ```typescript
2212
+ * const signature = await didModule.deactivate(signer, {
2213
+ * didDocument: didPda
2214
+ * })
2215
+ * ```
2216
+ */
2217
+ deactivate(signer: TransactionSigner, params: DeactivateDidDocumentParams): Promise<string>;
2218
+ /**
2219
+ * Resolve a DID document
2220
+ *
2221
+ * @param didOrController - DID string or controller address
2222
+ * @returns DID document or null if not found
2223
+ *
2224
+ * @example
2225
+ * ```typescript
2226
+ * // Resolve by controller address
2227
+ * const didDoc = await didModule.resolve(controllerAddress)
2228
+ *
2229
+ * // Resolve by DID string
2230
+ * const didDoc = await didModule.resolve('did:sol:devnet:5VKz...')
2231
+ * ```
2232
+ */
2233
+ resolve(didOrController: string | Address$1): Promise<DidDocument | null>;
2234
+ /**
2235
+ * Export a DID document as W3C-compliant JSON
2236
+ *
2237
+ * @param didOrController - DID string or controller address
2238
+ * @param pretty - Whether to pretty-print the JSON
2239
+ * @returns W3C DID document JSON string
2240
+ *
2241
+ * @example
2242
+ * ```typescript
2243
+ * const json = await didModule.exportW3C(controllerAddress, true)
2244
+ * console.log(json)
2245
+ * ```
2246
+ */
2247
+ exportW3C(didOrController: string | Address$1, pretty?: boolean): Promise<string | null>;
2248
+ /**
2249
+ * Get W3C DID document object
2250
+ *
2251
+ * @param didOrController - DID string or controller address
2252
+ * @returns W3C DID document object or null
2253
+ */
2254
+ getW3CDocument(didOrController: string | Address$1): Promise<W3CDidDocument | null>;
2255
+ /**
2256
+ * Derive DID document PDA for a controller
2257
+ *
2258
+ * @param controller - Controller address
2259
+ * @returns DID document PDA and bump
2260
+ */
2261
+ deriveDidPda(controller: Address$1): Promise<[Address$1, number]>;
2262
+ /**
2263
+ * Generate a DID string for a controller
2264
+ *
2265
+ * @param controller - Controller address
2266
+ * @param network - Network identifier
2267
+ * @returns DID string
2268
+ */
2269
+ generateDid(controller: Address$1, network?: 'mainnet' | 'devnet' | 'testnet'): string;
2270
+ /**
2271
+ * Validate a DID string
2272
+ *
2273
+ * @param did - DID string to validate
2274
+ * @returns True if valid, throws error if invalid
2275
+ */
2276
+ validateDid(did: string): boolean;
2277
+ /**
2278
+ * Check if a DID is active
2279
+ *
2280
+ * @param didOrController - DID string or controller address
2281
+ * @returns True if active, false if deactivated or not found
2282
+ */
2283
+ isActive(didOrController: string | Address$1): Promise<boolean>;
2284
+ /**
2285
+ * Build create DID instruction manually
2286
+ * Note: This is temporary until DID instructions are generated from IDL
2287
+ */
2288
+ private buildCreateDidInstruction;
2289
+ /**
2290
+ * Build update DID instruction manually
2291
+ * Note: This is temporary until DID instructions are generated from IDL
2292
+ */
2293
+ private buildUpdateDidInstruction;
2294
+ /**
2295
+ * Build deactivate DID instruction manually
2296
+ * Note: This is temporary until DID instructions are generated from IDL
2297
+ */
2298
+ private buildDeactivateDidInstruction;
2299
+ /**
2300
+ * Create an Ed25519 verification method
2301
+ */
2302
+ static createVerificationMethod: typeof createEd25519VerificationMethod;
2303
+ /**
2304
+ * Create a service endpoint
2305
+ */
2306
+ static createServiceEndpoint: typeof createServiceEndpoint;
2307
+ }
2308
+
2157
2309
  /**
2158
2310
  * GhostSpeak Credential Module
2159
2311
  *
2160
2312
  * Provides functionality for creating, signing, and exporting
2161
- * W3C-compatible Verifiable Credentials.
2313
+ * W3C-compatible Verifiable Credentials with DID integration.
2162
2314
  */
2163
2315
 
2164
2316
  interface W3CVerifiableCredential {
@@ -2251,277 +2403,1305 @@ declare class UnifiedCredentialService {
2251
2403
  }
2252
2404
 
2253
2405
  /**
2254
- * Main GhostSpeak client with fluent API design
2255
- *
2256
- * Example usage:
2257
- * ```typescript
2258
- * const ghostspeak = new GhostSpeak()
2406
+ * PayAI x402 Client
2259
2407
  *
2260
- * // Create an agent
2261
- * const agent = await ghostspeak
2262
- * .agent()
2263
- * .create({ name: "My Agent", capabilities: ["coding"] })
2264
- * .compressed()
2265
- * .execute()
2408
+ * Client for making x402 payments through the PayAI facilitator.
2409
+ * Wraps the standard fetch API with automatic payment handling.
2266
2410
  *
2267
- * // Create an escrow
2268
- * const escrow = await ghostspeak
2269
- * .escrow()
2270
- * .between(buyer, seller)
2271
- * .amount(sol(10))
2272
- * .withMilestones([...])
2273
- * .execute()
2274
- * ```
2411
+ * @module payai/PayAIClient
2412
+ * @see https://docs.payai.network/x402/introduction
2275
2413
  */
2276
- declare class GhostSpeakClient {
2277
- private config;
2278
- constructor(config?: Partial<GhostSpeakConfig>);
2279
- /**
2280
- * Agent operations
2281
- */
2282
- agent(): AgentBuilder;
2283
- /**
2284
- * Escrow operations
2285
- */
2286
- escrow(): EscrowBuilder;
2414
+
2415
+ declare class PayAIClient extends EventEmitter {
2416
+ private readonly config;
2417
+ private readonly localRecords;
2418
+ constructor(config: PayAIClientConfig);
2287
2419
  /**
2288
- * Channel operations
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
2289
2425
  */
2290
- channel(): ChannelBuilder;
2426
+ fetch(url: string, init?: RequestInit): Promise<Response>;
2291
2427
  /**
2292
- * Marketplace operations
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
2293
2433
  */
2294
- marketplace(): MarketplaceBuilder;
2434
+ verifyPayment(paymentHeader: string, requirement: PayAIPaymentRequirement): Promise<{
2435
+ valid: boolean;
2436
+ payer?: string;
2437
+ error?: string;
2438
+ }>;
2295
2439
  /**
2296
- * Governance operations
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
2297
2445
  */
2298
- governance(): GovernanceBuilder;
2446
+ settlePayment(paymentHeader: string, requirement: PayAIPaymentRequirement): Promise<{
2447
+ success: boolean;
2448
+ transaction?: string;
2449
+ error?: string;
2450
+ }>;
2299
2451
  /**
2300
- * Multisig operations
2301
- */
2302
- multisig(): MultisigBuilder;
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
+ }>;
2303
2469
  /**
2304
- * Token-2022 operations
2470
+ * Get locally tracked reputation records
2471
+ * (For payments made through this client instance)
2305
2472
  */
2306
- token2022(): Token2022Builder;
2473
+ getLocalReputationRecords(): PayAIReputationRecord[];
2307
2474
  /**
2308
- * Unified Credential operations (Solana + Crossmint)
2475
+ * Clear local reputation records
2309
2476
  */
2310
- credentials(): UnifiedCredentialService;
2477
+ clearLocalReputationRecords(): void;
2311
2478
  /**
2312
- * Enable development mode features
2479
+ * Select the best payment option from requirements
2313
2480
  */
2314
- enableDevMode(): this;
2481
+ private selectPaymentOption;
2315
2482
  /**
2316
- * Configure network
2483
+ * Make payment and retry the original request
2317
2484
  */
2318
- useNetwork(cluster: 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet'): this;
2485
+ private makePaymentAndRetry;
2319
2486
  /**
2320
- * Configure custom RPC
2487
+ * Create a payment header for a requirement
2488
+ * (In production, this would sign a real Solana transaction)
2321
2489
  */
2322
- useRpc(endpoint: string, wsEndpoint?: string): this;
2490
+ private createPaymentHeader;
2323
2491
  /**
2324
- * Get default RPC endpoint for cluster
2492
+ * Fetch with timeout
2325
2493
  */
2326
- private getDefaultRpcEndpoint;
2494
+ private fetchWithTimeout;
2327
2495
  }
2496
+
2328
2497
  /**
2329
- * Agent builder for fluent API
2498
+ * Reputation tier levels
2330
2499
  */
2331
- declare class AgentBuilder {
2332
- private module;
2333
- private params;
2334
- constructor(config: GhostSpeakConfig);
2335
- create(params: {
2336
- name: string;
2337
- description?: string;
2338
- capabilities: string[];
2339
- }): this;
2340
- withDescription(description: string): this;
2341
- withType(agentType: number): this;
2342
- withIPFS(): this;
2343
- compressed(): this;
2344
- debug(): this;
2345
- withSigner(signer: TransactionSigner): this;
2346
- private validateParams;
2347
- getCost(): Promise<bigint>;
2348
- simulate(): Promise<unknown>;
2349
- explain(): Promise<string>;
2350
- execute(): Promise<{
2351
- address: Address$1;
2352
- signature: string;
2353
- }>;
2354
- private deriveAgentAddress;
2500
+ declare enum ReputationTier {
2501
+ None = "None",
2502
+ Bronze = "Bronze",
2503
+ Silver = "Silver",
2504
+ Gold = "Gold",
2505
+ Platinum = "Platinum"
2355
2506
  }
2356
2507
  /**
2357
- * Escrow builder for fluent API
2508
+ * Badge types for reputation achievements
2358
2509
  */
2359
- declare class EscrowBuilder {
2360
- private module;
2361
- private params;
2362
- constructor(config: GhostSpeakConfig);
2363
- between(buyer: Address$1, seller: Address$1): this;
2364
- amount(lamports: bigint): this;
2365
- description(desc: string): this;
2366
- withMilestones(milestones: Array<{
2367
- amount: bigint;
2368
- description: string;
2369
- }>): this;
2370
- debug(): this;
2371
- withSigner(signer: TransactionSigner): this;
2372
- private validateParams;
2373
- getCost(): Promise<bigint>;
2374
- explain(): Promise<string>;
2375
- execute(): Promise<{
2376
- address: Address$1;
2377
- signature: string;
2510
+ declare enum BadgeType {
2511
+ FirstJob = "FirstJob",
2512
+ TenJobs = "TenJobs",
2513
+ HundredJobs = "HundredJobs",
2514
+ ThousandJobs = "ThousandJobs",
2515
+ PerfectRating = "PerfectRating",
2516
+ QuickResponder = "QuickResponder",
2517
+ HighEarner = "HighEarner",
2518
+ DisputeResolver = "DisputeResolver",
2519
+ CategoryExpert = "CategoryExpert",
2520
+ CrossCategoryMaster = "CrossCategoryMaster"
2521
+ }
2522
+ /**
2523
+ * Category-specific reputation data
2524
+ */
2525
+ interface CategoryReputation {
2526
+ /** Category identifier (e.g., "defi", "nft", "gaming") */
2527
+ category: string;
2528
+ /** Current reputation score in this category (basis points) */
2529
+ score: number;
2530
+ /** Total completed jobs in this category */
2531
+ completedJobs: number;
2532
+ /** Average completion time in seconds */
2533
+ avgCompletionTime: number;
2534
+ /** Quality ratings sum */
2535
+ qualitySum: number;
2536
+ /** Number of quality ratings */
2537
+ qualityCount: number;
2538
+ /** Last activity timestamp */
2539
+ lastActivity: number;
2540
+ /** Total earnings in this category */
2541
+ totalEarnings: number;
2542
+ }
2543
+ /**
2544
+ * Job performance data for reputation calculation
2545
+ */
2546
+ interface JobPerformance {
2547
+ /** Whether job was completed successfully */
2548
+ completed: boolean;
2549
+ /** Quality rating (0-100) */
2550
+ qualityRating: number;
2551
+ /** Expected duration in seconds */
2552
+ expectedDuration: number;
2553
+ /** Actual duration in seconds */
2554
+ actualDuration: number;
2555
+ /** Client satisfaction (0-100) */
2556
+ clientSatisfaction: number;
2557
+ /** Whether there was a dispute */
2558
+ hadDispute: boolean;
2559
+ /** Whether dispute was resolved favorably for agent */
2560
+ disputeResolvedFavorably: boolean;
2561
+ /** Job category */
2562
+ category: string;
2563
+ /** Payment amount */
2564
+ paymentAmount: number;
2565
+ }
2566
+ /**
2567
+ * Reputation calculation result
2568
+ */
2569
+ interface ReputationCalculationResult {
2570
+ /** New overall score */
2571
+ overallScore: number;
2572
+ /** Score for this specific job */
2573
+ jobScore: number;
2574
+ /** Category-specific score */
2575
+ categoryScore: number;
2576
+ /** New reputation tier */
2577
+ tier: ReputationTier;
2578
+ /** Badges earned from this update */
2579
+ newBadges: BadgeType[];
2580
+ /** Whether fraud was detected */
2581
+ fraudDetected: boolean;
2582
+ /** Fraud risk score (0-100) */
2583
+ fraudRiskScore: number;
2584
+ }
2585
+
2586
+ /**
2587
+ * Simplified reputation data for module use
2588
+ */
2589
+ interface ReputationData {
2590
+ agent: Address$1;
2591
+ overallScore: number;
2592
+ totalJobsCompleted: number;
2593
+ totalJobsFailed: number;
2594
+ avgResponseTime: number;
2595
+ disputesAgainst: number;
2596
+ disputesResolved: number;
2597
+ lastUpdated: number;
2598
+ categoryReputations: CategoryReputation[];
2599
+ badges: Array<{
2600
+ badgeType: BadgeType;
2601
+ earnedAt: number;
2602
+ }>;
2603
+ performanceHistory: Array<{
2604
+ timestamp: number;
2605
+ score: number;
2606
+ jobsCompleted: number;
2607
+ avgQuality: number;
2378
2608
  }>;
2379
- private deriveEscrowAddress;
2609
+ factors: {
2610
+ completionWeight: number;
2611
+ qualityWeight: number;
2612
+ timelinessWeight: number;
2613
+ satisfactionWeight: number;
2614
+ disputeWeight: number;
2615
+ };
2380
2616
  }
2381
2617
  /**
2382
- * Channel builder for fluent API
2618
+ * Reputation module for managing reputation calculations
2383
2619
  */
2384
- declare class ChannelBuilder {
2385
- private module;
2386
- private params;
2620
+ declare class ReputationModule extends BaseModule {
2621
+ private calculator;
2622
+ private tagEngine;
2387
2623
  constructor(config: GhostSpeakConfig);
2388
- create(name: string): this;
2389
- description(desc: string): this;
2390
- private(): this;
2391
- maxMembers(max: number): this;
2392
- debug(): this;
2393
- withSigner(signer: TransactionSigner): this;
2394
- private validateParams;
2395
- getCost(): Promise<bigint>;
2396
- explain(): Promise<string>;
2397
- execute(): Promise<{
2398
- address: Address$1;
2399
- signature: string;
2400
- }>;
2401
- private deriveChannelAddress;
2624
+ /**
2625
+ * Calculate reputation change for a job
2626
+ */
2627
+ calculateReputationChange(currentData: ReputationData, jobPerformance: JobPerformance): ReputationCalculationResult;
2628
+ /**
2629
+ * Get tier name from tier enum
2630
+ */
2631
+ getTierName(tier: ReputationTier): string;
2632
+ /**
2633
+ * Get tier from score
2634
+ */
2635
+ getTierFromScore(score: number): ReputationTier;
2636
+ /**
2637
+ * Get badge display name
2638
+ */
2639
+ getBadgeName(badge: BadgeType): string;
2640
+ /**
2641
+ * Calculate estimated APY boost from reputation
2642
+ */
2643
+ calculateApyBoost(score: number): number;
2644
+ /**
2645
+ * Get reputation tier color for UI
2646
+ */
2647
+ getTierColor(tier: ReputationTier): string;
2648
+ /**
2649
+ * Create default reputation data for new agents
2650
+ */
2651
+ createDefaultReputationData(agentAddress: Address$1): ReputationData;
2652
+ /**
2653
+ * Check if agent qualifies for a specific tier
2654
+ */
2655
+ qualifiesForTier(score: number, tier: ReputationTier): boolean;
2656
+ /**
2657
+ * Calculate points needed for next tier
2658
+ */
2659
+ pointsToNextTier(score: number): {
2660
+ nextTier: ReputationTier;
2661
+ pointsNeeded: number;
2662
+ } | null;
2663
+ /**
2664
+ * Record a PayAI payment event to update reputation
2665
+ *
2666
+ * Converts PayAI webhook data to JobPerformance format and
2667
+ * calculates reputation change.
2668
+ *
2669
+ * @param record - PayAI reputation record from webhook
2670
+ * @param currentData - Current agent reputation data (fetched from on-chain or cache)
2671
+ * @returns Reputation calculation result
2672
+ */
2673
+ recordPayAIPayment(record: PayAIReputationRecordInput, currentData: ReputationData): ReputationCalculationResult;
2674
+ /**
2675
+ * Convert a PayAI reputation record to JobPerformance format
2676
+ *
2677
+ * PayAI provides basic payment data, so we derive quality metrics
2678
+ * from response time and success status.
2679
+ */
2680
+ payAIRecordToJobPerformance(record: PayAIReputationRecordInput): JobPerformance;
2681
+ /**
2682
+ * Estimate quality rating from response time
2683
+ *
2684
+ * Fast responses (< 500ms) = 100 quality
2685
+ * Average responses (500ms-2s) = 70-90 quality
2686
+ * Slow responses (2s-10s) = 40-70 quality
2687
+ * Very slow responses (> 10s) = 20-40 quality
2688
+ */
2689
+ private estimateQualityFromResponseTime;
2690
+ /**
2691
+ * Estimate expected duration based on payment amount
2692
+ *
2693
+ * Larger payments = longer expected processing time
2694
+ */
2695
+ private estimateExpectedDuration;
2696
+ /**
2697
+ * Categorize payment by network
2698
+ */
2699
+ private categorizeFromNetwork;
2700
+ /**
2701
+ * Create a PayAI-compatible performance snapshot
2702
+ * Useful for tracking payment patterns
2703
+ */
2704
+ createPayAIPerformanceSnapshot(record: PayAIReputationRecordInput, reputationResult: ReputationCalculationResult): {
2705
+ timestamp: number;
2706
+ paymentId: string;
2707
+ network: string;
2708
+ amount: string;
2709
+ success: boolean;
2710
+ responseTimeMs: number;
2711
+ reputationChange: number;
2712
+ newScore: number;
2713
+ tier: string;
2714
+ };
2715
+ /**
2716
+ * Calculate tags for an agent based on metrics
2717
+ *
2718
+ * Automatically evaluates all tag criteria and assigns tags
2719
+ * with appropriate confidence scores.
2720
+ *
2721
+ * @param metrics - Agent reputation metrics
2722
+ * @returns Array of tag scores
2723
+ */
2724
+ calculateTagsForAgent(metrics: ReputationMetrics): Promise<TagScore[]>;
2725
+ /**
2726
+ * Get tags by category
2727
+ *
2728
+ * Filters tags to only those in the specified category.
2729
+ *
2730
+ * @param tags - All tag scores
2731
+ * @param category - Category to filter by
2732
+ * @returns Filtered tag scores
2733
+ */
2734
+ getTagsByCategory(tags: TagScore[], category: TagCategory): TagScore[];
2735
+ /**
2736
+ * Check if agent has a specific tag
2737
+ *
2738
+ * @param tags - Agent's tag scores
2739
+ * @param tagName - Tag to check for
2740
+ * @returns Whether the tag exists
2741
+ */
2742
+ hasTag(tags: TagScore[], tagName: string): boolean;
2743
+ /**
2744
+ * Get tag confidence score
2745
+ *
2746
+ * @param tags - Agent's tag scores
2747
+ * @param tagName - Tag to check
2748
+ * @returns Confidence score or undefined if tag doesn't exist
2749
+ */
2750
+ getTagConfidence(tags: TagScore[], tagName: string): number | undefined;
2751
+ /**
2752
+ * Filter tags by criteria
2753
+ *
2754
+ * @param tags - Tags to filter
2755
+ * @param filters - Filter criteria
2756
+ * @returns Filtered tags
2757
+ */
2758
+ filterTags(tags: TagScore[], filters: TagFilters): TagScore[];
2759
+ /**
2760
+ * Apply tag decay based on age
2761
+ *
2762
+ * Reduces confidence scores for old tags and removes stale tags.
2763
+ *
2764
+ * @param tags - Current tag scores
2765
+ * @param currentTimestamp - Current Unix timestamp (optional)
2766
+ * @returns Tags with decay applied
2767
+ */
2768
+ applyTagDecay(tags: TagScore[], currentTimestamp?: number): TagScore[];
2769
+ /**
2770
+ * Merge new tags with existing tags
2771
+ *
2772
+ * Updates existing tags or adds new ones, preferring higher confidence.
2773
+ *
2774
+ * @param existingTags - Current tags
2775
+ * @param newTags - New tags to merge
2776
+ * @returns Merged tag list
2777
+ */
2778
+ mergeTags(existingTags: TagScore[], newTags: TagScore[]): TagScore[];
2779
+ /**
2780
+ * Categorize tags by type
2781
+ *
2782
+ * Organizes tags into skill, behavior, and compliance categories.
2783
+ *
2784
+ * @param tags - Tags to categorize
2785
+ * @returns Categorized tag result
2786
+ */
2787
+ categorizeTags(tags: TagScore[]): TagQueryResult;
2788
+ /**
2789
+ * Get top N tags by confidence
2790
+ *
2791
+ * @param tags - Tags to sort
2792
+ * @param count - Number of tags to return
2793
+ * @returns Top tags
2794
+ */
2795
+ getTopTags(tags: TagScore[], count: number): TagScore[];
2796
+ /**
2797
+ * Sort tags by confidence (descending)
2798
+ *
2799
+ * @param tags - Tags to sort
2800
+ * @returns Sorted tags
2801
+ */
2802
+ sortTagsByConfidence(tags: TagScore[]): TagScore[];
2803
+ /**
2804
+ * Sort tags by evidence count (descending)
2805
+ *
2806
+ * @param tags - Tags to sort
2807
+ * @returns Sorted tags
2808
+ */
2809
+ sortTagsByEvidence(tags: TagScore[]): TagScore[];
2810
+ /**
2811
+ * Sort tags by most recently updated
2812
+ *
2813
+ * @param tags - Tags to sort
2814
+ * @returns Sorted tags
2815
+ */
2816
+ sortTagsByRecent(tags: TagScore[]): TagScore[];
2817
+ /**
2818
+ * Get confidence level description
2819
+ *
2820
+ * @param confidence - Confidence score (0-10000)
2821
+ * @returns Human-readable confidence level
2822
+ */
2823
+ getConfidenceLevel(confidence: number): string;
2824
+ /**
2825
+ * Validate tag name length
2826
+ *
2827
+ * @param tagName - Tag name to validate
2828
+ * @returns Whether tag name is valid
2829
+ */
2830
+ validateTagName(tagName: string): boolean;
2831
+ /**
2832
+ * Validate confidence score
2833
+ *
2834
+ * @param confidence - Confidence to validate
2835
+ * @returns Whether confidence is valid (0-10000)
2836
+ */
2837
+ validateConfidence(confidence: number): boolean;
2838
+ /**
2839
+ * Convert on-chain ReputationMetrics to TagEngine format
2840
+ *
2841
+ * Helper to convert blockchain data to the format needed for tag calculation.
2842
+ *
2843
+ * @param onChainMetrics - Metrics from blockchain
2844
+ * @returns Metrics in TagEngine format
2845
+ */
2846
+ convertMetricsForTagging(onChainMetrics: {
2847
+ successfulPayments: bigint;
2848
+ failedPayments: bigint;
2849
+ totalResponseTime: bigint;
2850
+ responseTimeCount: bigint;
2851
+ totalDisputes: number;
2852
+ disputesResolved: number;
2853
+ totalRating: number;
2854
+ totalRatingsCount: number;
2855
+ createdAt: number;
2856
+ updatedAt: number;
2857
+ }): ReputationMetrics;
2858
+ }
2859
+ /**
2860
+ * Interface for PayAI reputation record input
2861
+ * Matches the PayAIReputationRecord from payai module
2862
+ */
2863
+ interface PayAIReputationRecordInput {
2864
+ agentAddress: Address$1;
2865
+ paymentSignature: string;
2866
+ amount: bigint;
2867
+ success: boolean;
2868
+ responseTimeMs: number;
2869
+ payerAddress: string;
2870
+ timestamp: Date;
2871
+ network: string;
2402
2872
  }
2873
+
2403
2874
  /**
2404
- * Marketplace builder for fluent API
2875
+ * Privacy module for managing reputation privacy settings
2405
2876
  */
2406
- declare class MarketplaceBuilder {
2407
- private module;
2408
- private params;
2877
+ declare class PrivacyModule extends BaseModule {
2409
2878
  constructor(config: GhostSpeakConfig);
2410
2879
  /**
2411
- * Create a service listing
2880
+ * Initialize privacy settings for an agent
2881
+ *
2882
+ * Sets up privacy controls for an agent's reputation data.
2883
+ * By default, starts in Public mode with all metrics visible.
2884
+ *
2885
+ * @param signer - Transaction signer (must be agent owner)
2886
+ * @param params - Initialization parameters
2887
+ * @returns Transaction signature
2888
+ *
2889
+ * @example
2890
+ * ```typescript
2891
+ * const signature = await privacyModule.initializePrivacy(signer, {
2892
+ * agentAddress: agentPda,
2893
+ * mode: PrivacyMode.TierOnly,
2894
+ * metricVisibility: {
2895
+ * showScore: VisibilityLevel.Private,
2896
+ * showJobsCompleted: VisibilityLevel.Public,
2897
+ * // ... other metrics
2898
+ * }
2899
+ * })
2900
+ * ```
2901
+ */
2902
+ initializePrivacy(signer: TransactionSigner, params: InitializePrivacyParams): Promise<string>;
2903
+ /**
2904
+ * Update privacy mode for an agent
2905
+ *
2906
+ * Changes how reputation data is displayed publicly.
2907
+ *
2908
+ * @param signer - Transaction signer (must be agent owner)
2909
+ * @param params - Update parameters
2910
+ * @returns Transaction signature
2911
+ *
2912
+ * @example
2913
+ * ```typescript
2914
+ * // Switch to tier-only mode
2915
+ * await privacyModule.updatePrivacyMode(signer, {
2916
+ * agentAddress: agentPda,
2917
+ * mode: PrivacyMode.TierOnly
2918
+ * })
2919
+ * ```
2920
+ */
2921
+ updatePrivacyMode(signer: TransactionSigner, params: UpdatePrivacyModeParams): Promise<string>;
2922
+ /**
2923
+ * Set metric visibility settings
2924
+ *
2925
+ * Configure selective disclosure for individual metrics.
2926
+ * Only works in Custom privacy mode.
2927
+ *
2928
+ * @param signer - Transaction signer (must be agent owner)
2929
+ * @param params - Metric visibility parameters
2930
+ * @returns Transaction signature
2931
+ *
2932
+ * @example
2933
+ * ```typescript
2934
+ * await privacyModule.setMetricVisibility(signer, {
2935
+ * agentAddress: agentPda,
2936
+ * metricVisibility: {
2937
+ * showScore: VisibilityLevel.Private,
2938
+ * showJobsCompleted: VisibilityLevel.Public,
2939
+ * showSuccessRate: VisibilityLevel.Public,
2940
+ * showResponseTime: VisibilityLevel.Public,
2941
+ * showDisputes: VisibilityLevel.Private,
2942
+ * showEarnings: VisibilityLevel.Private,
2943
+ * showRatings: VisibilityLevel.Public,
2944
+ * showBadges: VisibilityLevel.Public
2945
+ * }
2946
+ * })
2947
+ * ```
2948
+ */
2949
+ setMetricVisibility(signer: TransactionSigner, params: SetMetricVisibilityParams): Promise<string>;
2950
+ /**
2951
+ * Grant viewer access to private reputation data
2952
+ *
2953
+ * Adds an address to the authorized viewers list, giving them
2954
+ * full access to all private metrics.
2955
+ *
2956
+ * @param signer - Transaction signer (must be agent owner)
2957
+ * @param params - Grant access parameters
2958
+ * @returns Transaction signature
2959
+ *
2960
+ * @example
2961
+ * ```typescript
2962
+ * // Grant access to a client
2963
+ * await privacyModule.grantAccess(signer, {
2964
+ * agentAddress: agentPda,
2965
+ * viewer: clientAddress
2966
+ * })
2967
+ * ```
2968
+ */
2969
+ grantAccess(signer: TransactionSigner, params: GrantAccessParams): Promise<string>;
2970
+ /**
2971
+ * Revoke viewer access to private reputation data
2972
+ *
2973
+ * Removes an address from the authorized viewers list.
2974
+ *
2975
+ * @param signer - Transaction signer (must be agent owner)
2976
+ * @param params - Revoke access parameters
2977
+ * @returns Transaction signature
2978
+ *
2979
+ * @example
2980
+ * ```typescript
2981
+ * // Revoke access from a viewer
2982
+ * await privacyModule.revokeAccess(signer, {
2983
+ * agentAddress: agentPda,
2984
+ * viewer: viewerAddress
2985
+ * })
2986
+ * ```
2987
+ */
2988
+ revokeAccess(signer: TransactionSigner, params: RevokeAccessParams): Promise<string>;
2989
+ /**
2990
+ * Apply a privacy preset
2991
+ *
2992
+ * Quickly configure privacy settings using a predefined preset
2993
+ * (Conservative, Balanced, or Open).
2994
+ *
2995
+ * @param signer - Transaction signer (must be agent owner)
2996
+ * @param params - Preset parameters
2997
+ * @returns Transaction signature
2998
+ *
2999
+ * @example
3000
+ * ```typescript
3001
+ * // Apply balanced preset
3002
+ * await privacyModule.applyPreset(signer, {
3003
+ * agentAddress: agentPda,
3004
+ * preset: PrivacyPresets.BALANCED
3005
+ * })
3006
+ * ```
3007
+ */
3008
+ applyPreset(signer: TransactionSigner, params: ApplyPresetParams): Promise<string>;
3009
+ /**
3010
+ * Get privacy settings for an agent
3011
+ *
3012
+ * Fetches the current privacy configuration.
3013
+ *
3014
+ * @param agentAddress - Agent address
3015
+ * @returns Privacy settings or null if not initialized
3016
+ *
3017
+ * @example
3018
+ * ```typescript
3019
+ * const settings = await privacyModule.getPrivacySettings(agentPda)
3020
+ * if (settings) {
3021
+ * console.log('Privacy mode:', settings.mode)
3022
+ * console.log('Authorized viewers:', settings.authorizedViewers.length)
3023
+ * }
3024
+ * ```
3025
+ */
3026
+ getPrivacySettings(agentAddress: Address$1): Promise<PrivacySettings | null>;
3027
+ /**
3028
+ * Get visible reputation data (privacy-filtered)
3029
+ *
3030
+ * Fetches reputation data and applies privacy filters based on
3031
+ * the viewer's access level.
3032
+ *
3033
+ * @param agentAddress - Agent address
3034
+ * @param viewerAddress - Viewer address (for access check)
3035
+ * @returns Privacy-filtered reputation data
3036
+ *
3037
+ * @example
3038
+ * ```typescript
3039
+ * // Get visible reputation for a specific viewer
3040
+ * const visibleRep = await privacyModule.getVisibleReputation(
3041
+ * agentPda,
3042
+ * viewerAddress
3043
+ * )
3044
+ *
3045
+ * console.log('Tier:', visibleRep.tier)
3046
+ * console.log('Exact score:', visibleRep.exactScore) // Only if visible
3047
+ * console.log('Has full access:', visibleRep.hasFullAccess)
3048
+ * ```
3049
+ */
3050
+ getVisibleReputation(agentAddress: Address$1, viewerAddress: Address$1): Promise<VisibleReputation>;
3051
+ /**
3052
+ * Validate privacy settings before applying
3053
+ *
3054
+ * @param settings - Privacy settings to validate
3055
+ * @returns Validation result
2412
3056
  */
2413
- service(): ServiceBuilder;
3057
+ validateSettings(settings: PrivacySettings): {
3058
+ valid: boolean;
3059
+ errors: string[];
3060
+ };
2414
3061
  /**
2415
- * Create a job posting
3062
+ * Get available privacy presets
3063
+ *
3064
+ * @returns Record of available presets
2416
3065
  */
2417
- job(): JobBuilder;
3066
+ getAvailablePresets(): Record<string, PrivacyPreset>;
2418
3067
  /**
2419
- * Create an auction
3068
+ * Get default metric visibility for a privacy mode
3069
+ *
3070
+ * @param mode - Privacy mode
3071
+ * @returns Default metric visibility
2420
3072
  */
2421
- auction(): AuctionBuilder;
3073
+ getDefaultVisibility(mode: PrivacyMode): MetricVisibility;
2422
3074
  /**
2423
- * Get marketplace queries
3075
+ * Calculate reputation tier from score
3076
+ *
3077
+ * @param score - Reputation score
3078
+ * @returns Reputation tier
2424
3079
  */
2425
- query(): MarketplaceQuery;
2426
- debug(): this;
2427
- withSigner(signer: TransactionSigner): this;
3080
+ getTier(score: number): ReputationTier$1;
3081
+ /**
3082
+ * Calculate score range from score
3083
+ *
3084
+ * @param score - Reputation score
3085
+ * @returns Score range
3086
+ */
3087
+ getRange(score: number): ScoreRange;
3088
+ private derivePrivacyPda;
2428
3089
  }
3090
+
2429
3091
  /**
2430
- * Marketplace builder parameters interface
3092
+ * Agent Authorization System Types
3093
+ *
3094
+ * GhostSpeak's trustless authorization mechanism for agents to
3095
+ * pre-authorize reputation updates with cryptographic signatures.
3096
+ *
3097
+ * Built for secure, delegated reputation management across protocols.
2431
3098
  */
2432
- interface MarketplaceBuilderParams {
2433
- signer?: TransactionSigner;
3099
+
3100
+ /**
3101
+ * Network types supported by GhostSpeak
3102
+ */
3103
+ type SolanaNetwork = 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet';
3104
+ /**
3105
+ * Configuration for on-chain authorization storage
3106
+ *
3107
+ * On-chain storage provides an immutable audit trail for authorizations,
3108
+ * but costs ~0.002 SOL in rent. Off-chain storage (default) is free but
3109
+ * requires agents to share signed authorizations with facilitators.
3110
+ */
3111
+ interface OnChainStorageConfig {
3112
+ /** Enable on-chain storage (default: false for cost efficiency) */
3113
+ enabled: boolean;
3114
+ /**
3115
+ * Storage fee in lamports (default: 0.002 SOL = 2000000 lamports for rent)
3116
+ * This covers the account rent exemption cost on Solana
3117
+ */
3118
+ storageFee?: bigint;
3119
+ /**
3120
+ * Who pays the storage fee
3121
+ * - true: Agent pays (stored authorization benefits agent's transparency)
3122
+ * - false: Facilitator pays (facilitator wants on-chain proof)
3123
+ * Default: true (agent pays for their own authorization storage)
3124
+ */
3125
+ feePayedByAgent?: boolean;
3126
+ /**
3127
+ * Automatically store on-chain after creation
3128
+ * - true: Store immediately (requires funded wallet)
3129
+ * - false: Manual storage via storeAuthorizationOnChain()
3130
+ * Default: false (manual control)
3131
+ */
3132
+ autoStore?: boolean;
3133
+ /**
3134
+ * Custom fee structure for different authorization durations
3135
+ * Maps duration in seconds to fee in lamports
3136
+ * Example: { 2592000: 1000000n } // 30 days = 0.001 SOL
3137
+ */
3138
+ customFees?: Record<number, bigint>;
2434
3139
  }
2435
3140
  /**
2436
- * Service builder for fluent API
3141
+ * Reputation Authorization
3142
+ *
3143
+ * Allows an agent to pre-authorize a specific source (e.g., PayAI facilitator)
3144
+ * to update their reputation a limited number of times before expiration.
3145
+ */
3146
+ interface ReputationAuthorization {
3147
+ /** Agent's public key (the one granting authorization) */
3148
+ agentAddress: Address$1;
3149
+ /** Authorized source address (e.g., PayAI facilitator address) */
3150
+ authorizedSource: Address$1;
3151
+ /** Maximum number of reputation updates allowed */
3152
+ indexLimit: number;
3153
+ /** Unix timestamp when authorization expires */
3154
+ expiresAt: number;
3155
+ /** Solana network this authorization is valid on */
3156
+ network: SolanaNetwork;
3157
+ /** Ed25519 signature (64 bytes) proving agent's intent */
3158
+ signature: Uint8Array;
3159
+ /** Optional nonce to prevent replay attacks */
3160
+ nonce?: string;
3161
+ /** Optional metadata */
3162
+ metadata?: AuthorizationMetadata;
3163
+ }
3164
+ /**
3165
+ * Authorization metadata (optional fields)
3166
+ */
3167
+ interface AuthorizationMetadata {
3168
+ /** Human-readable description */
3169
+ description?: string;
3170
+ /** Tags for categorization */
3171
+ tags?: string[];
3172
+ /** Custom data */
3173
+ customData?: Record<string, unknown>;
3174
+ /** Creation timestamp */
3175
+ createdAt?: number;
3176
+ /** Version of authorization format */
3177
+ version?: string;
3178
+ }
3179
+ /**
3180
+ * Authorization creation parameters
3181
+ */
3182
+ interface CreateAuthorizationParams {
3183
+ /** Authorized source (e.g., PayAI facilitator) */
3184
+ authorizedSource: Address$1;
3185
+ /** Maximum number of updates (default: 1000) */
3186
+ indexLimit?: number;
3187
+ /** Expiration time in seconds from now (default: 30 days) */
3188
+ expiresIn?: number;
3189
+ /** Specific expiration timestamp (overrides expiresIn) */
3190
+ expiresAt?: number;
3191
+ /** Network (defaults to current cluster) */
3192
+ network?: SolanaNetwork;
3193
+ /** Optional nonce for replay protection */
3194
+ nonce?: string;
3195
+ /** Optional metadata */
3196
+ metadata?: AuthorizationMetadata;
3197
+ /**
3198
+ * Whether to store authorization on-chain (default: false)
3199
+ * @deprecated Use onChainStorage.enabled instead
3200
+ */
3201
+ storeOnChain?: boolean;
3202
+ /**
3203
+ * On-chain storage configuration
3204
+ * If not provided, defaults to off-chain (free) storage
3205
+ */
3206
+ onChainStorage?: OnChainStorageConfig;
3207
+ }
3208
+ /**
3209
+ * Authorization status
3210
+ */
3211
+ declare enum AuthorizationStatus {
3212
+ ACTIVE = "active",
3213
+ EXPIRED = "expired",
3214
+ EXHAUSTED = "exhausted",// Index limit reached
3215
+ REVOKED = "revoked",
3216
+ PENDING = "pending"
3217
+ }
3218
+ /**
3219
+ * Authorization with status
3220
+ */
3221
+ interface AuthorizationWithStatus extends ReputationAuthorization {
3222
+ /** Current status */
3223
+ status: AuthorizationStatus;
3224
+ /** Current usage count */
3225
+ currentIndex: number;
3226
+ /** Remaining uses */
3227
+ remainingUses: number;
3228
+ /** Whether currently valid */
3229
+ isValid: boolean;
3230
+ /** Last used timestamp */
3231
+ lastUsedAt?: number;
3232
+ /** Authorization ID (derived from signature or on-chain account) */
3233
+ id: string;
3234
+ }
3235
+ /**
3236
+ * Authorization query filter
2437
3237
  */
2438
- declare class ServiceBuilder {
2439
- private module;
2440
- private builderParams;
2441
- private params;
2442
- constructor(module: MarketplaceModule, builderParams: MarketplaceBuilderParams);
2443
- create(params: {
2444
- title: string;
2445
- description: string;
2446
- agentAddress: Address$1;
2447
- }): this;
2448
- pricePerHour(price: bigint): this;
2449
- category(cat: string): this;
2450
- capabilities(caps: string[]): this;
2451
- private validateParams;
2452
- execute(): Promise<{
2453
- address: Address$1;
2454
- signature: string;
2455
- }>;
2456
- withSigner(signer: TransactionSigner): this;
3238
+ interface AuthorizationFilter {
3239
+ /** Filter by agent address */
3240
+ agentAddress?: Address$1;
3241
+ /** Filter by authorized source */
3242
+ authorizedSource?: Address$1;
3243
+ /** Filter by status */
3244
+ status?: AuthorizationStatus | AuthorizationStatus[];
3245
+ /** Filter by network */
3246
+ network?: SolanaNetwork;
3247
+ /** Filter by expiration (before/after timestamp) */
3248
+ expiresAfter?: number;
3249
+ expiresBefore?: number;
3250
+ /** Filter by creation time */
3251
+ createdAfter?: number;
3252
+ createdBefore?: number;
3253
+ /** Pagination */
3254
+ limit?: number;
3255
+ offset?: number;
3256
+ }
3257
+
3258
+ /**
3259
+ * Agent Authorization Signature Verification
3260
+ *
3261
+ * Ed25519 signature creation and verification for GhostSpeak's
3262
+ * trustless agent pre-authorization system.
3263
+ *
3264
+ * Enables verifiable delegation of reputation update authority.
3265
+ */
3266
+
3267
+ /**
3268
+ * Keypair interface for Ed25519 signing operations
3269
+ * Compatible with both legacy and modern Solana key formats
3270
+ */
3271
+ interface SigningKeypair {
3272
+ publicKey: {
3273
+ toBase58(): string;
3274
+ toBytes(): Uint8Array;
3275
+ };
3276
+ secretKey: Uint8Array;
3277
+ }
3278
+
3279
+ /**
3280
+ * Authorization Module - Agent Pre-Authorization System
3281
+ *
3282
+ * GhostSpeak's trustless system for agents to pre-authorize facilitators
3283
+ * (e.g., PayAI) to update their reputation with built-in security limits.
3284
+ *
3285
+ * @module AuthorizationModule
3286
+ */
3287
+
3288
+ /**
3289
+ * Authorization Module
3290
+ *
3291
+ * Manages agent pre-authorizations for reputation updates.
3292
+ */
3293
+ declare class AuthorizationModule extends BaseModule {
3294
+ constructor(config: GhostSpeakConfig);
3295
+ /**
3296
+ * Create a signed authorization for a facilitator
3297
+ *
3298
+ * @param params - Authorization parameters
3299
+ * @param agentKeypair - Agent's keypair for signing
3300
+ * @returns Signed authorization
3301
+ *
3302
+ * @example
3303
+ * ```typescript
3304
+ * const authorization = await client.authorization.createAuthorization({
3305
+ * authorizedSource: payAIFacilitatorAddress,
3306
+ * indexLimit: 1000, // Allow 1000 reputation updates
3307
+ * expiresIn: 30 * 24 * 60 * 60, // 30 days
3308
+ * network: 'devnet',
3309
+ * }, agentKeypair)
3310
+ * ```
3311
+ */
3312
+ createAuthorization(params: CreateAuthorizationParams, agentKeypair: SigningKeypair): Promise<ReputationAuthorization>;
3313
+ /**
3314
+ * Store authorization on-chain (optional, ~0.002 SOL fee)
3315
+ *
3316
+ * Creates a PDA account storing the authorization for on-chain verification.
3317
+ * This provides an immutable audit trail but costs rent (~0.002 SOL).
3318
+ *
3319
+ * **Cost vs Benefit:**
3320
+ * - Off-chain (default): Free, but requires sharing signed authorization
3321
+ * - On-chain: ~0.002 SOL, provides transparent audit trail
3322
+ *
3323
+ * **When to use on-chain storage:**
3324
+ * - High-value authorizations where transparency is critical
3325
+ * - Compliance/audit requirements
3326
+ * - Public agent reputation systems
3327
+ *
3328
+ * @param authorization - Authorization to store
3329
+ * @param agentSigner - Agent's signer (or facilitator if they pay fee)
3330
+ * @param config - Optional storage configuration
3331
+ * @returns Transaction signature
3332
+ *
3333
+ * @example
3334
+ * ```typescript
3335
+ * // Default: Agent pays ~0.002 SOL
3336
+ * const sig = await client.authorization.storeAuthorizationOnChain(auth, agentSigner)
3337
+ *
3338
+ * // Custom fee structure
3339
+ * const sig = await client.authorization.storeAuthorizationOnChain(auth, agentSigner, {
3340
+ * storageFee: 1500000n, // 0.0015 SOL
3341
+ * feePayedByAgent: false // Facilitator pays
3342
+ * })
3343
+ * ```
3344
+ */
3345
+ storeAuthorizationOnChain(authorization: ReputationAuthorization, agentSigner: TransactionSigner, config?: Partial<OnChainStorageConfig>): Promise<string>;
3346
+ /**
3347
+ * Verify authorization signature
3348
+ *
3349
+ * @param authorization - Authorization to verify
3350
+ * @returns True if signature is valid
3351
+ *
3352
+ * @example
3353
+ * ```typescript
3354
+ * const isValid = await client.authorization.verifySignature(authorization)
3355
+ * if (!isValid) {
3356
+ * throw new Error('Invalid authorization signature')
3357
+ * }
3358
+ * ```
3359
+ */
3360
+ verifySignature(authorization: ReputationAuthorization): Promise<boolean>;
3361
+ /**
3362
+ * Check authorization status (without on-chain call)
3363
+ *
3364
+ * @param authorization - Authorization to check
3365
+ * @param currentIndex - Current usage count (optional, defaults to authorization.currentIndex)
3366
+ * @returns Authorization status
3367
+ */
3368
+ getAuthorizationStatus(authorization: ReputationAuthorization, currentIndex?: number): {
3369
+ status: AuthorizationStatus;
3370
+ isValid: boolean;
3371
+ remainingUses: number;
3372
+ reason?: string;
3373
+ };
3374
+ /**
3375
+ * Fetch authorization from on-chain PDA
3376
+ *
3377
+ * @param agentAddress - Agent's address
3378
+ * @param authorizedSource - Authorized source address
3379
+ * @param nonce - Optional nonce (must match creation)
3380
+ * @returns Authorization with current on-chain status
3381
+ */
3382
+ fetchAuthorization(agentAddress: Address$1, authorizedSource: Address$1, nonce?: string): Promise<AuthorizationWithStatus | null>;
3383
+ /**
3384
+ * Update reputation using authorization
3385
+ *
3386
+ * Called by facilitators (e.g., PayAI) to update agent reputation
3387
+ * using a pre-signed authorization.
3388
+ *
3389
+ * @param authorization - Authorization to use
3390
+ * @param reputationChange - Reputation change to apply
3391
+ * @param transactionSignature - Transaction signature for audit trail
3392
+ * @param usageRecord - PDA for usage record (audit trail)
3393
+ * @param metadata - Optional metadata
3394
+ * @param facilitatorSigner - Facilitator's signer
3395
+ * @returns Transaction signature
3396
+ */
3397
+ updateReputationWithAuth(authorization: ReputationAuthorization, reputationChange: number, transactionSignature: string, usageRecord: Address$1, metadata: Record<string, unknown> | undefined, facilitatorSigner: TransactionSigner): Promise<string>;
3398
+ /**
3399
+ * Revoke authorization
3400
+ *
3401
+ * Agent can revoke an authorization before it expires or is exhausted.
3402
+ *
3403
+ * @param agentAddress - Agent's address
3404
+ * @param authorization - Authorization account PDA
3405
+ * @param nonce - Optional nonce (must match creation)
3406
+ * @param agentSigner - Agent's signer
3407
+ * @returns Transaction signature
3408
+ */
3409
+ revokeAuthorization(agentAddress: Address$1, authorization: Address$1, nonce: string | undefined, agentSigner: TransactionSigner): Promise<string>;
3410
+ /**
3411
+ * List authorizations for an agent (filtering)
3412
+ *
3413
+ * @param filter - Filter criteria
3414
+ * @returns List of authorizations
3415
+ */
3416
+ listAuthorizations(filter: AuthorizationFilter): Promise<AuthorizationWithStatus[]>;
3417
+ /**
3418
+ * Serialize authorization for storage/transmission
3419
+ *
3420
+ * @param authorization - Authorization to serialize
3421
+ * @returns JSON-safe object
3422
+ */
3423
+ serializeAuthorization(authorization: ReputationAuthorization): Record<string, unknown>;
3424
+ /**
3425
+ * Deserialize authorization from storage/transmission
3426
+ *
3427
+ * @param data - Serialized authorization data
3428
+ * @returns Authorization object
3429
+ */
3430
+ deserializeAuthorization(data: Record<string, unknown>): ReputationAuthorization;
3431
+ /**
3432
+ * Get authorization ID (deterministic hash)
3433
+ *
3434
+ * @param authorization - Authorization to hash
3435
+ * @returns Base58-encoded hash
3436
+ */
3437
+ getAuthorizationId(authorization: ReputationAuthorization): Promise<string>;
3438
+ /**
3439
+ * Helper: Create authorization for PayAI facilitator
3440
+ *
3441
+ * Convenience method with sensible defaults for PayAI integration.
3442
+ *
3443
+ * @param payAIFacilitatorAddress - PayAI facilitator address
3444
+ * @param agentKeypair - Agent's keypair
3445
+ * @param options - Optional overrides
3446
+ * @returns Signed authorization
3447
+ *
3448
+ * @example
3449
+ * ```typescript
3450
+ * const auth = await client.authorization.createPayAIAuthorization(
3451
+ * 'PayAI...FacilitatorAddress',
3452
+ * agentKeypair,
3453
+ * { indexLimit: 5000 } // Optional overrides
3454
+ * )
3455
+ * ```
3456
+ */
3457
+ createPayAIAuthorization(payAIFacilitatorAddress: Address$1, agentKeypair: SigningKeypair, options?: Partial<CreateAuthorizationParams>): Promise<ReputationAuthorization>;
3458
+ /**
3459
+ * Calculate storage fee based on authorization duration and custom fees
3460
+ *
3461
+ * @param authorization - Authorization to calculate fee for
3462
+ * @param config - Storage configuration
3463
+ * @returns Fee in lamports
3464
+ *
3465
+ * @example
3466
+ * ```typescript
3467
+ * // Default fee: 0.002 SOL
3468
+ * const fee = module.calculateStorageFee(auth)
3469
+ *
3470
+ * // Custom fee for 30-day authorizations: 0.001 SOL
3471
+ * const fee = module.calculateStorageFee(auth, {
3472
+ * customFees: { 2592000: 1000000n } // 30 days = 0.001 SOL
3473
+ * })
3474
+ * ```
3475
+ */
3476
+ private calculateStorageFee;
3477
+ /**
3478
+ * Estimate on-chain storage cost for an authorization
3479
+ *
3480
+ * @param params - Authorization parameters
3481
+ * @param config - Optional storage configuration
3482
+ * @returns Estimated cost in SOL
3483
+ *
3484
+ * @example
3485
+ * ```typescript
3486
+ * const costInSOL = await client.authorization.estimateStorageCost({
3487
+ * authorizedSource: facilitatorAddress,
3488
+ * expiresIn: 30 * 24 * 60 * 60 // 30 days
3489
+ * })
3490
+ * console.log(`On-chain storage will cost ${costInSOL} SOL`)
3491
+ * ```
3492
+ */
3493
+ estimateStorageCost(params: CreateAuthorizationParams, config?: Partial<OnChainStorageConfig>): Promise<number>;
3494
+ }
3495
+
3496
+ interface StakeParams {
3497
+ /** Agent address to stake for */
3498
+ agent: Address$1;
3499
+ /** Agent's token account holding GHOST tokens */
3500
+ agentTokenAccount: Address$1;
3501
+ /** Staking vault to receive tokens */
3502
+ stakingVault: Address$1;
3503
+ /** Global staking config account */
3504
+ stakingConfig: Address$1;
3505
+ /** GHOST token mint address */
3506
+ ghostMint: Address$1;
3507
+ /** Amount of GHOST tokens to stake (in lamports) */
3508
+ amount: bigint;
3509
+ /** Lock duration in seconds */
3510
+ lockDuration: bigint;
3511
+ /** The agent owner's transaction signer */
3512
+ agentOwner: TransactionSigner;
3513
+ }
3514
+ interface UnstakeParams {
3515
+ /** Staking account to unstake from */
3516
+ stakingAccount: Address$1;
3517
+ /** Agent address */
3518
+ agent: Address$1;
3519
+ /** Staking vault holding the tokens */
3520
+ stakingVault: Address$1;
3521
+ /** Agent's token account to receive tokens */
3522
+ agentTokenAccount: Address$1;
3523
+ /** The agent owner's transaction signer */
3524
+ agentOwner: TransactionSigner;
3525
+ }
3526
+ interface InitializeStakingConfigParams {
3527
+ /** Admin who can modify staking config */
3528
+ authority: TransactionSigner;
3529
+ /** Minimum stake amount */
3530
+ minStake: bigint;
3531
+ /** Treasury address to receive fees */
3532
+ treasury: Address$1;
3533
+ }
3534
+ declare class StakingModule extends BaseModule {
3535
+ /**
3536
+ * Initialize the global staking configuration (admin only)
3537
+ */
3538
+ initializeStakingConfig(params: InitializeStakingConfigParams): Promise<string>;
3539
+ /**
3540
+ * Stake GHOST tokens for an agent
3541
+ *
3542
+ * @param params - Staking parameters
3543
+ * @returns Transaction signature
3544
+ */
3545
+ stake(params: StakeParams): Promise<string>;
3546
+ /**
3547
+ * Unstake GHOST tokens from an agent
3548
+ *
3549
+ * @param params - Unstaking parameters
3550
+ * @returns Transaction signature
3551
+ */
3552
+ unstake(params: UnstakeParams): Promise<string>;
3553
+ /**
3554
+ * Get staking account for an agent
3555
+ *
3556
+ * @param stakingAccountAddress - The staking account address
3557
+ * @returns Staking account data or null if not found
3558
+ */
3559
+ getStakingAccount(stakingAccountAddress: Address$1): Promise<StakingAccount | null>;
3560
+ /**
3561
+ * Get the global staking configuration
3562
+ *
3563
+ * @param stakingConfigAddress - The staking config account address
3564
+ * @returns Staking config data or null if not initialized
3565
+ */
3566
+ getStakingConfig(stakingConfigAddress: Address$1): Promise<StakingConfig | null>;
3567
+ }
3568
+
3569
+ /**
3570
+ * Main GhostSpeak client with fluent API design
3571
+ *
3572
+ * Example usage:
3573
+ * ```typescript
3574
+ * const ghostspeak = new GhostSpeak()
3575
+ *
3576
+ * // Create an agent
3577
+ * const agent = await ghostspeak
3578
+ * .agent()
3579
+ * .create({ name: "My Agent", capabilities: ["coding"] })
3580
+ * .compressed()
3581
+ * .execute()
3582
+ *
3583
+ * ```
3584
+ */
3585
+ declare class GhostSpeakClient {
3586
+ private config;
3587
+ constructor(config?: Partial<GhostSpeakConfig>);
3588
+ /**
3589
+ * Direct access to Agent Module for read operations
3590
+ */
3591
+ get agents(): AgentModule;
3592
+ /**
3593
+ * Direct access to Governance Module for read operations
3594
+ */
3595
+ get governanceModule(): GovernanceModule;
3596
+ /**
3597
+ * Direct access to Multisig Module for read operations
3598
+ */
3599
+ get multisigModule(): MultisigModule;
3600
+ /**
3601
+ * Agent operations
3602
+ */
3603
+ agent(): AgentBuilder;
3604
+ /**
3605
+ * PayAI operations (x402 payments)
3606
+ */
3607
+ payai(): PayAIClient;
3608
+ /**
3609
+ * Reputation operations
3610
+ */
3611
+ reputation(): ReputationModule;
3612
+ /**
3613
+ * Reputation Tag Engine (Pillar 2: Granular Tags)
3614
+ *
3615
+ * Automatic tag assignment and management based on agent metrics.
3616
+ * Features confidence scoring, evidence tracking, and tag decay.
3617
+ */
3618
+ tagEngine(): any;
3619
+ /**
3620
+ * Multi-Source Reputation Aggregator (Pillar 3: External Sources)
3621
+ *
3622
+ * Aggregate reputation data from multiple sources (PayAI, GitHub, custom webhooks)
3623
+ * with weighted scoring and conflict detection.
3624
+ */
3625
+ reputationAggregator(): any;
3626
+ /**
3627
+ * Privacy operations
3628
+ */
3629
+ privacy(): PrivacyModule;
3630
+ /**
3631
+ * Governance operations
3632
+ */
3633
+ governance(): GovernanceBuilder;
3634
+ /**
3635
+ * Multisig operations
3636
+ */
3637
+ multisig(): MultisigBuilder;
3638
+ /**
3639
+ * Unified Credential operations (Solana + Crossmint)
3640
+ */
3641
+ credentials(): UnifiedCredentialService;
3642
+ /**
3643
+ * DID operations (Decentralized Identifiers)
3644
+ */
3645
+ did(): DidModule;
3646
+ /**
3647
+ * Direct access to Authorization Module for read operations
3648
+ */
3649
+ get authorization(): AuthorizationModule;
3650
+ /**
3651
+ * Direct access to Staking Module for read operations
3652
+ */
3653
+ get staking(): StakingModule;
3654
+ /**
3655
+ * Enable development mode features
3656
+ */
3657
+ enableDevMode(): this;
3658
+ /**
3659
+ * Configure network
3660
+ */
3661
+ useNetwork(cluster: 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet'): this;
3662
+ /**
3663
+ * Configure custom RPC
3664
+ */
3665
+ useRpc(endpoint: string, wsEndpoint?: string): this;
3666
+ /**
3667
+ * Get default RPC endpoint for cluster
3668
+ */
3669
+ private getDefaultRpcEndpoint;
2457
3670
  }
2458
3671
  /**
2459
- * Job builder for fluent API
3672
+ * Agent builder for fluent API
2460
3673
  */
2461
- declare class JobBuilder {
3674
+ declare class AgentBuilder {
2462
3675
  private module;
2463
- private builderParams;
2464
3676
  private params;
2465
- constructor(module: MarketplaceModule, builderParams: MarketplaceBuilderParams);
3677
+ constructor(config: GhostSpeakConfig);
2466
3678
  create(params: {
2467
- title: string;
2468
- description: string;
3679
+ name: string;
3680
+ description?: string;
3681
+ capabilities: string[];
2469
3682
  }): this;
2470
- budget(amount: bigint): this;
2471
- duration(hours: number): this;
2472
- skills(skillList: string[]): this;
2473
- category(cat: string): this;
3683
+ withDescription(description: string): this;
3684
+ withType(agentType: number): this;
3685
+ withIPFS(): this;
3686
+ compressed(): this;
3687
+ debug(): this;
3688
+ withSigner(signer: TransactionSigner): this;
2474
3689
  private validateParams;
3690
+ getCost(): Promise<bigint>;
3691
+ simulate(): Promise<unknown>;
3692
+ explain(): Promise<string>;
2475
3693
  execute(): Promise<{
2476
3694
  address: Address$1;
2477
3695
  signature: string;
2478
3696
  }>;
2479
- withSigner(signer: TransactionSigner): this;
3697
+ private deriveAgentAddress;
2480
3698
  }
2481
3699
  /**
2482
- * Auction builder for fluent API
3700
+ * Channel builder parameters interface
2483
3701
  */
2484
- declare class AuctionBuilder {
2485
- private module;
2486
- private builderParams;
2487
- private params;
2488
- constructor(module: MarketplaceModule, builderParams: MarketplaceBuilderParams);
2489
- forService(serviceAddress: Address$1): this;
2490
- startingPrice(price: bigint): this;
2491
- reservePrice(price: bigint): this;
2492
- duration(hours: number): this;
2493
- english(): this;
2494
- dutch(): this;
2495
- private validateParams;
2496
- execute(): Promise<{
2497
- address: Address$1;
2498
- signature: string;
2499
- }>;
2500
- withSigner(signer: TransactionSigner): this;
2501
- }
2502
3702
  /**
2503
- * Marketplace query helper
3703
+ * Marketplace builder for fluent API
2504
3704
  */
2505
- declare class MarketplaceQuery {
2506
- private module;
2507
- constructor(module: MarketplaceModule);
2508
- serviceListings(): Promise<{
2509
- address: Address$1;
2510
- data: ServiceListing;
2511
- }[]>;
2512
- serviceListingsByCategory(_category: string): Promise<{
2513
- address: Address$1;
2514
- data: ServiceListing;
2515
- }[]>;
2516
- jobPostings(): Promise<{
2517
- address: Address$1;
2518
- data: JobPosting;
2519
- }[]>;
2520
- auctions(): Promise<{
2521
- address: Address$1;
2522
- data: AuctionMarketplace;
2523
- }[]>;
2524
- }
2525
3705
  /**
2526
3706
  * Governance builder for fluent API
2527
3707
  */
@@ -2656,67 +3836,6 @@ declare class MultisigExecuteBuilder {
2656
3836
  }>;
2657
3837
  withSigner(signer: TransactionSigner): this;
2658
3838
  }
2659
- /**
2660
- * Token2022 builder for fluent API
2661
- */
2662
- declare class Token2022Builder {
2663
- private module;
2664
- private params;
2665
- constructor(config: GhostSpeakConfig);
2666
- /**
2667
- * Create a basic mint
2668
- */
2669
- mint(): MintBuilder;
2670
- /**
2671
- * Get Token2022 queries
2672
- */
2673
- query(): Token2022Query;
2674
- debug(): this;
2675
- withSigner(signer: TransactionSigner): this;
2676
- }
2677
- /**
2678
- * Token2022 builder parameters interface
2679
- */
2680
- interface Token2022BuilderParams {
2681
- signer?: TransactionSigner;
2682
- }
2683
- /**
2684
- * Mint builder for fluent API
2685
- */
2686
- declare class MintBuilder {
2687
- private module;
2688
- private builderParams;
2689
- private params;
2690
- constructor(module: Token2022Module, builderParams: Token2022BuilderParams);
2691
- forAgent(agentAddress: Address$1): this;
2692
- decimals(dec: number): this;
2693
- freezeAuthority(authority: Address$1): this;
2694
- withTransferFees(basisPoints: number, maxFee: bigint): this;
2695
- withConfidentialTransfers(autoApprove?: boolean): this;
2696
- withInterestBearing(rate: number): this;
2697
- defaultAccountState(state: AccountState): this;
2698
- private validateParams;
2699
- execute(): Promise<{
2700
- address: Address$1;
2701
- signature: string;
2702
- }>;
2703
- withSigner(signer: TransactionSigner): this;
2704
- }
2705
- /**
2706
- * Token2022 query helper
2707
- */
2708
- declare class Token2022Query {
2709
- private module;
2710
- constructor(module: Token2022Module);
2711
- allMints(): Promise<{
2712
- address: Address$1;
2713
- data: Token2022MintData;
2714
- }[]>;
2715
- mintsByAuthority(authority: Address$1): Promise<{
2716
- address: Address$1;
2717
- data: Token2022MintData;
2718
- }[]>;
2719
- }
2720
3839
 
2721
3840
  /**
2722
3841
  * Common utility functions for GhostSpeak SDK