@exagent/agent 0.1.44 → 0.1.46

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
@@ -548,6 +548,30 @@ var init_market = __esm({
548
548
  }
549
549
  };
550
550
  }
551
+ /**
552
+ * Discover all ERC-20 token holdings for a wallet via Blockscout API.
553
+ * Returns token addresses with non-zero balances.
554
+ * Used by Frontier agents to find tokens outside the standard whitelist.
555
+ */
556
+ async discoverTokenHoldings(walletAddress) {
557
+ try {
558
+ const resp = await fetch(
559
+ `https://base.blockscout.com/api/v2/addresses/${walletAddress}/token-balances`,
560
+ { signal: AbortSignal.timeout(1e4) }
561
+ );
562
+ if (!resp.ok) return [];
563
+ const data = await resp.json();
564
+ const addresses = [];
565
+ for (const entry of data) {
566
+ if (entry.token?.type === "ERC-20" && entry.value && entry.value !== "0") {
567
+ addresses.push(entry.token.address.toLowerCase());
568
+ }
569
+ }
570
+ return addresses;
571
+ } catch {
572
+ return [];
573
+ }
574
+ }
551
575
  /**
552
576
  * Check if cached prices are still fresh
553
577
  */
@@ -7925,7 +7949,7 @@ function loadSecureEnv(basePath, passphrase) {
7925
7949
  }
7926
7950
 
7927
7951
  // src/index.ts
7928
- var AGENT_VERSION = "0.1.44";
7952
+ var AGENT_VERSION = "0.1.46";
7929
7953
 
7930
7954
  // src/relay.ts
7931
7955
  var RelayClient = class {
@@ -8221,6 +8245,8 @@ var AgentRuntime = class {
8221
8245
  processAlive = true;
8222
8246
  riskUniverse = 0;
8223
8247
  allowedTokens = /* @__PURE__ */ new Set();
8248
+ /** Frontier token discovery — cached addresses from Blockscout scan */
8249
+ discoveredTokens = [];
8224
8250
  strategyContext;
8225
8251
  positionTracker;
8226
8252
  // Paper trading components (null when not in paper mode)
@@ -8822,6 +8848,13 @@ var AgentRuntime = class {
8822
8848
  console.log("");
8823
8849
  this.mode = "idle";
8824
8850
  try {
8851
+ if (this.riskUniverse === 4) {
8852
+ const discovered = await this.marketData.discoverTokenHoldings(this.client.address);
8853
+ if (discovered.length > 0) {
8854
+ this.discoveredTokens = discovered;
8855
+ console.log(`Frontier token discovery: ${discovered.length} token(s) found on-chain`);
8856
+ }
8857
+ }
8825
8858
  const tokens = this.getTokensToTrack();
8826
8859
  const initData = await this.marketData.fetchMarketData(this.client.address, tokens);
8827
8860
  void this.positionTracker.syncBalances(initData.balances, initData.prices);
@@ -10174,8 +10207,14 @@ See: https://exagent.io/docs/guides/manual-exit`,
10174
10207
  }
10175
10208
  }
10176
10209
  }
10210
+ for (const addr of this.discoveredTokens) {
10211
+ if (!baseSet.has(addr)) {
10212
+ extras.push(addr);
10213
+ baseSet.add(addr);
10214
+ }
10215
+ }
10177
10216
  if (extras.length > 0) {
10178
- console.log(`Auto-tracking ${extras.length} additional token(s) from position history`);
10217
+ console.log(`Auto-tracking ${extras.length} additional token(s) from position/discovery`);
10179
10218
  }
10180
10219
  const resolver = this.marketData.getResolver();
10181
10220
  const allTokens = [...base8, ...extras];
package/dist/cli.mjs CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  results_exports,
30
30
  saveSessionResult,
31
31
  validateConfig
32
- } from "./chunk-YXLDNUAH.mjs";
32
+ } from "./chunk-7QMPWDX3.mjs";
33
33
 
34
34
  // src/backtest/data-loader.ts
35
35
  import * as fs from "fs";
package/dist/index.d.mts CHANGED
@@ -1133,6 +1133,8 @@ declare class AgentRuntime {
1133
1133
  private processAlive;
1134
1134
  private riskUniverse;
1135
1135
  private allowedTokens;
1136
+ /** Frontier token discovery — cached addresses from Blockscout scan */
1137
+ private discoveredTokens;
1136
1138
  private strategyContext;
1137
1139
  private positionTracker;
1138
1140
  private paperExecutor;
@@ -1948,6 +1950,12 @@ declare class MarketDataService {
1948
1950
  * Fetch current market data for the agent
1949
1951
  */
1950
1952
  fetchMarketData(walletAddress: string, tokenAddresses: string[]): Promise<MarketData>;
1953
+ /**
1954
+ * Discover all ERC-20 token holdings for a wallet via Blockscout API.
1955
+ * Returns token addresses with non-zero balances.
1956
+ * Used by Frontier agents to find tokens outside the standard whitelist.
1957
+ */
1958
+ discoverTokenHoldings(walletAddress: string): Promise<string[]>;
1951
1959
  /**
1952
1960
  * Check if cached prices are still fresh
1953
1961
  */
@@ -3345,6 +3353,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
3345
3353
  declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
3346
3354
 
3347
3355
  /** @exagent/agent package version — update alongside package.json */
3348
- declare const AGENT_VERSION = "0.1.44";
3356
+ declare const AGENT_VERSION = "0.1.46";
3349
3357
 
3350
3358
  export { AGENT_VERSION, type AccountSummary, type AgentConfig, AgentConfigSchema, type AgentMode, AgentRuntime, type AgentStatusPayload, AnthropicAdapter, BaseLLMAdapter, type BridgeResult, type BridgeStep, type CommandType, DeepSeekAdapter, FileStore, type FillCallback, type FundingCallback, type FundingPayment, GoogleAdapter, GroqAdapter, HYPERLIQUID_DOMAIN, HyperliquidClient, HyperliquidSigner, HyperliquidWebSocket, type InferredExit, type LLMAdapter, type LLMConfig, LLMConfigSchema, type LLMMessage, type LLMMetadata, type LLMProvider, LLMProviderSchema, type LLMResponse, type LiquidationCallback, type LocalPosition, MARKET_CATEGORIES, MarketBrowser, type MarketCategory, 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, PolymarketClient, PositionManager, type PositionSummary, PositionTracker, type PredictionAccountSummary, type PredictionAction, type PredictionConfig$1 as PredictionConfig, PredictionConfigSchema, type PredictionFill, PredictionFunding, type PredictionFundingConfig, type PredictionMarket, PredictionOrderManager, type PredictionPosition, PredictionPositionManager, type PredictionStrategyFunction, PredictionTradeRecorder, type PredictionTradeSignal, type PredictionConfig as PredictionTradingConfig, type RecordPerpTradeParams, type RecordPredictionTradeParams, 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, type StuckPosition, TogetherAdapter, type TrackedPosition, TradeExecutor, type TradeRecord, type TradeSignal, type TradingConfig, TradingConfigSchema, type VaultConfig, VaultConfigSchema, VaultManager, type VaultManagerConfig, type VaultPolicy, VaultPolicySchema, type VaultStatus, calculatePredictionFee, createLLMAdapter, createSampleConfig, decodePredictionInstrument, decryptEnvFile, encodePredictionInstrument, encryptEnvFile, fillHashToBytes32, fillOidToBytes32, getAllStrategyTemplates, getNextNonce, getStrategyTemplate, loadConfig, loadSecureEnv, loadStrategy, orderIdToBytes32, tradeIdToBytes32, validateConfig, validateStrategy };
package/dist/index.d.ts CHANGED
@@ -1133,6 +1133,8 @@ declare class AgentRuntime {
1133
1133
  private processAlive;
1134
1134
  private riskUniverse;
1135
1135
  private allowedTokens;
1136
+ /** Frontier token discovery — cached addresses from Blockscout scan */
1137
+ private discoveredTokens;
1136
1138
  private strategyContext;
1137
1139
  private positionTracker;
1138
1140
  private paperExecutor;
@@ -1948,6 +1950,12 @@ declare class MarketDataService {
1948
1950
  * Fetch current market data for the agent
1949
1951
  */
1950
1952
  fetchMarketData(walletAddress: string, tokenAddresses: string[]): Promise<MarketData>;
1953
+ /**
1954
+ * Discover all ERC-20 token holdings for a wallet via Blockscout API.
1955
+ * Returns token addresses with non-zero balances.
1956
+ * Used by Frontier agents to find tokens outside the standard whitelist.
1957
+ */
1958
+ discoverTokenHoldings(walletAddress: string): Promise<string[]>;
1951
1959
  /**
1952
1960
  * Check if cached prices are still fresh
1953
1961
  */
@@ -3345,6 +3353,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
3345
3353
  declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
3346
3354
 
3347
3355
  /** @exagent/agent package version — update alongside package.json */
3348
- declare const AGENT_VERSION = "0.1.44";
3356
+ declare const AGENT_VERSION = "0.1.46";
3349
3357
 
3350
3358
  export { AGENT_VERSION, type AccountSummary, type AgentConfig, AgentConfigSchema, type AgentMode, AgentRuntime, type AgentStatusPayload, AnthropicAdapter, BaseLLMAdapter, type BridgeResult, type BridgeStep, type CommandType, DeepSeekAdapter, FileStore, type FillCallback, type FundingCallback, type FundingPayment, GoogleAdapter, GroqAdapter, HYPERLIQUID_DOMAIN, HyperliquidClient, HyperliquidSigner, HyperliquidWebSocket, type InferredExit, type LLMAdapter, type LLMConfig, LLMConfigSchema, type LLMMessage, type LLMMetadata, type LLMProvider, LLMProviderSchema, type LLMResponse, type LiquidationCallback, type LocalPosition, MARKET_CATEGORIES, MarketBrowser, type MarketCategory, 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, PolymarketClient, PositionManager, type PositionSummary, PositionTracker, type PredictionAccountSummary, type PredictionAction, type PredictionConfig$1 as PredictionConfig, PredictionConfigSchema, type PredictionFill, PredictionFunding, type PredictionFundingConfig, type PredictionMarket, PredictionOrderManager, type PredictionPosition, PredictionPositionManager, type PredictionStrategyFunction, PredictionTradeRecorder, type PredictionTradeSignal, type PredictionConfig as PredictionTradingConfig, type RecordPerpTradeParams, type RecordPredictionTradeParams, 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, type StuckPosition, TogetherAdapter, type TrackedPosition, TradeExecutor, type TradeRecord, type TradeSignal, type TradingConfig, TradingConfigSchema, type VaultConfig, VaultConfigSchema, VaultManager, type VaultManagerConfig, type VaultPolicy, VaultPolicySchema, type VaultStatus, calculatePredictionFee, createLLMAdapter, createSampleConfig, decodePredictionInstrument, decryptEnvFile, encodePredictionInstrument, encryptEnvFile, fillHashToBytes32, fillOidToBytes32, getAllStrategyTemplates, getNextNonce, getStrategyTemplate, loadConfig, loadSecureEnv, loadStrategy, orderIdToBytes32, tradeIdToBytes32, validateConfig, validateStrategy };
package/dist/index.js CHANGED
@@ -610,6 +610,30 @@ var MarketDataService = class {
610
610
  }
611
611
  };
612
612
  }
613
+ /**
614
+ * Discover all ERC-20 token holdings for a wallet via Blockscout API.
615
+ * Returns token addresses with non-zero balances.
616
+ * Used by Frontier agents to find tokens outside the standard whitelist.
617
+ */
618
+ async discoverTokenHoldings(walletAddress) {
619
+ try {
620
+ const resp = await fetch(
621
+ `https://base.blockscout.com/api/v2/addresses/${walletAddress}/token-balances`,
622
+ { signal: AbortSignal.timeout(1e4) }
623
+ );
624
+ if (!resp.ok) return [];
625
+ const data = await resp.json();
626
+ const addresses = [];
627
+ for (const entry of data) {
628
+ if (entry.token?.type === "ERC-20" && entry.value && entry.value !== "0") {
629
+ addresses.push(entry.token.address.toLowerCase());
630
+ }
631
+ }
632
+ return addresses;
633
+ } catch {
634
+ return [];
635
+ }
636
+ }
613
637
  /**
614
638
  * Check if cached prices are still fresh
615
639
  */
@@ -7148,6 +7172,8 @@ var AgentRuntime = class {
7148
7172
  processAlive = true;
7149
7173
  riskUniverse = 0;
7150
7174
  allowedTokens = /* @__PURE__ */ new Set();
7175
+ /** Frontier token discovery — cached addresses from Blockscout scan */
7176
+ discoveredTokens = [];
7151
7177
  strategyContext;
7152
7178
  positionTracker;
7153
7179
  // Paper trading components (null when not in paper mode)
@@ -7749,6 +7775,13 @@ var AgentRuntime = class {
7749
7775
  console.log("");
7750
7776
  this.mode = "idle";
7751
7777
  try {
7778
+ if (this.riskUniverse === 4) {
7779
+ const discovered = await this.marketData.discoverTokenHoldings(this.client.address);
7780
+ if (discovered.length > 0) {
7781
+ this.discoveredTokens = discovered;
7782
+ console.log(`Frontier token discovery: ${discovered.length} token(s) found on-chain`);
7783
+ }
7784
+ }
7752
7785
  const tokens = this.getTokensToTrack();
7753
7786
  const initData = await this.marketData.fetchMarketData(this.client.address, tokens);
7754
7787
  void this.positionTracker.syncBalances(initData.balances, initData.prices);
@@ -9101,8 +9134,14 @@ See: https://exagent.io/docs/guides/manual-exit`,
9101
9134
  }
9102
9135
  }
9103
9136
  }
9137
+ for (const addr of this.discoveredTokens) {
9138
+ if (!baseSet.has(addr)) {
9139
+ extras.push(addr);
9140
+ baseSet.add(addr);
9141
+ }
9142
+ }
9104
9143
  if (extras.length > 0) {
9105
- console.log(`Auto-tracking ${extras.length} additional token(s) from position history`);
9144
+ console.log(`Auto-tracking ${extras.length} additional token(s) from position/discovery`);
9106
9145
  }
9107
9146
  const resolver = this.marketData.getResolver();
9108
9147
  const allTokens = [...base8, ...extras];
@@ -9442,7 +9481,7 @@ function loadSecureEnv(basePath, passphrase) {
9442
9481
  }
9443
9482
 
9444
9483
  // src/index.ts
9445
- var AGENT_VERSION = "0.1.44";
9484
+ var AGENT_VERSION = "0.1.46";
9446
9485
  // Annotate the CommonJS export names for ESM import in node:
9447
9486
  0 && (module.exports = {
9448
9487
  AGENT_VERSION,
package/dist/index.mjs CHANGED
@@ -62,7 +62,7 @@ import {
62
62
  tradeIdToBytes32,
63
63
  validateConfig,
64
64
  validateStrategy
65
- } from "./chunk-YXLDNUAH.mjs";
65
+ } from "./chunk-7QMPWDX3.mjs";
66
66
  export {
67
67
  AGENT_VERSION,
68
68
  AgentConfigSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exagent/agent",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
4
4
  "description": "Autonomous trading agent runtime for Exagent",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -29,7 +29,7 @@
29
29
  "clean": "rm -rf dist"
30
30
  },
31
31
  "dependencies": {
32
- "@exagent/sdk": "^0.1.19",
32
+ "@exagent/sdk": "^0.1.20",
33
33
  "@nktkas/hyperliquid": "^0.31.0",
34
34
  "@polymarket/clob-client": "^4.0.0",
35
35
  "chalk": "^5.3.0",