@agether/sdk 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,23 +1,15 @@
1
1
  import { Signer } from 'ethers';
2
2
 
3
3
  /**
4
- * Agether SDK Types v2
4
+ * Agether SDK Types
5
5
  *
6
- * Account-based credit model:
6
+ * Architecture:
7
7
  * - Agent registers via ERC-8004 → gets agentId
8
- * - AccountFactory creates AgentAccount (smart wallet) per agent
9
- * - ReputationCredit: undercollateralized credit (LP-funded, Bayesian scoring)
10
- * - MorphoCredit: overcollateralized credit (Morpho Blue)
11
- * - Apply/approve pipeline: agent applies scoring evaluates → admin approves/rejects on-chain
8
+ * - AccountFactory creates AgentAccount (KYA-gated smart wallet) per agent
9
+ * - AgentReputation: oracle-based credit scoring
10
+ * - Morpho Blue: direct overcollateralized lending (agents interact directly)
11
+ * - x402: HTTP payment protocol for scoring API
12
12
  */
13
- declare enum CreditStatus {
14
- None = 0,
15
- Pending = 1,
16
- Active = 2,
17
- Frozen = 3,
18
- Closed = 4,
19
- Defaulted = 5
20
- }
21
13
  declare enum ChainId {
22
14
  Ethereum = 1,
23
15
  Base = 8453,
@@ -25,107 +17,59 @@ declare enum ChainId {
25
17
  Sepolia = 11155111,
26
18
  Hardhat = 31337
27
19
  }
28
- /** ICreditProvider.CreditInfo view struct */
29
- interface CreditInfo {
30
- limit: bigint;
31
- used: bigint;
32
- available: bigint;
33
- accruedInterest: bigint;
34
- aprBps: bigint;
35
- isActive: boolean;
36
- requiresCollateral: boolean;
20
+ /** Morpho Blue MarketParams struct */
21
+ interface MorphoMarketParams {
22
+ loanToken: string;
23
+ collateralToken: string;
24
+ oracle: string;
25
+ irm: string;
26
+ lltv: bigint;
37
27
  }
38
- /** ReputationCredit full credit line details */
39
- interface CreditLine {
40
- agentId: bigint;
41
- limit: bigint;
42
- used: bigint;
43
- aprBps: bigint;
44
- accruedInterest: bigint;
45
- requestedLimit: bigint;
46
- createdAt: bigint;
47
- lastActivityAt: bigint;
48
- status: CreditStatus;
28
+ /** Morpho Blue on-chain position for an account */
29
+ interface MorphoPosition {
30
+ supplyShares: bigint;
31
+ borrowShares: bigint;
32
+ collateral: bigint;
49
33
  }
50
- /** Credit application request */
51
- interface CreditApplication {
52
- agentId: bigint;
53
- requestedLimit: bigint;
34
+ /** Morpho market info (from GraphQL API or on-chain) */
35
+ interface MorphoMarketInfo {
36
+ uniqueKey: string;
37
+ loanAsset: {
38
+ address: string;
39
+ symbol: string;
40
+ decimals: number;
41
+ };
42
+ collateralAsset: {
43
+ address: string;
44
+ symbol: string;
45
+ decimals: number;
46
+ };
47
+ oracle: string;
48
+ irm: string;
49
+ lltv: bigint;
50
+ totalSupplyAssets: bigint;
51
+ totalBorrowAssets: bigint;
52
+ utilization: number;
54
53
  }
55
- /** Scored credit preview */
56
- interface ScoredLimitPreview {
57
- limit: bigint;
54
+ /** On-chain score attestation from AgentReputation contract */
55
+ interface ScoreAttestation {
58
56
  score: bigint;
59
- eligible: boolean;
60
- }
61
- /** AgentReputation data */
62
- interface AgentReputation {
63
- totalBorrowed: bigint;
64
- totalRepaid: bigint;
65
- totalInterestPaid: bigint;
66
- onTimePayments: bigint;
67
- latePayments: bigint;
68
- missedPayments: bigint;
69
- peakUtilization: bigint;
70
- avgUtilization: bigint;
71
- utilizationSamples: bigint;
72
- firstActivityAt: bigint;
73
- lastActivityAt: bigint;
74
- lastScoreUpdate: bigint;
75
- creditScore: bigint;
76
- creditLinesOpened: bigint;
77
- lastCreditOpenedAt: bigint;
78
- currentOutstanding: bigint;
79
- currentLimit: bigint;
80
- totalDeposits: bigint;
81
- totalWithdrawals: bigint;
82
- }
83
- /** Loan position tracked by AgentReputation (OCCR model) */
84
- interface LoanPosition {
85
- amount: bigint;
86
- collateral: bigint;
87
- ltvBps: bigint;
88
57
  timestamp: bigint;
89
- liquidated: boolean;
90
- repaid: boolean;
91
- active: boolean;
92
- }
93
- /** OCCR score explanation (5 subscores + raw/decayed) */
94
- interface ScoreExplanation {
95
- historical: bigint;
96
- currentRisk: bigint;
97
- utilization: bigint;
98
- onChainTx: bigint;
99
- newCredit: bigint;
100
- rawScore: bigint;
101
- decayedScore: bigint;
102
- }
103
- /** Bayesian score result */
104
- interface BayesianScore {
105
- combinedScore: bigint;
106
- confidence: bigint;
107
- }
108
- interface ScoringRequest {
109
- agentId: bigint;
110
- requestedLimit: bigint;
111
- codeHash?: string;
58
+ signer: string;
112
59
  }
113
- interface ScoringResult {
114
- approved: boolean;
115
- limit: bigint;
116
- aprBps: number;
117
- riskScore: number;
118
- bayesianScore: number;
119
- confidence: number;
120
- reason?: string;
121
- }
122
- interface DrawRequest {
123
- account: string;
124
- amount: bigint;
125
- }
126
- interface RepayRequest {
127
- account: string;
128
- amount: bigint;
60
+ /** Score result from backend scoring API */
61
+ interface ScoreResult {
62
+ agentId: string;
63
+ score: number;
64
+ timestamp: number;
65
+ breakdown: {
66
+ kyaBonus: number;
67
+ accountBonus: number;
68
+ balanceBonus: number;
69
+ historyBonus: number;
70
+ baseScore: number;
71
+ };
72
+ txHash?: string;
129
73
  }
130
74
  interface TransactionResult {
131
75
  txHash: string;
@@ -147,18 +91,6 @@ interface X402PaymentResult {
147
91
  chain: ChainId;
148
92
  status: 'pending' | 'confirmed' | 'failed';
149
93
  }
150
- interface VaultStats {
151
- totalAssets: bigint;
152
- totalBorrowed: bigint;
153
- availableLiquidity: bigint;
154
- utilizationRate: number;
155
- sharePrice: bigint;
156
- }
157
- interface LPPosition {
158
- shares: bigint;
159
- assets: bigint;
160
- pendingYield: bigint;
161
- }
162
94
  interface AgetherConfig {
163
95
  chainId: ChainId;
164
96
  rpcUrl: string;
@@ -168,56 +100,25 @@ interface AgetherConfig {
168
100
  }
169
101
  interface ContractAddresses {
170
102
  accountFactory: string;
171
- reputationCredit: string;
172
- lpVault: string;
173
103
  validationRegistry: string;
104
+ agentReputation: string;
174
105
  usdc: string;
175
106
  identityRegistry: string;
176
- morphoCredit?: string;
177
- agentReputation?: string;
178
- }
179
- interface CreditAppliedEvent {
180
- agentId: bigint;
181
- account: string;
182
- requestedLimit: bigint;
183
- timestamp: number;
184
- }
185
- interface CreditApprovedEvent {
186
- account: string;
187
- limit: bigint;
188
- aprBps: bigint;
189
- timestamp: number;
190
- }
191
- interface CreditRejectedEvent {
192
- account: string;
193
- reason: string;
194
- timestamp: number;
195
- }
196
- interface CreditDrawnEvent {
197
- account: string;
198
- amount: bigint;
199
- totalUsed: bigint;
200
- timestamp: number;
201
- }
202
- interface CreditRepaidEvent {
203
- account: string;
204
- amount: bigint;
205
- totalUsed: bigint;
206
- timestamp: number;
107
+ morphoBlue: string;
207
108
  }
208
109
  declare class AgetherError extends Error {
209
110
  code: string;
210
111
  details?: Record<string, unknown> | undefined;
211
112
  constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
212
113
  }
213
- declare class InsufficientCreditError extends AgetherError {
214
- constructor(available: bigint, requested: bigint);
114
+ declare class InsufficientBalanceError extends AgetherError {
115
+ constructor(available: bigint, required: bigint);
215
116
  }
216
117
  declare class ScoringRejectedError extends AgetherError {
217
118
  constructor(riskScore: number, reason?: string);
218
119
  }
219
- declare class CreditNotActiveError extends AgetherError {
220
- constructor(account: string, status: CreditStatus);
120
+ declare class AgentNotApprovedError extends AgetherError {
121
+ constructor(agentId: bigint);
221
122
  }
222
123
 
223
124
  interface AgetherClientOptions {
@@ -230,294 +131,414 @@ declare class AgetherClient {
230
131
  private signer;
231
132
  private agentId;
232
133
  private accountFactory;
233
- private reputationCredit;
134
+ private identityRegistry;
135
+ private validationRegistry;
136
+ private agentReputation;
234
137
  private accountAddress?;
235
- /**
236
- * Undercollateralized credit is disabled for now.
237
- * All credit operations go through MorphoCredit (overcollateralized).
238
- */
239
- private _requireUndercollateralizedEnabled;
240
138
  constructor(options: AgetherClientOptions);
241
- /**
242
- * Create client from private key.
243
- *
244
- * Simplest usage — only needs key, agentId, and chainId:
245
- * AgetherClient.fromPrivateKey(key, 42n, ChainId.Sepolia)
246
- *
247
- * All contract addresses and RPC URLs are resolved automatically.
248
- */
249
139
  static fromPrivateKey(privateKey: string, agentId: bigint, chainIdOrConfig: ChainId | AgetherConfig): AgetherClient;
250
- /**
251
- * Create an AgentAccount (smart wallet) for this agent.
252
- * Returns the account address.
253
- */
254
140
  createAccount(): Promise<string>;
255
- /**
256
- * Get the AgentAccount address for this agent.
257
- */
258
141
  getAccountAddress(): Promise<string>;
259
- /**
260
- * Check if an account already exists.
261
- */
262
142
  accountExists(): Promise<boolean>;
263
- /**
264
- * Apply for a credit line.
265
- * @deprecated Undercollateralized credit is not available yet. Use MorphoCredit.
266
- */
267
- apply(_limitOrApplication: bigint | CreditApplication): Promise<string>;
268
- /**
269
- * Get full credit line details from ReputationCredit.
270
- */
271
- getCreditLine(): Promise<CreditLine>;
272
- /**
273
- * Get ICreditProvider.CreditInfo view.
274
- */
275
- getCreditInfo(): Promise<CreditInfo>;
276
- /**
277
- * Get credit line status.
278
- */
279
- getStatus(): Promise<CreditStatus>;
280
- /**
281
- * Get available credit.
282
- */
283
- getAvailableCredit(): Promise<bigint>;
284
- /**
285
- * Get total debt (principal + interest).
286
- */
287
- getTotalDebt(): Promise<bigint>;
288
- /**
289
- * Check if agent is eligible for credit.
290
- */
291
- isEligible(): Promise<boolean>;
292
- /**
293
- * Draw funds from credit line via AgentAccount.
294
- * @deprecated Undercollateralized credit is not available yet. Use MorphoCredit.
295
- */
296
- draw(_amountOrRequest: bigint | DrawRequest): Promise<TransactionResult>;
297
- /**
298
- * Repay credit line debt via AgentAccount.
299
- * @deprecated Undercollateralized credit is not available yet. Use MorphoCredit.
300
- */
301
- repay(_amountOrRequest: bigint | RepayRequest): Promise<TransactionResult>;
302
- /**
303
- * Repay full debt.
304
- * @deprecated Undercollateralized credit is not available yet. Use MorphoCredit.
305
- */
306
- repayFull(): Promise<TransactionResult>;
307
- /**
308
- * Request a limit increase on-chain.
309
- * @deprecated Undercollateralized credit is not available yet. Use MorphoCredit.
310
- */
311
- requestLimitIncrease(_newLimit: bigint): Promise<string>;
312
- /**
313
- * Pay for a service using credit line.
314
- * @deprecated Undercollateralized credit is not available yet. Use MorphoCredit.
315
- */
316
- pay(_service: string, _amount: bigint, _asset?: string): Promise<TransactionResult>;
143
+ predictAddress(): Promise<string>;
144
+ getBalances(): Promise<{
145
+ eoa: {
146
+ eth: string;
147
+ usdc: string;
148
+ };
149
+ account?: {
150
+ address: string;
151
+ eth: string;
152
+ usdc: string;
153
+ };
154
+ }>;
155
+ fundAccount(usdcAmount: string): Promise<TransactionResult>;
156
+ withdrawUsdc(usdcAmount: string): Promise<TransactionResult>;
157
+ withdrawEth(ethAmount: string): Promise<TransactionResult>;
158
+ isKyaApproved(): Promise<boolean>;
159
+ identityExists(): Promise<boolean>;
160
+ getIdentityOwner(): Promise<string>;
161
+ getCreditScore(): Promise<bigint>;
162
+ isScoreFresh(): Promise<{
163
+ fresh: boolean;
164
+ age: bigint;
165
+ }>;
166
+ isEligible(minScore?: bigint): Promise<{
167
+ eligible: boolean;
168
+ currentScore: bigint;
169
+ }>;
317
170
  get chainId(): ChainId;
318
171
  get contracts(): ContractAddresses;
319
172
  get currentAccountAddress(): string | undefined;
320
- /** Get the underlying signer */
321
173
  getSigner(): Signer;
174
+ getAgentId(): bigint;
322
175
  }
323
176
 
324
177
  /**
325
- * ScoringClient - Client for the Agether backend scoring API (v2)
178
+ * MorphoClient Direct Morpho Blue lending via AgentAccount.executeBatch
326
179
  *
327
- * Connects to backend service at /credit/* and /admin/* endpoints.
328
- * The backend evaluates agents based on:
329
- * - On-chain reputation (AgentReputation contract, Bayesian scoring)
330
- * - Code audit status (ValidationRegistry)
331
- * - Default history
332
- * - Risk model
180
+ * Architecture (no intermediary contract):
181
+ * EOA AgentAccount.executeBatch Morpho Blue (direct)
333
182
  *
334
- * v2: account-based (not creditLineId-based)
183
+ * Batched operations:
184
+ * - depositAndBorrow: [ERC20.approve, Morpho.supplyCollateral, Morpho.borrow]
185
+ * - repay: [ERC20.approve, Morpho.repay]
186
+ * - supplyCollateral: [ERC20.approve, Morpho.supplyCollateral]
187
+ *
188
+ * Market discovery via Morpho GraphQL API (https://api.morpho.org/graphql)
335
189
  */
336
190
 
337
- interface ScoringContext {
338
- purpose?: string;
339
- reasoningTrace?: string[];
340
- runtimeEnv?: string;
191
+ interface MorphoClientConfig {
192
+ privateKey: string;
193
+ rpcUrl: string;
194
+ agentId?: string;
195
+ chainId?: ChainId;
196
+ contracts?: Partial<{
197
+ accountFactory: string;
198
+ morphoBlue: string;
199
+ usdc: string;
200
+ agentReputation: string;
201
+ identityRegistry: string;
202
+ }>;
203
+ }
204
+ interface BalancesResult {
205
+ agentId: string;
206
+ address: string;
207
+ eth: string;
208
+ usdc: string;
209
+ agentAccount?: {
210
+ address: string;
211
+ eth: string;
212
+ usdc: string;
213
+ };
341
214
  }
342
- interface RiskCheckResponse {
343
- riskScore: number;
344
- level: 'low' | 'medium' | 'high';
345
- wouldApprove: boolean;
346
- factors: RiskFactor[];
215
+ interface RegisterResult {
216
+ agentId: string;
217
+ address: string;
218
+ agentAccount: string;
219
+ alreadyRegistered: boolean;
220
+ tx?: string;
347
221
  }
348
- interface RiskFactor {
349
- name: string;
350
- score: number;
351
- weight: number;
352
- description: string;
222
+ interface PositionResult {
223
+ marketId: string;
224
+ collateralToken: string;
225
+ collateral: string;
226
+ borrowShares: string;
227
+ supplyShares: string;
228
+ debt: string;
353
229
  }
354
- interface GraduationStatus {
355
- eligible: boolean;
356
- reason: string;
357
- stats: {
358
- onTimeRepayments: number;
359
- totalVolume: string;
360
- creditScore: number;
361
- };
230
+ interface StatusResult {
231
+ agentId: string;
232
+ agentAccount: string;
233
+ totalDebt: string;
234
+ positions: PositionResult[];
362
235
  }
363
- declare class ScoringClient {
364
- private client;
365
- constructor(endpoint: string, apiKey?: string);
366
- /**
367
- * Evaluate a credit application (does not submit on-chain)
368
- * Backend endpoint: POST /credit/evaluate
369
- */
370
- evaluateCredit(request: ScoringRequest): Promise<ScoringResult>;
236
+ interface DepositResult {
237
+ tx: string;
238
+ collateralToken: string;
239
+ amount: string;
240
+ agentAccount: string;
241
+ }
242
+ interface BorrowResult {
243
+ tx: string;
244
+ amount: string;
245
+ collateralToken: string;
246
+ agentAccount: string;
247
+ }
248
+ interface DepositAndBorrowResult {
249
+ tx: string;
250
+ collateralToken: string;
251
+ collateralAmount: string;
252
+ borrowAmount: string;
253
+ agentAccount: string;
254
+ }
255
+ interface RepayResult {
256
+ tx: string;
257
+ amount: string;
258
+ remainingDebt: string;
259
+ }
260
+ interface WithdrawResult {
261
+ tx: string;
262
+ token: string;
263
+ amount: string;
264
+ remainingCollateral: string;
265
+ destination: string;
266
+ }
267
+ interface FundResult {
268
+ tx: string;
269
+ amount: string;
270
+ agentAccount: string;
271
+ }
272
+ declare class MorphoClient {
273
+ private wallet;
274
+ private provider;
275
+ private config;
276
+ private agentId;
277
+ private accountFactory;
278
+ private morphoBlue;
279
+ private agentReputation;
280
+ private identityRegistry;
281
+ private _accountAddress?;
282
+ private _marketCache;
283
+ private _discoveredMarkets?;
284
+ private _discoveredAt;
285
+ constructor(config: MorphoClientConfig);
286
+ /** Resolve the AgentAccount address (cached). */
287
+ getAccountAddress(): Promise<string>;
288
+ getAgentId(): string;
289
+ getWalletAddress(): string;
371
290
  /**
372
- * Process a credit application (evaluate + on-chain approve/reject)
373
- * Backend endpoint: POST /admin/credit/process
374
- *
375
- * Requires the credit application to be in Pending status on-chain
376
- * (agent must have called applyForCredit first).
291
+ * Register: create ERC-8004 identity + AgentAccount in one flow.
292
+ * If already registered, returns existing state.
377
293
  */
378
- processApplication(agentId: bigint, requestedLimit: bigint, codeHash?: string): Promise<{
379
- success: boolean;
380
- txHash?: string;
381
- error?: string;
382
- }>;
294
+ register(_name?: string): Promise<RegisterResult>;
295
+ /** Get ETH / USDC balances for EOA and AgentAccount. */
296
+ getBalances(): Promise<BalancesResult>;
297
+ /** Transfer USDC from EOA to AgentAccount. */
298
+ fundAccount(usdcAmount: string): Promise<FundResult>;
383
299
  /**
384
- * Get credit score for an agent
385
- * Backend endpoint: GET /credit/score/:agentId
300
+ * Fetch USDC borrow markets on Base from Morpho API.
301
+ * Caches results for 5 minutes.
386
302
  */
387
- getCreditScore(agentId: bigint): Promise<{
388
- agentId: string;
389
- creditScore: number;
390
- bayesianScore: number;
391
- confidence: number;
392
- }>;
303
+ getMarkets(forceRefresh?: boolean): Promise<MorphoMarketInfo[]>;
393
304
  /**
394
- * Preview scored limit for an agent
395
- * Backend endpoint: GET /credit/preview/:agentId
305
+ * Get MarketParams for a collateral token.
306
+ * Tries cache API → on-chain idToMarketParams.
396
307
  */
397
- previewScoredLimit(agentId: bigint): Promise<{
398
- limit: string;
399
- score: string;
400
- eligible: boolean;
401
- }>;
308
+ findMarketForCollateral(collateralSymbolOrAddress: string): Promise<MorphoMarketParams>;
309
+ /** Read MarketParams on-chain by market ID (bytes32). */
310
+ getMarketParams(marketId: string): Promise<MorphoMarketParams>;
311
+ /** Read on-chain position for a specific market. */
312
+ getPosition(marketId: string): Promise<MorphoPosition>;
402
313
  /**
403
- * Get credit line info for an agent
404
- * Backend endpoint: GET /credit/agent/:agentId
314
+ * Full status: positions across all discovered markets.
405
315
  */
406
- getAgentCredit(agentId: bigint): Promise<{
407
- agentId: string;
408
- account: string;
409
- creditInfo: Record<string, unknown>;
410
- creditLine: Record<string, unknown>;
411
- }>;
316
+ getStatus(): Promise<StatusResult>;
412
317
  /**
413
- * Get protocol info
414
- * Backend endpoint: GET /credit/protocol-info
318
+ * Deposit collateral into Morpho Blue.
319
+ *
320
+ * Flow:
321
+ * 1. EOA transfers collateral to AgentAccount
322
+ * 2. AgentAccount.executeBatch:
323
+ * [collateral.approve(MorphoBlue), Morpho.supplyCollateral(params)]
415
324
  */
416
- getProtocolInfo(): Promise<{
417
- dailyDrawLimit: string;
418
- totalBorrowed: string;
419
- asset: string;
420
- }>;
325
+ supplyCollateral(tokenSymbol: string, amount: string, marketParams?: MorphoMarketParams): Promise<DepositResult>;
421
326
  /**
422
- * Get backend service status
423
- * Backend endpoint: GET /status
327
+ * Borrow USDC against existing collateral.
328
+ *
329
+ * AgentAccount.execute: Morpho.borrow(params, amount, 0, account, account)
330
+ *
331
+ * @param usdcAmount - USDC amount (e.g. '100')
332
+ * @param tokenSymbol - collateral symbol to identify which market (default: first with collateral)
424
333
  */
425
- getStatus(): Promise<{
426
- status: string;
427
- version: string;
428
- signer: string;
429
- contracts: {
430
- healthy: boolean;
431
- };
432
- }>;
334
+ borrow(usdcAmount: string, tokenSymbol?: string, marketParams?: MorphoMarketParams): Promise<BorrowResult>;
433
335
  /**
434
- * Get full OCCR score explanation with subscores, decay, and loan positions
435
- * Backend endpoint: GET /agents/:agentId/score-explanation
336
+ * Deposit collateral AND borrow USDC in one batched transaction.
337
+ *
338
+ * AgentAccount.executeBatch:
339
+ * [collateral.approve, Morpho.supplyCollateral, Morpho.borrow]
340
+ *
341
+ * The collateral must be transferred to AgentAccount first.
436
342
  */
437
- getScoreExplanation(agentId: bigint): Promise<{
438
- agentId: string;
439
- subscores: {
440
- historical: number;
441
- currentRisk: number;
442
- utilization: number;
443
- onChainTx: number;
444
- newCredit: number;
445
- };
446
- rawScore: number;
447
- decayedScore: number;
448
- stressMultiplier: number;
449
- decayPeriod: number;
450
- loanPositions: Array<{
451
- amount: string;
452
- collateral: string;
453
- ltvBps: number;
454
- timestamp: number;
455
- liquidated: boolean;
456
- repaid: boolean;
457
- active: boolean;
458
- }>;
459
- }>;
460
- }
461
-
462
- /**
463
- * VaultClient - Client for liquidity providers
464
- */
465
-
466
- interface VaultClientOptions {
467
- config: AgetherConfig;
468
- signer: Signer;
469
- }
470
- declare class VaultClient {
471
- private config;
472
- private signer;
473
- private vault;
474
- private asset?;
475
- constructor(options: VaultClientOptions);
343
+ depositAndBorrow(tokenSymbol: string, collateralAmount: string, borrowUsdcAmount: string, marketParams?: MorphoMarketParams): Promise<DepositAndBorrowResult>;
476
344
  /**
477
- * Deposit assets to vault
345
+ * Repay borrowed USDC from AgentAccount.
346
+ *
347
+ * AgentAccount.executeBatch:
348
+ * [USDC.approve(MorphoBlue), Morpho.repay(params)]
478
349
  */
479
- deposit(amount: bigint): Promise<TransactionResult>;
350
+ repay(usdcAmount: string, tokenSymbol?: string, marketParams?: MorphoMarketParams): Promise<RepayResult>;
480
351
  /**
481
- * Withdraw assets from vault
352
+ * Withdraw collateral from Morpho Blue.
353
+ *
354
+ * AgentAccount.execute: Morpho.withdrawCollateral(params, amount, account, receiver)
355
+ *
356
+ * @param receiver - defaults to EOA wallet
482
357
  */
483
- withdraw(amount: bigint): Promise<TransactionResult>;
358
+ withdrawCollateral(tokenSymbol: string, amount: string, marketParams?: MorphoMarketParams, receiver?: string): Promise<WithdrawResult>;
484
359
  /**
485
- * Redeem shares for assets
360
+ * Sponsor: transfer collateral to another agent's AgentAccount.
361
+ * (The agent must then supplyCollateral themselves via their own account.)
486
362
  */
487
- redeem(shares: bigint): Promise<TransactionResult>;
363
+ sponsor(target: {
364
+ agentId?: string;
365
+ address?: string;
366
+ }, tokenSymbol: string, amount: string): Promise<{
367
+ tx: string;
368
+ targetAccount: string;
369
+ targetAgentId?: string;
370
+ }>;
371
+ getCreditScore(): Promise<bigint>;
372
+ getAttestation(): Promise<ScoreAttestation>;
373
+ isEligible(minScore?: bigint): Promise<{
374
+ eligible: boolean;
375
+ currentScore: bigint;
376
+ }>;
377
+ isScoreFresh(): Promise<{
378
+ fresh: boolean;
379
+ age: bigint;
380
+ }>;
488
381
  /**
489
- * Get vault statistics
382
+ * Execute a single call via AgentAccount.execute.
490
383
  */
491
- getStats(): Promise<VaultStats>;
384
+ private exec;
492
385
  /**
493
- * Get LP position
386
+ * Execute multiple calls via AgentAccount.executeBatch.
494
387
  */
495
- getPosition(address?: string): Promise<LPPosition>;
388
+ private batch;
389
+ /** Convert MorphoMarketParams to Solidity tuple. */
390
+ private _toTuple;
391
+ /** Find the first market where the agent has collateral deposited. */
392
+ private _findActiveMarket;
393
+ }
394
+
395
+ /**
396
+ * x402 HTTP Client — Make paid API calls via the x402 protocol (v2)
397
+ *
398
+ * Implements the Coinbase x402 spec:
399
+ * https://github.com/coinbase/x402
400
+ *
401
+ * Flow:
402
+ * 1. Client → Resource Server (normal request)
403
+ * 2. Resource Server → 402 with PaymentRequired JSON body
404
+ * Body: { x402Version, error, resource, accepts: [PaymentRequirements…] }
405
+ * 3. Client picks a PaymentRequirements from `accepts`,
406
+ * signs an EIP-3009 transferWithAuthorization (EIP-712 typed data),
407
+ * builds a PaymentPayload, base64-encodes it as PAYMENT-SIGNATURE header
408
+ * 4. Client → Resource Server (retries with PAYMENT-SIGNATURE)
409
+ * 5. Resource Server forwards to Facilitator /verify → /settle
410
+ * 6. Resource Server → 200 + data (or error)
411
+ *
412
+ * Chain support: Base (8453), Ethereum (1), and Hardhat fork (31337).
413
+ * USDC domain is resolved per-chain from USDC_DOMAINS map.
414
+ */
415
+ interface X402Config {
416
+ privateKey: string;
417
+ rpcUrl: string;
418
+ backendUrl: string;
419
+ agentId?: string;
420
+ accountAddress?: string;
421
+ }
422
+ interface X402Response<T = unknown> {
423
+ success: boolean;
424
+ data?: T;
425
+ error?: string;
426
+ paymentInfo?: {
427
+ amount: string;
428
+ asset: string;
429
+ network: string;
430
+ txHash?: string;
431
+ };
432
+ }
433
+ /** One item inside the `accepts` array returned by the resource server */
434
+ interface PaymentRequirements {
435
+ scheme: string;
436
+ network: string;
437
+ amount: string;
438
+ asset: string;
439
+ payTo: string;
440
+ maxTimeoutSeconds: number;
441
+ extra?: Record<string, unknown>;
442
+ }
443
+ declare class X402Client {
444
+ private wallet;
445
+ private config;
446
+ constructor(config: X402Config);
447
+ get<T = unknown>(url: string, opts?: RequestInit): Promise<X402Response<T>>;
448
+ post<T = unknown>(url: string, body?: unknown, opts?: RequestInit): Promise<X402Response<T>>;
449
+ getAddress(): string;
450
+ private request;
451
+ private parsePaymentRequired;
452
+ private buildPaymentPayload;
453
+ private riskCheck;
454
+ }
455
+
456
+ /**
457
+ * ScoringClient — Client for the Agether backend scoring API
458
+ *
459
+ * Endpoints:
460
+ * GET /score/:agentId — x402-gated, compute + submit score on-chain
461
+ * GET /score/:agentId/current — free, read current on-chain score
462
+ * GET /health — service health
463
+ * GET /status — detailed status
464
+ * GET /agents/:agentId/details — agent details
465
+ */
466
+
467
+ interface ScoringClientConfig {
468
+ /** Backend base URL (e.g. http://95.179.189.214:3001) */
469
+ endpoint: string;
470
+ /** x402 config for paid scoring calls (optional — if not set, paid calls will fail) */
471
+ x402?: X402Config;
472
+ }
473
+ declare class ScoringClient {
474
+ private client;
475
+ private x402Client?;
476
+ private endpoint;
477
+ constructor(config: ScoringClientConfig);
496
478
  /**
497
- * Preview deposit (how many shares for assets)
479
+ * Request a fresh score computation.
480
+ *
481
+ * This is x402-gated: the backend returns 402, the X402Client
482
+ * signs an EIP-3009 payment, and the backend computes + submits
483
+ * the score on-chain via AgentReputation.submitScore().
484
+ *
485
+ * Returns the ScoreResult with breakdown and txHash.
498
486
  */
499
- previewDeposit(assets: bigint): Promise<bigint>;
487
+ requestScore(agentId: string | bigint): Promise<ScoreResult>;
500
488
  /**
501
- * Preview withdraw (how many assets for shares)
489
+ * Get the current on-chain score (free, no payment required).
502
490
  */
503
- previewRedeem(shares: bigint): Promise<bigint>;
491
+ getCurrentScore(agentId: string | bigint): Promise<{
492
+ agentId: string;
493
+ score: number;
494
+ timestamp: number;
495
+ signer: string;
496
+ fresh: boolean;
497
+ age: number;
498
+ }>;
504
499
  /**
505
- * Check if withdrawal is allowed (sufficient liquidity)
500
+ * Get detailed agent info from backend.
506
501
  */
507
- canWithdraw(assets: bigint): Promise<boolean>;
502
+ getAgentDetails(agentId: string | bigint): Promise<{
503
+ agentId: string;
504
+ owner: string;
505
+ account: string;
506
+ accountExists: boolean;
507
+ kyaApproved: boolean;
508
+ score: number;
509
+ scoreFresh: boolean;
510
+ eligible: boolean;
511
+ }>;
508
512
  /**
509
- * Get current APY estimate
513
+ * Health check.
510
514
  */
511
- estimateAPY(): Promise<number>;
512
- private getAsset;
515
+ getHealth(): Promise<{
516
+ status: string;
517
+ timestamp: string;
518
+ }>;
513
519
  /**
514
- * Get underlying asset address
520
+ * Detailed status (contracts, signer, chain).
515
521
  */
516
- getAssetAddress(): Promise<string>;
522
+ getStatus(): Promise<{
523
+ status: string;
524
+ chain: {
525
+ id: number;
526
+ name: string;
527
+ };
528
+ contracts: Record<string, string>;
529
+ scoring: {
530
+ priceUsdc: string;
531
+ x402PayToAddress: string;
532
+ };
533
+ signer: string;
534
+ }>;
517
535
  /**
518
- * Get vault share token address
536
+ * Agent count and list.
519
537
  */
520
- getVaultAddress(): string;
538
+ getAgentCount(): Promise<{
539
+ totalAgents: number;
540
+ totalAccounts: number;
541
+ }>;
521
542
  }
522
543
 
523
544
  /**
@@ -703,423 +724,6 @@ declare class AgentIdentityClient {
703
724
  };
704
725
  }
705
726
 
706
- /**
707
- * x402 HTTP Client — Make paid API calls via the x402 protocol (v2)
708
- *
709
- * Implements the Coinbase x402 spec:
710
- * https://github.com/coinbase/x402
711
- *
712
- * Flow:
713
- * 1. Client → Resource Server (normal request)
714
- * 2. Resource Server → 402 with PaymentRequired JSON body
715
- * Body: { x402Version, error, resource, accepts: [PaymentRequirements…] }
716
- * 3. Client picks a PaymentRequirements from `accepts`,
717
- * signs an EIP-3009 transferWithAuthorization (EIP-712 typed data),
718
- * builds a PaymentPayload, base64-encodes it as PAYMENT-SIGNATURE header
719
- * 4. Client → Resource Server (retries with PAYMENT-SIGNATURE)
720
- * 5. Resource Server forwards to Facilitator /verify → /settle
721
- * 6. Resource Server → 200 + data (or error)
722
- *
723
- * Chain support: Base (8453), Ethereum (1), and Hardhat fork (31337).
724
- * USDC domain is resolved per-chain from USDC_DOMAINS map.
725
- */
726
- interface X402Config {
727
- privateKey: string;
728
- rpcUrl: string;
729
- backendUrl: string;
730
- agentId?: string;
731
- accountAddress?: string;
732
- /** Auto-borrow from Morpho credit line when USDC balance is insufficient for payment */
733
- autoDraw?: boolean;
734
- /** MorphoCredit contract address (required for autoDraw) */
735
- morphoCreditAddress?: string;
736
- }
737
- interface X402Response<T = unknown> {
738
- success: boolean;
739
- data?: T;
740
- error?: string;
741
- paymentInfo?: {
742
- amount: string;
743
- asset: string;
744
- network: string;
745
- txHash?: string;
746
- };
747
- }
748
- /** One item inside the `accepts` array returned by the resource server */
749
- interface PaymentRequirements {
750
- scheme: string;
751
- network: string;
752
- amount: string;
753
- asset: string;
754
- payTo: string;
755
- maxTimeoutSeconds: number;
756
- extra?: Record<string, unknown>;
757
- }
758
- declare class X402Client {
759
- private wallet;
760
- private config;
761
- constructor(config: X402Config);
762
- get<T = unknown>(url: string, opts?: RequestInit): Promise<X402Response<T>>;
763
- post<T = unknown>(url: string, body?: unknown, opts?: RequestInit): Promise<X402Response<T>>;
764
- getAddress(): string;
765
- private request;
766
- private parsePaymentRequired;
767
- private buildPaymentPayload;
768
- private static readonly MORPHO_DRAW_ABI;
769
- private static readonly AGENT_ACCOUNT_EXEC_ABI;
770
- private static readonly ERC20_BALANCE_ABI;
771
- private static readonly AUTO_DRAW_COLLATERALS;
772
- private ensureBalance;
773
- private riskCheck;
774
- }
775
-
776
- /**
777
- * MorphoCreditClient — SDK client for Morpho-backed overcollateralized credit
778
- *
779
- * Full lifecycle for AI agents:
780
- * - Register (ERC-8004 + AccountFactory)
781
- * - Check balances and status
782
- * - Deposit collateral + borrow USDC
783
- * - Repay debt + withdraw collateral
784
- * - Sponsor another agent
785
- * - Fund AgentAccount
786
- */
787
- interface MorphoCreditConfig {
788
- /** Private key for signing */
789
- privateKey: string;
790
- /** Base RPC URL */
791
- rpcUrl: string;
792
- /** Agent's ERC-8004 ID (optional — auto-resolved from chain if omitted) */
793
- agentId?: string | bigint;
794
- /** Contract addresses */
795
- contracts: {
796
- morphoCredit: string;
797
- accountFactory: string;
798
- usdc: string;
799
- /** ERC-8004 identity registry (needed for register()) */
800
- agentRegistry?: string;
801
- };
802
- }
803
- interface CollateralToken {
804
- symbol: string;
805
- address: string;
806
- decimals: number;
807
- }
808
- interface MorphoPosition {
809
- token: string;
810
- collateralAmount: bigint;
811
- borrowedAmount: bigint;
812
- borrowShares: bigint;
813
- isActive: boolean;
814
- }
815
- interface DepositResult {
816
- tx: string;
817
- amount: bigint;
818
- token: string;
819
- agentAccount: string;
820
- totalCollateral: bigint;
821
- }
822
- interface BorrowResult {
823
- tx: string;
824
- amount: bigint;
825
- agentAccount: string;
826
- totalDebt: bigint;
827
- collateralToken: string;
828
- }
829
- interface DepositAndBorrowResult {
830
- depositTx: string;
831
- borrowTx: string;
832
- collateral: {
833
- amount: bigint;
834
- token: string;
835
- };
836
- borrowed: bigint;
837
- agentAccount: string;
838
- totalDebt: bigint;
839
- }
840
- interface SponsorResult {
841
- depositTx: string;
842
- borrowTx?: string;
843
- targetAccount: string;
844
- targetAgentId?: string;
845
- collateral: {
846
- amount: bigint;
847
- token: string;
848
- };
849
- borrowed?: bigint;
850
- totalCollateral: bigint;
851
- totalDebt: bigint;
852
- }
853
- interface RepayResult {
854
- tx: string;
855
- amount: bigint;
856
- remainingDebt: bigint;
857
- }
858
- interface WithdrawResult {
859
- tx: string;
860
- amount: bigint;
861
- token: string;
862
- destination: string;
863
- remainingCollateral: bigint;
864
- }
865
- interface RegisterResult {
866
- tx: string;
867
- agentId: string;
868
- address: string;
869
- agentAccount: string;
870
- alreadyRegistered: boolean;
871
- }
872
- interface BalancesResult {
873
- address: string;
874
- agentId: string;
875
- eth: string;
876
- usdc: string;
877
- agentAccount?: {
878
- address: string;
879
- eth: string;
880
- usdc: string;
881
- };
882
- }
883
- interface StatusResult {
884
- agentAccount: string;
885
- totalDebt: string;
886
- positions: Array<{
887
- token: string;
888
- collateral: string;
889
- debt: string;
890
- active: boolean;
891
- }>;
892
- }
893
- interface FundResult {
894
- tx: string;
895
- amount: string;
896
- agentAccount: string;
897
- }
898
- interface LtvCheckResult {
899
- ok: boolean;
900
- currentLtv: number;
901
- newLtv: number;
902
- maxLtv: number;
903
- collateralUsd: number;
904
- currentDebt: number;
905
- maxBorrow: number;
906
- message?: string;
907
- }
908
- declare class MorphoCreditClient {
909
- private signer;
910
- private config;
911
- private morpho;
912
- private factory;
913
- private accountAddress?;
914
- private resolvedAgentId?;
915
- private collaterals;
916
- private static readonly ERC8004_ABI;
917
- constructor(config: MorphoCreditConfig, collaterals?: Record<string, CollateralToken>);
918
- private resolveToken;
919
- /**
920
- * Resolve agentId — from config, cache, or on-chain lookup.
921
- */
922
- getAgentId(): Promise<string>;
923
- /**
924
- * Get the AgentAccount address for the configured agentId.
925
- */
926
- getAccountAddress(): Promise<string>;
927
- /**
928
- * Get the AgentAccount address for any agentId.
929
- */
930
- getAccountForAgent(agentId: string | bigint): Promise<string>;
931
- private ensureCreditProvider;
932
- /**
933
- * Approve ERC-20 token from EOA → MorphoCredit, then deposit for account.
934
- * This is 2 EOA txs (approve + depositCollateralFor) — cannot be batched
935
- * because both are called from EOA, not from AgentAccount.
936
- */
937
- private approveAndDeposit;
938
- private morphoIface;
939
- private erc20Iface;
940
- /**
941
- * Execute multiple calls via AgentAccount.executeBatch() in a single tx.
942
- * Each call is { target, value, data }.
943
- */
944
- private batch;
945
- /**
946
- * Register a new ERC-8004 agent identity and create an AgentAccount.
947
- * If already registered (agentId in config or on-chain), returns existing info.
948
- *
949
- * @param name - Agent display name
950
- */
951
- register(name: string): Promise<RegisterResult>;
952
- /**
953
- * Get ETH and USDC balances for EOA wallet and AgentAccount.
954
- */
955
- getBalances(): Promise<BalancesResult>;
956
- /**
957
- * Get full Morpho credit status — all positions + total debt.
958
- */
959
- getStatus(): Promise<StatusResult>;
960
- /**
961
- * Transfer USDC from EOA wallet into AgentAccount.
962
- *
963
- * @param amount - Human-readable USDC amount (e.g. "50")
964
- */
965
- fundAccount(amount: string): Promise<FundResult>;
966
- private static readonly ORACLE_ABI;
967
- /**
968
- * Check whether a borrow would exceed max LTV.
969
- * Call before borrow() or depositAndBorrow() to get a clear error instead of on-chain revert.
970
- *
971
- * @param tokenSymbol - Collateral token
972
- * @param additionalCollateral - Additional collateral being deposited ("0" if just borrowing)
973
- * @param borrowAmount - USDC to borrow
974
- */
975
- checkLtv(tokenSymbol: string, additionalCollateral: string, borrowAmount: string): Promise<LtvCheckResult>;
976
- /**
977
- * Deposit collateral from EOA into Morpho for own AgentAccount.
978
- * Does NOT borrow — use `borrow()` or `depositAndBorrow()` for that.
979
- *
980
- * @param tokenSymbol - Collateral token (WETH, wstETH, cbETH)
981
- * @param amount - Human-readable amount (e.g. "0.05")
982
- */
983
- deposit(tokenSymbol: string, amount: string): Promise<DepositResult>;
984
- /**
985
- * Deposit collateral AND borrow USDC in a single SDK call.
986
- * USDC lands in the AgentAccount.
987
- *
988
- * @param tokenSymbol - Collateral token (WETH, wstETH, cbETH)
989
- * @param collateralAmount - Human-readable collateral amount (e.g. "0.05")
990
- * @param borrowAmount - Human-readable USDC amount to borrow (e.g. "50")
991
- */
992
- depositAndBorrow(tokenSymbol: string, collateralAmount: string, borrowAmount: string): Promise<DepositAndBorrowResult>;
993
- /**
994
- * Borrow USDC against already-deposited collateral.
995
- * Auto-detects which collateral token has a position.
996
- * USDC lands in AgentAccount — ready for x402 payments.
997
- *
998
- * @param amount - Human-readable USDC amount (e.g. "100")
999
- */
1000
- borrow(amount: string): Promise<BorrowResult>;
1001
- /**
1002
- * Deposit collateral for another agent. Caller pays from their wallet.
1003
- * Optionally borrow USDC for the agent (only works if caller owns the AgentAccount).
1004
- *
1005
- * Supports both agentId lookup and direct address.
1006
- *
1007
- * @param target - `{ agentId: "17676" }` or `{ address: "0x..." }`
1008
- * @param tokenSymbol - Collateral token
1009
- * @param amount - Human-readable collateral amount
1010
- * @param borrowAmount - Optional: USDC to borrow (only if caller is owner)
1011
- */
1012
- sponsor(target: {
1013
- agentId: string | bigint;
1014
- } | {
1015
- address: string;
1016
- }, tokenSymbol: string, amount: string, borrowAmount?: string): Promise<SponsorResult>;
1017
- /**
1018
- * Repay borrowed USDC from AgentAccount back to Morpho.
1019
- *
1020
- * @param amount - Human-readable USDC amount (e.g. "50")
1021
- */
1022
- repay(amount: string): Promise<RepayResult>;
1023
- /**
1024
- * Withdraw collateral from Morpho back to EOA.
1025
- *
1026
- * @param tokenSymbol - Collateral token
1027
- * @param amount - Human-readable amount or "all"
1028
- */
1029
- withdraw(tokenSymbol: string, amount: string): Promise<WithdrawResult>;
1030
- /**
1031
- * Get position for a specific collateral token.
1032
- */
1033
- getPosition(tokenSymbol: string): Promise<MorphoPosition>;
1034
- /**
1035
- * Get all active positions across all collateral tokens.
1036
- */
1037
- getAllPositions(): Promise<MorphoPosition[]>;
1038
- /**
1039
- * Get total debt across all positions.
1040
- */
1041
- getTotalDebt(): Promise<bigint>;
1042
- /**
1043
- * Get USDC balance in the AgentAccount.
1044
- */
1045
- getAccountUSDC(): Promise<bigint>;
1046
- /** Get the wallet (signer) address */
1047
- getAddress(): string;
1048
- }
1049
-
1050
- /**
1051
- * WalletClient - SDK for AgentAccount (smart wallet) operations (v2)
1052
- *
1053
- * Handles:
1054
- * - Account creation and lookup via AccountFactory
1055
- * - Funding and withdrawing tokens
1056
- * - Drawing/repaying credit via AgentAccount
1057
- * - Token balance queries
1058
- */
1059
- interface WalletInfo {
1060
- address: string;
1061
- agentId: bigint;
1062
- owner: string;
1063
- ethBalance: bigint;
1064
- usdcBalance: bigint;
1065
- }
1066
- interface ProviderStatus {
1067
- provider: string;
1068
- isEligible: boolean;
1069
- totalDebt: bigint;
1070
- maxDrawable: bigint;
1071
- }
1072
- interface MorphoMarketParams {
1073
- loanToken: string;
1074
- collateralToken: string;
1075
- oracle: string;
1076
- irm: string;
1077
- lltv: bigint;
1078
- }
1079
- interface PaymentProof {
1080
- recipient: string;
1081
- amount: bigint;
1082
- nonce: bigint;
1083
- deadline: bigint;
1084
- signature: string;
1085
- }
1086
- interface WalletClientConfig {
1087
- rpcUrl: string;
1088
- chainId: number;
1089
- factoryAddress: string;
1090
- usdcAddress?: string;
1091
- privateKey?: string;
1092
- }
1093
- declare class WalletClient {
1094
- private provider;
1095
- private privateKey;
1096
- private factoryAddress;
1097
- private usdcAddress;
1098
- private chainId;
1099
- private rpcUrl;
1100
- constructor(config: WalletClientConfig);
1101
- /**
1102
- * Create a fresh signer to avoid nonce caching issues
1103
- */
1104
- private getFreshSigner;
1105
- private getFactoryContract;
1106
- private getAccountContract;
1107
- getChainId(): number;
1108
- accountExists(agentId: bigint): Promise<boolean>;
1109
- getAccount(agentId: bigint): Promise<string | null>;
1110
- predictAddress(agentId: bigint): Promise<string>;
1111
- createAccount(agentId: bigint): Promise<string>;
1112
- totalAccounts(): Promise<bigint>;
1113
- getWalletInfo(accountAddress: string): Promise<WalletInfo>;
1114
- getProviderStatus(accountAddress: string, creditProvider: string): Promise<ProviderStatus>;
1115
- fundAccount(accountAddress: string, tokenAddress: string, amount: bigint): Promise<string>;
1116
- withdraw(accountAddress: string, tokenAddress: string, amount: bigint, to?: string): Promise<string>;
1117
- drawCredit(accountAddress: string, creditProvider: string, amount: bigint): Promise<string>;
1118
- repayCredit(accountAddress: string, creditProvider: string, amount: bigint): Promise<string>;
1119
- execute(accountAddress: string, target: string, value: bigint, data: string): Promise<string>;
1120
- generatePaymentMessageHash(accountAddress: string, recipient: string, amount: bigint, nonce: bigint, deadline: bigint, chainId: number): string;
1121
- }
1122
-
1123
727
  /**
1124
728
  * Formatting utilities
1125
729
  */
@@ -1165,15 +769,32 @@ declare function bpsToRate(bps: bigint): number;
1165
769
  declare function rateToBps(rate: number): bigint;
1166
770
 
1167
771
  /**
1168
- * Network configurations (v2)
772
+ * Contract ABIs (minimal for SDK)
773
+ *
774
+ * Architecture:
775
+ * - AccountFactory + AgentAccount (KYA-gated smart wallets)
776
+ * - AgentReputation (oracle-based credit scores)
777
+ * - ValidationRegistry (KYA code validation)
778
+ * - ERC-8004 IdentityRegistry
779
+ * - Morpho Blue (direct overcollateralized lending)
780
+ */
781
+ declare const IDENTITY_REGISTRY_ABI: string[];
782
+ declare const ACCOUNT_FACTORY_ABI: string[];
783
+ declare const AGENT_ACCOUNT_ABI: string[];
784
+ declare const AGENT_REPUTATION_ABI: string[];
785
+ declare const VALIDATION_REGISTRY_ABI: string[];
786
+ declare const MORPHO_BLUE_ABI: string[];
787
+ declare const ERC20_ABI: string[];
788
+
789
+ /**
790
+ * Network configurations
1169
791
  *
1170
- * v2 contract architecture:
1171
- * - AccountFactory + AgentAccount (smart wallets)
1172
- * - ReputationCredit (ICreditProvider, undercollateralized)
1173
- * - LPVault (ERC-4626)
1174
- * - ValidationRegistry (KYA)
1175
- * - AgentReputation (Bayesian scoring)
792
+ * Contract architecture:
793
+ * - AccountFactory + AgentAccount (KYA-gated smart wallets)
794
+ * - AgentReputation (oracle-based scoring)
795
+ * - ValidationRegistry (KYA code validation)
1176
796
  * - ERC-8004 IdentityRegistry
797
+ * - Morpho Blue (direct overcollateralized lending)
1177
798
  *
1178
799
  * All contract addresses are baked in — agents only need to specify chainId.
1179
800
  */
@@ -1186,31 +807,5 @@ declare function getDefaultConfig(chainId: ChainId): AgetherConfig;
1186
807
  * Create custom config (override any defaults)
1187
808
  */
1188
809
  declare function createConfig(chainId: ChainId, options?: Partial<AgetherConfig>): AgetherConfig;
1189
- /**
1190
- * Get USDC address for chain
1191
- */
1192
- declare function getUSDCAddress(chainId: ChainId): string;
1193
-
1194
- /**
1195
- * Contract ABIs v2 (minimal for SDK)
1196
- *
1197
- * v2 architecture:
1198
- * - AccountFactory + AgentAccount (smart wallets)
1199
- * - ReputationCredit (undercollateralized, ICreditProvider)
1200
- * - MorphoCredit (overcollateralized, ICreditProvider)
1201
- * - LPVault (ERC-4626)
1202
- * - ValidationRegistry (KYA)
1203
- * - AgentReputation (Bayesian scoring)
1204
- */
1205
- declare const IDENTITY_REGISTRY_ABI: string[];
1206
- declare const ACCOUNT_FACTORY_ABI: string[];
1207
- declare const AGENT_ACCOUNT_ABI: string[];
1208
- declare const CREDIT_PROVIDER_ABI: string[];
1209
- declare const REPUTATION_CREDIT_ABI: string[];
1210
- declare const LP_VAULT_ABI: string[];
1211
- declare const AGENT_REPUTATION_ABI: string[];
1212
- declare const VALIDATION_REGISTRY_ABI: string[];
1213
- declare const MORPHO_CREDIT_ABI: string[];
1214
- declare const ERC20_ABI: string[];
1215
810
 
1216
- export { ACCOUNT_FACTORY_ABI, AGENT_ACCOUNT_ABI, AGENT_REPUTATION_ABI, AgentIdentityClient, type AgentIdentityClientOptions, type AgentReputation, AgetherClient, type AgetherClientOptions, type AgetherConfig, AgetherError, type BalancesResult, type BayesianScore, type BorrowResult, CREDIT_PROVIDER_ABI, ChainId, type CollateralToken, type ContractAddresses, type CreditApplication, type CreditAppliedEvent, type CreditApprovedEvent, type CreditDrawnEvent, type CreditInfo, type CreditLine, CreditNotActiveError, type CreditRejectedEvent, type CreditRepaidEvent, CreditStatus, type DepositAndBorrowResult, type DepositResult, type DrawRequest, ERC20_ABI, type FundResult, type GraduationStatus, IDENTITY_REGISTRY_ABI, InsufficientCreditError, type LPPosition, LP_VAULT_ABI, type LoanPosition, type LtvCheckResult, MORPHO_CREDIT_ABI, MorphoCreditClient, type MorphoCreditConfig, type MorphoMarketParams, type MorphoPosition, type PaymentProof, type PaymentRequirements, type ProviderStatus, REPUTATION_CREDIT_ABI, type RegisterResult, type RepayRequest, type RepayResult, type RiskCheckResponse, type RiskFactor, type ScoreExplanation, type ScoredLimitPreview, ScoringClient, type ScoringContext, ScoringRejectedError, type ScoringRequest, type ScoringResult, type SponsorResult, type StatusResult, type TransactionResult, VALIDATION_REGISTRY_ABI, VaultClient, type VaultClientOptions, type VaultStats, WalletClient, type WalletClientConfig, type WalletInfo, type WithdrawResult, X402Client, type X402Config, type X402PaymentRequest, type X402PaymentResult, type X402Response, bpsToRate, createConfig, formatAPR, formatAddress, formatHealthFactor, formatPercent, formatTimestamp, formatUSD, formatUnits, getDefaultConfig, getUSDCAddress, parseUnits, rateToBps };
811
+ export { ACCOUNT_FACTORY_ABI, AGENT_ACCOUNT_ABI, AGENT_REPUTATION_ABI, AgentIdentityClient, type AgentIdentityClientOptions, AgentNotApprovedError, AgetherClient, type AgetherClientOptions, type AgetherConfig, AgetherError, type BalancesResult, type BorrowResult, ChainId, type ContractAddresses, type DepositAndBorrowResult, type DepositResult, ERC20_ABI, type FundResult, IDENTITY_REGISTRY_ABI, InsufficientBalanceError, MORPHO_BLUE_ABI, MorphoClient, type MorphoClientConfig, type MorphoMarketInfo, type MorphoMarketParams, type MorphoPosition, type PaymentRequirements, type PositionResult, type RegisterResult, type RepayResult, type ScoreAttestation, type ScoreResult, ScoringClient, type ScoringClientConfig, ScoringRejectedError, type StatusResult, type TransactionResult, VALIDATION_REGISTRY_ABI, type WithdrawResult, X402Client, type X402Config, type X402PaymentRequest, type X402PaymentResult, type X402Response, bpsToRate, createConfig, formatAPR, formatAddress, formatHealthFactor, formatPercent, formatTimestamp, formatUSD, formatUnits, getDefaultConfig, parseUnits, rateToBps };