hchain-mcp 1.0.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/.env.example +5 -0
- package/AGENT-MCP-RULES.md +248 -0
- package/OnchainOS-API/345/257/271/346/216/245/350/247/204/350/214/203.md +329 -0
- package/README.md +106 -0
- package/dist/adapters/onchainos-ws.d.ts +31 -0
- package/dist/adapters/onchainos-ws.js +103 -0
- package/dist/adapters/onchainos.d.ts +343 -0
- package/dist/adapters/onchainos.js +275 -0
- package/dist/adapters/shared.d.ts +23 -0
- package/dist/adapters/shared.js +107 -0
- package/dist/http.d.ts +9 -0
- package/dist/http.js +124 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +54 -0
- package/dist/tools/balance.d.ts +4 -0
- package/dist/tools/balance.js +69 -0
- package/dist/tools/defi.d.ts +4 -0
- package/dist/tools/defi.js +268 -0
- package/dist/tools/gateway.d.ts +4 -0
- package/dist/tools/gateway.js +107 -0
- package/dist/tools/intent.d.ts +4 -0
- package/dist/tools/intent.js +111 -0
- package/dist/tools/market.d.ts +4 -0
- package/dist/tools/market.js +612 -0
- package/dist/tools/payments.d.ts +4 -0
- package/dist/tools/payments.js +100 -0
- package/dist/tools/skills.d.ts +4 -0
- package/dist/tools/skills.js +464 -0
- package/dist/tools/trade.d.ts +4 -0
- package/dist/tools/trade.js +195 -0
- package/dist/tools/txhistory.d.ts +4 -0
- package/dist/tools/txhistory.js +49 -0
- package/dist/tools/ws.d.ts +4 -0
- package/dist/tools/ws.js +64 -0
- package/docs/DEFI.md +65 -0
- package/docs/GATEWAY.md +45 -0
- package/docs/MARKET.md +109 -0
- package/docs/PAYMENTS.md +83 -0
- package/docs/TRADE.md +103 -0
- package/package.json +25 -0
- package/src/adapters/onchainos-ws.ts +126 -0
- package/src/adapters/onchainos.ts +488 -0
- package/src/adapters/shared.ts +100 -0
- package/src/http.ts +132 -0
- package/src/index.ts +57 -0
- package/src/tools/balance.ts +67 -0
- package/src/tools/defi.ts +224 -0
- package/src/tools/gateway.ts +115 -0
- package/src/tools/intent.ts +106 -0
- package/src/tools/market.ts +543 -0
- package/src/tools/payments.ts +105 -0
- package/src/tools/skills.ts +489 -0
- package/src/tools/trade.ts +197 -0
- package/src/tools/txhistory.ts +51 -0
- package/src/tools/ws.ts +72 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Onchain OS WebSocket 适配层
|
|
3
|
+
* wss://wsdex.okx.com/ws/v6/dex
|
|
4
|
+
*
|
|
5
|
+
* MCP Tool 限制: WS 是长连接推送, Tool 是请求-响应。
|
|
6
|
+
* 工具只管理连接生命周期 (subscribe/unsubscribe), 推送数据走 stderr 日志。
|
|
7
|
+
*/
|
|
8
|
+
import type { Auth } from "./shared.js";
|
|
9
|
+
type WSChannel = {
|
|
10
|
+
channel: "price";
|
|
11
|
+
chainIndex: string;
|
|
12
|
+
tokenContractAddress: string;
|
|
13
|
+
} | {
|
|
14
|
+
channel: "price-info";
|
|
15
|
+
chainIndex: string;
|
|
16
|
+
tokenContractAddress: string;
|
|
17
|
+
} | {
|
|
18
|
+
channel: "trades";
|
|
19
|
+
chainIndex: string;
|
|
20
|
+
tokenContractAddress: string;
|
|
21
|
+
} | {
|
|
22
|
+
channel: string;
|
|
23
|
+
chainIndex: string;
|
|
24
|
+
[key: string]: string;
|
|
25
|
+
};
|
|
26
|
+
export declare function wsConnect(auth: Auth): Promise<string>;
|
|
27
|
+
export declare function wsSubscribe(channel: WSChannel): Promise<void>;
|
|
28
|
+
export declare function wsUnsubscribe(channel: WSChannel): Promise<void>;
|
|
29
|
+
export declare function wsDisconnect(): void;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=onchainos-ws.d.ts.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
const WS_URL = "wss://wsdex.okx.com/ws/v6/dex";
|
|
3
|
+
const PING_INTERVAL = 25000;
|
|
4
|
+
const state = { ws: null, connId: null, subscribed: new Set() };
|
|
5
|
+
function channelKey(c) { return `${c.channel}:${c.chainIndex}:${"tokenContractAddress" in c ? c.tokenContractAddress : ""}`; }
|
|
6
|
+
function sign(secret, timestamp) {
|
|
7
|
+
return crypto.createHmac("sha256", secret).update(timestamp + "GET" + "/users/self/verify").digest("base64");
|
|
8
|
+
}
|
|
9
|
+
function heartbeat(ws) {
|
|
10
|
+
const timer = setInterval(() => { if (ws.readyState === WebSocket.OPEN)
|
|
11
|
+
ws.send("ping"); }, PING_INTERVAL);
|
|
12
|
+
ws.addEventListener("close", () => clearInterval(timer));
|
|
13
|
+
}
|
|
14
|
+
// ── Public API ──────────────────────────────────────────
|
|
15
|
+
export async function wsConnect(auth) {
|
|
16
|
+
if (state.ws && state.ws.readyState === WebSocket.OPEN)
|
|
17
|
+
return state.connId ?? "already-connected";
|
|
18
|
+
const timestamp = String(Math.floor(Date.now() / 1000));
|
|
19
|
+
const loginMsg = JSON.stringify({
|
|
20
|
+
op: "login",
|
|
21
|
+
args: [{ apiKey: auth.apiKey, passphrase: auth.passphrase, timestamp, sign: sign(auth.secret, timestamp) }],
|
|
22
|
+
});
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
const ws = new WebSocket(WS_URL);
|
|
25
|
+
const timeout = setTimeout(() => { ws.close(); reject(new Error("WS connection timeout")); }, 10000);
|
|
26
|
+
ws.addEventListener("open", () => {
|
|
27
|
+
ws.send(loginMsg);
|
|
28
|
+
});
|
|
29
|
+
ws.addEventListener("message", (e) => {
|
|
30
|
+
const data = JSON.parse(e.data);
|
|
31
|
+
if (data.event === "login" && data.code === "0") {
|
|
32
|
+
clearTimeout(timeout);
|
|
33
|
+
state.ws = ws;
|
|
34
|
+
state.connId = data.connId;
|
|
35
|
+
heartbeat(ws);
|
|
36
|
+
ws.addEventListener("message", (e2) => {
|
|
37
|
+
const d = JSON.parse(e2.data);
|
|
38
|
+
if (d.event !== "login" && d.event !== "subscribe" && d.event !== "unsubscribe") {
|
|
39
|
+
console.error("[WS-DATA]", JSON.stringify(d));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
resolve(data.connId);
|
|
43
|
+
}
|
|
44
|
+
else if (data.event === "error") {
|
|
45
|
+
clearTimeout(timeout);
|
|
46
|
+
ws.close();
|
|
47
|
+
reject(new Error(`WS login failed: ${data.code} ${data.msg}`));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
ws.addEventListener("error", (e) => { clearTimeout(timeout); reject(new Error(`WS error: ${JSON.stringify(e)}`)); });
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export async function wsSubscribe(channel) {
|
|
54
|
+
if (!state.ws || state.ws.readyState !== WebSocket.OPEN)
|
|
55
|
+
throw new Error("WS not connected, call ws_connect first");
|
|
56
|
+
const key = channelKey(channel);
|
|
57
|
+
if (state.subscribed.has(key))
|
|
58
|
+
return;
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
const handler = (e) => {
|
|
61
|
+
const d = JSON.parse(e.data);
|
|
62
|
+
if (d.event === "subscribe" && d.arg?.channel === channel.channel) {
|
|
63
|
+
state.subscribed.add(key);
|
|
64
|
+
state.ws.removeEventListener("message", handler);
|
|
65
|
+
resolve();
|
|
66
|
+
}
|
|
67
|
+
else if (d.event === "error") {
|
|
68
|
+
state.ws.removeEventListener("message", handler);
|
|
69
|
+
reject(new Error(`WS subscribe failed: ${d.code} ${d.msg}`));
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
state.ws.addEventListener("message", handler);
|
|
73
|
+
state.ws.send(JSON.stringify({ op: "subscribe", args: [channel] }));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
export async function wsUnsubscribe(channel) {
|
|
77
|
+
if (!state.ws || state.ws.readyState !== WebSocket.OPEN)
|
|
78
|
+
return;
|
|
79
|
+
const key = channelKey(channel);
|
|
80
|
+
if (!state.subscribed.has(key))
|
|
81
|
+
return;
|
|
82
|
+
return new Promise((resolve) => {
|
|
83
|
+
const handler = (e) => {
|
|
84
|
+
const d = JSON.parse(e.data);
|
|
85
|
+
if (d.event === "unsubscribe") {
|
|
86
|
+
state.subscribed.delete(key);
|
|
87
|
+
state.ws.removeEventListener("message", handler);
|
|
88
|
+
resolve();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
state.ws.addEventListener("message", handler);
|
|
92
|
+
state.ws.send(JSON.stringify({ op: "unsubscribe", args: [channel] }));
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
export function wsDisconnect() {
|
|
96
|
+
if (state.ws) {
|
|
97
|
+
state.ws.close();
|
|
98
|
+
state.ws = null;
|
|
99
|
+
state.connId = null;
|
|
100
|
+
state.subscribed.clear();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=onchainos-ws.js.map
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import type { Auth } from "./shared.js";
|
|
2
|
+
export declare const balanceApi: {
|
|
3
|
+
/** GET /api/v6/dex/balance/supported/chain — 返回 name/logoUrl/shortName/chainIndex */
|
|
4
|
+
supportedChain: (auth: Auth) => Promise<unknown>;
|
|
5
|
+
/** GET /api/v6/dex/balance/total-value-by-address?address=&chains=&assetType=&excludeRiskToken= */
|
|
6
|
+
totalValue: (auth: Auth, address: string, chains: string, assetType?: string, excludeRiskToken?: boolean) => Promise<unknown>;
|
|
7
|
+
/** GET /api/v6/dex/balance/all-token-balances-by-address?address=&chains=&excludeRiskToken= */
|
|
8
|
+
allTokenBalances: (auth: Auth, address: string, chains: string, excludeRiskToken?: string) => Promise<unknown>;
|
|
9
|
+
/** POST /api/v6/dex/balance/token-balances-by-address — body: { address, tokenContractAddresses: [{chainIndex, tokenContractAddress}], excludeRiskToken? } */
|
|
10
|
+
specificTokenBalance: (auth: Auth, address: string, tokenContractAddresses: Array<{
|
|
11
|
+
chainIndex: string;
|
|
12
|
+
tokenContractAddress: string;
|
|
13
|
+
}>, excludeRiskToken?: string) => Promise<unknown>;
|
|
14
|
+
};
|
|
15
|
+
export declare const gatewayApi: {
|
|
16
|
+
/** GET /api/v6/dex/pre-transaction/supported/chain */
|
|
17
|
+
supportedChain: (auth: Auth) => Promise<unknown>;
|
|
18
|
+
/** GET /api/v6/dex/pre-transaction/gas-price?chainIndex= */
|
|
19
|
+
gasPrice: (auth: Auth, chainIndex: string) => Promise<unknown>;
|
|
20
|
+
/** POST /api/v6/dex/pre-transaction/gas-limit */
|
|
21
|
+
gasLimit: (auth: Auth, body: {
|
|
22
|
+
chainIndex: string;
|
|
23
|
+
fromAddress: string;
|
|
24
|
+
toAddress: string;
|
|
25
|
+
txAmount?: string;
|
|
26
|
+
extJson?: {
|
|
27
|
+
inputData?: string;
|
|
28
|
+
};
|
|
29
|
+
}) => Promise<unknown>;
|
|
30
|
+
/** POST /api/v6/dex/pre-transaction/simulate — 模拟执行, 返回 intention/assetChange/gasUsed/failReason/risks */
|
|
31
|
+
simulate: (auth: Auth, body: {
|
|
32
|
+
fromAddress: string;
|
|
33
|
+
toAddress: string;
|
|
34
|
+
chainIndex: string;
|
|
35
|
+
txAmount?: string;
|
|
36
|
+
extJson: {
|
|
37
|
+
inputData: string;
|
|
38
|
+
};
|
|
39
|
+
priorityFee?: string;
|
|
40
|
+
gasPrice?: string;
|
|
41
|
+
}) => Promise<unknown>;
|
|
42
|
+
/** POST /api/v6/dex/pre-transaction/broadcast-transaction — 返回 orderId/txHash */
|
|
43
|
+
broadcast: (auth: Auth, body: {
|
|
44
|
+
signedTx: string;
|
|
45
|
+
chainIndex: string;
|
|
46
|
+
address: string;
|
|
47
|
+
extraData?: string;
|
|
48
|
+
}) => Promise<unknown>;
|
|
49
|
+
};
|
|
50
|
+
export declare const postTxApi: {
|
|
51
|
+
/** GET /api/v6/dex/post-transaction/orders — 广播订单列表 */
|
|
52
|
+
orders: (auth: Auth, address: string, chainIndex: string, txStatus?: string, orderId?: string, cursor?: string, limit?: string) => Promise<unknown>;
|
|
53
|
+
/** GET /api/v6/dex/post-transaction/supported/chain — 交易历史支持的链 */
|
|
54
|
+
supportedChain: (auth: Auth) => Promise<unknown>;
|
|
55
|
+
/** GET /api/v6/dex/post-transaction/transactions-by-address?address=&chains=&tokenContractAddress=&begin=&end=&cursor=&limit= */
|
|
56
|
+
transactions: (auth: Auth, address: string, chains: string, tokenContractAddress?: string, begin?: string, end?: string, cursor?: string, limit?: string) => Promise<unknown>;
|
|
57
|
+
/** GET /api/v6/dex/post-transaction/transaction-detail-by-txhash?chainIndex=&txHash=&itype= */
|
|
58
|
+
transactionDetail: (auth: Auth, chainIndex: string, txHash: string, itype?: string) => Promise<unknown>;
|
|
59
|
+
};
|
|
60
|
+
export declare const defiApi: {
|
|
61
|
+
/** GET /api/v6/defi/product/supported-chains — 返回 chainIndex(String)+network */
|
|
62
|
+
supportedChains: (auth: Auth) => Promise<unknown>;
|
|
63
|
+
/** GET /api/v6/defi/product/supported-platforms — 返回 analysisPlatformId+platformName+investmentCount */
|
|
64
|
+
supportedPlatforms: (auth: Auth) => Promise<unknown>;
|
|
65
|
+
/** POST /api/v6/defi/product/search — body: { tokenKeywordList, platformKeywordList?, pageNum?, chainIndex?, productGroup? } */
|
|
66
|
+
searchProducts: (auth: Auth, body: {
|
|
67
|
+
tokenKeywordList: string[];
|
|
68
|
+
platformKeywordList?: string[];
|
|
69
|
+
pageNum?: number;
|
|
70
|
+
chainIndex?: string;
|
|
71
|
+
productGroup?: string;
|
|
72
|
+
}) => Promise<unknown>;
|
|
73
|
+
/** GET /api/v6/defi/product/detail?investmentId= */
|
|
74
|
+
productDetail: (auth: Auth, investmentId: string) => Promise<unknown>;
|
|
75
|
+
/** GET /api/v6/defi/product/rate/chart?investmentId=&timeRange= — APY 折线图 */
|
|
76
|
+
rateChart: (auth: Auth, investmentId: string, timeRange?: string) => Promise<unknown>;
|
|
77
|
+
/** GET /api/v6/defi/product/tvl/chart?investmentId=&timeRange= — TVL 折线图 */
|
|
78
|
+
tvlChart: (auth: Auth, investmentId: string, timeRange?: string) => Promise<unknown>;
|
|
79
|
+
/** GET /api/v6/defi/product/depth-price/chart?investmentId=&chartType=&timeRange= — V3 深度/价格图 */
|
|
80
|
+
depthPriceChart: (auth: Auth, investmentId: string, chartType?: string, timeRange?: string) => Promise<unknown>;
|
|
81
|
+
/** POST /api/v6/defi/product/detail/prepare — 交易前准备, 返回 investWithTokenList/receiveTokenInfo */
|
|
82
|
+
prepareTransaction: (auth: Auth, investmentId: string) => Promise<unknown>;
|
|
83
|
+
/** POST /api/v6/defi/calculator/enter/info — V3 Pool 双币分配计算 */
|
|
84
|
+
calcEnterInfo: (auth: Auth, body: {
|
|
85
|
+
inputAmount: string;
|
|
86
|
+
inputTokenAddress: string;
|
|
87
|
+
tokenDecimal: string;
|
|
88
|
+
investmentId: string;
|
|
89
|
+
address: string;
|
|
90
|
+
tickLower: string;
|
|
91
|
+
tickUpper: string;
|
|
92
|
+
}) => Promise<unknown>;
|
|
93
|
+
/** POST /api/v6/defi/transaction/enter — 申购/存款/借款, 返回 dataList(APPROVE→DEPOSIT) */
|
|
94
|
+
enter: (auth: Auth, body: Record<string, unknown>) => Promise<unknown>;
|
|
95
|
+
/** POST /api/v6/defi/transaction/exit — 赎回/还款, 返回 dataList */
|
|
96
|
+
exit: (auth: Auth, body: Record<string, unknown>) => Promise<unknown>;
|
|
97
|
+
/** POST /api/v6/defi/transaction/claim — 领取奖励, 返回 dataList */
|
|
98
|
+
claim: (auth: Auth, body: Record<string, unknown>) => Promise<unknown>;
|
|
99
|
+
/** POST /api/v6/defi/user/asset/platform/list — 用户持仓概览(协议维度) */
|
|
100
|
+
userPlatformList: (auth: Auth, body: {
|
|
101
|
+
walletAddressList: Array<{
|
|
102
|
+
chainIndex: string;
|
|
103
|
+
walletAddress: string;
|
|
104
|
+
pubKey?: string;
|
|
105
|
+
}>;
|
|
106
|
+
tag?: string;
|
|
107
|
+
}) => Promise<unknown>;
|
|
108
|
+
/** POST /api/v6/defi/user/asset/platform/detail — 用户持仓明细(投资品维度) */
|
|
109
|
+
userPlatformDetail: (auth: Auth, body: Record<string, unknown>) => Promise<unknown>;
|
|
110
|
+
};
|
|
111
|
+
export declare const paymentsApi: {
|
|
112
|
+
/** POST /api/v6/pay/a2a/payment/create — Seller 创建付款, 返回 paymentId+challenge+付款链接 */
|
|
113
|
+
create: (auth: Auth, body: {
|
|
114
|
+
type: string;
|
|
115
|
+
amount: string;
|
|
116
|
+
symbol: string;
|
|
117
|
+
recipient: string;
|
|
118
|
+
description?: string;
|
|
119
|
+
externalId?: string;
|
|
120
|
+
expiresIn?: number;
|
|
121
|
+
realm?: string;
|
|
122
|
+
deliveries?: Record<string, unknown>;
|
|
123
|
+
}) => Promise<unknown>;
|
|
124
|
+
/** GET /api/v6/pay/a2a/p/{paymentId} — Buyer 拉取付款详情, PUBLIC */
|
|
125
|
+
detail: (paymentId: string) => Promise<unknown>;
|
|
126
|
+
/** POST /api/v6/pay/a2a/p/{paymentId}/credential — Buyer 提交 EIP-3009 签名凭证, PUBLIC */
|
|
127
|
+
submit: (paymentId: string, body: Record<string, unknown>) => Promise<unknown>;
|
|
128
|
+
/** GET /api/v6/pay/a2a/p/{paymentId}/status — 查询支付状态, PUBLIC */
|
|
129
|
+
status: (paymentId: string) => Promise<unknown>;
|
|
130
|
+
/** GET /api/v6/pay/x402/supported — 支持的网络/代币/scheme */
|
|
131
|
+
supported: (auth: Auth) => Promise<unknown>;
|
|
132
|
+
/** POST /api/v6/pay/x402/verify — 验签 */
|
|
133
|
+
verify: (auth: Auth, body: Record<string, unknown>) => Promise<unknown>;
|
|
134
|
+
/** POST /api/v6/pay/x402/settle — 上链结算 */
|
|
135
|
+
settle: (auth: Auth, body: Record<string, unknown>) => Promise<unknown>;
|
|
136
|
+
/** GET /api/v6/pay/x402/settle/status?txHash= — 轮询结算状态 */
|
|
137
|
+
settleStatus: (auth: Auth, txHash: string) => Promise<unknown>;
|
|
138
|
+
};
|
|
139
|
+
export declare const tradeApi: {
|
|
140
|
+
/** GET /api/v6/dex/aggregator/supported/chain?chainIndex= — 返回 chainIndex/chainName/dexTokenApproveAddress */
|
|
141
|
+
supportedChain: (auth: Auth, chainIndex?: string) => Promise<unknown>;
|
|
142
|
+
allTokens: (auth: Auth, chainIndex: string) => Promise<unknown>;
|
|
143
|
+
liquidity: (auth: Auth, chainIndex: string) => Promise<unknown>;
|
|
144
|
+
approveTransaction: (auth: Auth, chainIndex: string, tokenContractAddress: string, approveAmount: string) => Promise<unknown>;
|
|
145
|
+
quote: (auth: Auth, params: Record<string, string>) => Promise<unknown>;
|
|
146
|
+
swap: (auth: Auth, params: Record<string, string>) => Promise<unknown>;
|
|
147
|
+
swapInstruction: (auth: Auth, params: Record<string, string>) => Promise<unknown>;
|
|
148
|
+
swapHistory: (auth: Auth, chainIndex: string, txHash: string, isFromMyProject?: boolean) => Promise<unknown>;
|
|
149
|
+
};
|
|
150
|
+
export declare const intentApi: {
|
|
151
|
+
/** POST /api/v6/dex/aggregator/intent/create-order — 创建意图订单, 返回 orderUid */
|
|
152
|
+
createOrder: (auth: Auth, body: Record<string, unknown>) => Promise<unknown>;
|
|
153
|
+
/** GET /api/v6/dex/aggregator/intent/order-list?userWalletAddress=&orderUid=&cursor=&limit= — 订单列表 */
|
|
154
|
+
orderList: (auth: Auth, params: {
|
|
155
|
+
userWalletAddress?: string;
|
|
156
|
+
orderUid?: string;
|
|
157
|
+
cursor?: string;
|
|
158
|
+
limit?: number;
|
|
159
|
+
}) => Promise<unknown>;
|
|
160
|
+
/** GET /api/v6/dex/aggregator/intent/order-status?orderUid= — 查订单状态 */
|
|
161
|
+
orderStatus: (auth: Auth, orderUid: string) => Promise<unknown>;
|
|
162
|
+
/** POST /api/v6/dex/aggregator/intent/cancel-signdata — 获取取消签名数据 */
|
|
163
|
+
cancelSignData: (auth: Auth, userWalletAddress: string, orderUid: string) => Promise<unknown>;
|
|
164
|
+
/** POST /api/v6/dex/aggregator/intent/cancel-order — 取消订单 */
|
|
165
|
+
cancelOrder: (auth: Auth, userWalletAddress: string, orderUid: string, signature: string) => Promise<unknown>;
|
|
166
|
+
/** GET /api/v6/dex/aggregator/intent/auction-info?auctionId=&txHash= — 查拍卖结果 */
|
|
167
|
+
auctionInfo: (auth: Auth, params: {
|
|
168
|
+
auctionId?: string;
|
|
169
|
+
txHash?: string;
|
|
170
|
+
}) => Promise<unknown>;
|
|
171
|
+
};
|
|
172
|
+
export declare const marketApi: {
|
|
173
|
+
/** GET /api/v6/dex/market/supported/chain?chainIndex= */
|
|
174
|
+
supportedChain: (auth: Auth, chainIndex?: string) => Promise<unknown>;
|
|
175
|
+
/** POST /api/v6/dex/market/price — body: [{chainIndex, tokenContractAddress}] */
|
|
176
|
+
price: (auth: Auth, body: Array<{
|
|
177
|
+
chainIndex: string;
|
|
178
|
+
tokenContractAddress: string;
|
|
179
|
+
}>) => Promise<unknown>;
|
|
180
|
+
/** GET /api/v6/dex/market/candles?chainIndex=&tokenContractAddress=&bar=&after=&before=&limit= */
|
|
181
|
+
candles: (auth: Auth, params: {
|
|
182
|
+
chainIndex: string;
|
|
183
|
+
tokenContractAddress: string;
|
|
184
|
+
bar?: string;
|
|
185
|
+
after?: string;
|
|
186
|
+
before?: string;
|
|
187
|
+
limit?: string;
|
|
188
|
+
}) => Promise<unknown>;
|
|
189
|
+
/** GET /api/v6/dex/market/historical-candles?chainIndex=&tokenContractAddress=&bar=&after=&before=&limit= */
|
|
190
|
+
historicalCandles: (auth: Auth, params: {
|
|
191
|
+
chainIndex: string;
|
|
192
|
+
tokenContractAddress: string;
|
|
193
|
+
bar?: string;
|
|
194
|
+
after?: string;
|
|
195
|
+
before?: string;
|
|
196
|
+
limit?: string;
|
|
197
|
+
}) => Promise<unknown>;
|
|
198
|
+
/** POST /api/v6/dex/index/current-price — body: [{chainIndex, tokenContractAddress}] */
|
|
199
|
+
indexCurrentPrice: (auth: Auth, body: Array<{
|
|
200
|
+
chainIndex: string;
|
|
201
|
+
tokenContractAddress: string;
|
|
202
|
+
}>) => Promise<unknown>;
|
|
203
|
+
/** GET /api/v6/dex/index/historical-price?chainIndex=&tokenContractAddress=&limit=&cursor=&begin=&end=&period= */
|
|
204
|
+
indexHistoricalPrice: (auth: Auth, params: {
|
|
205
|
+
chainIndex: string;
|
|
206
|
+
tokenContractAddress?: string;
|
|
207
|
+
limit?: string;
|
|
208
|
+
cursor?: string;
|
|
209
|
+
begin?: string;
|
|
210
|
+
end?: string;
|
|
211
|
+
period?: string;
|
|
212
|
+
}) => Promise<unknown>;
|
|
213
|
+
/** GET /api/v6/dex/market/token/search?chains=&search=&cursor=&limit= — 搜索代币 */
|
|
214
|
+
searchToken: (auth: Auth, chains: string, search: string, cursor?: string, limit?: string) => Promise<unknown>;
|
|
215
|
+
/** POST /api/v6/dex/market/token/basic-info — body: [{chainIndex, tokenContractAddress}] */
|
|
216
|
+
tokenBasicInfo: (auth: Auth, body: Array<{
|
|
217
|
+
chainIndex: string;
|
|
218
|
+
tokenContractAddress: string;
|
|
219
|
+
}>) => Promise<unknown>;
|
|
220
|
+
/** GET /api/v6/dex/market/token/top-liquidity?chainIndex=&tokenContractAddress= — 流动性池 */
|
|
221
|
+
tokenTopLiquidity: (auth: Auth, chainIndex: string, tokenContractAddress: string) => Promise<unknown>;
|
|
222
|
+
/** POST /api/v6/dex/market/price-info — 批量交易信息, body: [{chainIndex, tokenContractAddress}], max 100 */
|
|
223
|
+
priceInfo: (auth: Auth, body: Array<{
|
|
224
|
+
chainIndex: string;
|
|
225
|
+
tokenContractAddress: string;
|
|
226
|
+
}>) => Promise<unknown>;
|
|
227
|
+
/** GET /api/v6/dex/market/token/advanced-info?chainIndex=&tokenContractAddress= — 代币安全分析(貔貅/开发者/狙击手) */
|
|
228
|
+
tokenAdvancedInfo: (auth: Auth, chainIndex: string, tokenContractAddress: string) => Promise<unknown>;
|
|
229
|
+
/** GET /api/v6/dex/market/token/hot-token?rankingType=&chainIndex=&rankBy=... — 热门代币(最多100) */
|
|
230
|
+
tokenHot: (auth: Auth, params: Record<string, string | number | boolean | undefined>) => Promise<unknown>;
|
|
231
|
+
/** GET /api/v6/dex/market/token/holder?chainIndex=&tokenContractAddress=&tagFilter=&cursor=&limit= — 前100持有人 */
|
|
232
|
+
tokenHolder: (auth: Auth, params: {
|
|
233
|
+
chainIndex: string;
|
|
234
|
+
tokenContractAddress: string;
|
|
235
|
+
tagFilter?: string;
|
|
236
|
+
cursor?: string;
|
|
237
|
+
limit?: string;
|
|
238
|
+
}) => Promise<unknown>;
|
|
239
|
+
/** GET /api/v6/dex/market/token/cluster/supported/chain — 聚类支持链 */
|
|
240
|
+
tokenClusterSupportedChain: (auth: Auth) => Promise<unknown>;
|
|
241
|
+
/** GET /api/v6/dex/market/token/cluster/overview?chainIndex=&tokenContractAddress= — 持仓集中度 */
|
|
242
|
+
tokenClusterOverview: (auth: Auth, chainIndex: string, tokenContractAddress: string) => Promise<unknown>;
|
|
243
|
+
/** GET /api/v6/dex/market/token/cluster/list?chainIndex=&tokenContractAddress= — 聚类列表(top100集群) */
|
|
244
|
+
tokenClusterList: (auth: Auth, chainIndex: string, tokenContractAddress: string) => Promise<unknown>;
|
|
245
|
+
/** GET /api/v6/dex/market/token/cluster/top-holders?chainIndex=&tokenContractAddress=&rangeFilter= — 前10/50/100持仓 */
|
|
246
|
+
tokenClusterTopHolders: (auth: Auth, chainIndex: string, tokenContractAddress: string, rangeFilter: string) => Promise<unknown>;
|
|
247
|
+
/** GET /api/v6/dex/market/token/top-trader?chainIndex=&tokenContractAddress=&tagFilter=&cursor=&limit= — 前100盈利地址 */
|
|
248
|
+
tokenTopTrader: (auth: Auth, params: {
|
|
249
|
+
chainIndex: string;
|
|
250
|
+
tokenContractAddress: string;
|
|
251
|
+
tagFilter?: string;
|
|
252
|
+
cursor?: string;
|
|
253
|
+
limit?: string;
|
|
254
|
+
}) => Promise<unknown>;
|
|
255
|
+
/** GET /api/v6/dex/market/signal/supported/chain — 信号支持链 */
|
|
256
|
+
signalSupportedChain: (auth: Auth) => Promise<unknown>;
|
|
257
|
+
/** POST /api/v6/dex/market/signal/list — 获取信号 */
|
|
258
|
+
signalList: (auth: Auth, body: Record<string, unknown>) => Promise<unknown>;
|
|
259
|
+
/** GET /api/v6/dex/market/leaderboard/supported/chain — 聪明钱榜单支持链 */
|
|
260
|
+
leaderboardSupportedChain: (auth: Auth) => Promise<unknown>;
|
|
261
|
+
/** GET /api/v6/dex/market/leaderboard/list?chainIndex=&timeFrame=&sortBy=&walletType=... — 聪明钱榜单 */
|
|
262
|
+
leaderboardList: (auth: Auth, params: Record<string, string>) => Promise<unknown>;
|
|
263
|
+
/** GET /api/v6/dex/market/memepump/supported/chainsProtocol — 支持的链+协议 */
|
|
264
|
+
memepumpSupported: (auth: Auth) => Promise<unknown>;
|
|
265
|
+
/** GET /api/v6/dex/market/memepump/tokenList?chainIndex=&stage=&... — 代币列表(最多30) */
|
|
266
|
+
memepumpTokenList: (auth: Auth, params: Record<string, string | boolean | undefined>) => Promise<unknown>;
|
|
267
|
+
/** GET /api/v6/dex/market/memepump/tokenDetails?chainIndex=&tokenContractAddress=&walletAddress= */
|
|
268
|
+
memepumpTokenDetails: (auth: Auth, chainIndex: string, tokenContractAddress: string, walletAddress?: string) => Promise<unknown>;
|
|
269
|
+
/** GET /api/v6/dex/market/memepump/tokenDevInfo?chainIndex=&tokenContractAddress= */
|
|
270
|
+
memepumpTokenDevInfo: (auth: Auth, chainIndex: string, tokenContractAddress: string) => Promise<unknown>;
|
|
271
|
+
/** GET /api/v6/dex/market/memepump/similarToken?chainIndex=&tokenContractAddress= */
|
|
272
|
+
memepumpSimilarToken: (auth: Auth, chainIndex: string, tokenContractAddress: string) => Promise<unknown>;
|
|
273
|
+
/** GET /api/v6/dex/market/memepump/tokenBundleInfo?chainIndex=&tokenContractAddress= */
|
|
274
|
+
memepumpBundleInfo: (auth: Auth, chainIndex: string, tokenContractAddress: string) => Promise<unknown>;
|
|
275
|
+
/** GET /api/v6/dex/market/memepump/apedWallet?chainIndex=&tokenContractAddress=&walletAddress= */
|
|
276
|
+
memepumpApedWallet: (auth: Auth, chainIndex: string, tokenContractAddress: string, walletAddress?: string) => Promise<unknown>;
|
|
277
|
+
/** GET /api/v6/dex/market/portfolio/supported/chain */
|
|
278
|
+
portfolioSupportedChain: (auth: Auth) => Promise<unknown>;
|
|
279
|
+
/** GET /api/v6/dex/market/portfolio/overview?chainIndex=&walletAddress=&timeFrame= */
|
|
280
|
+
portfolioOverview: (auth: Auth, chainIndex: string, walletAddress: string, timeFrame: string) => Promise<unknown>;
|
|
281
|
+
/** GET /api/v6/dex/market/portfolio/recent-pnl?chainIndex=&walletAddress=&cursor=&limit= */
|
|
282
|
+
portfolioRecentPnl: (auth: Auth, params: {
|
|
283
|
+
chainIndex: string;
|
|
284
|
+
walletAddress: string;
|
|
285
|
+
cursor?: string;
|
|
286
|
+
limit?: string;
|
|
287
|
+
}) => Promise<unknown>;
|
|
288
|
+
/** GET /api/v6/dex/market/portfolio/token/latest-pnl?chainIndex=&walletAddress=&tokenContractAddress= */
|
|
289
|
+
portfolioTokenLatestPnl: (auth: Auth, chainIndex: string, walletAddress: string, tokenContractAddress: string) => Promise<unknown>;
|
|
290
|
+
/** GET /api/v6/dex/market/portfolio/dex-history?chainIndex=&walletAddress=&begin=&end=&... */
|
|
291
|
+
portfolioDexHistory: (auth: Auth, params: {
|
|
292
|
+
chainIndex: string;
|
|
293
|
+
walletAddress: string;
|
|
294
|
+
begin: string;
|
|
295
|
+
end: string;
|
|
296
|
+
tokenContractAddress?: string;
|
|
297
|
+
type?: string;
|
|
298
|
+
cursor?: string;
|
|
299
|
+
limit?: string;
|
|
300
|
+
}) => Promise<unknown>;
|
|
301
|
+
/** GET /api/v6/dex/market/address-tracker/trades?trackerType=&walletAddress=&tradeType=... */
|
|
302
|
+
addressTrackerTrades: (auth: Auth, params: {
|
|
303
|
+
trackerType: string;
|
|
304
|
+
walletAddress?: string;
|
|
305
|
+
tradeType?: string;
|
|
306
|
+
chainIndex?: string;
|
|
307
|
+
minVolume?: string;
|
|
308
|
+
maxVolume?: string;
|
|
309
|
+
minHolders?: string;
|
|
310
|
+
minMarketCap?: string;
|
|
311
|
+
maxMarketCap?: string;
|
|
312
|
+
minLiquidity?: string;
|
|
313
|
+
maxLiquidity?: string;
|
|
314
|
+
}) => Promise<unknown>;
|
|
315
|
+
/** GET /api/v6/dex/market/social/news/latest */
|
|
316
|
+
socialNewsLatest: (auth: Auth, params: Record<string, string>) => Promise<unknown>;
|
|
317
|
+
/** GET /api/v6/dex/market/social/news/by-symbol */
|
|
318
|
+
socialNewsBySymbol: (auth: Auth, params: Record<string, string>) => Promise<unknown>;
|
|
319
|
+
/** GET /api/v6/dex/market/social/news/search */
|
|
320
|
+
socialNewsSearch: (auth: Auth, params: Record<string, string>) => Promise<unknown>;
|
|
321
|
+
/** GET /api/v6/dex/market/social/news/detail?articleId= */
|
|
322
|
+
socialNewsDetail: (auth: Auth, articleId: string, language?: string) => Promise<unknown>;
|
|
323
|
+
/** GET /api/v6/dex/market/social/news/platforms */
|
|
324
|
+
socialNewsPlatforms: (auth: Auth) => Promise<unknown>;
|
|
325
|
+
/** GET /api/v6/dex/market/social/sentiment/symbol?tokenSymbols=&timeFrame=&trendPoints= */
|
|
326
|
+
socialSentimentSymbol: (auth: Auth, params: Record<string, string>) => Promise<unknown>;
|
|
327
|
+
/** GET /api/v6/dex/market/social/sentiment/ranking?timeFrame=&sortBy=&limit= */
|
|
328
|
+
socialSentimentRanking: (auth: Auth, params: Record<string, string>) => Promise<unknown>;
|
|
329
|
+
/** GET /api/v6/dex/market/social/vibe/timeline?chainIndex=&tokenAddress=&timeFrame= */
|
|
330
|
+
socialVibeTimeline: (auth: Auth, params: Record<string, string>) => Promise<unknown>;
|
|
331
|
+
/** GET /api/v6/dex/market/social/vibe/top-kols?chainIndex=&tokenAddress=&sortBy=&timeFrame=&limit= */
|
|
332
|
+
socialVibeTopKols: (auth: Auth, params: Record<string, string>) => Promise<unknown>;
|
|
333
|
+
/** GET /api/v6/dex/market/trades?chainIndex=&tokenContractAddress=&after=&limit=&tagFilter=&walletAddressFilter= */
|
|
334
|
+
trades: (auth: Auth, params: {
|
|
335
|
+
chainIndex: string;
|
|
336
|
+
tokenContractAddress: string;
|
|
337
|
+
after?: string;
|
|
338
|
+
limit?: string;
|
|
339
|
+
tagFilter?: string;
|
|
340
|
+
walletAddressFilter?: string;
|
|
341
|
+
}) => Promise<unknown>;
|
|
342
|
+
};
|
|
343
|
+
//# sourceMappingURL=onchainos.d.ts.map
|