opentool 0.18.0 → 0.19.1
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/polymarket/index.d.ts +223 -11
- package/dist/adapters/polymarket/index.js +543 -44
- package/dist/adapters/polymarket/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +543 -44
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/base/package.json +1 -1
- package/templates/polymarket-simple-trade/README.md +28 -0
- package/templates/polymarket-simple-trade/metadata.ts +12 -0
- package/templates/polymarket-simple-trade/package.json +23 -0
- package/templates/polymarket-simple-trade/tools/place-polymarket-order.ts +172 -0
- package/templates/polymarket-simple-trade/tsconfig.json +14 -0
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as path from 'path';
|
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
7
7
|
import { zodToJsonSchema } from '@alcyone-labs/zod-to-json-schema';
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { zeroAddress, createWalletClient, http, createPublicClient, parseUnits, encodeFunctionData, erc20Abi } from 'viem';
|
|
9
|
+
import { zeroAddress, createWalletClient, http, createPublicClient, parseUnits, encodeFunctionData, erc20Abi, maxUint256, decodeFunctionData } from 'viem';
|
|
10
10
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
11
11
|
import { arbitrumSepolia, arbitrum, baseSepolia, mainnet, base } from 'viem/chains';
|
|
12
12
|
import { Turnkey } from '@turnkey/sdk-server';
|
|
@@ -5910,7 +5910,7 @@ async function buildL1Headers(args) {
|
|
|
5910
5910
|
const nonce = args.nonce ?? Date.now();
|
|
5911
5911
|
const chainId = POLYMARKET_CHAIN_ID[args.environment ?? "mainnet"];
|
|
5912
5912
|
const address = args.wallet.address;
|
|
5913
|
-
const message = args.message ?? "
|
|
5913
|
+
const message = args.message ?? "This message attests that I control the given wallet";
|
|
5914
5914
|
const signature = await args.wallet.walletClient.signTypedData({
|
|
5915
5915
|
account: args.wallet.account,
|
|
5916
5916
|
domain: {
|
|
@@ -6064,14 +6064,32 @@ async function buildSignedOrderPayload(args) {
|
|
|
6064
6064
|
}
|
|
6065
6065
|
|
|
6066
6066
|
// src/adapters/polymarket/exchange.ts
|
|
6067
|
+
function requireApiKeyNonce(nonce, message = "Polymarket API key operations require an explicit nonce.") {
|
|
6068
|
+
if (!Number.isSafeInteger(nonce) || nonce == null || nonce < 0) {
|
|
6069
|
+
throw new PolymarketAuthError(message);
|
|
6070
|
+
}
|
|
6071
|
+
return nonce;
|
|
6072
|
+
}
|
|
6067
6073
|
async function resolveAuthContext(args) {
|
|
6068
6074
|
if (args.wallet) {
|
|
6069
|
-
const credentials = args.credentials
|
|
6075
|
+
const credentials = args.credentials;
|
|
6076
|
+
if (credentials) {
|
|
6077
|
+
return {
|
|
6078
|
+
credentials,
|
|
6079
|
+
address: args.wallet.address
|
|
6080
|
+
};
|
|
6081
|
+
}
|
|
6082
|
+
const apiKeyNonce = requireApiKeyNonce(
|
|
6083
|
+
args.apiKeyNonce,
|
|
6084
|
+
"Polymarket auto-auth requires apiKeyNonce when credentials are not provided."
|
|
6085
|
+
);
|
|
6086
|
+
const derivedCredentials = await derivePolymarketApiKey({
|
|
6070
6087
|
wallet: args.wallet,
|
|
6071
|
-
...args.environment ? { environment: args.environment } : {}
|
|
6088
|
+
...args.environment ? { environment: args.environment } : {},
|
|
6089
|
+
nonce: apiKeyNonce
|
|
6072
6090
|
});
|
|
6073
6091
|
return {
|
|
6074
|
-
credentials,
|
|
6092
|
+
credentials: derivedCredentials,
|
|
6075
6093
|
address: args.wallet.address
|
|
6076
6094
|
};
|
|
6077
6095
|
}
|
|
@@ -6103,27 +6121,9 @@ function resolvePath(url) {
|
|
|
6103
6121
|
const parsed = new URL(url);
|
|
6104
6122
|
return `${parsed.pathname}${parsed.search}`;
|
|
6105
6123
|
}
|
|
6106
|
-
|
|
6107
|
-
const environment = args.environment ?? "mainnet";
|
|
6108
|
-
const baseUrl = resolvePolymarketBaseUrl("clob", environment);
|
|
6109
|
-
const url = `${baseUrl}/auth/api-key`;
|
|
6110
|
-
const headers = await buildL1Headers({
|
|
6111
|
-
wallet: args.wallet,
|
|
6112
|
-
environment,
|
|
6113
|
-
...args.timestamp !== void 0 ? { timestamp: args.timestamp } : {},
|
|
6114
|
-
...args.nonce !== void 0 ? { nonce: args.nonce } : {},
|
|
6115
|
-
...args.message !== void 0 ? { message: args.message } : {}
|
|
6116
|
-
});
|
|
6117
|
-
const data = await requestJson2(url, {
|
|
6118
|
-
method: "POST",
|
|
6119
|
-
headers: {
|
|
6120
|
-
"content-type": "application/json",
|
|
6121
|
-
...headers
|
|
6122
|
-
},
|
|
6123
|
-
body: JSON.stringify({})
|
|
6124
|
-
});
|
|
6124
|
+
function normalizeApiKeyResponse(data) {
|
|
6125
6125
|
if (!data?.apiKey || !data?.secret || !data?.passphrase) {
|
|
6126
|
-
|
|
6126
|
+
return null;
|
|
6127
6127
|
}
|
|
6128
6128
|
return {
|
|
6129
6129
|
apiKey: data.apiKey,
|
|
@@ -6131,32 +6131,69 @@ async function createPolymarketApiKey(args) {
|
|
|
6131
6131
|
passphrase: data.passphrase
|
|
6132
6132
|
};
|
|
6133
6133
|
}
|
|
6134
|
-
async function
|
|
6134
|
+
async function requestPolymarketApiKey(args) {
|
|
6135
6135
|
const environment = args.environment ?? "mainnet";
|
|
6136
6136
|
const baseUrl = resolvePolymarketBaseUrl("clob", environment);
|
|
6137
|
-
const url = `${baseUrl}/auth/derive-api-key`;
|
|
6137
|
+
const url = args.mode === "create" ? `${baseUrl}/auth/api-key` : `${baseUrl}/auth/derive-api-key`;
|
|
6138
|
+
const nonce = requireApiKeyNonce(args.nonce);
|
|
6138
6139
|
const headers = await buildL1Headers({
|
|
6139
6140
|
wallet: args.wallet,
|
|
6140
6141
|
environment,
|
|
6141
6142
|
...args.timestamp !== void 0 ? { timestamp: args.timestamp } : {},
|
|
6142
|
-
|
|
6143
|
+
nonce,
|
|
6143
6144
|
...args.message !== void 0 ? { message: args.message } : {}
|
|
6144
6145
|
});
|
|
6145
|
-
|
|
6146
|
-
method: "GET",
|
|
6146
|
+
return await requestJson2(url, {
|
|
6147
|
+
method: args.mode === "create" ? "POST" : "GET",
|
|
6147
6148
|
headers: {
|
|
6148
6149
|
"content-type": "application/json",
|
|
6149
6150
|
...headers
|
|
6150
|
-
}
|
|
6151
|
+
},
|
|
6152
|
+
...args.mode === "create" ? { body: JSON.stringify({}) } : {}
|
|
6151
6153
|
});
|
|
6152
|
-
|
|
6154
|
+
}
|
|
6155
|
+
async function createPolymarketApiKey(args) {
|
|
6156
|
+
const normalized = normalizeApiKeyResponse(
|
|
6157
|
+
await requestPolymarketApiKey({ ...args, mode: "create" })
|
|
6158
|
+
);
|
|
6159
|
+
if (!normalized) {
|
|
6160
|
+
throw new PolymarketAuthError("Failed to create Polymarket API key.");
|
|
6161
|
+
}
|
|
6162
|
+
return normalized;
|
|
6163
|
+
}
|
|
6164
|
+
async function derivePolymarketApiKey(args) {
|
|
6165
|
+
const normalized = normalizeApiKeyResponse(
|
|
6166
|
+
await requestPolymarketApiKey({ ...args, mode: "derive" })
|
|
6167
|
+
);
|
|
6168
|
+
if (!normalized) {
|
|
6153
6169
|
throw new PolymarketAuthError("Failed to derive Polymarket API key.");
|
|
6154
6170
|
}
|
|
6155
|
-
return
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6171
|
+
return normalized;
|
|
6172
|
+
}
|
|
6173
|
+
async function createOrDerivePolymarketApiKey(args) {
|
|
6174
|
+
let deriveError;
|
|
6175
|
+
try {
|
|
6176
|
+
const derived = normalizeApiKeyResponse(
|
|
6177
|
+
await requestPolymarketApiKey({ ...args, mode: "derive" })
|
|
6178
|
+
);
|
|
6179
|
+
if (derived) {
|
|
6180
|
+
return derived;
|
|
6181
|
+
}
|
|
6182
|
+
} catch (error) {
|
|
6183
|
+
deriveError = error;
|
|
6184
|
+
}
|
|
6185
|
+
const created = normalizeApiKeyResponse(
|
|
6186
|
+
await requestPolymarketApiKey({ ...args, mode: "create" })
|
|
6187
|
+
);
|
|
6188
|
+
if (created) {
|
|
6189
|
+
return created;
|
|
6190
|
+
}
|
|
6191
|
+
if (deriveError) {
|
|
6192
|
+
throw deriveError;
|
|
6193
|
+
}
|
|
6194
|
+
throw new PolymarketAuthError(
|
|
6195
|
+
"Failed to derive or create Polymarket API key."
|
|
6196
|
+
);
|
|
6160
6197
|
}
|
|
6161
6198
|
async function placePolymarketOrder(args) {
|
|
6162
6199
|
const environment = args.environment ?? "mainnet";
|
|
@@ -6170,7 +6207,8 @@ async function placePolymarketOrder(args) {
|
|
|
6170
6207
|
const auth = await resolveAuthContext({
|
|
6171
6208
|
wallet: args.wallet,
|
|
6172
6209
|
...args.credentials ? { credentials: args.credentials } : {},
|
|
6173
|
-
environment
|
|
6210
|
+
environment,
|
|
6211
|
+
...args.apiKeyNonce !== void 0 ? { apiKeyNonce: args.apiKeyNonce } : {}
|
|
6174
6212
|
});
|
|
6175
6213
|
const body = {
|
|
6176
6214
|
order: signedOrder,
|
|
@@ -6202,7 +6240,8 @@ async function cancelPolymarketOrder(args) {
|
|
|
6202
6240
|
...args.wallet ? { wallet: args.wallet } : {},
|
|
6203
6241
|
...args.walletAddress ? { walletAddress: args.walletAddress } : {},
|
|
6204
6242
|
...args.credentials ? { credentials: args.credentials } : {},
|
|
6205
|
-
environment
|
|
6243
|
+
environment,
|
|
6244
|
+
...args.apiKeyNonce !== void 0 ? { apiKeyNonce: args.apiKeyNonce } : {}
|
|
6206
6245
|
});
|
|
6207
6246
|
const headers = buildL2Headers({
|
|
6208
6247
|
credentials: auth.credentials,
|
|
@@ -6229,7 +6268,8 @@ async function cancelPolymarketOrders(args) {
|
|
|
6229
6268
|
...args.wallet ? { wallet: args.wallet } : {},
|
|
6230
6269
|
...args.walletAddress ? { walletAddress: args.walletAddress } : {},
|
|
6231
6270
|
...args.credentials ? { credentials: args.credentials } : {},
|
|
6232
|
-
environment
|
|
6271
|
+
environment,
|
|
6272
|
+
...args.apiKeyNonce !== void 0 ? { apiKeyNonce: args.apiKeyNonce } : {}
|
|
6233
6273
|
});
|
|
6234
6274
|
const headers = buildL2Headers({
|
|
6235
6275
|
credentials: auth.credentials,
|
|
@@ -6255,7 +6295,8 @@ async function cancelAllPolymarketOrders(args) {
|
|
|
6255
6295
|
...args.wallet ? { wallet: args.wallet } : {},
|
|
6256
6296
|
...args.walletAddress ? { walletAddress: args.walletAddress } : {},
|
|
6257
6297
|
...args.credentials ? { credentials: args.credentials } : {},
|
|
6258
|
-
environment
|
|
6298
|
+
environment,
|
|
6299
|
+
...args.apiKeyNonce !== void 0 ? { apiKeyNonce: args.apiKeyNonce } : {}
|
|
6259
6300
|
});
|
|
6260
6301
|
const headers = buildL2Headers({
|
|
6261
6302
|
credentials: auth.credentials,
|
|
@@ -6280,7 +6321,8 @@ async function cancelMarketPolymarketOrders(args) {
|
|
|
6280
6321
|
...args.wallet ? { wallet: args.wallet } : {},
|
|
6281
6322
|
...args.walletAddress ? { walletAddress: args.walletAddress } : {},
|
|
6282
6323
|
...args.credentials ? { credentials: args.credentials } : {},
|
|
6283
|
-
environment
|
|
6324
|
+
environment,
|
|
6325
|
+
...args.apiKeyNonce !== void 0 ? { apiKeyNonce: args.apiKeyNonce } : {}
|
|
6284
6326
|
});
|
|
6285
6327
|
const headers = buildL2Headers({
|
|
6286
6328
|
credentials: auth.credentials,
|
|
@@ -6302,6 +6344,7 @@ var PolymarketExchangeClient = class {
|
|
|
6302
6344
|
constructor(args) {
|
|
6303
6345
|
this.wallet = args.wallet;
|
|
6304
6346
|
this.credentials = args.credentials;
|
|
6347
|
+
this.apiKeyNonce = args.apiKeyNonce;
|
|
6305
6348
|
this.environment = args.environment ?? "mainnet";
|
|
6306
6349
|
}
|
|
6307
6350
|
async getCredentials() {
|
|
@@ -6309,7 +6352,8 @@ var PolymarketExchangeClient = class {
|
|
|
6309
6352
|
const resolved = await resolveAuthContext({
|
|
6310
6353
|
wallet: this.wallet,
|
|
6311
6354
|
...this.credentials ? { credentials: this.credentials } : {},
|
|
6312
|
-
environment: this.environment
|
|
6355
|
+
environment: this.environment,
|
|
6356
|
+
...this.apiKeyNonce !== void 0 ? { apiKeyNonce: this.apiKeyNonce } : {}
|
|
6313
6357
|
});
|
|
6314
6358
|
this.cachedCredentials = resolved.credentials;
|
|
6315
6359
|
return resolved.credentials;
|
|
@@ -6385,6 +6429,61 @@ function getString(value) {
|
|
|
6385
6429
|
const str = String(value).trim();
|
|
6386
6430
|
return str.length ? str : null;
|
|
6387
6431
|
}
|
|
6432
|
+
function getNumber(value) {
|
|
6433
|
+
const numeric = Number(value);
|
|
6434
|
+
return Number.isFinite(numeric) ? numeric : null;
|
|
6435
|
+
}
|
|
6436
|
+
function getInteger(value) {
|
|
6437
|
+
const numeric = getNumber(value);
|
|
6438
|
+
return numeric == null ? null : Math.trunc(numeric);
|
|
6439
|
+
}
|
|
6440
|
+
function getBoolean(value) {
|
|
6441
|
+
if (typeof value === "boolean") return value;
|
|
6442
|
+
if (typeof value === "string") {
|
|
6443
|
+
const normalized = value.trim().toLowerCase();
|
|
6444
|
+
if (normalized === "true") return true;
|
|
6445
|
+
if (normalized === "false") return false;
|
|
6446
|
+
}
|
|
6447
|
+
return null;
|
|
6448
|
+
}
|
|
6449
|
+
function normalizeCsvStringInput(value) {
|
|
6450
|
+
if (Array.isArray(value)) {
|
|
6451
|
+
return value.flatMap((entry) => String(entry).split(",")).map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
6452
|
+
}
|
|
6453
|
+
if (typeof value === "string") {
|
|
6454
|
+
return value.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
6455
|
+
}
|
|
6456
|
+
return [];
|
|
6457
|
+
}
|
|
6458
|
+
function normalizeCsvNumberInput(value) {
|
|
6459
|
+
if (Array.isArray(value)) {
|
|
6460
|
+
return value.filter((entry) => Number.isFinite(entry));
|
|
6461
|
+
}
|
|
6462
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
6463
|
+
return [value];
|
|
6464
|
+
}
|
|
6465
|
+
return [];
|
|
6466
|
+
}
|
|
6467
|
+
function appendCsvParam(url, key, values) {
|
|
6468
|
+
if (values.length > 0) {
|
|
6469
|
+
url.searchParams.set(key, values.join(","));
|
|
6470
|
+
}
|
|
6471
|
+
}
|
|
6472
|
+
function appendNumberParam(url, key, value) {
|
|
6473
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
6474
|
+
url.searchParams.set(key, String(value));
|
|
6475
|
+
}
|
|
6476
|
+
}
|
|
6477
|
+
function appendBooleanParam(url, key, value) {
|
|
6478
|
+
if (typeof value === "boolean") {
|
|
6479
|
+
url.searchParams.set(key, value ? "true" : "false");
|
|
6480
|
+
}
|
|
6481
|
+
}
|
|
6482
|
+
function assertMutuallyExclusiveMarketScope(market, eventIds) {
|
|
6483
|
+
if (market.length > 0 && eventIds.length > 0) {
|
|
6484
|
+
throw new Error("market and eventId are mutually exclusive.");
|
|
6485
|
+
}
|
|
6486
|
+
}
|
|
6388
6487
|
function normalizeOrderbookLevels(raw) {
|
|
6389
6488
|
if (!Array.isArray(raw)) return [];
|
|
6390
6489
|
return raw.map((entry) => {
|
|
@@ -6448,6 +6547,132 @@ function normalizeGammaMarket(market, event) {
|
|
|
6448
6547
|
}
|
|
6449
6548
|
return normalized;
|
|
6450
6549
|
}
|
|
6550
|
+
function normalizeUserPosition(raw) {
|
|
6551
|
+
const record = raw && typeof raw === "object" ? raw : {};
|
|
6552
|
+
const normalized = {
|
|
6553
|
+
proxyWallet: getString(record.proxyWallet),
|
|
6554
|
+
asset: getString(record.asset),
|
|
6555
|
+
conditionId: getString(record.conditionId),
|
|
6556
|
+
size: getNumber(record.size),
|
|
6557
|
+
avgPrice: getNumber(record.avgPrice),
|
|
6558
|
+
initialValue: getNumber(record.initialValue),
|
|
6559
|
+
currentValue: getNumber(record.currentValue),
|
|
6560
|
+
cashPnl: getNumber(record.cashPnl),
|
|
6561
|
+
percentPnl: getNumber(record.percentPnl),
|
|
6562
|
+
totalBought: getNumber(record.totalBought),
|
|
6563
|
+
realizedPnl: getNumber(record.realizedPnl),
|
|
6564
|
+
percentRealizedPnl: getNumber(record.percentRealizedPnl),
|
|
6565
|
+
curPrice: getNumber(record.curPrice),
|
|
6566
|
+
title: getString(record.title),
|
|
6567
|
+
slug: getString(record.slug),
|
|
6568
|
+
icon: getString(record.icon),
|
|
6569
|
+
eventSlug: getString(record.eventSlug),
|
|
6570
|
+
outcome: getString(record.outcome),
|
|
6571
|
+
outcomeIndex: getInteger(record.outcomeIndex),
|
|
6572
|
+
oppositeOutcome: getString(record.oppositeOutcome),
|
|
6573
|
+
oppositeAsset: getString(record.oppositeAsset),
|
|
6574
|
+
endDate: parseOptionalDate(record.endDate)
|
|
6575
|
+
};
|
|
6576
|
+
const redeemable = getBoolean(record.redeemable);
|
|
6577
|
+
if (redeemable != null) normalized.redeemable = redeemable;
|
|
6578
|
+
const mergeable = getBoolean(record.mergeable);
|
|
6579
|
+
if (mergeable != null) normalized.mergeable = mergeable;
|
|
6580
|
+
const negativeRisk = getBoolean(record.negativeRisk);
|
|
6581
|
+
if (negativeRisk != null) normalized.negativeRisk = negativeRisk;
|
|
6582
|
+
return normalized;
|
|
6583
|
+
}
|
|
6584
|
+
function normalizeClosedPosition(raw) {
|
|
6585
|
+
const record = raw && typeof raw === "object" ? raw : {};
|
|
6586
|
+
return {
|
|
6587
|
+
proxyWallet: getString(record.proxyWallet),
|
|
6588
|
+
asset: getString(record.asset),
|
|
6589
|
+
conditionId: getString(record.conditionId),
|
|
6590
|
+
avgPrice: getNumber(record.avgPrice),
|
|
6591
|
+
totalBought: getNumber(record.totalBought),
|
|
6592
|
+
realizedPnl: getNumber(record.realizedPnl),
|
|
6593
|
+
curPrice: getNumber(record.curPrice),
|
|
6594
|
+
timestamp: getInteger(record.timestamp),
|
|
6595
|
+
title: getString(record.title),
|
|
6596
|
+
slug: getString(record.slug),
|
|
6597
|
+
icon: getString(record.icon),
|
|
6598
|
+
eventSlug: getString(record.eventSlug),
|
|
6599
|
+
outcome: getString(record.outcome),
|
|
6600
|
+
outcomeIndex: getInteger(record.outcomeIndex),
|
|
6601
|
+
oppositeOutcome: getString(record.oppositeOutcome),
|
|
6602
|
+
oppositeAsset: getString(record.oppositeAsset),
|
|
6603
|
+
endDate: parseOptionalDate(record.endDate)
|
|
6604
|
+
};
|
|
6605
|
+
}
|
|
6606
|
+
function normalizeUserActivity(raw) {
|
|
6607
|
+
const record = raw && typeof raw === "object" ? raw : {};
|
|
6608
|
+
return {
|
|
6609
|
+
proxyWallet: getString(record.proxyWallet),
|
|
6610
|
+
timestamp: getInteger(record.timestamp),
|
|
6611
|
+
conditionId: getString(record.conditionId),
|
|
6612
|
+
type: getString(record.type),
|
|
6613
|
+
size: getNumber(record.size),
|
|
6614
|
+
usdcSize: getNumber(record.usdcSize),
|
|
6615
|
+
transactionHash: getString(record.transactionHash),
|
|
6616
|
+
price: getNumber(record.price),
|
|
6617
|
+
asset: getString(record.asset),
|
|
6618
|
+
side: getString(record.side),
|
|
6619
|
+
outcomeIndex: getInteger(record.outcomeIndex),
|
|
6620
|
+
title: getString(record.title),
|
|
6621
|
+
slug: getString(record.slug),
|
|
6622
|
+
icon: getString(record.icon),
|
|
6623
|
+
eventSlug: getString(record.eventSlug),
|
|
6624
|
+
outcome: getString(record.outcome),
|
|
6625
|
+
name: getString(record.name),
|
|
6626
|
+
pseudonym: getString(record.pseudonym),
|
|
6627
|
+
bio: getString(record.bio),
|
|
6628
|
+
profileImage: getString(record.profileImage),
|
|
6629
|
+
profileImageOptimized: getString(record.profileImageOptimized)
|
|
6630
|
+
};
|
|
6631
|
+
}
|
|
6632
|
+
function normalizePositionValue(raw) {
|
|
6633
|
+
const record = raw && typeof raw === "object" ? raw : {};
|
|
6634
|
+
return {
|
|
6635
|
+
user: getString(record.user),
|
|
6636
|
+
value: getNumber(record.value)
|
|
6637
|
+
};
|
|
6638
|
+
}
|
|
6639
|
+
function normalizeProfileUsers(raw) {
|
|
6640
|
+
if (!Array.isArray(raw)) return null;
|
|
6641
|
+
return raw.map((entry) => {
|
|
6642
|
+
const record = entry && typeof entry === "object" ? entry : {};
|
|
6643
|
+
const normalized = {
|
|
6644
|
+
id: getString(record.id)
|
|
6645
|
+
};
|
|
6646
|
+
const creator = getBoolean(record.creator);
|
|
6647
|
+
if (creator != null) normalized.creator = creator;
|
|
6648
|
+
const mod = getBoolean(record.mod);
|
|
6649
|
+
if (mod != null) normalized.mod = mod;
|
|
6650
|
+
return normalized;
|
|
6651
|
+
});
|
|
6652
|
+
}
|
|
6653
|
+
function normalizePublicProfile(raw) {
|
|
6654
|
+
if (!raw || typeof raw !== "object") return null;
|
|
6655
|
+
const record = raw;
|
|
6656
|
+
const normalized = {
|
|
6657
|
+
createdAt: parseOptionalDate(record.createdAt),
|
|
6658
|
+
proxyWallet: getString(record.proxyWallet),
|
|
6659
|
+
profileImage: getString(record.profileImage),
|
|
6660
|
+
bio: getString(record.bio),
|
|
6661
|
+
pseudonym: getString(record.pseudonym),
|
|
6662
|
+
name: getString(record.name),
|
|
6663
|
+
users: normalizeProfileUsers(record.users),
|
|
6664
|
+
xUsername: getString(record.xUsername)
|
|
6665
|
+
};
|
|
6666
|
+
const displayUsernamePublic = getBoolean(record.displayUsernamePublic);
|
|
6667
|
+
if (displayUsernamePublic != null) {
|
|
6668
|
+
normalized.displayUsernamePublic = displayUsernamePublic;
|
|
6669
|
+
}
|
|
6670
|
+
const verifiedBadge = getBoolean(record.verifiedBadge);
|
|
6671
|
+
if (verifiedBadge != null) {
|
|
6672
|
+
normalized.verifiedBadge = verifiedBadge;
|
|
6673
|
+
}
|
|
6674
|
+
return normalized;
|
|
6675
|
+
}
|
|
6451
6676
|
var PolymarketInfoClient = class {
|
|
6452
6677
|
constructor(environment = "mainnet") {
|
|
6453
6678
|
this.environment = environment;
|
|
@@ -6470,6 +6695,21 @@ var PolymarketInfoClient = class {
|
|
|
6470
6695
|
priceHistory(params) {
|
|
6471
6696
|
return fetchPolymarketPriceHistory({ ...params, environment: this.environment });
|
|
6472
6697
|
}
|
|
6698
|
+
positions(params) {
|
|
6699
|
+
return fetchPolymarketPositions({ ...params, environment: this.environment });
|
|
6700
|
+
}
|
|
6701
|
+
closedPositions(params) {
|
|
6702
|
+
return fetchPolymarketClosedPositions({ ...params, environment: this.environment });
|
|
6703
|
+
}
|
|
6704
|
+
activity(params) {
|
|
6705
|
+
return fetchPolymarketActivity({ ...params, environment: this.environment });
|
|
6706
|
+
}
|
|
6707
|
+
positionValue(params) {
|
|
6708
|
+
return fetchPolymarketPositionValue({ ...params, environment: this.environment });
|
|
6709
|
+
}
|
|
6710
|
+
publicProfile(address) {
|
|
6711
|
+
return fetchPolymarketPublicProfile({ address, environment: this.environment });
|
|
6712
|
+
}
|
|
6473
6713
|
};
|
|
6474
6714
|
async function fetchPolymarketMarkets(params = {}) {
|
|
6475
6715
|
if (params.active !== void 0 && params.active !== true) {
|
|
@@ -6576,6 +6816,265 @@ async function fetchPolymarketPriceHistory(params) {
|
|
|
6576
6816
|
p: Number(point.p)
|
|
6577
6817
|
})).filter((point) => Number.isFinite(point.t) && Number.isFinite(point.p));
|
|
6578
6818
|
}
|
|
6819
|
+
async function fetchPolymarketPositions(params) {
|
|
6820
|
+
const environment = params.environment ?? "mainnet";
|
|
6821
|
+
const market = normalizeCsvStringInput(params.market);
|
|
6822
|
+
const eventIds = normalizeCsvNumberInput(params.eventId);
|
|
6823
|
+
assertMutuallyExclusiveMarketScope(market, eventIds);
|
|
6824
|
+
const baseUrl = resolvePolymarketBaseUrl("data", environment);
|
|
6825
|
+
const url = new URL("/positions", baseUrl);
|
|
6826
|
+
url.searchParams.set("user", params.user);
|
|
6827
|
+
appendCsvParam(url, "market", market);
|
|
6828
|
+
appendCsvParam(
|
|
6829
|
+
url,
|
|
6830
|
+
"eventId",
|
|
6831
|
+
eventIds.map((entry) => String(entry))
|
|
6832
|
+
);
|
|
6833
|
+
appendNumberParam(url, "sizeThreshold", params.sizeThreshold);
|
|
6834
|
+
appendBooleanParam(url, "redeemable", params.redeemable);
|
|
6835
|
+
appendBooleanParam(url, "mergeable", params.mergeable);
|
|
6836
|
+
appendNumberParam(url, "limit", params.limit);
|
|
6837
|
+
appendNumberParam(url, "offset", params.offset);
|
|
6838
|
+
if (params.sortBy) url.searchParams.set("sortBy", params.sortBy);
|
|
6839
|
+
if (params.sortDirection) url.searchParams.set("sortDirection", params.sortDirection);
|
|
6840
|
+
if (params.title) url.searchParams.set("title", params.title);
|
|
6841
|
+
const data = await requestJson3(url.toString());
|
|
6842
|
+
return Array.isArray(data) ? data.map((entry) => normalizeUserPosition(entry)) : [];
|
|
6843
|
+
}
|
|
6844
|
+
async function fetchPolymarketClosedPositions(params) {
|
|
6845
|
+
const environment = params.environment ?? "mainnet";
|
|
6846
|
+
const market = normalizeCsvStringInput(params.market);
|
|
6847
|
+
const eventIds = normalizeCsvNumberInput(params.eventId);
|
|
6848
|
+
assertMutuallyExclusiveMarketScope(market, eventIds);
|
|
6849
|
+
const baseUrl = resolvePolymarketBaseUrl("data", environment);
|
|
6850
|
+
const url = new URL("/closed-positions", baseUrl);
|
|
6851
|
+
url.searchParams.set("user", params.user);
|
|
6852
|
+
appendCsvParam(url, "market", market);
|
|
6853
|
+
appendCsvParam(
|
|
6854
|
+
url,
|
|
6855
|
+
"eventId",
|
|
6856
|
+
eventIds.map((entry) => String(entry))
|
|
6857
|
+
);
|
|
6858
|
+
appendNumberParam(url, "limit", params.limit);
|
|
6859
|
+
appendNumberParam(url, "offset", params.offset);
|
|
6860
|
+
if (params.sortBy) url.searchParams.set("sortBy", params.sortBy);
|
|
6861
|
+
if (params.sortDirection) url.searchParams.set("sortDirection", params.sortDirection);
|
|
6862
|
+
if (params.title) url.searchParams.set("title", params.title);
|
|
6863
|
+
const data = await requestJson3(url.toString());
|
|
6864
|
+
return Array.isArray(data) ? data.map((entry) => normalizeClosedPosition(entry)) : [];
|
|
6865
|
+
}
|
|
6866
|
+
async function fetchPolymarketActivity(params) {
|
|
6867
|
+
const environment = params.environment ?? "mainnet";
|
|
6868
|
+
const market = normalizeCsvStringInput(params.market);
|
|
6869
|
+
const eventIds = normalizeCsvNumberInput(params.eventId);
|
|
6870
|
+
assertMutuallyExclusiveMarketScope(market, eventIds);
|
|
6871
|
+
const types = Array.isArray(params.type) ? params.type : params.type ? [params.type] : [];
|
|
6872
|
+
const baseUrl = resolvePolymarketBaseUrl("data", environment);
|
|
6873
|
+
const url = new URL("/activity", baseUrl);
|
|
6874
|
+
url.searchParams.set("user", params.user);
|
|
6875
|
+
appendCsvParam(url, "market", market);
|
|
6876
|
+
appendCsvParam(
|
|
6877
|
+
url,
|
|
6878
|
+
"eventId",
|
|
6879
|
+
eventIds.map((entry) => String(entry))
|
|
6880
|
+
);
|
|
6881
|
+
appendCsvParam(url, "type", types);
|
|
6882
|
+
appendNumberParam(url, "start", params.start);
|
|
6883
|
+
appendNumberParam(url, "end", params.end);
|
|
6884
|
+
appendNumberParam(url, "limit", params.limit);
|
|
6885
|
+
appendNumberParam(url, "offset", params.offset);
|
|
6886
|
+
if (params.sortBy) url.searchParams.set("sortBy", params.sortBy);
|
|
6887
|
+
if (params.sortDirection) url.searchParams.set("sortDirection", params.sortDirection);
|
|
6888
|
+
if (params.side) url.searchParams.set("side", params.side);
|
|
6889
|
+
const data = await requestJson3(url.toString());
|
|
6890
|
+
return Array.isArray(data) ? data.map((entry) => normalizeUserActivity(entry)) : [];
|
|
6891
|
+
}
|
|
6892
|
+
async function fetchPolymarketPositionValue(params) {
|
|
6893
|
+
const environment = params.environment ?? "mainnet";
|
|
6894
|
+
const baseUrl = resolvePolymarketBaseUrl("data", environment);
|
|
6895
|
+
const url = new URL("/value", baseUrl);
|
|
6896
|
+
url.searchParams.set("user", params.user);
|
|
6897
|
+
appendCsvParam(url, "market", normalizeCsvStringInput(params.market));
|
|
6898
|
+
const data = await requestJson3(url.toString());
|
|
6899
|
+
return Array.isArray(data) ? data.map((entry) => normalizePositionValue(entry)) : [];
|
|
6900
|
+
}
|
|
6901
|
+
async function fetchPolymarketPublicProfile(params) {
|
|
6902
|
+
const environment = params.environment ?? "mainnet";
|
|
6903
|
+
const baseUrl = resolvePolymarketBaseUrl("gamma", environment);
|
|
6904
|
+
const url = new URL("/public-profile", baseUrl);
|
|
6905
|
+
url.searchParams.set("address", params.address);
|
|
6906
|
+
const data = await requestJson3(url.toString());
|
|
6907
|
+
return normalizePublicProfile(data);
|
|
6908
|
+
}
|
|
6909
|
+
var POLYMARKET_SET_APPROVAL_FOR_ALL_ABI = [
|
|
6910
|
+
{
|
|
6911
|
+
inputs: [
|
|
6912
|
+
{ name: "operator", type: "address" },
|
|
6913
|
+
{ name: "approved", type: "bool" }
|
|
6914
|
+
],
|
|
6915
|
+
name: "setApprovalForAll",
|
|
6916
|
+
outputs: [],
|
|
6917
|
+
stateMutability: "nonpayable",
|
|
6918
|
+
type: "function"
|
|
6919
|
+
},
|
|
6920
|
+
{
|
|
6921
|
+
inputs: [
|
|
6922
|
+
{ name: "account", type: "address" },
|
|
6923
|
+
{ name: "operator", type: "address" }
|
|
6924
|
+
],
|
|
6925
|
+
name: "isApprovedForAll",
|
|
6926
|
+
outputs: [{ name: "", type: "bool" }],
|
|
6927
|
+
stateMutability: "view",
|
|
6928
|
+
type: "function"
|
|
6929
|
+
}
|
|
6930
|
+
];
|
|
6931
|
+
var POLYMARKET_BOOTSTRAP_CONTRACTS_BY_ENV = {
|
|
6932
|
+
mainnet: {
|
|
6933
|
+
usdc: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
|
|
6934
|
+
ctf: "0x4D97DCd97eC945f40cF65F87097ACe5EA0476045",
|
|
6935
|
+
negRiskAdapter: "0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296",
|
|
6936
|
+
safeFactory: "0xaacFeEa03eb1561C4e67d661e40682Bd20E3541b",
|
|
6937
|
+
safeMultisend: "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761",
|
|
6938
|
+
relayerUrl: "https://relayer-v2.polymarket.com",
|
|
6939
|
+
bridgeUrl: "https://bridge.polymarket.com"
|
|
6940
|
+
}
|
|
6941
|
+
};
|
|
6942
|
+
async function requestJson4(url, init) {
|
|
6943
|
+
const response = await fetch(url, init);
|
|
6944
|
+
const text = await response.text().catch(() => "");
|
|
6945
|
+
let data = null;
|
|
6946
|
+
try {
|
|
6947
|
+
data = text ? JSON.parse(text) : null;
|
|
6948
|
+
} catch {
|
|
6949
|
+
data = text;
|
|
6950
|
+
}
|
|
6951
|
+
if (!response.ok) {
|
|
6952
|
+
throw new PolymarketApiError(
|
|
6953
|
+
`Polymarket request failed (${response.status}).`,
|
|
6954
|
+
data ?? { status: response.status }
|
|
6955
|
+
);
|
|
6956
|
+
}
|
|
6957
|
+
return data;
|
|
6958
|
+
}
|
|
6959
|
+
function resolvePolymarketBootstrapContracts(environment) {
|
|
6960
|
+
const contracts = POLYMARKET_BOOTSTRAP_CONTRACTS_BY_ENV[environment];
|
|
6961
|
+
if (!contracts) {
|
|
6962
|
+
throw new Error(
|
|
6963
|
+
`Polymarket bootstrap contracts are not configured for ${environment}.`
|
|
6964
|
+
);
|
|
6965
|
+
}
|
|
6966
|
+
return contracts;
|
|
6967
|
+
}
|
|
6968
|
+
function buildPolymarketUsdcApprovalTransaction(args) {
|
|
6969
|
+
const environment = args?.environment ?? "mainnet";
|
|
6970
|
+
const contracts = resolvePolymarketBootstrapContracts(environment);
|
|
6971
|
+
return {
|
|
6972
|
+
to: contracts.usdc,
|
|
6973
|
+
data: encodeFunctionData({
|
|
6974
|
+
abi: erc20Abi,
|
|
6975
|
+
functionName: "approve",
|
|
6976
|
+
args: [contracts.ctf, args?.amount ?? maxUint256]
|
|
6977
|
+
}),
|
|
6978
|
+
value: "0",
|
|
6979
|
+
description: "Approve USDC.e for CTF"
|
|
6980
|
+
};
|
|
6981
|
+
}
|
|
6982
|
+
function buildPolymarketOutcomeTokenApprovalTransactions(args) {
|
|
6983
|
+
const environment = args?.environment ?? "mainnet";
|
|
6984
|
+
const includeNegRisk = args?.includeNegRisk ?? true;
|
|
6985
|
+
const contracts = resolvePolymarketBootstrapContracts(environment);
|
|
6986
|
+
const transactions = [
|
|
6987
|
+
{
|
|
6988
|
+
to: contracts.ctf,
|
|
6989
|
+
data: encodeFunctionData({
|
|
6990
|
+
abi: POLYMARKET_SET_APPROVAL_FOR_ALL_ABI,
|
|
6991
|
+
functionName: "setApprovalForAll",
|
|
6992
|
+
args: [POLYMARKET_EXCHANGE_ADDRESSES[environment].ctf, true]
|
|
6993
|
+
}),
|
|
6994
|
+
value: "0",
|
|
6995
|
+
description: "Approve outcome tokens for CTF Exchange"
|
|
6996
|
+
}
|
|
6997
|
+
];
|
|
6998
|
+
if (includeNegRisk) {
|
|
6999
|
+
transactions.push({
|
|
7000
|
+
to: contracts.ctf,
|
|
7001
|
+
data: encodeFunctionData({
|
|
7002
|
+
abi: POLYMARKET_SET_APPROVAL_FOR_ALL_ABI,
|
|
7003
|
+
functionName: "setApprovalForAll",
|
|
7004
|
+
args: [POLYMARKET_EXCHANGE_ADDRESSES[environment].negRisk, true]
|
|
7005
|
+
}),
|
|
7006
|
+
value: "0",
|
|
7007
|
+
description: "Approve outcome tokens for Neg Risk Exchange"
|
|
7008
|
+
});
|
|
7009
|
+
}
|
|
7010
|
+
return transactions;
|
|
7011
|
+
}
|
|
7012
|
+
function buildPolymarketApprovalTransactions(args) {
|
|
7013
|
+
return [
|
|
7014
|
+
buildPolymarketUsdcApprovalTransaction(args),
|
|
7015
|
+
...buildPolymarketOutcomeTokenApprovalTransactions(args)
|
|
7016
|
+
];
|
|
7017
|
+
}
|
|
7018
|
+
async function fetchPolymarketApprovalState(args) {
|
|
7019
|
+
const environment = args.environment ?? "mainnet";
|
|
7020
|
+
const includeNegRisk = args.includeNegRisk ?? true;
|
|
7021
|
+
const contracts = resolvePolymarketBootstrapContracts(environment);
|
|
7022
|
+
const ctfExchange = POLYMARKET_EXCHANGE_ADDRESSES[environment].ctf;
|
|
7023
|
+
const negRiskExchange = POLYMARKET_EXCHANGE_ADDRESSES[environment].negRisk;
|
|
7024
|
+
const [allowance, ctfExchangeApproved, negRiskExchangeApproved] = await Promise.all([
|
|
7025
|
+
args.publicClient.readContract({
|
|
7026
|
+
address: contracts.usdc,
|
|
7027
|
+
abi: erc20Abi,
|
|
7028
|
+
functionName: "allowance",
|
|
7029
|
+
args: [args.funder, contracts.ctf]
|
|
7030
|
+
}),
|
|
7031
|
+
args.publicClient.readContract({
|
|
7032
|
+
address: contracts.ctf,
|
|
7033
|
+
abi: POLYMARKET_SET_APPROVAL_FOR_ALL_ABI,
|
|
7034
|
+
functionName: "isApprovedForAll",
|
|
7035
|
+
args: [args.funder, ctfExchange]
|
|
7036
|
+
}),
|
|
7037
|
+
includeNegRisk ? args.publicClient.readContract({
|
|
7038
|
+
address: contracts.ctf,
|
|
7039
|
+
abi: POLYMARKET_SET_APPROVAL_FOR_ALL_ABI,
|
|
7040
|
+
functionName: "isApprovedForAll",
|
|
7041
|
+
args: [args.funder, negRiskExchange]
|
|
7042
|
+
}) : Promise.resolve(true)
|
|
7043
|
+
]);
|
|
7044
|
+
return {
|
|
7045
|
+
funder: args.funder,
|
|
7046
|
+
usdcAllowance: allowance,
|
|
7047
|
+
usdcApproved: allowance > 0n,
|
|
7048
|
+
ctfExchangeApproved,
|
|
7049
|
+
negRiskExchangeApproved,
|
|
7050
|
+
approvalsReady: allowance > 0n && ctfExchangeApproved && negRiskExchangeApproved
|
|
7051
|
+
};
|
|
7052
|
+
}
|
|
7053
|
+
async function fetchPolymarketDepositAddresses(args) {
|
|
7054
|
+
const environment = args.environment ?? "mainnet";
|
|
7055
|
+
const contracts = resolvePolymarketBootstrapContracts(environment);
|
|
7056
|
+
return await requestJson4(`${contracts.bridgeUrl}/deposit`, {
|
|
7057
|
+
method: "POST",
|
|
7058
|
+
headers: {
|
|
7059
|
+
"content-type": "application/json"
|
|
7060
|
+
},
|
|
7061
|
+
body: JSON.stringify({
|
|
7062
|
+
address: args.address
|
|
7063
|
+
})
|
|
7064
|
+
});
|
|
7065
|
+
}
|
|
7066
|
+
function decodePolymarketBootstrapTransaction(transaction) {
|
|
7067
|
+
const abi = transaction.to.toLowerCase() === resolvePolymarketBootstrapContracts("mainnet").usdc.toLowerCase() ? erc20Abi : POLYMARKET_SET_APPROVAL_FOR_ALL_ABI;
|
|
7068
|
+
const decoded = decodeFunctionData({
|
|
7069
|
+
abi,
|
|
7070
|
+
data: transaction.data
|
|
7071
|
+
});
|
|
7072
|
+
return {
|
|
7073
|
+
to: transaction.to,
|
|
7074
|
+
functionName: decoded.functionName,
|
|
7075
|
+
args: decoded.args ?? []
|
|
7076
|
+
};
|
|
7077
|
+
}
|
|
6579
7078
|
|
|
6580
7079
|
// src/adapters/news/signals.ts
|
|
6581
7080
|
var DEFAULT_OPENPOND_GATEWAY_URL2 = "https://gateway.openpond.dev";
|
|
@@ -7613,6 +8112,6 @@ function buildBacktestDecisionSeriesInput(request) {
|
|
|
7613
8112
|
};
|
|
7614
8113
|
}
|
|
7615
8114
|
|
|
7616
|
-
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_HYPERLIQUID_TPSL_MARKET_SLIPPAGE_BPS, DEFAULT_MODEL, DEFAULT_OPENPOND_GATEWAY_URL2 as DEFAULT_OPENPOND_GATEWAY_URL, DEFAULT_TIMEOUT_MS, DEFAULT_TOKENS, HTTP_METHODS2 as HTTP_METHODS, HYPERLIQUID_HIP3_DEXES, 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, buildHyperliquidMarketDescriptor, 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, estimateHyperliquidLiquidationPrice, evaluateNewsContinuationGate, executeTool, extractHyperliquidDex, extractHyperliquidOrderIds, fetchHyperliquidActiveAsset, fetchHyperliquidAllMids, fetchHyperliquidAssetCtxs, fetchHyperliquidBars, fetchHyperliquidClearinghouseState, fetchHyperliquidDexMeta, fetchHyperliquidDexMetaAndAssetCtxs, fetchHyperliquidFrontendOpenOrders, fetchHyperliquidFrontendOpenOrdersAcrossDexes, fetchHyperliquidHistoricalOrders, fetchHyperliquidMeta, fetchHyperliquidMetaAndAssetCtxs, fetchHyperliquidOpenOrders, fetchHyperliquidOpenOrdersAcrossDexes, fetchHyperliquidOrderStatus, fetchHyperliquidPerpMarketInfo, fetchHyperliquidPreTransferCheck, fetchHyperliquidResolvedMarketDescriptor, 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, generateText, getHyperliquidMaxBuilderFee, getKnownHyperliquidDexes, getModelConfig, getMyPerformance, getMyTools, getRpcUrl, getX402PaymentContext, isHyperliquidSpotSymbol, isStreamingSupported, isToolCallingSupported, listModels, modifyHyperliquidOrder, normalizeHyperliquidBaseSymbol, normalizeHyperliquidDcaEntries, normalizeHyperliquidIndicatorBars, normalizeHyperliquidMetaSymbol, normalizeModelName, normalizeNumberArrayish, normalizeSpotTokenName2 as normalizeSpotTokenName, normalizeStringArrayish, parseHyperliquidJson, parseHyperliquidSymbol, parseSpotPairSymbol, parseTimeToSeconds, payX402, payX402WithWallet, placeHyperliquidOrder2 as placeHyperliquidOrder, placeHyperliquidOrderWithTpSl, placeHyperliquidPositionTpSl, 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, resolveHyperliquidMarketDataCoin, 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, setHyperliquidPortfolioMargin, store, streamText, supportsHyperliquidBuilderFee, tokens, transferHyperliquidSubAccount, updateHyperliquidIsolatedMargin, updateHyperliquidLeverage, wallet, walletToolkit, withX402Payment, withdrawFromHyperliquid };
|
|
8115
|
+
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_HYPERLIQUID_TPSL_MARKET_SLIPPAGE_BPS, DEFAULT_MODEL, DEFAULT_OPENPOND_GATEWAY_URL2 as DEFAULT_OPENPOND_GATEWAY_URL, DEFAULT_TIMEOUT_MS, DEFAULT_TOKENS, HTTP_METHODS2 as HTTP_METHODS, HYPERLIQUID_HIP3_DEXES, 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, buildHyperliquidMarketDescriptor, buildHyperliquidMarketIdentity, buildHyperliquidProfileAssets, buildHyperliquidSpotUsdPriceMap, buildL1Headers, buildL2Headers, buildPolymarketApprovalTransactions, buildPolymarketOrderAmounts, buildPolymarketOutcomeTokenApprovalTransactions, buildPolymarketUsdcApprovalTransaction, buildSignedOrderPayload, cancelAllHyperliquidOrders, cancelAllPolymarketOrders, cancelHyperliquidOrders, cancelHyperliquidOrdersByCloid, cancelHyperliquidTwapOrder, cancelMarketPolymarketOrders, cancelPolymarketOrder, cancelPolymarketOrders, chains, clampHyperliquidAbs, clampHyperliquidFloat, clampHyperliquidInt, computeHyperliquidMarketIocLimitPrice, createAIClient, createDevServer, createHyperliquidSubAccount, createMcpAdapter, createMonotonicNonceFactory, createOrDerivePolymarketApiKey, createPolymarketApiKey, createStdioServer, decodePolymarketBootstrapTransaction, defineX402Payment, depositToHyperliquidBridge, derivePolymarketApiKey, ensureTextContent, estimateCountBack, estimateHyperliquidLiquidationPrice, evaluateNewsContinuationGate, executeTool, extractHyperliquidDex, extractHyperliquidOrderIds, fetchHyperliquidActiveAsset, fetchHyperliquidAllMids, fetchHyperliquidAssetCtxs, fetchHyperliquidBars, fetchHyperliquidClearinghouseState, fetchHyperliquidDexMeta, fetchHyperliquidDexMetaAndAssetCtxs, fetchHyperliquidFrontendOpenOrders, fetchHyperliquidFrontendOpenOrdersAcrossDexes, fetchHyperliquidHistoricalOrders, fetchHyperliquidMeta, fetchHyperliquidMetaAndAssetCtxs, fetchHyperliquidOpenOrders, fetchHyperliquidOpenOrdersAcrossDexes, fetchHyperliquidOrderStatus, fetchHyperliquidPerpMarketInfo, fetchHyperliquidPreTransferCheck, fetchHyperliquidResolvedMarketDescriptor, fetchHyperliquidSizeDecimals, fetchHyperliquidSpotAccountValue, fetchHyperliquidSpotAssetCtxs, fetchHyperliquidSpotClearinghouseState, fetchHyperliquidSpotMarketInfo, fetchHyperliquidSpotMeta, fetchHyperliquidSpotMetaAndAssetCtxs, fetchHyperliquidSpotTickSize, fetchHyperliquidSpotUsdPriceMap, fetchHyperliquidTickSize, fetchHyperliquidUserFills, fetchHyperliquidUserFillsByTime, fetchHyperliquidUserRateLimit, fetchNewsEventSignal, fetchNewsPropositionSignal, fetchPolymarketActivity, fetchPolymarketApprovalState, fetchPolymarketClosedPositions, fetchPolymarketDepositAddresses, fetchPolymarketMarket, fetchPolymarketMarkets, fetchPolymarketMidpoint, fetchPolymarketOrderbook, fetchPolymarketPositionValue, fetchPolymarketPositions, fetchPolymarketPrice, fetchPolymarketPriceHistory, fetchPolymarketPublicProfile, flattenMessageContent, formatHyperliquidMarketablePrice, formatHyperliquidOrderSize, formatHyperliquidPrice, formatHyperliquidSize, generateText, getHyperliquidMaxBuilderFee, getKnownHyperliquidDexes, getModelConfig, getMyPerformance, getMyTools, getRpcUrl, getX402PaymentContext, isHyperliquidSpotSymbol, isStreamingSupported, isToolCallingSupported, listModels, modifyHyperliquidOrder, normalizeHyperliquidBaseSymbol, normalizeHyperliquidDcaEntries, normalizeHyperliquidIndicatorBars, normalizeHyperliquidMetaSymbol, normalizeModelName, normalizeNumberArrayish, normalizeSpotTokenName2 as normalizeSpotTokenName, normalizeStringArrayish, parseHyperliquidJson, parseHyperliquidSymbol, parseSpotPairSymbol, parseTimeToSeconds, payX402, payX402WithWallet, placeHyperliquidOrder2 as placeHyperliquidOrder, placeHyperliquidOrderWithTpSl, placeHyperliquidPositionTpSl, 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, resolveHyperliquidMarketDataCoin, resolveHyperliquidMaxPerRunUsd, resolveHyperliquidOrderRef, resolveHyperliquidOrderSymbol, resolveHyperliquidPair, resolveHyperliquidPerpSymbol, resolveHyperliquidProfileChain, resolveHyperliquidRpcEnvVar, resolveHyperliquidScheduleEvery, resolveHyperliquidScheduleUnit, resolveHyperliquidSpotSymbol, resolveHyperliquidStoreNetwork, resolveHyperliquidSymbol, resolveHyperliquidTargetSize, resolveNewsGatewayBase, resolvePolymarketBaseUrl, resolvePolymarketBootstrapContracts, resolveRuntimePath, resolveSpotMidCandidates, resolveSpotTokenCandidates, resolveToolset, responseToToolResponse, retrieve, roundHyperliquidPriceToTick, scheduleHyperliquidCancel, sendHyperliquidSpot, setHyperliquidAccountAbstractionMode, setHyperliquidPortfolioMargin, store, streamText, supportsHyperliquidBuilderFee, tokens, transferHyperliquidSubAccount, updateHyperliquidIsolatedMargin, updateHyperliquidLeverage, wallet, walletToolkit, withX402Payment, withdrawFromHyperliquid };
|
|
7617
8116
|
//# sourceMappingURL=index.js.map
|
|
7618
8117
|
//# sourceMappingURL=index.js.map
|