@agether/sdk 2.14.0 → 2.15.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.ts CHANGED
@@ -252,7 +252,7 @@ declare class AgetherClient {
252
252
  getBalances(): Promise<BalancesResult>;
253
253
  /**
254
254
  * Fund the Safe account with USDC from EOA.
255
- * This is a simple ERC-20 transfer (does NOT require a UserOp).
255
+ * @deprecated Use `fundAccountToken('USDC', amount)` instead.
256
256
  */
257
257
  fundAccount(usdcAmount: string): Promise<TransactionResult>;
258
258
  /**
@@ -270,6 +270,54 @@ declare class AgetherClient {
270
270
  * @param amount - ETH amount (e.g. '0.01' or 'all')
271
271
  */
272
272
  withdrawEth(amount: string): Promise<WithdrawFromAccountResult>;
273
+ /**
274
+ * Fund the AgentAccount with any ERC-20 token from EOA.
275
+ * Simple ERC-20 transfer (does NOT require a UserOp).
276
+ *
277
+ * @param tokenSymbol - Token symbol (e.g. 'USDC', 'WETH') or 0x address
278
+ * @param amount - Amount to send (human-readable, e.g. '100')
279
+ */
280
+ fundAccountToken(tokenSymbol: string, amount: string): Promise<TransactionResult>;
281
+ /**
282
+ * Transfer any ERC-20 token from AgentAccount to any address or agent.
283
+ * Executes via Safe UserOp (ERC-7579 single execution).
284
+ *
285
+ * @param tokenSymbol - Token symbol (e.g. 'USDC', 'WETH') or 0x address
286
+ * @param amount - Amount to send (e.g. '100' or 'all')
287
+ * @param to - Destination: `{ address: '0x...' }` or `{ agentId: '42' }`
288
+ */
289
+ transferToken(tokenSymbol: string, amount: string, to: {
290
+ address?: string;
291
+ agentId?: string;
292
+ }): Promise<WithdrawFromAccountResult>;
293
+ /**
294
+ * Transfer ETH from AgentAccount to any address or agent.
295
+ * Executes via Safe UserOp.
296
+ *
297
+ * @param amount - ETH amount (e.g. '0.01' or 'all')
298
+ * @param to - Destination: `{ address: '0x...' }` or `{ agentId: '42' }`
299
+ */
300
+ transferEth(amount: string, to: {
301
+ address?: string;
302
+ agentId?: string;
303
+ }): Promise<WithdrawFromAccountResult>;
304
+ /**
305
+ * Approve a spender to use ERC-20 tokens from the AgentAccount.
306
+ * Executes via Safe UserOp (ERC-7579 single execution).
307
+ *
308
+ * @param tokenSymbol - Token symbol (e.g. 'USDC', 'WETH') or 0x address
309
+ * @param amount - Allowance amount (e.g. '1000' or 'max' for uint256 max)
310
+ * @param spender - Spender: `{ address: '0x...' }` or `{ agentId: '42' }`
311
+ */
312
+ approveToken(tokenSymbol: string, amount: string, spender: {
313
+ address?: string;
314
+ agentId?: string;
315
+ }): Promise<{
316
+ tx: string;
317
+ token: string;
318
+ amount: string;
319
+ spender: string;
320
+ }>;
273
321
  /**
274
322
  * Send tokens to another agent's Safe account (or any address).
275
323
  * Transfers from EOA (does NOT require a UserOp).
@@ -324,11 +372,14 @@ declare class AgetherClient {
324
372
  /**
325
373
  * Resolve a token symbol or address to { address, symbol, decimals }.
326
374
  *
327
- * Supports:
328
- * - `'USDC'` → from chain config
329
- * - Well-known symbols (`'WETH'`, `'wstETH'`, `'cbETH'`) → built-in per-chain registry
330
- * - `'0x...'` address reads decimals and symbol onchain
375
+ * Resolution order:
376
+ * 1. `'USDC'` → from chain config (instant)
377
+ * 2. Well-known symbols (`'WETH'`, `'wstETH'`, `'cbETH'`) → built-in per-chain registry (instant)
378
+ * 3. Dynamic cache populated by previous Morpho API lookups (instant)
379
+ * 4. `'0x...'` address → reads decimals and symbol onchain
380
+ * 5. Morpho GraphQL `search` API → discovers any token across all Morpho markets
331
381
  */
382
+ private _dynamicTokenCache;
332
383
  private _resolveToken;
333
384
  /**
334
385
  * Refresh signer and rebind contracts for fresh nonce.
@@ -575,7 +626,10 @@ declare class MorphoClient {
575
626
  /** Read onchain position for a specific market. */
576
627
  getPosition(marketId: string): Promise<MorphoPosition>;
577
628
  /**
578
- * Full status: positions across all discovered markets.
629
+ * Full status: positions across all markets the user has interacted with.
630
+ *
631
+ * Uses Morpho GraphQL `marketPositions` to find ALL positions (not limited
632
+ * to the top-500 markets), then reads onchain data for accurate debt.
579
633
  */
580
634
  getStatus(): Promise<StatusResult>;
581
635
  /**