opentool 0.10.4 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/hyperliquid/index.d.ts +7 -3
- package/dist/adapters/hyperliquid/index.js +66 -8
- package/dist/adapters/hyperliquid/index.js.map +1 -1
- package/dist/adapters/news/index.d.ts +176 -0
- package/dist/adapters/news/index.js +173 -0
- package/dist/adapters/news/index.js.map +1 -0
- package/dist/adapters/polymarket/index.d.ts +319 -0
- package/dist/adapters/polymarket/index.js +831 -0
- package/dist/adapters/polymarket/index.js.map +1 -0
- package/dist/backtest/index.d.ts +58 -0
- package/dist/backtest/index.js +122 -0
- package/dist/backtest/index.js.map +1 -0
- package/dist/cli/index.d.ts +26 -4
- package/dist/{validate-DbhJ_r0Z.d.ts → index-9Z3wo28l.d.ts} +2 -25
- package/dist/index.d.ts +10 -377
- package/dist/index.js +280 -1141
- package/dist/index.js.map +1 -1
- package/dist/{payment-orkZA9se.d.ts → payment-BLm1ltur.d.ts} +1 -1
- package/dist/{types-3w880w_t.d.ts → types-BaTmu0gS.d.ts} +3 -2
- package/dist/wallet/browser.d.ts +33 -0
- package/dist/wallet/browser.js +271 -0
- package/dist/wallet/browser.js.map +1 -0
- package/dist/wallet/index.d.ts +2 -2
- package/dist/wallet/index.js +15 -23
- package/dist/wallet/index.js.map +1 -1
- package/dist/x402/index.d.ts +1 -1
- package/package.json +13 -1
- package/templates/base/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as WalletFullContext } from '../../types-BaTmu0gS.js';
|
|
2
2
|
import { StoreOptions, StoreResponse } from '../../store/index.js';
|
|
3
3
|
import 'viem';
|
|
4
4
|
import 'viem/accounts';
|
|
@@ -357,7 +357,7 @@ declare function sendHyperliquidSpot(options: {
|
|
|
357
357
|
amount: string | number | bigint;
|
|
358
358
|
environment?: HyperliquidEnvironment;
|
|
359
359
|
nonce?: number;
|
|
360
|
-
nonceSource?: NonceSource;
|
|
360
|
+
nonceSource?: NonceSource | undefined;
|
|
361
361
|
}): Promise<HyperliquidExchangeResponse<unknown>>;
|
|
362
362
|
|
|
363
363
|
type HyperliquidChain = "arbitrum" | "arbitrum-sepolia";
|
|
@@ -661,6 +661,7 @@ interface HyperliquidOrderOptions {
|
|
|
661
661
|
vaultAddress?: `0x${string}`;
|
|
662
662
|
expiresAfter?: number;
|
|
663
663
|
nonce?: number;
|
|
664
|
+
nonceSource?: NonceSource;
|
|
664
665
|
}
|
|
665
666
|
type HyperliquidOrderStatus = {
|
|
666
667
|
resting: {
|
|
@@ -708,6 +709,7 @@ interface HyperliquidApproveBuilderFeeOptions {
|
|
|
708
709
|
environment: HyperliquidEnvironment;
|
|
709
710
|
wallet: WalletFullContext;
|
|
710
711
|
nonce?: number;
|
|
712
|
+
nonceSource?: NonceSource;
|
|
711
713
|
/** Override default signature chain id. */
|
|
712
714
|
signatureChainId?: string;
|
|
713
715
|
}
|
|
@@ -740,6 +742,8 @@ declare function withdrawFromHyperliquid(options: {
|
|
|
740
742
|
amount: string;
|
|
741
743
|
destination: `0x${string}`;
|
|
742
744
|
wallet: WalletFullContext;
|
|
745
|
+
nonce?: number;
|
|
746
|
+
nonceSource?: NonceSource;
|
|
743
747
|
}): Promise<HyperliquidWithdrawResult>;
|
|
744
748
|
declare function fetchHyperliquidClearinghouseState(params: {
|
|
745
749
|
environment: HyperliquidEnvironment;
|
|
@@ -765,4 +769,4 @@ declare const __hyperliquidInternals: {
|
|
|
765
769
|
splitSignature: typeof splitSignature;
|
|
766
770
|
};
|
|
767
771
|
|
|
768
|
-
export { DEFAULT_HYPERLIQUID_CADENCE_CRON, DEFAULT_HYPERLIQUID_MARKET_SLIPPAGE_BPS, type HyperliquidAbstraction, type HyperliquidAccountMode, HyperliquidApiError, type HyperliquidApproveBuilderFeeOptions, type HyperliquidApproveBuilderFeeResponse, type HyperliquidBar, type HyperliquidBarResolution, HyperliquidBuilderApprovalError, type HyperliquidBuilderApprovalRecordInput, type HyperliquidBuilderFee, type HyperliquidCadence, type HyperliquidChain, type HyperliquidClearinghouseState, type HyperliquidDcaNormalizedEntry, type HyperliquidDcaSymbolEntry, type HyperliquidDcaSymbolInput, type HyperliquidDepositResult, type HyperliquidEnvironment, HyperliquidExchangeClient, type HyperliquidExchangeResponse, type HyperliquidExecutionMode, type HyperliquidGrouping, HyperliquidGuardError, type HyperliquidIndicatorBar, HyperliquidInfoClient, type HyperliquidMarketIdentityInput, type HyperliquidMarketType, type HyperliquidOrderIntent, type HyperliquidOrderOptions, type HyperliquidOrderResponse, type HyperliquidOrderStatus, type HyperliquidPerpMarketInfo, type HyperliquidProfileAsset, type HyperliquidProfileAssetInput, type HyperliquidProfileChain, type HyperliquidResolution, type HyperliquidScheduleUnit, type HyperliquidSpotMarketInfo, type HyperliquidStoreNetwork, type HyperliquidTargetSizeConfig, type HyperliquidTargetSizeExecution, HyperliquidTermsError, type HyperliquidTermsRecordInput, type HyperliquidTickSize, type HyperliquidTimeInForce, type HyperliquidTradePlan, type HyperliquidTradeSignal, type HyperliquidTriggerOptions, type HyperliquidTriggerType, type HyperliquidWithdrawResult, type MarketIdentity,
|
|
772
|
+
export { DEFAULT_HYPERLIQUID_CADENCE_CRON, DEFAULT_HYPERLIQUID_MARKET_SLIPPAGE_BPS, type HyperliquidAbstraction, type HyperliquidAccountMode, HyperliquidApiError, type HyperliquidApproveBuilderFeeOptions, type HyperliquidApproveBuilderFeeResponse, type HyperliquidBar, type HyperliquidBarResolution, HyperliquidBuilderApprovalError, type HyperliquidBuilderApprovalRecordInput, type HyperliquidBuilderFee, type HyperliquidCadence, type HyperliquidChain, type HyperliquidClearinghouseState, type HyperliquidDcaNormalizedEntry, type HyperliquidDcaSymbolEntry, type HyperliquidDcaSymbolInput, type HyperliquidDepositResult, type HyperliquidEnvironment, HyperliquidExchangeClient, type HyperliquidExchangeResponse, type HyperliquidExecutionMode, type HyperliquidGrouping, HyperliquidGuardError, type HyperliquidIndicatorBar, HyperliquidInfoClient, type HyperliquidMarketIdentityInput, type HyperliquidMarketType, type HyperliquidOrderIntent, type HyperliquidOrderOptions, type HyperliquidOrderResponse, type HyperliquidOrderStatus, type HyperliquidPerpMarketInfo, type HyperliquidProfileAsset, type HyperliquidProfileAssetInput, type HyperliquidProfileChain, type HyperliquidResolution, type HyperliquidScheduleUnit, type HyperliquidSpotMarketInfo, type HyperliquidStoreNetwork, type HyperliquidTargetSizeConfig, type HyperliquidTargetSizeExecution, HyperliquidTermsError, type HyperliquidTermsRecordInput, type HyperliquidTickSize, type HyperliquidTimeInForce, type HyperliquidTradePlan, type HyperliquidTradeSignal, type HyperliquidTriggerOptions, type HyperliquidTriggerType, type HyperliquidWithdrawResult, type MarketIdentity, __hyperliquidInternals, __hyperliquidMarketDataInternals, approveHyperliquidBuilderFee, batchModifyHyperliquidOrders, buildHyperliquidMarketIdentity, buildHyperliquidProfileAssets, buildHyperliquidSpotUsdPriceMap, cancelAllHyperliquidOrders, cancelHyperliquidOrders, cancelHyperliquidOrdersByCloid, cancelHyperliquidTwapOrder, clampHyperliquidAbs, clampHyperliquidFloat, clampHyperliquidInt, computeHyperliquidMarketIocLimitPrice, createHyperliquidSubAccount, createMonotonicNonceFactory, depositToHyperliquidBridge, 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, formatHyperliquidMarketablePrice, formatHyperliquidOrderSize, formatHyperliquidPrice, formatHyperliquidSize, getHyperliquidMaxBuilderFee, isHyperliquidSpotSymbol, modifyHyperliquidOrder, normalizeHyperliquidBaseSymbol, normalizeHyperliquidDcaEntries, normalizeHyperliquidIndicatorBars, normalizeHyperliquidMetaSymbol, normalizeSpotTokenName, parseHyperliquidJson, parseSpotPairSymbol, placeHyperliquidOrder, placeHyperliquidTwapOrder, planHyperliquidTrade, readHyperliquidAccountValue, readHyperliquidNumber, readHyperliquidPerpPosition, readHyperliquidPerpPositionSize, readHyperliquidSpotAccountValue, readHyperliquidSpotBalance, readHyperliquidSpotBalanceSize, recordHyperliquidBuilderApproval, recordHyperliquidTermsAcceptance, reserveHyperliquidRequestWeight, resolveHyperliquidAbstractionFromMode, resolveHyperliquidBudgetUsd, resolveHyperliquidCadenceCron, resolveHyperliquidCadenceFromResolution, resolveHyperliquidChain, resolveHyperliquidChainConfig, resolveHyperliquidDcaSymbolEntries, resolveHyperliquidErrorDetail, resolveHyperliquidHourlyInterval, resolveHyperliquidIntervalCron, resolveHyperliquidLeverageMode, resolveHyperliquidMaxPerRunUsd, resolveHyperliquidOrderRef, resolveHyperliquidOrderSymbol, resolveHyperliquidPair, resolveHyperliquidPerpSymbol, resolveHyperliquidProfileChain, resolveHyperliquidRpcEnvVar, resolveHyperliquidScheduleEvery, resolveHyperliquidScheduleUnit, resolveHyperliquidSpotSymbol, resolveHyperliquidStoreNetwork, resolveHyperliquidSymbol, resolveHyperliquidTargetSize, resolveSpotMidCandidates, resolveSpotTokenCandidates, roundHyperliquidPriceToTick, scheduleHyperliquidCancel, sendHyperliquidSpot, setHyperliquidAccountAbstractionMode, setHyperliquidDexAbstraction, setHyperliquidPortfolioMargin, transferHyperliquidSubAccount, updateHyperliquidIsolatedMargin, updateHyperliquidLeverage, withdrawFromHyperliquid };
|
|
@@ -1021,6 +1021,16 @@ async function fetchHyperliquidSpotClearinghouseState(params) {
|
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
1023
1023
|
// src/adapters/hyperliquid/exchange.ts
|
|
1024
|
+
function resolveRequiredExchangeNonce(options) {
|
|
1025
|
+
if (typeof options.nonce === "number") {
|
|
1026
|
+
return options.nonce;
|
|
1027
|
+
}
|
|
1028
|
+
const resolved = options.walletNonceProvider?.() ?? options.wallet.nonceSource?.() ?? options.nonceSource?.();
|
|
1029
|
+
if (resolved === void 0) {
|
|
1030
|
+
throw new Error(`${options.action} requires an explicit nonce or wallet nonce source.`);
|
|
1031
|
+
}
|
|
1032
|
+
return resolved;
|
|
1033
|
+
}
|
|
1024
1034
|
var HyperliquidExchangeClient = class {
|
|
1025
1035
|
constructor(args) {
|
|
1026
1036
|
this.wallet = args.wallet;
|
|
@@ -1191,7 +1201,13 @@ async function setHyperliquidPortfolioMargin(options) {
|
|
|
1191
1201
|
if (!options.wallet?.account || !options.wallet.walletClient) {
|
|
1192
1202
|
throw new Error("Wallet with signing capability is required for portfolio margin.");
|
|
1193
1203
|
}
|
|
1194
|
-
const nonce =
|
|
1204
|
+
const nonce = resolveRequiredExchangeNonce({
|
|
1205
|
+
nonce: options.nonce,
|
|
1206
|
+
nonceSource: options.nonceSource,
|
|
1207
|
+
walletNonceProvider: options.walletNonceProvider,
|
|
1208
|
+
wallet: options.wallet,
|
|
1209
|
+
action: "Hyperliquid portfolio margin"
|
|
1210
|
+
});
|
|
1195
1211
|
const signatureChainId = getSignatureChainId(env);
|
|
1196
1212
|
const hyperliquidChain = HL_CHAIN_LABEL[env];
|
|
1197
1213
|
const user = normalizeAddress(options.user ?? options.wallet.address);
|
|
@@ -1225,7 +1241,13 @@ async function setHyperliquidDexAbstraction(options) {
|
|
|
1225
1241
|
if (!options.wallet?.account || !options.wallet.walletClient) {
|
|
1226
1242
|
throw new Error("Wallet with signing capability is required for dex abstraction.");
|
|
1227
1243
|
}
|
|
1228
|
-
const nonce =
|
|
1244
|
+
const nonce = resolveRequiredExchangeNonce({
|
|
1245
|
+
nonce: options.nonce,
|
|
1246
|
+
nonceSource: options.nonceSource,
|
|
1247
|
+
walletNonceProvider: options.walletNonceProvider,
|
|
1248
|
+
wallet: options.wallet,
|
|
1249
|
+
action: "Hyperliquid dex abstraction"
|
|
1250
|
+
});
|
|
1229
1251
|
const signatureChainId = getSignatureChainId(env);
|
|
1230
1252
|
const hyperliquidChain = HL_CHAIN_LABEL[env];
|
|
1231
1253
|
const user = normalizeAddress(options.user ?? options.wallet.address);
|
|
@@ -1259,7 +1281,13 @@ async function setHyperliquidAccountAbstractionMode(options) {
|
|
|
1259
1281
|
if (!options.wallet?.account || !options.wallet.walletClient) {
|
|
1260
1282
|
throw new Error("Wallet with signing capability is required for account abstraction mode.");
|
|
1261
1283
|
}
|
|
1262
|
-
const nonce =
|
|
1284
|
+
const nonce = resolveRequiredExchangeNonce({
|
|
1285
|
+
nonce: options.nonce,
|
|
1286
|
+
nonceSource: options.nonceSource,
|
|
1287
|
+
walletNonceProvider: options.walletNonceProvider,
|
|
1288
|
+
wallet: options.wallet,
|
|
1289
|
+
action: "Hyperliquid account abstraction mode"
|
|
1290
|
+
});
|
|
1263
1291
|
const signatureChainId = getSignatureChainId(env);
|
|
1264
1292
|
const hyperliquidChain = HL_CHAIN_LABEL[env];
|
|
1265
1293
|
const user = normalizeAddress(options.user ?? options.wallet.address);
|
|
@@ -1459,7 +1487,12 @@ async function sendHyperliquidSpot(options) {
|
|
|
1459
1487
|
assertPositiveDecimal(options.amount, "amount");
|
|
1460
1488
|
const signatureChainId = getSignatureChainId(env);
|
|
1461
1489
|
const hyperliquidChain = HL_CHAIN_LABEL[env];
|
|
1462
|
-
const nonce =
|
|
1490
|
+
const nonce = resolveRequiredExchangeNonce({
|
|
1491
|
+
nonce: options.nonce,
|
|
1492
|
+
nonceSource: options.nonceSource,
|
|
1493
|
+
wallet: options.wallet,
|
|
1494
|
+
action: "Hyperliquid spot send"
|
|
1495
|
+
});
|
|
1463
1496
|
const time = BigInt(nonce);
|
|
1464
1497
|
const signature = await signSpotSend({
|
|
1465
1498
|
wallet: options.wallet,
|
|
@@ -2833,6 +2866,16 @@ function resolveHyperliquidCadenceFromResolution(resolution) {
|
|
|
2833
2866
|
}
|
|
2834
2867
|
|
|
2835
2868
|
// src/adapters/hyperliquid/index.ts
|
|
2869
|
+
function resolveRequiredNonce(params) {
|
|
2870
|
+
if (typeof params.nonce === "number") {
|
|
2871
|
+
return params.nonce;
|
|
2872
|
+
}
|
|
2873
|
+
const resolved = params.nonceSource?.() ?? params.wallet?.nonceSource?.();
|
|
2874
|
+
if (resolved === void 0) {
|
|
2875
|
+
throw new Error(`${params.action} requires an explicit nonce or wallet nonce source.`);
|
|
2876
|
+
}
|
|
2877
|
+
return resolved;
|
|
2878
|
+
}
|
|
2836
2879
|
function assertPositiveDecimalInput(value, label) {
|
|
2837
2880
|
if (typeof value === "number") {
|
|
2838
2881
|
if (!Number.isFinite(value) || value <= 0) {
|
|
@@ -2941,7 +2984,12 @@ async function placeHyperliquidOrder(options) {
|
|
|
2941
2984
|
f: effectiveBuilder.fee
|
|
2942
2985
|
};
|
|
2943
2986
|
}
|
|
2944
|
-
const effectiveNonce =
|
|
2987
|
+
const effectiveNonce = resolveRequiredNonce({
|
|
2988
|
+
nonce,
|
|
2989
|
+
nonceSource: options.nonceSource,
|
|
2990
|
+
wallet,
|
|
2991
|
+
action: "Hyperliquid order submission"
|
|
2992
|
+
});
|
|
2945
2993
|
const signature = await signL1Action({
|
|
2946
2994
|
wallet,
|
|
2947
2995
|
action,
|
|
@@ -3057,8 +3105,13 @@ async function withdrawFromHyperliquid(options) {
|
|
|
3057
3105
|
chainId: Number.parseInt(signatureChainId, 16),
|
|
3058
3106
|
verifyingContract: ZERO_ADDRESS
|
|
3059
3107
|
};
|
|
3060
|
-
const
|
|
3061
|
-
|
|
3108
|
+
const nonce = resolveRequiredNonce({
|
|
3109
|
+
nonce: options.nonce,
|
|
3110
|
+
nonceSource: options.nonceSource,
|
|
3111
|
+
wallet,
|
|
3112
|
+
action: "Hyperliquid withdraw"
|
|
3113
|
+
});
|
|
3114
|
+
const time = BigInt(nonce);
|
|
3062
3115
|
const normalizedDestination = normalizeAddress(destination);
|
|
3063
3116
|
const message = {
|
|
3064
3117
|
hyperliquidChain,
|
|
@@ -3138,7 +3191,12 @@ async function approveHyperliquidBuilderFee(options) {
|
|
|
3138
3191
|
const inferredEnvironment = environment ?? "mainnet";
|
|
3139
3192
|
const resolvedBaseUrl = API_BASES[inferredEnvironment];
|
|
3140
3193
|
const maxFeeRate = formattedPercent;
|
|
3141
|
-
const effectiveNonce =
|
|
3194
|
+
const effectiveNonce = resolveRequiredNonce({
|
|
3195
|
+
nonce,
|
|
3196
|
+
nonceSource: options.nonceSource,
|
|
3197
|
+
wallet,
|
|
3198
|
+
action: "Hyperliquid builder approval"
|
|
3199
|
+
});
|
|
3142
3200
|
const signatureNonce = BigInt(effectiveNonce);
|
|
3143
3201
|
const signatureChainHex = signatureChainId ?? getSignatureChainId(inferredEnvironment);
|
|
3144
3202
|
const approvalSignature = await signApproveBuilderFee({
|