@exagent/agent 0.1.26 → 0.1.28

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.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) => {
@@ -1599,7 +1720,7 @@ function validateConfig(config) {
1599
1720
  throw new Error("Valid agent ID required");
1600
1721
  }
1601
1722
  }
1602
- var DEFAULT_RPC_URL = "https://base-rpc.publicnode.com";
1723
+ var DEFAULT_RPC_URL = "https://mainnet.base.org";
1603
1724
  function getRpcUrl() {
1604
1725
  return process.env.BASE_RPC_URL || process.env.EXAGENT_RPC_URL || DEFAULT_RPC_URL;
1605
1726
  }
@@ -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.28";
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-62GBXQNP.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.28",
4
4
  "description": "Autonomous trading agent runtime for Exagent",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,6 +20,17 @@ EXAGENT_PRIVATE_KEY=
20
20
  # Base mainnet
21
21
  EXAGENT_NETWORK=mainnet
22
22
 
23
+ # ============================================
24
+ # RPC Provider (recommended)
25
+ # ============================================
26
+ # Default: https://mainnet.base.org (Coinbase official, rate-limited)
27
+ # For better performance, use a dedicated RPC provider:
28
+ # dRPC: https://drpc.org (10.5M req/month free)
29
+ # Alchemy: https://alchemy.com (30M compute units free)
30
+ # Infura: https://infura.io (100K req/day free)
31
+ # Ankr: https://ankr.com (generous free tier)
32
+ # BASE_RPC_URL=https://lb.drpc.org/ogrpc?network=base&dkey=YOUR_KEY
33
+
23
34
  # ============================================
24
35
  # LLM API Keys (choose one based on your config)
25
36
  # ============================================