@exagent/agent 0.1.26 → 0.1.27

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 CHANGED
@@ -40,77 +40,192 @@ var import_accounts5 = require("viem/accounts");
40
40
  var import_viem = require("viem");
41
41
  var NATIVE_ETH = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
42
42
  var TOKEN_DECIMALS = {
43
- // Base Mainnet — Core tokens
44
- "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913": 6,
45
- // USDC
46
- "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca": 6,
47
- // USDbC
43
+ [NATIVE_ETH.toLowerCase()]: 18,
44
+ // Native ETH
45
+ // Core (0)
48
46
  "0x4200000000000000000000000000000000000006": 18,
49
47
  // WETH
50
- "0x50c5725949a6f0c72e6c4a641f24049a917db0cb": 18,
51
- // DAI
48
+ "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913": 6,
49
+ // USDC
52
50
  "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22": 18,
53
51
  // cbETH
54
- [NATIVE_ETH.toLowerCase()]: 18,
55
- // Native ETH
56
- // Base Mainnet — Established tokens
52
+ "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf": 8,
53
+ // cbBTC
54
+ "0xc1cba3fcea344f92d9239c08c0568f6f2f0ee452": 18,
55
+ // wstETH
56
+ "0x50c5725949a6f0c72e6c4a641f24049a917db0cb": 18,
57
+ // DAI
58
+ "0xfde4c96c8593536e31f229ea8f37b2ada2699bb2": 6,
59
+ // USDT
60
+ "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca": 6,
61
+ // USDbC
62
+ "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42": 6,
63
+ // EURC
64
+ "0xb6fe221fe9eef5aba221c348ba20a1bf5e73624c": 18,
65
+ // rETH
66
+ "0x0555e30da8f98308edb960aa94c0db47230d2b9c": 8,
67
+ // WBTC
68
+ // Established (1)
57
69
  "0x940181a94a35a4569e4529a3cdfb74e38fd98631": 18,
58
- // AERO (Aerodrome)
59
- "0x532f27101965dd16442e59d40670faf5ebb142e4": 18,
60
- // BRETT
61
- "0x4ed4e862860bed51a9570b96d89af5e1b0efefed": 18,
62
- // DEGEN
70
+ // AERO
71
+ "0x04c0599ae5a44757c0af6f9ec3b93da8976c150a": 18,
72
+ // weETH
73
+ "0x2416092f143378750bb29b79ed961ab195cceea5": 18,
74
+ // ezETH
75
+ "0xa88594d404727625a9437c3f886c7643872296ae": 18,
76
+ // WELL
77
+ "0xbaa5cc21fd487b8fcc2f632f3f4e8d37262a0842": 18,
78
+ // MORPHO
79
+ "0x88fb150bdc53a65fe94dea0c9ba0a6daf8c6e196": 18,
80
+ // LINK
81
+ "0xc3de830ea07524a0761646a6a4e4be0e114a3c83": 18,
82
+ // UNI
83
+ "0x63706e401c06ac8513145b7687a14804d17f814b": 18,
84
+ // AAVE
85
+ "0x9e1028f5f1d5ede59748ffcee5532509976840e0": 18,
86
+ // COMP
87
+ "0x4158734d47fc9692176b5085e0f52ee0da5d47f1": 18,
88
+ // BAL
89
+ "0x8ee73c484a26e0a5df2ee2a4960b789967dd0415": 18,
90
+ // CRV
91
+ "0x22e6966b799c4d5b13be962e1d117b56327fda66": 18,
92
+ // SNX
93
+ // Derivatives (2)
63
94
  "0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b": 18,
64
95
  // VIRTUAL
96
+ "0x4f9fd6be4a90f2620860d680c0d4d5fb53d1a825": 18,
97
+ // AIXBT
98
+ "0x4ed4e862860bed51a9570b96d89af5e1b0efefed": 18,
99
+ // DEGEN
100
+ "0x0578d8a44db98b23bf096a382e016e29a5ce0ffe": 18,
101
+ // HIGHER
102
+ "0x1bc0c42215582d5a085795f4badbaac3ff36d1bcb": 18,
103
+ // CLANKER
104
+ // Emerging (3)
105
+ "0x532f27101965dd16442e59d40670faf5ebb142e4": 18,
106
+ // BRETT
65
107
  "0xac1bd2486aaf3b5c0fc3fd868558b082a531b2b4": 18,
66
108
  // TOSHI
67
- "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf": 8,
68
- // cbBTC
69
- "0x2416092f143378750bb29b79ed961ab195cceea5": 18,
70
- // ezETH (Renzo)
71
- "0xc1cba3fcea344f92d9239c08c0568f6f2f0ee452": 18
72
- // wstETH (Lido)
109
+ "0x6921b130d297cc43754afba22e5eac0fbf8db75b": 18,
110
+ // DOGINME
111
+ "0xb1a03eda10342529bbf8eb700a06c60441fef25d": 18,
112
+ // MIGGLES
113
+ "0x7f12d13b34f5f4f0a9449c16bcd42f0da47af200": 9,
114
+ // NORMIE
115
+ "0x27d2decb4bfc9c76f0309b8e88dec3a601fe25a8": 18,
116
+ // BALD
117
+ "0x768be13e1680b5ebe0024c42c896e3db59ec0149": 9
118
+ // SKI
73
119
  };
120
+ var decimalsCache = {};
74
121
  function getTokenDecimals(address) {
75
- const decimals = TOKEN_DECIMALS[address.toLowerCase()];
76
- if (decimals === void 0) {
77
- console.warn(`Unknown token decimals for ${address}, defaulting to 18. THIS MAY BE WRONG.`);
122
+ const key = address.toLowerCase();
123
+ const known = TOKEN_DECIMALS[key];
124
+ if (known !== void 0) return known;
125
+ const cached = decimalsCache[key];
126
+ if (cached !== void 0) return cached;
127
+ console.warn(`Unknown token decimals for ${address}, defaulting to 18. Call fetchTokenDecimals() first for accuracy.`);
128
+ return 18;
129
+ }
130
+ async function fetchTokenDecimals(client, address) {
131
+ const key = address.toLowerCase();
132
+ const known = TOKEN_DECIMALS[key];
133
+ if (known !== void 0) return known;
134
+ const cached = decimalsCache[key];
135
+ if (cached !== void 0) return cached;
136
+ try {
137
+ const decimals = await client.readContract({
138
+ address,
139
+ abi: import_viem.erc20Abi,
140
+ functionName: "decimals"
141
+ });
142
+ const result = Number(decimals);
143
+ decimalsCache[key] = result;
144
+ return result;
145
+ } catch {
146
+ console.warn(`Failed to fetch decimals for ${address} on-chain, defaulting to 18`);
147
+ decimalsCache[key] = 18;
78
148
  return 18;
79
149
  }
80
- return decimals;
81
150
  }
82
151
  var TOKEN_TO_COINGECKO = {
83
- // Core
152
+ [NATIVE_ETH.toLowerCase()]: "ethereum",
153
+ // Core (0)
84
154
  "0x4200000000000000000000000000000000000006": "ethereum",
85
155
  // WETH
86
- [NATIVE_ETH.toLowerCase()]: "ethereum",
87
156
  "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913": "usd-coin",
88
157
  // USDC
89
- "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca": "usd-coin",
90
- // USDbC
91
158
  "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22": "coinbase-wrapped-staked-eth",
92
159
  // cbETH
160
+ "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf": "coinbase-wrapped-btc",
161
+ // cbBTC
162
+ "0xc1cba3fcea344f92d9239c08c0568f6f2f0ee452": "wrapped-steth",
163
+ // wstETH
93
164
  "0x50c5725949a6f0c72e6c4a641f24049a917db0cb": "dai",
94
165
  // DAI
95
- // Established
166
+ "0xfde4c96c8593536e31f229ea8f37b2ada2699bb2": "tether",
167
+ // USDT
168
+ "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca": "usd-coin",
169
+ // USDbC
170
+ "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42": "euro-coin",
171
+ // EURC
172
+ "0xb6fe221fe9eef5aba221c348ba20a1bf5e73624c": "rocket-pool-eth",
173
+ // rETH
174
+ "0x0555e30da8f98308edb960aa94c0db47230d2b9c": "wrapped-bitcoin",
175
+ // WBTC
176
+ // Established (1)
96
177
  "0x940181a94a35a4569e4529a3cdfb74e38fd98631": "aerodrome-finance",
97
178
  // AERO
98
- "0x532f27101965dd16442e59d40670faf5ebb142e4": "brett",
99
- // BRETT
100
- "0x4ed4e862860bed51a9570b96d89af5e1b0efefed": "degen-base",
101
- // DEGEN
179
+ "0x04c0599ae5a44757c0af6f9ec3b93da8976c150a": "wrapped-eeth",
180
+ // weETH
181
+ "0x2416092f143378750bb29b79ed961ab195cceea5": "renzo-restaked-eth",
182
+ // ezETH
183
+ "0xa88594d404727625a9437c3f886c7643872296ae": "moonwell",
184
+ // WELL
185
+ "0xbaa5cc21fd487b8fcc2f632f3f4e8d37262a0842": "morpho",
186
+ // MORPHO
187
+ "0x88fb150bdc53a65fe94dea0c9ba0a6daf8c6e196": "chainlink",
188
+ // LINK
189
+ "0xc3de830ea07524a0761646a6a4e4be0e114a3c83": "uniswap",
190
+ // UNI
191
+ "0x63706e401c06ac8513145b7687a14804d17f814b": "aave",
192
+ // AAVE
193
+ "0x9e1028f5f1d5ede59748ffcee5532509976840e0": "compound-governance-token",
194
+ // COMP
195
+ "0x4158734d47fc9692176b5085e0f52ee0da5d47f1": "balancer",
196
+ // BAL
197
+ "0x8ee73c484a26e0a5df2ee2a4960b789967dd0415": "curve-dao-token",
198
+ // CRV
199
+ "0x22e6966b799c4d5b13be962e1d117b56327fda66": "havven",
200
+ // SNX
201
+ // Derivatives (2)
102
202
  "0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b": "virtual-protocol",
103
203
  // VIRTUAL
204
+ "0x4f9fd6be4a90f2620860d680c0d4d5fb53d1a825": "aixbt",
205
+ // AIXBT
206
+ "0x4ed4e862860bed51a9570b96d89af5e1b0efefed": "degen-base",
207
+ // DEGEN
208
+ "0x0578d8a44db98b23bf096a382e016e29a5ce0ffe": "higher",
209
+ // HIGHER
210
+ "0x1bc0c42215582d5a085795f4badbaac3ff36d1bcb": "clanker",
211
+ // CLANKER
212
+ // Emerging (3)
213
+ "0x532f27101965dd16442e59d40670faf5ebb142e4": "based-brett",
214
+ // BRETT
104
215
  "0xac1bd2486aaf3b5c0fc3fd868558b082a531b2b4": "toshi",
105
216
  // TOSHI
106
- "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf": "coinbase-wrapped-btc",
107
- // cbBTC
108
- "0x2416092f143378750bb29b79ed961ab195cceea5": "renzo-restaked-eth",
109
- // ezETH
110
- "0xc1cba3fcea344f92d9239c08c0568f6f2f0ee452": "wrapped-steth"
111
- // wstETH
217
+ "0x6921b130d297cc43754afba22e5eac0fbf8db75b": "doginme",
218
+ // DOGINME
219
+ "0xb1a03eda10342529bbf8eb700a06c60441fef25d": "mister-miggles",
220
+ // MIGGLES
221
+ "0x7f12d13b34f5f4f0a9449c16bcd42f0da47af200": "normie-2",
222
+ // NORMIE
223
+ "0x27d2decb4bfc9c76f0309b8e88dec3a601fe25a8": "bald",
224
+ // BALD
225
+ "0x768be13e1680b5ebe0024c42c896e3db59ec0149": "ski-mask-dog"
226
+ // SKI
112
227
  };
113
- var STABLECOIN_IDS = /* @__PURE__ */ new Set(["usd-coin", "dai"]);
228
+ var STABLECOIN_IDS = /* @__PURE__ */ new Set(["usd-coin", "dai", "tether"]);
114
229
  var PRICE_STALENESS_MS = 6e4;
115
230
  var MarketDataService = class {
116
231
  rpcUrl;
@@ -266,6 +381,12 @@ var MarketDataService = class {
266
381
  const balances = {};
267
382
  const wallet = walletAddress;
268
383
  try {
384
+ const unknownTokens = tokenAddresses.filter(
385
+ (addr) => TOKEN_DECIMALS[addr.toLowerCase()] === void 0 && !decimalsCache[addr.toLowerCase()]
386
+ );
387
+ if (unknownTokens.length > 0) {
388
+ await Promise.all(unknownTokens.map((addr) => fetchTokenDecimals(this.client, addr)));
389
+ }
269
390
  const nativeBalance = await this.client.getBalance({ address: wallet });
270
391
  balances[NATIVE_ETH.toLowerCase()] = nativeBalance;
271
392
  const erc20Promises = tokenAddresses.map(async (tokenAddress) => {
@@ -3704,7 +3825,7 @@ function loadSecureEnv(basePath, passphrase) {
3704
3825
  }
3705
3826
 
3706
3827
  // src/index.ts
3707
- var AGENT_VERSION = "0.1.26";
3828
+ var AGENT_VERSION = "0.1.27";
3708
3829
 
3709
3830
  // src/relay.ts
3710
3831
  var RelayClient = class {
package/dist/cli.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  loadConfig,
7
7
  loadSecureEnv,
8
8
  validateConfig
9
- } from "./chunk-AWBQDPZ6.mjs";
9
+ } from "./chunk-L67V7YG6.mjs";
10
10
 
11
11
  // src/cli.ts
12
12
  import { Command } from "commander";
package/dist/index.d.mts CHANGED
@@ -339,9 +339,9 @@ declare const AgentConfigSchema: z.ZodObject<{
339
339
  }>>;
340
340
  allowedTokens: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
341
341
  }, "strip", z.ZodTypeAny, {
342
- agentId: string | number;
343
342
  name: string;
344
343
  network: "mainnet";
344
+ agentId: string | number;
345
345
  llm: {
346
346
  provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
347
347
  temperature: number;
@@ -388,8 +388,8 @@ declare const AgentConfigSchema: z.ZodObject<{
388
388
  } | undefined;
389
389
  allowedTokens?: string[] | undefined;
390
390
  }, {
391
- agentId: string | number;
392
391
  name: string;
392
+ agentId: string | number;
393
393
  llm: {
394
394
  provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
395
395
  model?: string | undefined;
@@ -2107,6 +2107,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
2107
2107
  declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
2108
2108
 
2109
2109
  /** @exagent/agent package version — update alongside package.json */
2110
- declare const AGENT_VERSION = "0.1.26";
2110
+ declare const AGENT_VERSION = "0.1.27";
2111
2111
 
2112
2112
  export { AGENT_VERSION, type AccountSummary, type AgentConfig, AgentConfigSchema, type AgentMode, AgentRuntime, type AgentStatusPayload, AnthropicAdapter, BaseLLMAdapter, type CommandType, DeepSeekAdapter, FileStore, type FillCallback, type FundingCallback, type FundingPayment, GoogleAdapter, GroqAdapter, HYPERLIQUID_DOMAIN, HyperliquidClient, HyperliquidSigner, HyperliquidWebSocket, type LLMAdapter, type LLMConfig, LLMConfigSchema, type LLMMessage, type LLMMetadata, type LLMProvider, LLMProviderSchema, type LLMResponse, type LiquidationCallback, type MarketData, MarketDataService, type MessageLevel, type MessageType, MistralAdapter, OllamaAdapter, type OnboardingStatus, OpenAIAdapter, OrderManager, type OrderResult, type PerpAction, type PerpConfig$1 as PerpConfig, PerpConfigSchema, type PerpFill, type PerpMarketData, PerpOnboarding, type PerpPosition, type PerpStrategyFunction, PerpTradeRecorder, type PerpTradeSignal, type PerpConfig as PerpTradingConfig, PositionManager, type PositionSummary, PositionTracker, type RecordPerpTradeParams, RelayClient, type RelayCommand, type RelayConfig$1 as RelayConfig, RelayConfigSchema, RiskManager, type RiskState, type RiskUniverse, RiskUniverseSchema, type RuntimeConfig, STRATEGY_TEMPLATES, type StrategyContext, type StrategyFunction, type StrategyStore, type StrategyTemplate, TogetherAdapter, type TrackedPosition, TradeExecutor, type TradeRecord, type TradeSignal, type TradingConfig, TradingConfigSchema, type VaultConfig, VaultConfigSchema, VaultManager, type VaultManagerConfig, type VaultPolicy, VaultPolicySchema, type VaultStatus, createLLMAdapter, createSampleConfig, decryptEnvFile, encryptEnvFile, fillHashToBytes32, fillOidToBytes32, getAllStrategyTemplates, getNextNonce, getStrategyTemplate, loadConfig, loadSecureEnv, loadStrategy, validateConfig, validateStrategy };
package/dist/index.d.ts CHANGED
@@ -339,9 +339,9 @@ declare const AgentConfigSchema: z.ZodObject<{
339
339
  }>>;
340
340
  allowedTokens: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
341
341
  }, "strip", z.ZodTypeAny, {
342
- agentId: string | number;
343
342
  name: string;
344
343
  network: "mainnet";
344
+ agentId: string | number;
345
345
  llm: {
346
346
  provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
347
347
  temperature: number;
@@ -388,8 +388,8 @@ declare const AgentConfigSchema: z.ZodObject<{
388
388
  } | undefined;
389
389
  allowedTokens?: string[] | undefined;
390
390
  }, {
391
- agentId: string | number;
392
391
  name: string;
392
+ agentId: string | number;
393
393
  llm: {
394
394
  provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
395
395
  model?: string | undefined;
@@ -2107,6 +2107,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
2107
2107
  declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
2108
2108
 
2109
2109
  /** @exagent/agent package version — update alongside package.json */
2110
- declare const AGENT_VERSION = "0.1.26";
2110
+ declare const AGENT_VERSION = "0.1.27";
2111
2111
 
2112
2112
  export { AGENT_VERSION, type AccountSummary, type AgentConfig, AgentConfigSchema, type AgentMode, AgentRuntime, type AgentStatusPayload, AnthropicAdapter, BaseLLMAdapter, type CommandType, DeepSeekAdapter, FileStore, type FillCallback, type FundingCallback, type FundingPayment, GoogleAdapter, GroqAdapter, HYPERLIQUID_DOMAIN, HyperliquidClient, HyperliquidSigner, HyperliquidWebSocket, type LLMAdapter, type LLMConfig, LLMConfigSchema, type LLMMessage, type LLMMetadata, type LLMProvider, LLMProviderSchema, type LLMResponse, type LiquidationCallback, type MarketData, MarketDataService, type MessageLevel, type MessageType, MistralAdapter, OllamaAdapter, type OnboardingStatus, OpenAIAdapter, OrderManager, type OrderResult, type PerpAction, type PerpConfig$1 as PerpConfig, PerpConfigSchema, type PerpFill, type PerpMarketData, PerpOnboarding, type PerpPosition, type PerpStrategyFunction, PerpTradeRecorder, type PerpTradeSignal, type PerpConfig as PerpTradingConfig, PositionManager, type PositionSummary, PositionTracker, type RecordPerpTradeParams, RelayClient, type RelayCommand, type RelayConfig$1 as RelayConfig, RelayConfigSchema, RiskManager, type RiskState, type RiskUniverse, RiskUniverseSchema, type RuntimeConfig, STRATEGY_TEMPLATES, type StrategyContext, type StrategyFunction, type StrategyStore, type StrategyTemplate, TogetherAdapter, type TrackedPosition, TradeExecutor, type TradeRecord, type TradeSignal, type TradingConfig, TradingConfigSchema, type VaultConfig, VaultConfigSchema, VaultManager, type VaultManagerConfig, type VaultPolicy, VaultPolicySchema, type VaultStatus, createLLMAdapter, createSampleConfig, decryptEnvFile, encryptEnvFile, fillHashToBytes32, fillOidToBytes32, getAllStrategyTemplates, getNextNonce, getStrategyTemplate, loadConfig, loadSecureEnv, loadStrategy, validateConfig, validateStrategy };
package/dist/index.js CHANGED
@@ -93,77 +93,192 @@ var import_accounts5 = require("viem/accounts");
93
93
  var import_viem = require("viem");
94
94
  var NATIVE_ETH = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
95
95
  var TOKEN_DECIMALS = {
96
- // Base Mainnet — Core tokens
97
- "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913": 6,
98
- // USDC
99
- "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca": 6,
100
- // USDbC
96
+ [NATIVE_ETH.toLowerCase()]: 18,
97
+ // Native ETH
98
+ // Core (0)
101
99
  "0x4200000000000000000000000000000000000006": 18,
102
100
  // WETH
103
- "0x50c5725949a6f0c72e6c4a641f24049a917db0cb": 18,
104
- // DAI
101
+ "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913": 6,
102
+ // USDC
105
103
  "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22": 18,
106
104
  // cbETH
107
- [NATIVE_ETH.toLowerCase()]: 18,
108
- // Native ETH
109
- // Base Mainnet — Established tokens
105
+ "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf": 8,
106
+ // cbBTC
107
+ "0xc1cba3fcea344f92d9239c08c0568f6f2f0ee452": 18,
108
+ // wstETH
109
+ "0x50c5725949a6f0c72e6c4a641f24049a917db0cb": 18,
110
+ // DAI
111
+ "0xfde4c96c8593536e31f229ea8f37b2ada2699bb2": 6,
112
+ // USDT
113
+ "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca": 6,
114
+ // USDbC
115
+ "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42": 6,
116
+ // EURC
117
+ "0xb6fe221fe9eef5aba221c348ba20a1bf5e73624c": 18,
118
+ // rETH
119
+ "0x0555e30da8f98308edb960aa94c0db47230d2b9c": 8,
120
+ // WBTC
121
+ // Established (1)
110
122
  "0x940181a94a35a4569e4529a3cdfb74e38fd98631": 18,
111
- // AERO (Aerodrome)
112
- "0x532f27101965dd16442e59d40670faf5ebb142e4": 18,
113
- // BRETT
114
- "0x4ed4e862860bed51a9570b96d89af5e1b0efefed": 18,
115
- // DEGEN
123
+ // AERO
124
+ "0x04c0599ae5a44757c0af6f9ec3b93da8976c150a": 18,
125
+ // weETH
126
+ "0x2416092f143378750bb29b79ed961ab195cceea5": 18,
127
+ // ezETH
128
+ "0xa88594d404727625a9437c3f886c7643872296ae": 18,
129
+ // WELL
130
+ "0xbaa5cc21fd487b8fcc2f632f3f4e8d37262a0842": 18,
131
+ // MORPHO
132
+ "0x88fb150bdc53a65fe94dea0c9ba0a6daf8c6e196": 18,
133
+ // LINK
134
+ "0xc3de830ea07524a0761646a6a4e4be0e114a3c83": 18,
135
+ // UNI
136
+ "0x63706e401c06ac8513145b7687a14804d17f814b": 18,
137
+ // AAVE
138
+ "0x9e1028f5f1d5ede59748ffcee5532509976840e0": 18,
139
+ // COMP
140
+ "0x4158734d47fc9692176b5085e0f52ee0da5d47f1": 18,
141
+ // BAL
142
+ "0x8ee73c484a26e0a5df2ee2a4960b789967dd0415": 18,
143
+ // CRV
144
+ "0x22e6966b799c4d5b13be962e1d117b56327fda66": 18,
145
+ // SNX
146
+ // Derivatives (2)
116
147
  "0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b": 18,
117
148
  // VIRTUAL
149
+ "0x4f9fd6be4a90f2620860d680c0d4d5fb53d1a825": 18,
150
+ // AIXBT
151
+ "0x4ed4e862860bed51a9570b96d89af5e1b0efefed": 18,
152
+ // DEGEN
153
+ "0x0578d8a44db98b23bf096a382e016e29a5ce0ffe": 18,
154
+ // HIGHER
155
+ "0x1bc0c42215582d5a085795f4badbaac3ff36d1bcb": 18,
156
+ // CLANKER
157
+ // Emerging (3)
158
+ "0x532f27101965dd16442e59d40670faf5ebb142e4": 18,
159
+ // BRETT
118
160
  "0xac1bd2486aaf3b5c0fc3fd868558b082a531b2b4": 18,
119
161
  // TOSHI
120
- "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf": 8,
121
- // cbBTC
122
- "0x2416092f143378750bb29b79ed961ab195cceea5": 18,
123
- // ezETH (Renzo)
124
- "0xc1cba3fcea344f92d9239c08c0568f6f2f0ee452": 18
125
- // wstETH (Lido)
162
+ "0x6921b130d297cc43754afba22e5eac0fbf8db75b": 18,
163
+ // DOGINME
164
+ "0xb1a03eda10342529bbf8eb700a06c60441fef25d": 18,
165
+ // MIGGLES
166
+ "0x7f12d13b34f5f4f0a9449c16bcd42f0da47af200": 9,
167
+ // NORMIE
168
+ "0x27d2decb4bfc9c76f0309b8e88dec3a601fe25a8": 18,
169
+ // BALD
170
+ "0x768be13e1680b5ebe0024c42c896e3db59ec0149": 9
171
+ // SKI
126
172
  };
173
+ var decimalsCache = {};
127
174
  function getTokenDecimals(address) {
128
- const decimals = TOKEN_DECIMALS[address.toLowerCase()];
129
- if (decimals === void 0) {
130
- console.warn(`Unknown token decimals for ${address}, defaulting to 18. THIS MAY BE WRONG.`);
175
+ const key = address.toLowerCase();
176
+ const known = TOKEN_DECIMALS[key];
177
+ if (known !== void 0) return known;
178
+ const cached = decimalsCache[key];
179
+ if (cached !== void 0) return cached;
180
+ console.warn(`Unknown token decimals for ${address}, defaulting to 18. Call fetchTokenDecimals() first for accuracy.`);
181
+ return 18;
182
+ }
183
+ async function fetchTokenDecimals(client, address) {
184
+ const key = address.toLowerCase();
185
+ const known = TOKEN_DECIMALS[key];
186
+ if (known !== void 0) return known;
187
+ const cached = decimalsCache[key];
188
+ if (cached !== void 0) return cached;
189
+ try {
190
+ const decimals = await client.readContract({
191
+ address,
192
+ abi: import_viem.erc20Abi,
193
+ functionName: "decimals"
194
+ });
195
+ const result = Number(decimals);
196
+ decimalsCache[key] = result;
197
+ return result;
198
+ } catch {
199
+ console.warn(`Failed to fetch decimals for ${address} on-chain, defaulting to 18`);
200
+ decimalsCache[key] = 18;
131
201
  return 18;
132
202
  }
133
- return decimals;
134
203
  }
135
204
  var TOKEN_TO_COINGECKO = {
136
- // Core
205
+ [NATIVE_ETH.toLowerCase()]: "ethereum",
206
+ // Core (0)
137
207
  "0x4200000000000000000000000000000000000006": "ethereum",
138
208
  // WETH
139
- [NATIVE_ETH.toLowerCase()]: "ethereum",
140
209
  "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913": "usd-coin",
141
210
  // USDC
142
- "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca": "usd-coin",
143
- // USDbC
144
211
  "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22": "coinbase-wrapped-staked-eth",
145
212
  // cbETH
213
+ "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf": "coinbase-wrapped-btc",
214
+ // cbBTC
215
+ "0xc1cba3fcea344f92d9239c08c0568f6f2f0ee452": "wrapped-steth",
216
+ // wstETH
146
217
  "0x50c5725949a6f0c72e6c4a641f24049a917db0cb": "dai",
147
218
  // DAI
148
- // Established
219
+ "0xfde4c96c8593536e31f229ea8f37b2ada2699bb2": "tether",
220
+ // USDT
221
+ "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca": "usd-coin",
222
+ // USDbC
223
+ "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42": "euro-coin",
224
+ // EURC
225
+ "0xb6fe221fe9eef5aba221c348ba20a1bf5e73624c": "rocket-pool-eth",
226
+ // rETH
227
+ "0x0555e30da8f98308edb960aa94c0db47230d2b9c": "wrapped-bitcoin",
228
+ // WBTC
229
+ // Established (1)
149
230
  "0x940181a94a35a4569e4529a3cdfb74e38fd98631": "aerodrome-finance",
150
231
  // AERO
151
- "0x532f27101965dd16442e59d40670faf5ebb142e4": "brett",
152
- // BRETT
153
- "0x4ed4e862860bed51a9570b96d89af5e1b0efefed": "degen-base",
154
- // DEGEN
232
+ "0x04c0599ae5a44757c0af6f9ec3b93da8976c150a": "wrapped-eeth",
233
+ // weETH
234
+ "0x2416092f143378750bb29b79ed961ab195cceea5": "renzo-restaked-eth",
235
+ // ezETH
236
+ "0xa88594d404727625a9437c3f886c7643872296ae": "moonwell",
237
+ // WELL
238
+ "0xbaa5cc21fd487b8fcc2f632f3f4e8d37262a0842": "morpho",
239
+ // MORPHO
240
+ "0x88fb150bdc53a65fe94dea0c9ba0a6daf8c6e196": "chainlink",
241
+ // LINK
242
+ "0xc3de830ea07524a0761646a6a4e4be0e114a3c83": "uniswap",
243
+ // UNI
244
+ "0x63706e401c06ac8513145b7687a14804d17f814b": "aave",
245
+ // AAVE
246
+ "0x9e1028f5f1d5ede59748ffcee5532509976840e0": "compound-governance-token",
247
+ // COMP
248
+ "0x4158734d47fc9692176b5085e0f52ee0da5d47f1": "balancer",
249
+ // BAL
250
+ "0x8ee73c484a26e0a5df2ee2a4960b789967dd0415": "curve-dao-token",
251
+ // CRV
252
+ "0x22e6966b799c4d5b13be962e1d117b56327fda66": "havven",
253
+ // SNX
254
+ // Derivatives (2)
155
255
  "0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b": "virtual-protocol",
156
256
  // VIRTUAL
257
+ "0x4f9fd6be4a90f2620860d680c0d4d5fb53d1a825": "aixbt",
258
+ // AIXBT
259
+ "0x4ed4e862860bed51a9570b96d89af5e1b0efefed": "degen-base",
260
+ // DEGEN
261
+ "0x0578d8a44db98b23bf096a382e016e29a5ce0ffe": "higher",
262
+ // HIGHER
263
+ "0x1bc0c42215582d5a085795f4badbaac3ff36d1bcb": "clanker",
264
+ // CLANKER
265
+ // Emerging (3)
266
+ "0x532f27101965dd16442e59d40670faf5ebb142e4": "based-brett",
267
+ // BRETT
157
268
  "0xac1bd2486aaf3b5c0fc3fd868558b082a531b2b4": "toshi",
158
269
  // TOSHI
159
- "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf": "coinbase-wrapped-btc",
160
- // cbBTC
161
- "0x2416092f143378750bb29b79ed961ab195cceea5": "renzo-restaked-eth",
162
- // ezETH
163
- "0xc1cba3fcea344f92d9239c08c0568f6f2f0ee452": "wrapped-steth"
164
- // wstETH
270
+ "0x6921b130d297cc43754afba22e5eac0fbf8db75b": "doginme",
271
+ // DOGINME
272
+ "0xb1a03eda10342529bbf8eb700a06c60441fef25d": "mister-miggles",
273
+ // MIGGLES
274
+ "0x7f12d13b34f5f4f0a9449c16bcd42f0da47af200": "normie-2",
275
+ // NORMIE
276
+ "0x27d2decb4bfc9c76f0309b8e88dec3a601fe25a8": "bald",
277
+ // BALD
278
+ "0x768be13e1680b5ebe0024c42c896e3db59ec0149": "ski-mask-dog"
279
+ // SKI
165
280
  };
166
- var STABLECOIN_IDS = /* @__PURE__ */ new Set(["usd-coin", "dai"]);
281
+ var STABLECOIN_IDS = /* @__PURE__ */ new Set(["usd-coin", "dai", "tether"]);
167
282
  var PRICE_STALENESS_MS = 6e4;
168
283
  var MarketDataService = class {
169
284
  rpcUrl;
@@ -319,6 +434,12 @@ var MarketDataService = class {
319
434
  const balances = {};
320
435
  const wallet = walletAddress;
321
436
  try {
437
+ const unknownTokens = tokenAddresses.filter(
438
+ (addr) => TOKEN_DECIMALS[addr.toLowerCase()] === void 0 && !decimalsCache[addr.toLowerCase()]
439
+ );
440
+ if (unknownTokens.length > 0) {
441
+ await Promise.all(unknownTokens.map((addr) => fetchTokenDecimals(this.client, addr)));
442
+ }
322
443
  const nativeBalance = await this.client.getBalance({ address: wallet });
323
444
  balances[NATIVE_ETH.toLowerCase()] = nativeBalance;
324
445
  const erc20Promises = tokenAddresses.map(async (tokenAddress) => {
@@ -5331,7 +5452,7 @@ function loadSecureEnv(basePath, passphrase) {
5331
5452
  }
5332
5453
 
5333
5454
  // src/index.ts
5334
- var AGENT_VERSION = "0.1.26";
5455
+ var AGENT_VERSION = "0.1.27";
5335
5456
  // Annotate the CommonJS export names for ESM import in node:
5336
5457
  0 && (module.exports = {
5337
5458
  AGENT_VERSION,
package/dist/index.mjs CHANGED
@@ -49,7 +49,7 @@ import {
49
49
  loadStrategy,
50
50
  validateConfig,
51
51
  validateStrategy
52
- } from "./chunk-AWBQDPZ6.mjs";
52
+ } from "./chunk-L67V7YG6.mjs";
53
53
  export {
54
54
  AGENT_VERSION,
55
55
  AgentConfigSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exagent/agent",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "description": "Autonomous trading agent runtime for Exagent",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",