opentool 0.10.3 → 0.10.5

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
@@ -1299,15 +1299,9 @@ var registry = {
1299
1299
  chains,
1300
1300
  tokens
1301
1301
  };
1302
- function normalizePrivateKey(raw) {
1303
- const trimmed = raw.trim();
1304
- const withPrefix = trimmed.startsWith("0x") ? trimmed : `0x${trimmed}`;
1305
- if (!/^0x[0-9a-fA-F]{64}$/.test(withPrefix)) {
1306
- throw new Error("wallet() privateKey must be a 32-byte hex string");
1307
- }
1308
- return withPrefix;
1309
- }
1310
- function createNonceSource(start = Date.now()) {
1302
+
1303
+ // src/wallet/nonces.ts
1304
+ function createMonotonicNonceSource(start = Date.now()) {
1311
1305
  let last = start;
1312
1306
  return () => {
1313
1307
  const now = Date.now();
@@ -1319,6 +1313,16 @@ function createNonceSource(start = Date.now()) {
1319
1313
  return last;
1320
1314
  };
1321
1315
  }
1316
+
1317
+ // src/wallet/providers/private-key.ts
1318
+ function normalizePrivateKey(raw) {
1319
+ const trimmed = raw.trim();
1320
+ const withPrefix = trimmed.startsWith("0x") ? trimmed : `0x${trimmed}`;
1321
+ if (!/^0x[0-9a-fA-F]{64}$/.test(withPrefix)) {
1322
+ throw new Error("wallet() privateKey must be a 32-byte hex string");
1323
+ }
1324
+ return withPrefix;
1325
+ }
1322
1326
  function createPrivateKeyProvider(config) {
1323
1327
  const privateKey = normalizePrivateKey(config.privateKey);
1324
1328
  const account = privateKeyToAccount(privateKey);
@@ -1365,19 +1369,7 @@ function createPrivateKeyProvider(config) {
1365
1369
  sendTransaction,
1366
1370
  getNativeBalance,
1367
1371
  transfer,
1368
- nonceSource: createNonceSource()
1369
- };
1370
- }
1371
- function createNonceSource2(start = Date.now()) {
1372
- let last = start;
1373
- return () => {
1374
- const now = Date.now();
1375
- if (now > last) {
1376
- last = now;
1377
- } else {
1378
- last += 1;
1379
- }
1380
- return last;
1372
+ nonceSource: createMonotonicNonceSource()
1381
1373
  };
1382
1374
  }
1383
1375
  async function createTurnkeyProvider(config) {
@@ -1436,7 +1428,7 @@ async function createTurnkeyProvider(config) {
1436
1428
  sendTransaction,
1437
1429
  getNativeBalance,
1438
1430
  transfer,
1439
- nonceSource: createNonceSource2()
1431
+ nonceSource: createMonotonicNonceSource()
1440
1432
  };
1441
1433
  }
1442
1434
 
@@ -2703,6 +2695,16 @@ async function fetchHyperliquidSpotClearinghouseState(params) {
2703
2695
  }
2704
2696
 
2705
2697
  // src/adapters/hyperliquid/exchange.ts
2698
+ function resolveRequiredExchangeNonce(options) {
2699
+ if (typeof options.nonce === "number") {
2700
+ return options.nonce;
2701
+ }
2702
+ const resolved = options.walletNonceProvider?.() ?? options.wallet.nonceSource?.() ?? options.nonceSource?.();
2703
+ if (resolved === void 0) {
2704
+ throw new Error(`${options.action} requires an explicit nonce or wallet nonce source.`);
2705
+ }
2706
+ return resolved;
2707
+ }
2706
2708
  var HyperliquidExchangeClient = class {
2707
2709
  constructor(args) {
2708
2710
  this.wallet = args.wallet;
@@ -2873,7 +2875,13 @@ async function setHyperliquidPortfolioMargin(options) {
2873
2875
  if (!options.wallet?.account || !options.wallet.walletClient) {
2874
2876
  throw new Error("Wallet with signing capability is required for portfolio margin.");
2875
2877
  }
2876
- const nonce = options.nonce ?? options.walletNonceProvider?.() ?? options.wallet.nonceSource?.() ?? options.nonceSource?.() ?? Date.now();
2878
+ const nonce = resolveRequiredExchangeNonce({
2879
+ nonce: options.nonce,
2880
+ nonceSource: options.nonceSource,
2881
+ walletNonceProvider: options.walletNonceProvider,
2882
+ wallet: options.wallet,
2883
+ action: "Hyperliquid portfolio margin"
2884
+ });
2877
2885
  const signatureChainId = getSignatureChainId(env);
2878
2886
  const hyperliquidChain = HL_CHAIN_LABEL[env];
2879
2887
  const user = normalizeAddress(options.user ?? options.wallet.address);
@@ -2907,7 +2915,13 @@ async function setHyperliquidDexAbstraction(options) {
2907
2915
  if (!options.wallet?.account || !options.wallet.walletClient) {
2908
2916
  throw new Error("Wallet with signing capability is required for dex abstraction.");
2909
2917
  }
2910
- const nonce = options.nonce ?? options.walletNonceProvider?.() ?? options.wallet.nonceSource?.() ?? options.nonceSource?.() ?? Date.now();
2918
+ const nonce = resolveRequiredExchangeNonce({
2919
+ nonce: options.nonce,
2920
+ nonceSource: options.nonceSource,
2921
+ walletNonceProvider: options.walletNonceProvider,
2922
+ wallet: options.wallet,
2923
+ action: "Hyperliquid dex abstraction"
2924
+ });
2911
2925
  const signatureChainId = getSignatureChainId(env);
2912
2926
  const hyperliquidChain = HL_CHAIN_LABEL[env];
2913
2927
  const user = normalizeAddress(options.user ?? options.wallet.address);
@@ -2941,7 +2955,13 @@ async function setHyperliquidAccountAbstractionMode(options) {
2941
2955
  if (!options.wallet?.account || !options.wallet.walletClient) {
2942
2956
  throw new Error("Wallet with signing capability is required for account abstraction mode.");
2943
2957
  }
2944
- const nonce = options.nonce ?? options.walletNonceProvider?.() ?? options.wallet.nonceSource?.() ?? options.nonceSource?.() ?? Date.now();
2958
+ const nonce = resolveRequiredExchangeNonce({
2959
+ nonce: options.nonce,
2960
+ nonceSource: options.nonceSource,
2961
+ walletNonceProvider: options.walletNonceProvider,
2962
+ wallet: options.wallet,
2963
+ action: "Hyperliquid account abstraction mode"
2964
+ });
2945
2965
  const signatureChainId = getSignatureChainId(env);
2946
2966
  const hyperliquidChain = HL_CHAIN_LABEL[env];
2947
2967
  const user = normalizeAddress(options.user ?? options.wallet.address);
@@ -3141,7 +3161,12 @@ async function sendHyperliquidSpot(options) {
3141
3161
  assertPositiveDecimal(options.amount, "amount");
3142
3162
  const signatureChainId = getSignatureChainId(env);
3143
3163
  const hyperliquidChain = HL_CHAIN_LABEL[env];
3144
- const nonce = options.nonce ?? options.nonceSource?.() ?? Date.now();
3164
+ const nonce = resolveRequiredExchangeNonce({
3165
+ nonce: options.nonce,
3166
+ nonceSource: options.nonceSource,
3167
+ wallet: options.wallet,
3168
+ action: "Hyperliquid spot send"
3169
+ });
3145
3170
  const time = BigInt(nonce);
3146
3171
  const signature = await signSpotSend({
3147
3172
  wallet: options.wallet,
@@ -3425,6 +3450,9 @@ function resolveHyperliquidPair(value) {
3425
3450
  }
3426
3451
  return null;
3427
3452
  }
3453
+ function resolveHyperliquidLeverageMode(symbol) {
3454
+ return symbol.includes(":") ? "isolated" : "cross";
3455
+ }
3428
3456
  function resolveHyperliquidProfileChain(environment) {
3429
3457
  return environment === "testnet" ? "hyperliquid-testnet" : "hyperliquid";
3430
3458
  }
@@ -3525,6 +3553,175 @@ function resolveHyperliquidSymbol(asset, override) {
3525
3553
  const baseNoPair = base2.split("/")[0] ?? base2;
3526
3554
  return baseNoPair.trim().toUpperCase();
3527
3555
  }
3556
+ function resolveHyperliquidPerpSymbol(asset) {
3557
+ const raw = asset.trim();
3558
+ if (!raw) return raw;
3559
+ const dex = extractHyperliquidDex(raw);
3560
+ const base2 = normalizeHyperliquidBaseSymbol(raw) ?? raw.toUpperCase();
3561
+ return dex ? `${dex}:${base2}` : base2;
3562
+ }
3563
+ function resolveHyperliquidSpotSymbol(asset, defaultQuote = "USDC") {
3564
+ const quote = defaultQuote.trim().toUpperCase() || "USDC";
3565
+ const raw = asset.trim().toUpperCase();
3566
+ if (!raw) {
3567
+ return { symbol: raw, base: raw, quote };
3568
+ }
3569
+ const pair = resolveHyperliquidPair(raw);
3570
+ if (pair) {
3571
+ const [base3, pairQuote] = pair.split("/");
3572
+ return {
3573
+ symbol: pair,
3574
+ base: base3?.trim() ?? raw,
3575
+ quote: pairQuote?.trim() ?? quote
3576
+ };
3577
+ }
3578
+ const base2 = normalizeHyperliquidBaseSymbol(raw) ?? raw;
3579
+ return { symbol: `${base2}/${quote}`, base: base2, quote };
3580
+ }
3581
+
3582
+ // src/adapters/hyperliquid/strategy.ts
3583
+ function clampDcaWeight(value) {
3584
+ if (typeof value !== "number" || !Number.isFinite(value)) return 0;
3585
+ return Math.min(1e6, Math.max(0, value));
3586
+ }
3587
+ function resolveHyperliquidBudgetUsd(params) {
3588
+ const { config, accountValue } = params;
3589
+ if (config.allocationMode === "fixed") {
3590
+ const desiredUsd = config.amountUsd ?? 0;
3591
+ if (!Number.isFinite(desiredUsd) || desiredUsd <= 0) {
3592
+ throw new Error("fixed allocation requires amountUsd");
3593
+ }
3594
+ return desiredUsd;
3595
+ }
3596
+ if (!Number.isFinite(accountValue ?? Number.NaN)) {
3597
+ throw new Error("percent allocation requires accountValue");
3598
+ }
3599
+ const rawUsd = accountValue * (config.percentOfEquity / 100);
3600
+ const maxPercentUsd = accountValue * (config.maxPercentOfEquity / 100);
3601
+ return Math.min(rawUsd, maxPercentUsd);
3602
+ }
3603
+ function resolveHyperliquidDcaSymbolEntries(inputs, fallbackSymbol) {
3604
+ const entries = [];
3605
+ const values = Array.isArray(inputs) ? inputs : [];
3606
+ for (const input of values) {
3607
+ if (typeof input === "string") {
3608
+ const trimmed = input.trim();
3609
+ if (!trimmed) continue;
3610
+ const [rawSymbol, rawWeight] = trimmed.split(":");
3611
+ const symbol2 = rawSymbol?.trim();
3612
+ if (!symbol2) continue;
3613
+ const parsedWeight2 = typeof rawWeight === "string" && rawWeight.trim().length > 0 ? Number.parseFloat(rawWeight.trim()) : 1;
3614
+ const weight2 = Number.isFinite(parsedWeight2) && parsedWeight2 > 0 ? parsedWeight2 : 1;
3615
+ entries.push({ symbol: symbol2, weight: weight2 });
3616
+ continue;
3617
+ }
3618
+ if (!input || typeof input !== "object") continue;
3619
+ const symbol = input.symbol?.trim();
3620
+ if (!symbol) continue;
3621
+ const parsedWeight = typeof input.weight === "number" && Number.isFinite(input.weight) ? input.weight : 1;
3622
+ const weight = parsedWeight > 0 ? parsedWeight : 1;
3623
+ entries.push({ symbol, weight });
3624
+ }
3625
+ if (entries.length > 0) {
3626
+ return entries;
3627
+ }
3628
+ return [{ symbol: fallbackSymbol, weight: 1 }];
3629
+ }
3630
+ function normalizeHyperliquidDcaEntries(params) {
3631
+ const map = /* @__PURE__ */ new Map();
3632
+ const entries = Array.isArray(params.entries) ? params.entries : [];
3633
+ for (const entry of entries) {
3634
+ if (!entry || typeof entry !== "object") continue;
3635
+ const symbol = typeof entry.symbol === "string" ? entry.symbol.trim() : "";
3636
+ if (!symbol) continue;
3637
+ const key = symbol.toUpperCase();
3638
+ const weight = clampDcaWeight(entry.weight);
3639
+ if (weight <= 0) continue;
3640
+ const existing = map.get(key);
3641
+ if (existing) {
3642
+ existing.weight += weight;
3643
+ } else {
3644
+ map.set(key, { symbol, weight });
3645
+ }
3646
+ }
3647
+ if (map.size === 0) {
3648
+ map.set(params.fallbackSymbol.toUpperCase(), {
3649
+ symbol: params.fallbackSymbol,
3650
+ weight: 1
3651
+ });
3652
+ }
3653
+ const entriesList = Array.from(map.values());
3654
+ const totalWeight = entriesList.reduce((sum, entry) => sum + entry.weight, 0);
3655
+ if (!Number.isFinite(totalWeight) || totalWeight <= 0) {
3656
+ return [];
3657
+ }
3658
+ return entriesList.map((entry) => ({
3659
+ symbol: entry.symbol,
3660
+ weight: entry.weight,
3661
+ normalizedWeight: entry.weight / totalWeight
3662
+ }));
3663
+ }
3664
+ function resolveHyperliquidMaxPerRunUsd(targetNotionalUsd, hedgeRatio) {
3665
+ if (!Number.isFinite(targetNotionalUsd) || targetNotionalUsd <= 0) return 0;
3666
+ const ratio = Number.isFinite(hedgeRatio) && hedgeRatio > 0 ? hedgeRatio : 1;
3667
+ return Math.max(targetNotionalUsd, targetNotionalUsd * ratio);
3668
+ }
3669
+ function clampHyperliquidAbs(value, limit) {
3670
+ if (!Number.isFinite(value) || !Number.isFinite(limit) || limit <= 0) return 0;
3671
+ const capped = Math.min(Math.abs(value), limit);
3672
+ return Math.sign(value) * capped;
3673
+ }
3674
+ function resolveHyperliquidTargetSize(params) {
3675
+ const { config, execution, accountValue, currentPrice } = params;
3676
+ if (execution.size && Number.isFinite(execution.size)) {
3677
+ return { targetSize: execution.size, budgetUsd: execution.size * currentPrice };
3678
+ }
3679
+ if (config.allocationMode === "fixed") {
3680
+ const budgetUsd2 = resolveHyperliquidBudgetUsd({
3681
+ config,
3682
+ accountValue
3683
+ });
3684
+ return { targetSize: budgetUsd2 / currentPrice, budgetUsd: budgetUsd2 };
3685
+ }
3686
+ const budgetUsd = resolveHyperliquidBudgetUsd({
3687
+ config,
3688
+ accountValue
3689
+ });
3690
+ return { targetSize: budgetUsd / currentPrice, budgetUsd };
3691
+ }
3692
+ function planHyperliquidTrade(params) {
3693
+ const { signal, mode, currentSize, targetSize } = params;
3694
+ if (signal === "hold" || signal === "unknown") return null;
3695
+ if (signal === "buy") {
3696
+ const desired2 = mode === "long-short" ? targetSize : Math.max(targetSize, 0);
3697
+ const delta2 = desired2 - currentSize;
3698
+ if (delta2 <= 0) return null;
3699
+ return {
3700
+ side: "buy",
3701
+ size: delta2,
3702
+ reduceOnly: false,
3703
+ targetSize: desired2
3704
+ };
3705
+ }
3706
+ if (mode === "long-only") {
3707
+ if (currentSize <= 0) return null;
3708
+ return {
3709
+ side: "sell",
3710
+ size: currentSize,
3711
+ reduceOnly: true,
3712
+ targetSize: 0
3713
+ };
3714
+ }
3715
+ const desired = -Math.abs(targetSize);
3716
+ const delta = currentSize - desired;
3717
+ if (delta <= 0) return null;
3718
+ return {
3719
+ side: "sell",
3720
+ size: delta,
3721
+ reduceOnly: false,
3722
+ targetSize: desired
3723
+ };
3724
+ }
3528
3725
 
3529
3726
  // src/adapters/hyperliquid/order-utils.ts
3530
3727
  var MAX_HYPERLIQUID_PRICE_DECIMALS = 8;
@@ -3870,9 +4067,10 @@ function readHyperliquidSpotAccountValue(params) {
3870
4067
 
3871
4068
  // src/adapters/hyperliquid/market-data.ts
3872
4069
  var META_CACHE_TTL_MS = 5 * 60 * 1e3;
4070
+ var DEFAULT_OPENPOND_GATEWAY_URL = "https://gateway.openpond.dev";
3873
4071
  var allMidsCache = /* @__PURE__ */ new Map();
3874
4072
  function resolveGatewayBase(override) {
3875
- const value = override ?? process.env.OPENPOND_GATEWAY_URL ?? null;
4073
+ const value = override ?? process.env.OPENPOND_GATEWAY_URL ?? DEFAULT_OPENPOND_GATEWAY_URL;
3876
4074
  if (typeof value !== "string") {
3877
4075
  return null;
3878
4076
  }
@@ -4041,6 +4239,25 @@ async function fetchHyperliquidBars(params) {
4041
4239
  return typeof record.close === "number" && Number.isFinite(record.close) && typeof record.time === "number" && Number.isFinite(record.time);
4042
4240
  });
4043
4241
  }
4242
+ function normalizeHyperliquidIndicatorBars(bars) {
4243
+ return bars.filter(
4244
+ (bar) => bar && typeof bar === "object" && typeof bar.time === "number" && Number.isFinite(bar.time) && typeof bar.close === "number" && Number.isFinite(bar.close)
4245
+ ).map((bar) => {
4246
+ const close = bar.close;
4247
+ const open = typeof bar.open === "number" && Number.isFinite(bar.open) ? bar.open : close;
4248
+ const high = typeof bar.high === "number" && Number.isFinite(bar.high) ? bar.high : close;
4249
+ const low = typeof bar.low === "number" && Number.isFinite(bar.low) ? bar.low : close;
4250
+ const volume = typeof bar.volume === "number" && Number.isFinite(bar.volume) ? bar.volume : 0;
4251
+ return {
4252
+ time: bar.time,
4253
+ open,
4254
+ high,
4255
+ low,
4256
+ close,
4257
+ volume
4258
+ };
4259
+ });
4260
+ }
4044
4261
  async function fetchHyperliquidTickSize(params) {
4045
4262
  return fetchHyperliquidTickSizeForCoin(params.environment, params.symbol);
4046
4263
  }
@@ -4250,7 +4467,89 @@ var __hyperliquidMarketDataInternals = {
4250
4467
  formatScaledInt
4251
4468
  };
4252
4469
 
4470
+ // src/adapters/hyperliquid/utils.ts
4471
+ var DEFAULT_HYPERLIQUID_CADENCE_CRON = {
4472
+ daily: "0 8 * * *",
4473
+ hourly: "0 * * * *",
4474
+ weekly: "0 8 * * 1",
4475
+ "twice-weekly": "0 8 * * 1,4",
4476
+ monthly: "0 8 1 * *"
4477
+ };
4478
+ function parseHyperliquidJson(raw) {
4479
+ if (!raw) return null;
4480
+ try {
4481
+ return JSON.parse(raw);
4482
+ } catch {
4483
+ return null;
4484
+ }
4485
+ }
4486
+ function clampHyperliquidInt(value, min, max, fallback) {
4487
+ if (value == null) return fallback;
4488
+ if (typeof value === "string" && value.trim().length === 0) return fallback;
4489
+ const parsed = Number(value);
4490
+ if (!Number.isFinite(parsed)) return fallback;
4491
+ const numeric = Math.trunc(parsed);
4492
+ if (!Number.isFinite(numeric)) return fallback;
4493
+ return Math.min(max, Math.max(min, numeric));
4494
+ }
4495
+ function clampHyperliquidFloat(value, min, max, fallback) {
4496
+ if (value == null) return fallback;
4497
+ if (typeof value === "string" && value.trim().length === 0) return fallback;
4498
+ const numeric = Number(value);
4499
+ if (!Number.isFinite(numeric)) return fallback;
4500
+ return Math.min(max, Math.max(min, numeric));
4501
+ }
4502
+ function resolveHyperliquidScheduleEvery(input, options) {
4503
+ const min = options?.min ?? 1;
4504
+ const max = options?.max ?? 59;
4505
+ const fallback = options?.fallback ?? 1;
4506
+ return clampHyperliquidInt(input, min, max, fallback);
4507
+ }
4508
+ function resolveHyperliquidScheduleUnit(input, fallback = "hours") {
4509
+ if (input === "minutes") return "minutes";
4510
+ if (input === "hours") return "hours";
4511
+ return fallback;
4512
+ }
4513
+ function resolveHyperliquidIntervalCron(every, unit) {
4514
+ if (unit === "minutes") {
4515
+ return every === 1 ? "* * * * *" : `*/${every} * * * *`;
4516
+ }
4517
+ return every === 1 ? "0 * * * *" : `0 */${every} * * *`;
4518
+ }
4519
+ function resolveHyperliquidHourlyInterval(input, fallback = 1) {
4520
+ return clampHyperliquidInt(input, 1, 24, fallback);
4521
+ }
4522
+ function resolveHyperliquidCadenceCron(cadence, hourlyInterval, cadenceToCron = DEFAULT_HYPERLIQUID_CADENCE_CRON) {
4523
+ if (cadence !== "hourly") {
4524
+ return cadenceToCron[cadence];
4525
+ }
4526
+ const interval = resolveHyperliquidHourlyInterval(hourlyInterval, 1);
4527
+ return interval === 1 ? cadenceToCron.hourly : `0 */${interval} * * *`;
4528
+ }
4529
+ function resolveHyperliquidCadenceFromResolution(resolution) {
4530
+ if (resolution === "60") {
4531
+ return { cadence: "hourly", hourlyInterval: 1 };
4532
+ }
4533
+ if (resolution === "240") {
4534
+ return { cadence: "hourly", hourlyInterval: 4 };
4535
+ }
4536
+ if (resolution === "1W") {
4537
+ return { cadence: "weekly" };
4538
+ }
4539
+ return { cadence: "daily" };
4540
+ }
4541
+
4253
4542
  // src/adapters/hyperliquid/index.ts
4543
+ function resolveRequiredNonce(params) {
4544
+ if (typeof params.nonce === "number") {
4545
+ return params.nonce;
4546
+ }
4547
+ const resolved = params.nonceSource?.() ?? params.wallet?.nonceSource?.();
4548
+ if (resolved === void 0) {
4549
+ throw new Error(`${params.action} requires an explicit nonce or wallet nonce source.`);
4550
+ }
4551
+ return resolved;
4552
+ }
4254
4553
  function assertPositiveDecimalInput(value, label) {
4255
4554
  if (typeof value === "number") {
4256
4555
  if (!Number.isFinite(value) || value <= 0) {
@@ -4359,7 +4658,12 @@ async function placeHyperliquidOrder(options) {
4359
4658
  f: effectiveBuilder.fee
4360
4659
  };
4361
4660
  }
4362
- const effectiveNonce = nonce ?? Date.now();
4661
+ const effectiveNonce = resolveRequiredNonce({
4662
+ nonce,
4663
+ nonceSource: options.nonceSource,
4664
+ wallet: wallet2,
4665
+ action: "Hyperliquid order submission"
4666
+ });
4363
4667
  const signature = await signL1Action({
4364
4668
  wallet: wallet2,
4365
4669
  action,
@@ -4475,8 +4779,13 @@ async function withdrawFromHyperliquid(options) {
4475
4779
  chainId: Number.parseInt(signatureChainId, 16),
4476
4780
  verifyingContract: ZERO_ADDRESS
4477
4781
  };
4478
- const time = BigInt(Date.now());
4479
- const nonce = Number(time);
4782
+ const nonce = resolveRequiredNonce({
4783
+ nonce: options.nonce,
4784
+ nonceSource: options.nonceSource,
4785
+ wallet: wallet2,
4786
+ action: "Hyperliquid withdraw"
4787
+ });
4788
+ const time = BigInt(nonce);
4480
4789
  const normalizedDestination = normalizeAddress(destination);
4481
4790
  const message = {
4482
4791
  hyperliquidChain,
@@ -4556,7 +4865,12 @@ async function approveHyperliquidBuilderFee(options) {
4556
4865
  const inferredEnvironment = environment ?? "mainnet";
4557
4866
  const resolvedBaseUrl = API_BASES[inferredEnvironment];
4558
4867
  const maxFeeRate = formattedPercent;
4559
- const effectiveNonce = nonce ?? Date.now();
4868
+ const effectiveNonce = resolveRequiredNonce({
4869
+ nonce,
4870
+ nonceSource: options.nonceSource,
4871
+ wallet: wallet2,
4872
+ action: "Hyperliquid builder approval"
4873
+ });
4560
4874
  const signatureNonce = BigInt(effectiveNonce);
4561
4875
  const signatureChainHex = signatureChainId ?? getSignatureChainId(inferredEnvironment);
4562
4876
  const approvalSignature = await signApproveBuilderFee({
@@ -5497,6 +5811,176 @@ async function fetchPolymarketPriceHistory(params) {
5497
5811
  })).filter((point) => Number.isFinite(point.t) && Number.isFinite(point.p));
5498
5812
  }
5499
5813
 
5814
+ // src/adapters/news/signals.ts
5815
+ var DEFAULT_OPENPOND_GATEWAY_URL2 = "https://gateway.openpond.dev";
5816
+ function resolveFetchImplementation(override) {
5817
+ const fetchImplementation = override ?? globalThis.fetch;
5818
+ if (!fetchImplementation) {
5819
+ throw new Error(
5820
+ "No fetch implementation available. Provide one via NewsSignalClientConfig.fetchImplementation."
5821
+ );
5822
+ }
5823
+ return fetchImplementation;
5824
+ }
5825
+ function resolveNewsGatewayBase(override) {
5826
+ const value = override ?? process.env.OPENPOND_GATEWAY_URL ?? DEFAULT_OPENPOND_GATEWAY_URL2;
5827
+ if (typeof value !== "string") {
5828
+ throw new Error("OPENPOND_GATEWAY_URL is required.");
5829
+ }
5830
+ const trimmed = value.trim();
5831
+ if (!trimmed) {
5832
+ throw new Error("OPENPOND_GATEWAY_URL is required.");
5833
+ }
5834
+ return trimmed.replace(/\/$/, "");
5835
+ }
5836
+ function normalizeAsOf(value) {
5837
+ if (value == null) return void 0;
5838
+ const date = value instanceof Date ? value : new Date(value);
5839
+ if (Number.isNaN(date.getTime())) {
5840
+ throw new Error("asOf must be a valid ISO-8601 datetime or Date.");
5841
+ }
5842
+ return date.toISOString();
5843
+ }
5844
+ async function postGatewayJson(params) {
5845
+ const gatewayBase = resolveNewsGatewayBase(params.gatewayBase);
5846
+ const fetchImplementation = resolveFetchImplementation(params.fetchImplementation);
5847
+ const response = await fetchImplementation(`${gatewayBase}${params.path}`, {
5848
+ method: "POST",
5849
+ headers: { "content-type": "application/json" },
5850
+ body: JSON.stringify(params.body)
5851
+ });
5852
+ const text = await response.text().catch(() => "");
5853
+ let payload = null;
5854
+ try {
5855
+ payload = text ? JSON.parse(text) : null;
5856
+ } catch {
5857
+ payload = text;
5858
+ }
5859
+ if (!response.ok) {
5860
+ throw new Error(
5861
+ `Gateway request failed (${response.status}) for ${params.path}: ${typeof payload === "string" && payload ? payload : "no_body"}`
5862
+ );
5863
+ }
5864
+ return payload;
5865
+ }
5866
+ async function fetchNewsEventSignal(params) {
5867
+ if (!params.query?.trim() && !params.eventKey?.trim()) {
5868
+ throw new Error("query or eventKey is required.");
5869
+ }
5870
+ return postGatewayJson({
5871
+ path: "/v1/news/event-signal",
5872
+ gatewayBase: params.gatewayBase,
5873
+ fetchImplementation: params.fetchImplementation,
5874
+ body: {
5875
+ ...params.query?.trim() ? { query: params.query.trim() } : {},
5876
+ ...params.eventKey?.trim() ? { eventKey: params.eventKey.trim() } : {},
5877
+ ...normalizeAsOf(params.asOf) ? { asOf: normalizeAsOf(params.asOf) } : {},
5878
+ ...typeof params.includePredictionMarkets === "boolean" ? { includePredictionMarkets: params.includePredictionMarkets } : {},
5879
+ ...typeof params.ingestOnRequest === "boolean" ? { ingestOnRequest: params.ingestOnRequest } : {},
5880
+ ...typeof params.maxAgeHours === "number" ? { maxAgeHours: params.maxAgeHours } : {},
5881
+ policy: {
5882
+ ...typeof params.minConfidence === "number" ? { minConfidence: params.minConfidence } : {},
5883
+ ...typeof params.minIndependentSources === "number" ? { minIndependentSources: params.minIndependentSources } : {},
5884
+ ...typeof params.minTierASources === "number" ? { minTierASources: params.minTierASources } : {}
5885
+ }
5886
+ }
5887
+ });
5888
+ }
5889
+ async function fetchNewsPropositionSignal(params) {
5890
+ const question = params.question.trim();
5891
+ if (!question) {
5892
+ throw new Error("question is required.");
5893
+ }
5894
+ return postGatewayJson({
5895
+ path: "/v1/news/event-proposition-signal",
5896
+ gatewayBase: params.gatewayBase,
5897
+ fetchImplementation: params.fetchImplementation,
5898
+ body: {
5899
+ question,
5900
+ ...params.query?.trim() ? { query: params.query.trim() } : {},
5901
+ ...params.eventKey?.trim() ? { eventKey: params.eventKey.trim() } : {},
5902
+ ...params.propositionType?.trim() ? { propositionType: params.propositionType.trim() } : {},
5903
+ ...normalizeAsOf(params.asOf) ? { asOf: normalizeAsOf(params.asOf) } : {},
5904
+ ...typeof params.includePredictionMarkets === "boolean" ? { includePredictionMarkets: params.includePredictionMarkets } : {},
5905
+ ...typeof params.ingestOnRequest === "boolean" ? { ingestOnRequest: params.ingestOnRequest } : {},
5906
+ ...typeof params.maxAgeHours === "number" ? { maxAgeHours: params.maxAgeHours } : {},
5907
+ ...typeof params.candidateLimit === "number" ? { candidateLimit: params.candidateLimit } : {}
5908
+ }
5909
+ });
5910
+ }
5911
+ function evaluateNewsContinuationGate(signal, gate) {
5912
+ const blockedAction = gate.onBlocked ?? "skip";
5913
+ const blockingFactors = [];
5914
+ if (gate.mode === "event") {
5915
+ const eventSignal = signal;
5916
+ if (gate.requireTriggerPassed !== false && !eventSignal.triggerPassed) {
5917
+ blockingFactors.push("trigger_not_passed");
5918
+ }
5919
+ if (typeof gate.minConfidence === "number" && eventSignal.eventConfidence < gate.minConfidence) {
5920
+ blockingFactors.push("confidence_below_threshold");
5921
+ }
5922
+ if (typeof gate.maxDataAgeMs === "number" && typeof eventSignal.dataAgeMs === "number" && eventSignal.dataAgeMs > gate.maxDataAgeMs) {
5923
+ blockingFactors.push("signal_too_stale");
5924
+ }
5925
+ if (typeof gate.minIndependentSources === "number" && eventSignal.supportingSourceCount < gate.minIndependentSources) {
5926
+ blockingFactors.push("insufficient_supporting_sources");
5927
+ }
5928
+ if (typeof gate.minTierASources === "number" && eventSignal.tierASourceCount < gate.minTierASources) {
5929
+ blockingFactors.push("insufficient_tier_a_sources");
5930
+ }
5931
+ } else {
5932
+ const propositionSignal = signal;
5933
+ if (gate.requireResolvedEvent !== false && propositionSignal.propositionStatus === "no_matching_event") {
5934
+ blockingFactors.push("no_matching_event");
5935
+ }
5936
+ if (gate.expectedAnswer && propositionSignal.answer !== gate.expectedAnswer) {
5937
+ blockingFactors.push("unexpected_answer");
5938
+ }
5939
+ if (typeof gate.minConfidence === "number" && propositionSignal.propositionConfidence < gate.minConfidence) {
5940
+ blockingFactors.push("confidence_below_threshold");
5941
+ }
5942
+ if (typeof gate.maxDataAgeMs === "number" && typeof propositionSignal.dataAgeMs === "number" && propositionSignal.dataAgeMs > gate.maxDataAgeMs) {
5943
+ blockingFactors.push("signal_too_stale");
5944
+ }
5945
+ }
5946
+ if (blockingFactors.length === 0) {
5947
+ return {
5948
+ allowed: true,
5949
+ action: "continue",
5950
+ reason: "All continuation gate checks passed.",
5951
+ matchedRule: gate.mode,
5952
+ blockingFactors: []
5953
+ };
5954
+ }
5955
+ return {
5956
+ allowed: false,
5957
+ action: blockedAction,
5958
+ reason: `Blocked by continuation gate: ${blockingFactors.join(", ")}.`,
5959
+ matchedRule: gate.mode,
5960
+ blockingFactors
5961
+ };
5962
+ }
5963
+ var NewsSignalClient = class {
5964
+ constructor(config = {}) {
5965
+ this.gatewayBase = resolveNewsGatewayBase(config.gatewayBase);
5966
+ this.fetchImplementation = resolveFetchImplementation(config.fetchImplementation);
5967
+ }
5968
+ eventSignal(params) {
5969
+ return fetchNewsEventSignal({
5970
+ ...params,
5971
+ gatewayBase: this.gatewayBase,
5972
+ fetchImplementation: this.fetchImplementation
5973
+ });
5974
+ }
5975
+ propositionSignal(params) {
5976
+ return fetchNewsPropositionSignal({
5977
+ ...params,
5978
+ gatewayBase: this.gatewayBase,
5979
+ fetchImplementation: this.fetchImplementation
5980
+ });
5981
+ }
5982
+ };
5983
+
5500
5984
  // src/ai/errors.ts
5501
5985
  var AIError = class extends Error {
5502
5986
  constructor(message, options) {
@@ -6247,8 +6731,9 @@ function toAbortError(reason) {
6247
6731
  }
6248
6732
  return new AIAbortError(String(reason ?? "AI request aborted"));
6249
6733
  }
6734
+ var BACKTEST_DECISION_MODE = "backtest_decisions";
6250
6735
  var backtestDecisionRequestSchema = z.object({
6251
- mode: z.literal("backtest_decisions"),
6736
+ mode: z.literal(BACKTEST_DECISION_MODE),
6252
6737
  source: z.string().min(1).optional(),
6253
6738
  symbol: z.string().min(1).optional(),
6254
6739
  lookbackDays: z.number().positive().optional(),
@@ -6310,6 +6795,57 @@ function estimateCountBack(params) {
6310
6795
  }
6311
6796
  return fallback;
6312
6797
  }
6798
+ function resolveBacktestMode(value) {
6799
+ if (typeof value !== "string") return null;
6800
+ const normalized = value.trim().toLowerCase();
6801
+ return normalized === BACKTEST_DECISION_MODE ? BACKTEST_DECISION_MODE : null;
6802
+ }
6803
+ function resolveBacktestWindow(params) {
6804
+ const fromSeconds = parseTimeToSeconds(params.from) ?? parseTimeToSeconds(params.timeframeStart);
6805
+ const toSeconds = parseTimeToSeconds(params.to) ?? parseTimeToSeconds(params.timeframeEnd);
6806
+ const hasWindow = fromSeconds != null && toSeconds != null && Number.isFinite(fromSeconds) && Number.isFinite(toSeconds) && toSeconds > fromSeconds;
6807
+ const resolvedFrom = hasWindow ? fromSeconds : void 0;
6808
+ const resolvedTo = hasWindow ? toSeconds : void 0;
6809
+ const lookbackDays = typeof params.lookbackDays === "number" && Number.isFinite(params.lookbackDays) ? params.lookbackDays : void 0;
6810
+ const countBack = estimateCountBack({
6811
+ fallback: params.fallbackCountBack,
6812
+ resolution: params.resolution,
6813
+ ...lookbackDays != null ? { lookbackDays } : {},
6814
+ ...resolvedFrom != null ? { fromSeconds: resolvedFrom } : {},
6815
+ ...resolvedTo != null ? { toSeconds: resolvedTo } : {},
6816
+ ...typeof params.minCountBack === "number" ? { minCountBack: params.minCountBack } : {},
6817
+ ...typeof params.bufferBars === "number" ? { bufferBars: params.bufferBars } : {}
6818
+ });
6819
+ return {
6820
+ ...resolvedFrom != null ? { fromSeconds: resolvedFrom } : {},
6821
+ ...resolvedTo != null ? { toSeconds: resolvedTo } : {},
6822
+ countBack
6823
+ };
6824
+ }
6825
+ function resolveBacktestAccountValueUsd(value) {
6826
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) {
6827
+ return value;
6828
+ }
6829
+ if (typeof value === "string" && value.trim().length > 0) {
6830
+ const parsed = Number.parseFloat(value.trim());
6831
+ if (Number.isFinite(parsed) && parsed > 0) {
6832
+ return parsed;
6833
+ }
6834
+ }
6835
+ return void 0;
6836
+ }
6837
+ function buildBacktestDecisionSeriesInput(request) {
6838
+ const accountValueUsd = resolveBacktestAccountValueUsd(request.initialEquityUsd);
6839
+ return {
6840
+ ...request.symbol ? { symbol: request.symbol } : {},
6841
+ ...request.timeframeStart ? { timeframeStart: request.timeframeStart } : {},
6842
+ ...request.timeframeEnd ? { timeframeEnd: request.timeframeEnd } : {},
6843
+ ...request.from != null ? { from: request.from } : {},
6844
+ ...request.to != null ? { to: request.to } : {},
6845
+ ...request.lookbackDays != null ? { lookbackDays: request.lookbackDays } : {},
6846
+ ...accountValueUsd != null ? { accountValueUsd } : {}
6847
+ };
6848
+ }
6313
6849
  var METADATA_SPEC_VERSION = "1.1.0";
6314
6850
  var McpAnnotationsSchema = z.object({
6315
6851
  title: z.string().optional(),
@@ -7389,6 +7925,6 @@ function timestamp() {
7389
7925
  return (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").slice(0, 19);
7390
7926
  }
7391
7927
 
7392
- export { AIAbortError, AIError, AIFetchError, AIResponseError, DEFAULT_BASE_URL, DEFAULT_CHAIN, DEFAULT_FACILITATOR, DEFAULT_HYPERLIQUID_MARKET_SLIPPAGE_BPS, DEFAULT_MODEL, DEFAULT_TIMEOUT_MS, DEFAULT_TOKENS, HTTP_METHODS2 as HTTP_METHODS, HyperliquidApiError, HyperliquidBuilderApprovalError, HyperliquidExchangeClient, HyperliquidGuardError, HyperliquidInfoClient, HyperliquidTermsError, PAYMENT_HEADERS, POLYMARKET_CHAIN_ID, POLYMARKET_CLOB_AUTH_DOMAIN, POLYMARKET_CLOB_DOMAIN, POLYMARKET_ENDPOINTS, POLYMARKET_EXCHANGE_ADDRESSES, PolymarketApiError, PolymarketAuthError, PolymarketExchangeClient, PolymarketInfoClient, SUPPORTED_CURRENCIES, StoreError, WEBSEARCH_TOOL_DEFINITION, WEBSEARCH_TOOL_NAME, X402BrowserClient, X402Client, X402PaymentRequiredError, __hyperliquidInternals, __hyperliquidMarketDataInternals, approveHyperliquidBuilderFee, backtestDecisionRequestSchema, batchModifyHyperliquidOrders, buildHmacSignature, buildHyperliquidMarketIdentity, buildHyperliquidProfileAssets, buildHyperliquidSpotUsdPriceMap, buildL1Headers, buildL2Headers, buildPolymarketOrderAmounts, buildSignedOrderPayload, cancelAllHyperliquidOrders, cancelAllPolymarketOrders, cancelHyperliquidOrders, cancelHyperliquidOrdersByCloid, cancelHyperliquidTwapOrder, cancelMarketPolymarketOrders, cancelPolymarketOrder, cancelPolymarketOrders, chains, computeHyperliquidMarketIocLimitPrice, createAIClient, createDevServer, createHyperliquidSubAccount, createMcpAdapter, createMonotonicNonceFactory, createPolymarketApiKey, createStdioServer, defineX402Payment, depositToHyperliquidBridge, derivePolymarketApiKey, ensureTextContent, estimateCountBack, executeTool, extractHyperliquidDex, extractHyperliquidOrderIds, fetchHyperliquidAllMids, fetchHyperliquidAssetCtxs, fetchHyperliquidBars, fetchHyperliquidClearinghouseState, fetchHyperliquidFrontendOpenOrders, fetchHyperliquidHistoricalOrders, fetchHyperliquidMeta, fetchHyperliquidMetaAndAssetCtxs, fetchHyperliquidOpenOrders, fetchHyperliquidOrderStatus, fetchHyperliquidPerpMarketInfo, fetchHyperliquidPreTransferCheck, fetchHyperliquidSizeDecimals, fetchHyperliquidSpotAccountValue, fetchHyperliquidSpotAssetCtxs, fetchHyperliquidSpotClearinghouseState, fetchHyperliquidSpotMarketInfo, fetchHyperliquidSpotMeta, fetchHyperliquidSpotMetaAndAssetCtxs, fetchHyperliquidSpotTickSize, fetchHyperliquidSpotUsdPriceMap, fetchHyperliquidTickSize, fetchHyperliquidUserFills, fetchHyperliquidUserFillsByTime, fetchHyperliquidUserRateLimit, fetchPolymarketMarket, fetchPolymarketMarkets, fetchPolymarketMidpoint, fetchPolymarketOrderbook, fetchPolymarketPrice, fetchPolymarketPriceHistory, flattenMessageContent, formatHyperliquidMarketablePrice, formatHyperliquidOrderSize, formatHyperliquidPrice, formatHyperliquidSize, generateMetadata, generateMetadataCommand, generateText, getHyperliquidMaxBuilderFee, getModelConfig, getMyPerformance, getMyTools, getRpcUrl, getX402PaymentContext, isHyperliquidSpotSymbol, isStreamingSupported, isToolCallingSupported, listModels, loadAndValidateTools, modifyHyperliquidOrder, normalizeHyperliquidBaseSymbol, normalizeHyperliquidMetaSymbol, normalizeModelName, normalizeNumberArrayish, normalizeSpotTokenName2 as normalizeSpotTokenName, normalizeStringArrayish, parseSpotPairSymbol, parseTimeToSeconds, payX402, payX402WithWallet, placeHyperliquidOrder, placeHyperliquidTwapOrder, placePolymarketOrder, postAgentDigest, readHyperliquidAccountValue, readHyperliquidNumber, readHyperliquidPerpPosition, readHyperliquidPerpPositionSize, readHyperliquidSpotAccountValue, readHyperliquidSpotBalance, readHyperliquidSpotBalanceSize, recordHyperliquidBuilderApproval, recordHyperliquidTermsAcceptance, registry, requireX402Payment, reserveHyperliquidRequestWeight, resolutionToSeconds, resolveConfig2 as resolveConfig, resolveExchangeAddress, resolveHyperliquidAbstractionFromMode, resolveHyperliquidChain, resolveHyperliquidChainConfig, resolveHyperliquidErrorDetail, resolveHyperliquidOrderRef, resolveHyperliquidOrderSymbol, resolveHyperliquidPair, resolveHyperliquidProfileChain, resolveHyperliquidRpcEnvVar, resolveHyperliquidStoreNetwork, resolveHyperliquidSymbol, resolvePolymarketBaseUrl, resolveRuntimePath, resolveSpotMidCandidates, resolveSpotTokenCandidates, resolveToolset, responseToToolResponse, retrieve, roundHyperliquidPriceToTick, scheduleHyperliquidCancel, sendHyperliquidSpot, setHyperliquidAccountAbstractionMode, setHyperliquidDexAbstraction, setHyperliquidPortfolioMargin, store, streamText, tokens, transferHyperliquidSubAccount, updateHyperliquidIsolatedMargin, updateHyperliquidLeverage, validateCommand, wallet, walletToolkit, withX402Payment, withdrawFromHyperliquid };
7928
+ export { AIAbortError, AIError, AIFetchError, AIResponseError, BACKTEST_DECISION_MODE, DEFAULT_BASE_URL, DEFAULT_CHAIN, DEFAULT_FACILITATOR, DEFAULT_HYPERLIQUID_CADENCE_CRON, DEFAULT_HYPERLIQUID_MARKET_SLIPPAGE_BPS, DEFAULT_MODEL, DEFAULT_OPENPOND_GATEWAY_URL2 as DEFAULT_OPENPOND_GATEWAY_URL, DEFAULT_TIMEOUT_MS, DEFAULT_TOKENS, HTTP_METHODS2 as HTTP_METHODS, HyperliquidApiError, HyperliquidBuilderApprovalError, HyperliquidExchangeClient, HyperliquidGuardError, HyperliquidInfoClient, HyperliquidTermsError, NewsSignalClient, PAYMENT_HEADERS, POLYMARKET_CHAIN_ID, POLYMARKET_CLOB_AUTH_DOMAIN, POLYMARKET_CLOB_DOMAIN, POLYMARKET_ENDPOINTS, POLYMARKET_EXCHANGE_ADDRESSES, PolymarketApiError, PolymarketAuthError, PolymarketExchangeClient, PolymarketInfoClient, SUPPORTED_CURRENCIES, StoreError, WEBSEARCH_TOOL_DEFINITION, WEBSEARCH_TOOL_NAME, X402BrowserClient, X402Client, X402PaymentRequiredError, __hyperliquidInternals, __hyperliquidMarketDataInternals, approveHyperliquidBuilderFee, backtestDecisionRequestSchema, batchModifyHyperliquidOrders, buildBacktestDecisionSeriesInput, buildHmacSignature, buildHyperliquidMarketIdentity, buildHyperliquidProfileAssets, buildHyperliquidSpotUsdPriceMap, buildL1Headers, buildL2Headers, buildPolymarketOrderAmounts, buildSignedOrderPayload, cancelAllHyperliquidOrders, cancelAllPolymarketOrders, cancelHyperliquidOrders, cancelHyperliquidOrdersByCloid, cancelHyperliquidTwapOrder, cancelMarketPolymarketOrders, cancelPolymarketOrder, cancelPolymarketOrders, chains, clampHyperliquidAbs, clampHyperliquidFloat, clampHyperliquidInt, computeHyperliquidMarketIocLimitPrice, createAIClient, createDevServer, createHyperliquidSubAccount, createMcpAdapter, createMonotonicNonceFactory, createPolymarketApiKey, createStdioServer, defineX402Payment, depositToHyperliquidBridge, derivePolymarketApiKey, ensureTextContent, estimateCountBack, evaluateNewsContinuationGate, executeTool, extractHyperliquidDex, extractHyperliquidOrderIds, fetchHyperliquidAllMids, fetchHyperliquidAssetCtxs, fetchHyperliquidBars, fetchHyperliquidClearinghouseState, fetchHyperliquidFrontendOpenOrders, fetchHyperliquidHistoricalOrders, fetchHyperliquidMeta, fetchHyperliquidMetaAndAssetCtxs, fetchHyperliquidOpenOrders, fetchHyperliquidOrderStatus, fetchHyperliquidPerpMarketInfo, fetchHyperliquidPreTransferCheck, fetchHyperliquidSizeDecimals, fetchHyperliquidSpotAccountValue, fetchHyperliquidSpotAssetCtxs, fetchHyperliquidSpotClearinghouseState, fetchHyperliquidSpotMarketInfo, fetchHyperliquidSpotMeta, fetchHyperliquidSpotMetaAndAssetCtxs, fetchHyperliquidSpotTickSize, fetchHyperliquidSpotUsdPriceMap, fetchHyperliquidTickSize, fetchHyperliquidUserFills, fetchHyperliquidUserFillsByTime, fetchHyperliquidUserRateLimit, fetchNewsEventSignal, fetchNewsPropositionSignal, fetchPolymarketMarket, fetchPolymarketMarkets, fetchPolymarketMidpoint, fetchPolymarketOrderbook, fetchPolymarketPrice, fetchPolymarketPriceHistory, flattenMessageContent, formatHyperliquidMarketablePrice, formatHyperliquidOrderSize, formatHyperliquidPrice, formatHyperliquidSize, generateMetadata, generateMetadataCommand, generateText, getHyperliquidMaxBuilderFee, getModelConfig, getMyPerformance, getMyTools, getRpcUrl, getX402PaymentContext, isHyperliquidSpotSymbol, isStreamingSupported, isToolCallingSupported, listModels, loadAndValidateTools, modifyHyperliquidOrder, normalizeHyperliquidBaseSymbol, normalizeHyperliquidDcaEntries, normalizeHyperliquidIndicatorBars, normalizeHyperliquidMetaSymbol, normalizeModelName, normalizeNumberArrayish, normalizeSpotTokenName2 as normalizeSpotTokenName, normalizeStringArrayish, parseHyperliquidJson, parseSpotPairSymbol, parseTimeToSeconds, payX402, payX402WithWallet, placeHyperliquidOrder, placeHyperliquidTwapOrder, placePolymarketOrder, planHyperliquidTrade, postAgentDigest, readHyperliquidAccountValue, readHyperliquidNumber, readHyperliquidPerpPosition, readHyperliquidPerpPositionSize, readHyperliquidSpotAccountValue, readHyperliquidSpotBalance, readHyperliquidSpotBalanceSize, recordHyperliquidBuilderApproval, recordHyperliquidTermsAcceptance, registry, requireX402Payment, reserveHyperliquidRequestWeight, resolutionToSeconds, resolveBacktestAccountValueUsd, resolveBacktestMode, resolveBacktestWindow, resolveConfig2 as resolveConfig, resolveExchangeAddress, resolveHyperliquidAbstractionFromMode, resolveHyperliquidBudgetUsd, resolveHyperliquidCadenceCron, resolveHyperliquidCadenceFromResolution, resolveHyperliquidChain, resolveHyperliquidChainConfig, resolveHyperliquidDcaSymbolEntries, resolveHyperliquidErrorDetail, resolveHyperliquidHourlyInterval, resolveHyperliquidIntervalCron, resolveHyperliquidLeverageMode, resolveHyperliquidMaxPerRunUsd, resolveHyperliquidOrderRef, resolveHyperliquidOrderSymbol, resolveHyperliquidPair, resolveHyperliquidPerpSymbol, resolveHyperliquidProfileChain, resolveHyperliquidRpcEnvVar, resolveHyperliquidScheduleEvery, resolveHyperliquidScheduleUnit, resolveHyperliquidSpotSymbol, resolveHyperliquidStoreNetwork, resolveHyperliquidSymbol, resolveHyperliquidTargetSize, resolveNewsGatewayBase, resolvePolymarketBaseUrl, resolveRuntimePath, resolveSpotMidCandidates, resolveSpotTokenCandidates, resolveToolset, responseToToolResponse, retrieve, roundHyperliquidPriceToTick, scheduleHyperliquidCancel, sendHyperliquidSpot, setHyperliquidAccountAbstractionMode, setHyperliquidDexAbstraction, setHyperliquidPortfolioMargin, store, streamText, tokens, transferHyperliquidSubAccount, updateHyperliquidIsolatedMargin, updateHyperliquidLeverage, validateCommand, wallet, walletToolkit, withX402Payment, withdrawFromHyperliquid };
7393
7929
  //# sourceMappingURL=index.js.map
7394
7930
  //# sourceMappingURL=index.js.map