@agether/sdk 2.13.0 → 2.14.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/cli.d.ts ADDED
@@ -0,0 +1,29 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG"}
package/dist/cli.js CHANGED
@@ -408,7 +408,7 @@ var init_MorphoClient = __esm({
408
408
  const chainId = this.config.chainId;
409
409
  const query = `{
410
410
  markets(
411
- first: 50
411
+ first: 500
412
412
  orderBy: SupplyAssetsUsd
413
413
  orderDirection: Desc
414
414
  where: { chainId_in: [${chainId}] }
@@ -530,6 +530,14 @@ var init_MorphoClient = __esm({
530
530
  lltv: m.lltv
531
531
  };
532
532
  }
533
+ if (!collateralSymbolOrAddress.startsWith("0x")) {
534
+ const searched = await this.searchMarkets(collateralSymbolOrAddress, { asCollateral: true });
535
+ for (const m of searched) {
536
+ if (loanAddr && m.loanAddress.toLowerCase() !== loanAddr) continue;
537
+ if (loanTokenSymbolOrAddress && !loanTokenSymbolOrAddress.startsWith("0x") && m.loanToken.toUpperCase() !== loanTokenSymbolOrAddress.toUpperCase()) continue;
538
+ return this.getMarketParams(m.marketId);
539
+ }
540
+ }
533
541
  throw new AgetherError(
534
542
  `No Morpho market found for collateral ${collateralSymbolOrAddress}` + (loanTokenSymbolOrAddress ? ` with loan token ${loanTokenSymbolOrAddress}` : ""),
535
543
  "MARKET_NOT_FOUND"
@@ -700,41 +708,39 @@ var init_MorphoClient = __esm({
700
708
  async getMarketRates(collateralSymbolOrAddress, loanTokenSymbolOrAddress) {
701
709
  const chainId = this.config.chainId;
702
710
  let collateralFilter = "";
711
+ let loanFilter = "";
712
+ let searchTerm = "";
703
713
  if (collateralSymbolOrAddress) {
704
- let colAddr;
705
714
  if (collateralSymbolOrAddress.startsWith("0x")) {
706
- colAddr = collateralSymbolOrAddress.toLowerCase();
715
+ collateralFilter = `, collateralAssetAddress_in: ["${collateralSymbolOrAddress.toLowerCase()}"]`;
707
716
  } else {
708
- try {
709
- const resolved = await this._resolveToken(collateralSymbolOrAddress);
710
- colAddr = resolved.address.toLowerCase();
711
- } catch {
712
- colAddr = collateralSymbolOrAddress.toLowerCase();
717
+ const cached = this._tokenCache.get(collateralSymbolOrAddress.toUpperCase());
718
+ if (cached) {
719
+ collateralFilter = `, collateralAssetAddress_in: ["${cached.address.toLowerCase()}"]`;
720
+ } else {
721
+ searchTerm = collateralSymbolOrAddress;
713
722
  }
714
723
  }
715
- collateralFilter = `, collateralAssetAddress_in: ["${colAddr}"]`;
716
724
  }
717
- let loanFilter = "";
718
725
  if (loanTokenSymbolOrAddress) {
719
- let loanAddr;
720
726
  if (loanTokenSymbolOrAddress.startsWith("0x")) {
721
- loanAddr = loanTokenSymbolOrAddress.toLowerCase();
727
+ loanFilter = `, loanAssetAddress_in: ["${loanTokenSymbolOrAddress.toLowerCase()}"]`;
722
728
  } else {
723
- try {
724
- const resolved = await this._resolveToken(loanTokenSymbolOrAddress);
725
- loanAddr = resolved.address.toLowerCase();
726
- } catch {
727
- loanAddr = loanTokenSymbolOrAddress.toLowerCase();
729
+ const cached = this._tokenCache.get(loanTokenSymbolOrAddress.toUpperCase());
730
+ if (cached) {
731
+ loanFilter = `, loanAssetAddress_in: ["${cached.address.toLowerCase()}"]`;
732
+ } else {
733
+ searchTerm = searchTerm || loanTokenSymbolOrAddress;
728
734
  }
729
735
  }
730
- loanFilter = `, loanAssetAddress_in: ["${loanAddr}"]`;
731
736
  }
737
+ const searchClause = searchTerm ? `, search: "${searchTerm}"` : "";
732
738
  const query = `{
733
739
  markets(
734
- first: 50
740
+ first: 100
735
741
  orderBy: SupplyAssetsUsd
736
742
  orderDirection: Desc
737
- where: { chainId_in: [${chainId}]${loanFilter}${collateralFilter} }
743
+ where: { chainId_in: [${chainId}]${loanFilter}${collateralFilter}${searchClause} }
738
744
  ) {
739
745
  items {
740
746
  uniqueKey
@@ -753,7 +759,15 @@ var init_MorphoClient = __esm({
753
759
  }`;
754
760
  try {
755
761
  const resp = await import_axios.default.post(MORPHO_API_URL, { query }, { timeout: 1e4 });
756
- const items = resp.data?.data?.markets?.items ?? [];
762
+ let items = resp.data?.data?.markets?.items ?? [];
763
+ if (searchTerm && collateralSymbolOrAddress && !collateralSymbolOrAddress.startsWith("0x")) {
764
+ const sym = collateralSymbolOrAddress.toUpperCase();
765
+ items = items.filter((m) => m.collateralAsset?.symbol?.toUpperCase() === sym);
766
+ }
767
+ if (searchTerm && loanTokenSymbolOrAddress && !loanTokenSymbolOrAddress.startsWith("0x")) {
768
+ const sym = loanTokenSymbolOrAddress.toUpperCase();
769
+ items = items.filter((m) => m.loanAsset?.symbol?.toUpperCase() === sym);
770
+ }
757
771
  return items.filter((m) => m.collateralAsset?.address && m.collateralAsset.address !== import_ethers.ethers.ZeroAddress).map((m) => {
758
772
  const loanDecimals = m.loanAsset?.decimals ?? 18;
759
773
  return {
@@ -774,6 +788,205 @@ var init_MorphoClient = __esm({
774
788
  return [];
775
789
  }
776
790
  }
791
+ // ════════════════════════════════════════════════════════
792
+ // Market Search & Wallet Discovery
793
+ // ════════════════════════════════════════════════════════
794
+ /**
795
+ * Search Morpho markets by token name using the Morpho GraphQL API `search` field.
796
+ * No hardcoded token lists — uses Morpho's built-in fuzzy search.
797
+ *
798
+ * @param search - token name or symbol (e.g. 'WETH', 'staked ETH', 'ezETH')
799
+ * @param options.asCollateral - only return markets where the searched token is collateral
800
+ * @param options.asLoanToken - only return markets where the searched token is the loan asset
801
+ */
802
+ async searchMarkets(search, options) {
803
+ const chainId = this.config.chainId;
804
+ const query = `{
805
+ markets(
806
+ first: 100
807
+ orderBy: SupplyAssetsUsd
808
+ orderDirection: Desc
809
+ where: { chainId_in: [${chainId}], search: "${search}" }
810
+ ) {
811
+ items {
812
+ uniqueKey
813
+ lltv
814
+ loanAsset { address symbol decimals }
815
+ collateralAsset { address symbol decimals }
816
+ state {
817
+ borrowAssets
818
+ supplyAssets
819
+ utilization
820
+ supplyApy
821
+ borrowApy
822
+ }
823
+ }
824
+ }
825
+ }`;
826
+ try {
827
+ const resp = await import_axios.default.post(MORPHO_API_URL, { query }, { timeout: 1e4 });
828
+ let items = resp.data?.data?.markets?.items ?? [];
829
+ items = items.filter((m) => m.collateralAsset?.address && m.collateralAsset.address !== import_ethers.ethers.ZeroAddress);
830
+ const searchUpper = search.toUpperCase();
831
+ if (options?.asCollateral) {
832
+ items = items.filter((m) => m.collateralAsset?.symbol?.toUpperCase() === searchUpper);
833
+ }
834
+ if (options?.asLoanToken) {
835
+ items = items.filter((m) => m.loanAsset?.symbol?.toUpperCase() === searchUpper);
836
+ }
837
+ return items.map((m) => {
838
+ const loanDecimals = m.loanAsset?.decimals ?? 18;
839
+ const collateralDecimals = m.collateralAsset?.decimals ?? 18;
840
+ return {
841
+ collateralToken: m.collateralAsset.symbol,
842
+ loanToken: m.loanAsset.symbol,
843
+ loanDecimals,
844
+ collateralDecimals,
845
+ supplyApy: m.state?.supplyApy ? Number(m.state.supplyApy) : 0,
846
+ borrowApy: m.state?.borrowApy ? Number(m.state.borrowApy) : 0,
847
+ utilization: m.state?.utilization ? Number(m.state.utilization) : 0,
848
+ totalSupplyUsd: m.state?.supplyAssets ? Number(m.state.supplyAssets) / 10 ** loanDecimals : 0,
849
+ totalBorrowUsd: m.state?.borrowAssets ? Number(m.state.borrowAssets) / 10 ** loanDecimals : 0,
850
+ lltv: `${(Number(m.lltv) / 1e16).toFixed(0)}%`,
851
+ marketId: m.uniqueKey,
852
+ collateralAddress: m.collateralAsset.address,
853
+ loanAddress: m.loanAsset.address
854
+ };
855
+ });
856
+ } catch (e) {
857
+ console.warn("[agether] searchMarkets failed:", e instanceof Error ? e.message : e);
858
+ return [];
859
+ }
860
+ }
861
+ /**
862
+ * Scan the AgentAccount wallet for all ERC-20 tokens that appear in Morpho
863
+ * markets on the current chain. Returns tokens where balance > 0.
864
+ *
865
+ * Uses the full market list (500 markets) to discover all relevant tokens,
866
+ * then checks on-chain balance for each unique token address.
867
+ *
868
+ * @returns Array of tokens with non-zero balance, sorted by balance descending.
869
+ */
870
+ async getWalletTokenBalances() {
871
+ const acctAddr = await this.getAccountAddress();
872
+ await this.getMarkets();
873
+ const uniqueTokens = /* @__PURE__ */ new Map();
874
+ for (const [key, info] of this._tokenCache.entries()) {
875
+ if (key.startsWith("0x") && !uniqueTokens.has(key)) {
876
+ uniqueTokens.set(key, info);
877
+ }
878
+ }
879
+ const results = [];
880
+ try {
881
+ const ethBalance = await this.provider.getBalance(acctAddr);
882
+ if (ethBalance > 0n) {
883
+ results.push({
884
+ symbol: "ETH",
885
+ address: import_ethers.ethers.ZeroAddress,
886
+ decimals: 18,
887
+ balance: ethBalance,
888
+ balanceFormatted: import_ethers.ethers.formatEther(ethBalance)
889
+ });
890
+ }
891
+ } catch {
892
+ }
893
+ const tokenEntries = Array.from(uniqueTokens.values());
894
+ const batchSize = 20;
895
+ for (let i = 0; i < tokenEntries.length; i += batchSize) {
896
+ const batch = tokenEntries.slice(i, i + batchSize);
897
+ const checks = batch.map(async (info) => {
898
+ try {
899
+ const token = new import_ethers.Contract(info.address, ERC20_ABI, this.provider);
900
+ const balance = await token.balanceOf(acctAddr);
901
+ if (balance > 0n) {
902
+ return {
903
+ symbol: info.symbol,
904
+ address: info.address,
905
+ decimals: info.decimals,
906
+ balance,
907
+ balanceFormatted: import_ethers.ethers.formatUnits(balance, info.decimals)
908
+ };
909
+ }
910
+ } catch {
911
+ }
912
+ return null;
913
+ });
914
+ const batchResults = await Promise.all(checks);
915
+ for (const r of batchResults) {
916
+ if (r) results.push(r);
917
+ }
918
+ }
919
+ results.sort((a, b) => b.balance > a.balance ? 1 : b.balance < a.balance ? -1 : 0);
920
+ return results;
921
+ }
922
+ /**
923
+ * Find borrowing opportunities for the agent.
924
+ *
925
+ * - If `collateralSymbol` is provided: find all markets where that token is collateral.
926
+ * - If omitted: scan wallet balances and find markets for each token the agent holds.
927
+ *
928
+ * Returns markets grouped by collateral token with APY, liquidity, and balance info.
929
+ *
930
+ * @param collateralSymbol - optional, e.g. 'WETH'. If omitted, scans wallet.
931
+ */
932
+ async findBorrowingOptions(collateralSymbol) {
933
+ let tokensToCheck;
934
+ if (collateralSymbol) {
935
+ tokensToCheck = [{ symbol: collateralSymbol, balanceFormatted: "N/A" }];
936
+ try {
937
+ const balance = await this.getTokenBalance(collateralSymbol);
938
+ const info = await this._resolveToken(collateralSymbol);
939
+ tokensToCheck = [{ symbol: collateralSymbol, balanceFormatted: import_ethers.ethers.formatUnits(balance, info.decimals) }];
940
+ } catch {
941
+ }
942
+ } else {
943
+ const walletTokens = await this.getWalletTokenBalances();
944
+ tokensToCheck = walletTokens.filter((t) => t.symbol !== "ETH").map((t) => ({ symbol: t.symbol, balanceFormatted: t.balanceFormatted }));
945
+ if (tokensToCheck.length === 0) {
946
+ return [];
947
+ }
948
+ }
949
+ const results = [];
950
+ for (const token of tokensToCheck) {
951
+ const markets = await this.searchMarkets(token.symbol, { asCollateral: true });
952
+ if (markets.length === 0) continue;
953
+ results.push({
954
+ collateralToken: token.symbol,
955
+ collateralBalance: token.balanceFormatted,
956
+ markets: markets.map((m) => ({
957
+ loanToken: m.loanToken,
958
+ borrowApy: `${(m.borrowApy * 100).toFixed(2)}%`,
959
+ supplyApy: `${(m.supplyApy * 100).toFixed(2)}%`,
960
+ lltv: m.lltv,
961
+ utilization: `${(m.utilization * 100).toFixed(1)}%`,
962
+ availableLiquidity: `$${(m.totalSupplyUsd - m.totalBorrowUsd).toFixed(0)}`,
963
+ marketId: m.marketId
964
+ }))
965
+ });
966
+ }
967
+ return results;
968
+ }
969
+ /**
970
+ * Find supply/lending opportunities for a specific loan token.
971
+ *
972
+ * "What can I supply to earn WETH?" → shows all markets where WETH is the loan token
973
+ * (user supplies WETH to earn yield from borrowers).
974
+ *
975
+ * @param loanTokenSymbol - e.g. 'USDC', 'WETH'
976
+ */
977
+ async findSupplyOptions(loanTokenSymbol) {
978
+ const markets = await this.searchMarkets(loanTokenSymbol, { asLoanToken: true });
979
+ return markets.map((m) => ({
980
+ collateralToken: m.collateralToken,
981
+ loanToken: m.loanToken,
982
+ supplyApy: `${(m.supplyApy * 100).toFixed(2)}%`,
983
+ borrowApy: `${(m.borrowApy * 100).toFixed(2)}%`,
984
+ lltv: m.lltv,
985
+ utilization: `${(m.utilization * 100).toFixed(1)}%`,
986
+ totalSupply: `$${m.totalSupplyUsd.toFixed(0)}`,
987
+ marketId: m.marketId
988
+ }));
989
+ }
777
990
  /**
778
991
  * Estimate theoretical yield for a given collateral amount over a period.
779
992
  *
@@ -1776,6 +1989,24 @@ var init_MorphoClient = __esm({
1776
1989
  await this.getMarkets();
1777
1990
  const fromApi = this._tokenCache.get(key);
1778
1991
  if (fromApi) return fromApi;
1992
+ if (!symbolOrAddress.startsWith("0x")) {
1993
+ const searchResults = await this.searchMarkets(symbolOrAddress);
1994
+ const sym = symbolOrAddress.toUpperCase();
1995
+ for (const m of searchResults) {
1996
+ if (m.collateralToken.toUpperCase() === sym) {
1997
+ const info = { address: m.collateralAddress, symbol: m.collateralToken, decimals: m.collateralDecimals };
1998
+ this._tokenCache.set(sym, info);
1999
+ this._tokenCache.set(m.collateralAddress.toLowerCase(), info);
2000
+ return info;
2001
+ }
2002
+ if (m.loanToken.toUpperCase() === sym) {
2003
+ const info = { address: m.loanAddress, symbol: m.loanToken, decimals: m.loanDecimals };
2004
+ this._tokenCache.set(sym, info);
2005
+ this._tokenCache.set(m.loanAddress.toLowerCase(), info);
2006
+ return info;
2007
+ }
2008
+ }
2009
+ }
1779
2010
  throw new AgetherError(
1780
2011
  `Unknown token: ${symbolOrAddress}. No Morpho market found with this token.`,
1781
2012
  "UNKNOWN_TOKEN"
@@ -0,0 +1,200 @@
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
@@ -0,0 +1 @@
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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