@agether/sdk 2.15.1 → 2.16.1
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/cli.js +134 -8
- package/dist/index.d.mts +35 -5
- package/dist/index.d.ts +35 -5
- package/dist/index.js +134 -11
- package/dist/index.mjs +132 -10
- package/package.json +1 -1
- package/dist/cli.d.ts +0 -29
- package/dist/cli.d.ts.map +0 -1
- package/dist/clients/AgentIdentityClient.d.ts +0 -200
- package/dist/clients/AgentIdentityClient.d.ts.map +0 -1
- package/dist/clients/AgentIdentityClient.js +0 -351
- package/dist/clients/AgetherClient.d.ts +0 -242
- package/dist/clients/AgetherClient.d.ts.map +0 -1
- package/dist/clients/AgetherClient.js +0 -736
- package/dist/clients/MorphoClient.d.ts +0 -572
- package/dist/clients/MorphoClient.d.ts.map +0 -1
- package/dist/clients/MorphoClient.js +0 -1974
- package/dist/clients/ScoringClient.d.ts +0 -103
- package/dist/clients/ScoringClient.d.ts.map +0 -1
- package/dist/clients/ScoringClient.js +0 -112
- package/dist/clients/X402Client.d.ts +0 -198
- package/dist/clients/X402Client.d.ts.map +0 -1
- package/dist/clients/X402Client.js +0 -438
- package/dist/index.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -132
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -46
- package/dist/utils/abis.d.ts +0 -29
- package/dist/utils/abis.d.ts.map +0 -1
- package/dist/utils/abis.js +0 -138
- package/dist/utils/config.d.ts +0 -36
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js +0 -168
- package/dist/utils/format.d.ts +0 -44
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js +0 -75
package/dist/index.mjs
CHANGED
|
@@ -543,13 +543,64 @@ var AgetherClient = class _AgetherClient {
|
|
|
543
543
|
return this.agether4337Factory.accountExists(id);
|
|
544
544
|
}
|
|
545
545
|
// ════════════════════════════════════════════════════════
|
|
546
|
+
// Token Discovery (for dynamic balance queries)
|
|
547
|
+
// ════════════════════════════════════════════════════════
|
|
548
|
+
/**
|
|
549
|
+
* Discover token addresses from active Morpho Blue positions.
|
|
550
|
+
* Queries the Morpho GraphQL API for markets involving this agent's account,
|
|
551
|
+
* then extracts collateral and loan token info.
|
|
552
|
+
*/
|
|
553
|
+
async _discoverPositionTokens() {
|
|
554
|
+
const tokens = {};
|
|
555
|
+
try {
|
|
556
|
+
const acctAddr = await this.getAccountAddress();
|
|
557
|
+
const chainId = this.config.chainId;
|
|
558
|
+
const query = `{
|
|
559
|
+
marketPositions(
|
|
560
|
+
where: { userAddress_in: ["${acctAddr.toLowerCase()}"], chainId_in: [${chainId}] }
|
|
561
|
+
first: 20
|
|
562
|
+
) {
|
|
563
|
+
items {
|
|
564
|
+
market {
|
|
565
|
+
collateralAsset { address symbol decimals }
|
|
566
|
+
loanAsset { address symbol decimals }
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}`;
|
|
571
|
+
const resp = await fetch("https://blue-api.morpho.org/graphql", {
|
|
572
|
+
method: "POST",
|
|
573
|
+
headers: { "Content-Type": "application/json" },
|
|
574
|
+
body: JSON.stringify({ query }),
|
|
575
|
+
signal: AbortSignal.timeout(5e3)
|
|
576
|
+
});
|
|
577
|
+
if (!resp.ok) return tokens;
|
|
578
|
+
const data = await resp.json();
|
|
579
|
+
const items = data?.data?.marketPositions?.items ?? [];
|
|
580
|
+
for (const item of items) {
|
|
581
|
+
const col = item?.market?.collateralAsset;
|
|
582
|
+
const loan = item?.market?.loanAsset;
|
|
583
|
+
if (col?.symbol && col?.address) {
|
|
584
|
+
tokens[col.symbol] = { address: col.address, symbol: col.symbol, decimals: col.decimals ?? 18 };
|
|
585
|
+
}
|
|
586
|
+
if (loan?.symbol && loan?.address) {
|
|
587
|
+
tokens[loan.symbol] = { address: loan.address, symbol: loan.symbol, decimals: loan.decimals ?? 18 };
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
} catch {
|
|
591
|
+
}
|
|
592
|
+
return tokens;
|
|
593
|
+
}
|
|
594
|
+
// ════════════════════════════════════════════════════════
|
|
546
595
|
// Balances
|
|
547
596
|
// ════════════════════════════════════════════════════════
|
|
548
597
|
/**
|
|
549
|
-
* Get ETH, USDC, and
|
|
598
|
+
* Get ETH, USDC, and all token balances for EOA and Safe account.
|
|
550
599
|
*
|
|
551
|
-
*
|
|
552
|
-
*
|
|
600
|
+
* Tokens are resolved from:
|
|
601
|
+
* 1. Built-in registry of well-known tokens (WETH, wstETH, cbETH)
|
|
602
|
+
* 2. Dynamic discovery from active Morpho positions (loan + collateral tokens)
|
|
603
|
+
* This ensures tokens like LCAP or any new Morpho market tokens appear in balances.
|
|
553
604
|
*/
|
|
554
605
|
async getBalances() {
|
|
555
606
|
const provider = this.signer.provider;
|
|
@@ -557,7 +608,18 @@ var AgetherClient = class _AgetherClient {
|
|
|
557
608
|
const usdc = new Contract(this.config.contracts.usdc, ERC20_ABI, provider);
|
|
558
609
|
const ethBal = await provider.getBalance(eoaAddr);
|
|
559
610
|
const usdcBal = await usdc.balanceOf(eoaAddr);
|
|
560
|
-
const knownTokens =
|
|
611
|
+
const knownTokens = {
|
|
612
|
+
...KNOWN_TOKENS[this.config.chainId] ?? {}
|
|
613
|
+
};
|
|
614
|
+
try {
|
|
615
|
+
const positions = await this._discoverPositionTokens();
|
|
616
|
+
for (const [symbol, info] of Object.entries(positions)) {
|
|
617
|
+
if (!knownTokens[symbol]) {
|
|
618
|
+
knownTokens[symbol] = info;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
} catch {
|
|
622
|
+
}
|
|
561
623
|
const eoaCollateral = {};
|
|
562
624
|
for (const [symbol, info] of Object.entries(knownTokens)) {
|
|
563
625
|
try {
|
|
@@ -1125,6 +1187,53 @@ var AgetherClient = class _AgetherClient {
|
|
|
1125
1187
|
// src/clients/MorphoClient.ts
|
|
1126
1188
|
import { ethers as ethers2, Contract as Contract2 } from "ethers";
|
|
1127
1189
|
import axios2 from "axios";
|
|
1190
|
+
|
|
1191
|
+
// src/utils/retry.ts
|
|
1192
|
+
var RETRIABLE_PATTERNS = [
|
|
1193
|
+
"ECONNRESET",
|
|
1194
|
+
"ECONNREFUSED",
|
|
1195
|
+
"ENOTFOUND",
|
|
1196
|
+
"ETIMEDOUT",
|
|
1197
|
+
"fetch failed",
|
|
1198
|
+
"network error",
|
|
1199
|
+
"socket hang up",
|
|
1200
|
+
"rate limit",
|
|
1201
|
+
"429",
|
|
1202
|
+
"502",
|
|
1203
|
+
"503",
|
|
1204
|
+
"504",
|
|
1205
|
+
"timeout"
|
|
1206
|
+
];
|
|
1207
|
+
function isRetriable(error) {
|
|
1208
|
+
const msg = error instanceof Error ? error.message.toLowerCase() : String(error).toLowerCase();
|
|
1209
|
+
return RETRIABLE_PATTERNS.some((p) => msg.includes(p.toLowerCase()));
|
|
1210
|
+
}
|
|
1211
|
+
async function withRetry(fn, options = {}) {
|
|
1212
|
+
const {
|
|
1213
|
+
maxRetries = 3,
|
|
1214
|
+
baseDelay = 1e3,
|
|
1215
|
+
maxDelay = 15e3,
|
|
1216
|
+
onRetry
|
|
1217
|
+
} = options;
|
|
1218
|
+
let lastError;
|
|
1219
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
1220
|
+
try {
|
|
1221
|
+
return await fn();
|
|
1222
|
+
} catch (error) {
|
|
1223
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
1224
|
+
if (attempt >= maxRetries || !isRetriable(error)) {
|
|
1225
|
+
throw lastError;
|
|
1226
|
+
}
|
|
1227
|
+
const delay = Math.min(baseDelay * Math.pow(2, attempt - 1), maxDelay);
|
|
1228
|
+
const jitter = delay * (0.5 + Math.random() * 0.5);
|
|
1229
|
+
onRetry?.(attempt, lastError);
|
|
1230
|
+
await new Promise((resolve) => setTimeout(resolve, jitter));
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
throw lastError;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
// src/clients/MorphoClient.ts
|
|
1128
1237
|
var MORPHO_API_URL2 = "https://api.morpho.org/graphql";
|
|
1129
1238
|
var MODE_SINGLE2 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
1130
1239
|
var MODE_BATCH = "0x0100000000000000000000000000000000000000000000000000000000000000";
|
|
@@ -1271,7 +1380,10 @@ var MorphoClient = class {
|
|
|
1271
1380
|
}
|
|
1272
1381
|
}`;
|
|
1273
1382
|
try {
|
|
1274
|
-
const resp = await
|
|
1383
|
+
const resp = await withRetry(
|
|
1384
|
+
() => axios2.post(MORPHO_API_URL2, { query }, { timeout: 1e4 }),
|
|
1385
|
+
{ maxRetries: 3, onRetry: (n, e) => console.warn(`[agether] Morpho API retry ${n}:`, e.message) }
|
|
1386
|
+
);
|
|
1275
1387
|
const items = resp.data?.data?.markets?.items ?? [];
|
|
1276
1388
|
this._discoveredMarkets = items.map((m) => ({
|
|
1277
1389
|
uniqueKey: m.uniqueKey,
|
|
@@ -1455,7 +1567,10 @@ var MorphoClient = class {
|
|
|
1455
1567
|
}
|
|
1456
1568
|
}
|
|
1457
1569
|
}`;
|
|
1458
|
-
const resp = await
|
|
1570
|
+
const resp = await withRetry(
|
|
1571
|
+
() => axios2.post(MORPHO_API_URL2, { query: posQuery }, { timeout: 15e3 }),
|
|
1572
|
+
{ maxRetries: 3, onRetry: (n, e) => console.warn(`[agether] Morpho position query retry ${n}:`, e.message) }
|
|
1573
|
+
);
|
|
1459
1574
|
const items = resp.data?.data?.marketPositions?.items ?? [];
|
|
1460
1575
|
for (const item of items) {
|
|
1461
1576
|
const supplyShares = BigInt(item.supplyShares ?? "0");
|
|
@@ -1674,7 +1789,10 @@ var MorphoClient = class {
|
|
|
1674
1789
|
}
|
|
1675
1790
|
}`;
|
|
1676
1791
|
try {
|
|
1677
|
-
const resp = await
|
|
1792
|
+
const resp = await withRetry(
|
|
1793
|
+
() => axios2.post(MORPHO_API_URL2, { query }, { timeout: 1e4 }),
|
|
1794
|
+
{ maxRetries: 3, onRetry: (n, e) => console.warn(`[agether] Morpho API retry ${n}:`, e.message) }
|
|
1795
|
+
);
|
|
1678
1796
|
let items = resp.data?.data?.markets?.items ?? [];
|
|
1679
1797
|
if (searchTerm && collateralSymbolOrAddress && !collateralSymbolOrAddress.startsWith("0x")) {
|
|
1680
1798
|
const sym = collateralSymbolOrAddress.toUpperCase();
|
|
@@ -1740,7 +1858,10 @@ var MorphoClient = class {
|
|
|
1740
1858
|
}
|
|
1741
1859
|
}`;
|
|
1742
1860
|
try {
|
|
1743
|
-
const resp = await
|
|
1861
|
+
const resp = await withRetry(
|
|
1862
|
+
() => axios2.post(MORPHO_API_URL2, { query }, { timeout: 1e4 }),
|
|
1863
|
+
{ maxRetries: 3, onRetry: (n, e) => console.warn(`[agether] Morpho API retry ${n}:`, e.message) }
|
|
1864
|
+
);
|
|
1744
1865
|
let items = resp.data?.data?.markets?.items ?? [];
|
|
1745
1866
|
items = items.filter((m) => m.collateralAsset?.address && m.collateralAsset.address !== ethers2.ZeroAddress);
|
|
1746
1867
|
const searchUpper = search.toUpperCase();
|
|
@@ -3751,7 +3872,7 @@ var AgentIdentityClient = class {
|
|
|
3751
3872
|
/**
|
|
3752
3873
|
* Give positive feedback (shorthand)
|
|
3753
3874
|
*/
|
|
3754
|
-
async
|
|
3875
|
+
async givePositiveFeedback(agentId, value = 100, tags = {}) {
|
|
3755
3876
|
return this.giveFeedback({
|
|
3756
3877
|
agentId,
|
|
3757
3878
|
value: Math.abs(value),
|
|
@@ -3956,5 +4077,6 @@ export {
|
|
|
3956
4077
|
getMorphoBlueAddress,
|
|
3957
4078
|
getUSDCAddress,
|
|
3958
4079
|
parseUnits,
|
|
3959
|
-
rateToBps
|
|
4080
|
+
rateToBps,
|
|
4081
|
+
withRetry
|
|
3960
4082
|
};
|
package/package.json
CHANGED
package/dist/cli.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Agether CLI — Direct Morpho Blue Credit for AI Agents
|
|
4
|
-
*
|
|
5
|
-
* Architecture (v2 — Safe + Safe7579):
|
|
6
|
-
* - All commands sign transactions directly with the agent's private key
|
|
7
|
-
* - Uses MorphoClient for lending (ERC-4337 UserOps through Safe account)
|
|
8
|
-
* - Uses X402Client for paid API calls
|
|
9
|
-
*
|
|
10
|
-
* Supported chains: Ethereum (1, default), Base (8453), Base Sepolia (84532)
|
|
11
|
-
*
|
|
12
|
-
* Usage:
|
|
13
|
-
* agether init <private-key> [--agent-id <id>] [--chain <chainId>]
|
|
14
|
-
* agether register [--name <n>] Register ERC-8004 + Safe account
|
|
15
|
-
* agether balance Check balances
|
|
16
|
-
* agether status Show Morpho positions
|
|
17
|
-
* agether score Get credit score (x402-gated)
|
|
18
|
-
* agether markets List Morpho markets
|
|
19
|
-
* agether deposit --amount 0.05 --token WETH Deposit collateral
|
|
20
|
-
* agether borrow --amount 100 Borrow USDC
|
|
21
|
-
* agether deposit-and-borrow --amount 0.05 --token WETH --borrow 100
|
|
22
|
-
* agether repay --amount 50 Repay USDC
|
|
23
|
-
* agether withdraw --amount 0.05 --token WETH Withdraw collateral
|
|
24
|
-
* agether sponsor --amount 0.05 --token WETH --agent-id 123
|
|
25
|
-
* agether fund --amount 50 Fund Safe account with USDC
|
|
26
|
-
* agether x402 <url> [--method GET|POST] [--body <json>]
|
|
27
|
-
*/
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG"}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AgentIdentityClient - Integration with ag0 (ERC-8004)
|
|
3
|
-
*
|
|
4
|
-
* ERC-8004 is a per-chain singleton — different chain = different agentId.
|
|
5
|
-
*
|
|
6
|
-
* Contract Addresses:
|
|
7
|
-
* - Ethereum IdentityRegistry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
|
|
8
|
-
* - Base IdentityRegistry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
|
|
9
|
-
* - Sepolia IdentityRegistry: 0x8004A818BFB912233c491871b3d84c89A494BD9e
|
|
10
|
-
* - Sepolia ReputationRegistry: 0x8004B663056A597Dffe9eCcC1965A193B7388713
|
|
11
|
-
*
|
|
12
|
-
* SDKs:
|
|
13
|
-
* - TypeScript: https://github.com/agent0lab/agent0-ts
|
|
14
|
-
* - Python: https://github.com/agent0lab/agent0-py
|
|
15
|
-
*
|
|
16
|
-
* Docs: https://sdk.ag0.xyz/docs
|
|
17
|
-
*/
|
|
18
|
-
import { Signer } from 'ethers';
|
|
19
|
-
import { AgetherConfig } from '../types';
|
|
20
|
-
export declare const ERC8004_SEPOLIA: {
|
|
21
|
-
identityRegistry: string;
|
|
22
|
-
reputationRegistry: string;
|
|
23
|
-
};
|
|
24
|
-
export declare const ERC8004_MAINNET: {
|
|
25
|
-
identityRegistry: string;
|
|
26
|
-
reputationRegistry: string;
|
|
27
|
-
};
|
|
28
|
-
export declare const ERC8004_BASE: {
|
|
29
|
-
identityRegistry: string;
|
|
30
|
-
reputationRegistry: string;
|
|
31
|
-
};
|
|
32
|
-
export interface AgentIdentityClientOptions {
|
|
33
|
-
config: AgetherConfig;
|
|
34
|
-
signer: Signer;
|
|
35
|
-
/** Optional: Use ag0 TypeScript SDK instead of direct contracts */
|
|
36
|
-
useAg0SDK?: boolean;
|
|
37
|
-
}
|
|
38
|
-
export interface AgentMetadata {
|
|
39
|
-
name: string;
|
|
40
|
-
description: string;
|
|
41
|
-
image?: string;
|
|
42
|
-
endpoints?: {
|
|
43
|
-
name: string;
|
|
44
|
-
endpoint: string;
|
|
45
|
-
version?: string;
|
|
46
|
-
}[];
|
|
47
|
-
x402Support?: boolean;
|
|
48
|
-
active?: boolean;
|
|
49
|
-
}
|
|
50
|
-
export interface FeedbackInput {
|
|
51
|
-
agentId: bigint;
|
|
52
|
-
value: number;
|
|
53
|
-
decimals?: number;
|
|
54
|
-
tag1?: string;
|
|
55
|
-
tag2?: string;
|
|
56
|
-
endpoint?: string;
|
|
57
|
-
feedbackURI?: string;
|
|
58
|
-
}
|
|
59
|
-
export interface ReputationSummary {
|
|
60
|
-
count: number;
|
|
61
|
-
totalValue: number;
|
|
62
|
-
averageValue: number;
|
|
63
|
-
clients: string[];
|
|
64
|
-
}
|
|
65
|
-
export declare class AgentIdentityClient {
|
|
66
|
-
readonly config: AgetherConfig;
|
|
67
|
-
private signer;
|
|
68
|
-
private identityRegistry;
|
|
69
|
-
private reputationRegistry;
|
|
70
|
-
constructor(options: AgentIdentityClientOptions);
|
|
71
|
-
/**
|
|
72
|
-
* Register a new agent (minimal - no metadata)
|
|
73
|
-
*/
|
|
74
|
-
register(): Promise<{
|
|
75
|
-
agentId: bigint;
|
|
76
|
-
txHash: string;
|
|
77
|
-
}>;
|
|
78
|
-
/**
|
|
79
|
-
* Register agent with IPFS/HTTP URI to metadata JSON
|
|
80
|
-
* @param agentURI URI pointing to agent metadata (ipfs:// or https://)
|
|
81
|
-
*/
|
|
82
|
-
registerWithURI(agentURI: string): Promise<{
|
|
83
|
-
agentId: bigint;
|
|
84
|
-
txHash: string;
|
|
85
|
-
}>;
|
|
86
|
-
/**
|
|
87
|
-
* Check if the signer already owns an ERC-8004 identity token.
|
|
88
|
-
* Returns true if balanceOf > 0, false otherwise.
|
|
89
|
-
* Note: Cannot determine the specific agentId without enumeration —
|
|
90
|
-
* use agether init <pk> --agent-id <id> if you know your agentId.
|
|
91
|
-
*/
|
|
92
|
-
hasExistingIdentity(): Promise<boolean>;
|
|
93
|
-
/**
|
|
94
|
-
* Register only if no identity exists; otherwise throw.
|
|
95
|
-
* Prevents accidental double-registration.
|
|
96
|
-
*/
|
|
97
|
-
registerOrGet(): Promise<{
|
|
98
|
-
agentId: bigint;
|
|
99
|
-
txHash: string | null;
|
|
100
|
-
existing: boolean;
|
|
101
|
-
}>;
|
|
102
|
-
/**
|
|
103
|
-
* Register with URI only if no identity exists; otherwise throw.
|
|
104
|
-
* Prevents accidental double-registration.
|
|
105
|
-
*/
|
|
106
|
-
registerOrGetWithURI(agentURI: string): Promise<{
|
|
107
|
-
agentId: bigint;
|
|
108
|
-
txHash: string | null;
|
|
109
|
-
existing: boolean;
|
|
110
|
-
}>;
|
|
111
|
-
/**
|
|
112
|
-
* Register agent with URI and onchain metadata
|
|
113
|
-
*/
|
|
114
|
-
registerWithMetadata(agentURI: string, metadata: {
|
|
115
|
-
key: string;
|
|
116
|
-
value: string;
|
|
117
|
-
}[]): Promise<{
|
|
118
|
-
agentId: bigint;
|
|
119
|
-
txHash: string;
|
|
120
|
-
}>;
|
|
121
|
-
/**
|
|
122
|
-
* Get agent owner address
|
|
123
|
-
*/
|
|
124
|
-
getOwner(agentId: bigint): Promise<string>;
|
|
125
|
-
/**
|
|
126
|
-
* Get agent URI (metadata JSON location)
|
|
127
|
-
*/
|
|
128
|
-
getAgentURI(agentId: bigint): Promise<string>;
|
|
129
|
-
/**
|
|
130
|
-
* Update agent URI
|
|
131
|
-
*/
|
|
132
|
-
setAgentURI(agentId: bigint, newURI: string): Promise<string>;
|
|
133
|
-
/**
|
|
134
|
-
* Set onchain metadata (key-value)
|
|
135
|
-
*/
|
|
136
|
-
setMetadata(agentId: bigint, key: string, value: string): Promise<string>;
|
|
137
|
-
/**
|
|
138
|
-
* Get onchain metadata
|
|
139
|
-
*/
|
|
140
|
-
getMetadata(agentId: bigint, key: string): Promise<string>;
|
|
141
|
-
/**
|
|
142
|
-
* Transfer agent to new owner
|
|
143
|
-
*/
|
|
144
|
-
transfer(agentId: bigint, to: string): Promise<string>;
|
|
145
|
-
/**
|
|
146
|
-
* Fetch and parse agent metadata from URI
|
|
147
|
-
*/
|
|
148
|
-
fetchAgentMetadata(agentId: bigint): Promise<AgentMetadata | null>;
|
|
149
|
-
/**
|
|
150
|
-
* Give feedback to an agent
|
|
151
|
-
*/
|
|
152
|
-
giveFeedback(input: FeedbackInput): Promise<string>;
|
|
153
|
-
/**
|
|
154
|
-
* Give positive feedback (shorthand)
|
|
155
|
-
*/
|
|
156
|
-
givePosisitiveFeedback(agentId: bigint, value?: number, tags?: {
|
|
157
|
-
tag1?: string;
|
|
158
|
-
tag2?: string;
|
|
159
|
-
}): Promise<string>;
|
|
160
|
-
/**
|
|
161
|
-
* Give negative feedback (e.g., for defaults)
|
|
162
|
-
*/
|
|
163
|
-
giveNegativeFeedback(agentId: bigint, value?: number, tags?: {
|
|
164
|
-
tag1?: string;
|
|
165
|
-
tag2?: string;
|
|
166
|
-
}): Promise<string>;
|
|
167
|
-
/**
|
|
168
|
-
* Record credit default in reputation system
|
|
169
|
-
*/
|
|
170
|
-
recordCreditDefault(agentId: bigint, creditLineId: bigint): Promise<string>;
|
|
171
|
-
/**
|
|
172
|
-
* Get reputation summary for an agent
|
|
173
|
-
*/
|
|
174
|
-
getReputation(agentId: bigint, tag1?: string, tag2?: string): Promise<ReputationSummary>;
|
|
175
|
-
/**
|
|
176
|
-
* Check if agent has negative credit reputation
|
|
177
|
-
*/
|
|
178
|
-
hasNegativeCreditReputation(agentId: bigint): Promise<boolean>;
|
|
179
|
-
/**
|
|
180
|
-
* Verify agent is eligible for Agether credit
|
|
181
|
-
* Checks:
|
|
182
|
-
* 1. Agent exists in ERC-8004 registry
|
|
183
|
-
* 2. Agent has no negative credit reputation
|
|
184
|
-
*/
|
|
185
|
-
verifyForCredit(agentId: bigint): Promise<{
|
|
186
|
-
eligible: boolean;
|
|
187
|
-
reason?: string;
|
|
188
|
-
owner?: string;
|
|
189
|
-
reputation?: ReputationSummary;
|
|
190
|
-
}>;
|
|
191
|
-
private parseAgentIdFromReceipt;
|
|
192
|
-
/**
|
|
193
|
-
* Get contract addresses
|
|
194
|
-
*/
|
|
195
|
-
getContractAddresses(): {
|
|
196
|
-
identity: string;
|
|
197
|
-
reputation: string;
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
//# sourceMappingURL=AgentIdentityClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AgentIdentityClient.d.ts","sourceRoot":"","sources":["../../src/clients/AgentIdentityClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA0CzC,eAAO,MAAM,eAAe;;;CAG3B,CAAC;AAGF,eAAO,MAAM,eAAe;;;CAG3B,CAAC;AAGF,eAAO,MAAM,YAAY;;;CAGxB,CAAC;AAEF,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,EAAE,CAAC;IACJ,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;C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