@nadohq/client 0.1.0-alpha.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/README.md +3 -0
- package/dist/apis/base.cjs +66 -0
- package/dist/apis/base.cjs.map +1 -0
- package/dist/apis/base.d.cts +23 -0
- package/dist/apis/base.d.ts +23 -0
- package/dist/apis/base.js +41 -0
- package/dist/apis/base.js.map +1 -0
- package/dist/apis/market/MarketExecuteAPI.cjs +169 -0
- package/dist/apis/market/MarketExecuteAPI.cjs.map +1 -0
- package/dist/apis/market/MarketExecuteAPI.d.cts +57 -0
- package/dist/apis/market/MarketExecuteAPI.d.ts +57 -0
- package/dist/apis/market/MarketExecuteAPI.js +144 -0
- package/dist/apis/market/MarketExecuteAPI.js.map +1 -0
- package/dist/apis/market/MarketQueryAPI.cjs +191 -0
- package/dist/apis/market/MarketQueryAPI.cjs.map +1 -0
- package/dist/apis/market/MarketQueryAPI.d.cts +127 -0
- package/dist/apis/market/MarketQueryAPI.d.ts +127 -0
- package/dist/apis/market/MarketQueryAPI.js +166 -0
- package/dist/apis/market/MarketQueryAPI.js.map +1 -0
- package/dist/apis/market/index.cjs +38 -0
- package/dist/apis/market/index.cjs.map +1 -0
- package/dist/apis/market/index.d.cts +18 -0
- package/dist/apis/market/index.d.ts +18 -0
- package/dist/apis/market/index.js +11 -0
- package/dist/apis/market/index.js.map +1 -0
- package/dist/apis/market/types.cjs +19 -0
- package/dist/apis/market/types.cjs.map +1 -0
- package/dist/apis/market/types.d.cts +26 -0
- package/dist/apis/market/types.d.ts +26 -0
- package/dist/apis/market/types.js +1 -0
- package/dist/apis/market/types.js.map +1 -0
- package/dist/apis/perp/PerpExecuteAPI.cjs +36 -0
- package/dist/apis/perp/PerpExecuteAPI.cjs.map +1 -0
- package/dist/apis/perp/PerpExecuteAPI.d.cts +13 -0
- package/dist/apis/perp/PerpExecuteAPI.d.ts +13 -0
- package/dist/apis/perp/PerpExecuteAPI.js +11 -0
- package/dist/apis/perp/PerpExecuteAPI.js.map +1 -0
- package/dist/apis/perp/PerpQueryAPI.cjs +47 -0
- package/dist/apis/perp/PerpQueryAPI.cjs.map +1 -0
- package/dist/apis/perp/PerpQueryAPI.d.cts +23 -0
- package/dist/apis/perp/PerpQueryAPI.d.ts +23 -0
- package/dist/apis/perp/PerpQueryAPI.js +22 -0
- package/dist/apis/perp/PerpQueryAPI.js.map +1 -0
- package/dist/apis/perp/index.cjs +35 -0
- package/dist/apis/perp/index.cjs.map +1 -0
- package/dist/apis/perp/index.d.cts +16 -0
- package/dist/apis/perp/index.d.ts +16 -0
- package/dist/apis/perp/index.js +10 -0
- package/dist/apis/perp/index.js.map +1 -0
- package/dist/apis/spot/BaseSpotAPI.cjs +55 -0
- package/dist/apis/spot/BaseSpotAPI.cjs.map +1 -0
- package/dist/apis/spot/BaseSpotAPI.d.cts +19 -0
- package/dist/apis/spot/BaseSpotAPI.d.ts +19 -0
- package/dist/apis/spot/BaseSpotAPI.js +30 -0
- package/dist/apis/spot/BaseSpotAPI.js.map +1 -0
- package/dist/apis/spot/SpotExecuteAPI.cjs +108 -0
- package/dist/apis/spot/SpotExecuteAPI.cjs.map +1 -0
- package/dist/apis/spot/SpotExecuteAPI.d.cts +28 -0
- package/dist/apis/spot/SpotExecuteAPI.d.ts +28 -0
- package/dist/apis/spot/SpotExecuteAPI.js +88 -0
- package/dist/apis/spot/SpotExecuteAPI.js.map +1 -0
- package/dist/apis/spot/SpotQueryAPI.cjs +74 -0
- package/dist/apis/spot/SpotQueryAPI.cjs.map +1 -0
- package/dist/apis/spot/SpotQueryAPI.d.cts +35 -0
- package/dist/apis/spot/SpotQueryAPI.d.ts +35 -0
- package/dist/apis/spot/SpotQueryAPI.js +49 -0
- package/dist/apis/spot/SpotQueryAPI.js.map +1 -0
- package/dist/apis/spot/index.cjs +38 -0
- package/dist/apis/spot/index.cjs.map +1 -0
- package/dist/apis/spot/index.d.cts +23 -0
- package/dist/apis/spot/index.d.ts +23 -0
- package/dist/apis/spot/index.js +11 -0
- package/dist/apis/spot/index.js.map +1 -0
- package/dist/apis/spot/types.cjs +19 -0
- package/dist/apis/spot/types.cjs.map +1 -0
- package/dist/apis/spot/types.d.cts +23 -0
- package/dist/apis/spot/types.d.ts +23 -0
- package/dist/apis/spot/types.js +1 -0
- package/dist/apis/spot/types.js.map +1 -0
- package/dist/apis/subaccount/SubaccountExecuteAPI.cjs +59 -0
- package/dist/apis/subaccount/SubaccountExecuteAPI.cjs.map +1 -0
- package/dist/apis/subaccount/SubaccountExecuteAPI.d.cts +26 -0
- package/dist/apis/subaccount/SubaccountExecuteAPI.d.ts +26 -0
- package/dist/apis/subaccount/SubaccountExecuteAPI.js +34 -0
- package/dist/apis/subaccount/SubaccountExecuteAPI.js.map +1 -0
- package/dist/apis/subaccount/SubaccountQueryAPI.cjs +84 -0
- package/dist/apis/subaccount/SubaccountQueryAPI.cjs.map +1 -0
- package/dist/apis/subaccount/SubaccountQueryAPI.d.cts +51 -0
- package/dist/apis/subaccount/SubaccountQueryAPI.d.ts +51 -0
- package/dist/apis/subaccount/SubaccountQueryAPI.js +61 -0
- package/dist/apis/subaccount/SubaccountQueryAPI.js.map +1 -0
- package/dist/apis/subaccount/index.cjs +68 -0
- package/dist/apis/subaccount/index.cjs.map +1 -0
- package/dist/apis/subaccount/index.d.cts +27 -0
- package/dist/apis/subaccount/index.d.ts +27 -0
- package/dist/apis/subaccount/index.js +41 -0
- package/dist/apis/subaccount/index.js.map +1 -0
- package/dist/apis/subaccount/types.cjs +19 -0
- package/dist/apis/subaccount/types.cjs.map +1 -0
- package/dist/apis/subaccount/types.d.cts +9 -0
- package/dist/apis/subaccount/types.d.ts +9 -0
- package/dist/apis/subaccount/types.js +1 -0
- package/dist/apis/subaccount/types.js.map +1 -0
- package/dist/apis/types.cjs +19 -0
- package/dist/apis/types.cjs.map +1 -0
- package/dist/apis/types.d.cts +9 -0
- package/dist/apis/types.d.ts +9 -0
- package/dist/apis/types.js +1 -0
- package/dist/apis/types.js.map +1 -0
- package/dist/apis/ws/WebSocketExecuteAPI.cjs +73 -0
- package/dist/apis/ws/WebSocketExecuteAPI.cjs.map +1 -0
- package/dist/apis/ws/WebSocketExecuteAPI.d.cts +48 -0
- package/dist/apis/ws/WebSocketExecuteAPI.d.ts +48 -0
- package/dist/apis/ws/WebSocketExecuteAPI.js +48 -0
- package/dist/apis/ws/WebSocketExecuteAPI.js.map +1 -0
- package/dist/apis/ws/WebSocketQueryAPI.cjs +42 -0
- package/dist/apis/ws/WebSocketQueryAPI.cjs.map +1 -0
- package/dist/apis/ws/WebSocketQueryAPI.d.cts +23 -0
- package/dist/apis/ws/WebSocketQueryAPI.d.ts +23 -0
- package/dist/apis/ws/WebSocketQueryAPI.js +17 -0
- package/dist/apis/ws/WebSocketQueryAPI.js.map +1 -0
- package/dist/apis/ws/WebSocketSubscriptionAPI.cjs +61 -0
- package/dist/apis/ws/WebSocketSubscriptionAPI.cjs.map +1 -0
- package/dist/apis/ws/WebSocketSubscriptionAPI.d.cts +37 -0
- package/dist/apis/ws/WebSocketSubscriptionAPI.d.ts +37 -0
- package/dist/apis/ws/WebSocketSubscriptionAPI.js +36 -0
- package/dist/apis/ws/WebSocketSubscriptionAPI.js.map +1 -0
- package/dist/apis/ws/index.cjs +42 -0
- package/dist/apis/ws/index.cjs.map +1 -0
- package/dist/apis/ws/index.d.cts +22 -0
- package/dist/apis/ws/index.d.ts +22 -0
- package/dist/apis/ws/index.js +17 -0
- package/dist/apis/ws/index.js.map +1 -0
- package/dist/client.cjs +79 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +57 -0
- package/dist/client.d.ts +57 -0
- package/dist/client.js +54 -0
- package/dist/client.js.map +1 -0
- package/dist/context.cjs +125 -0
- package/dist/context.cjs.map +1 -0
- package/dist/context.d.cts +42 -0
- package/dist/context.d.ts +42 -0
- package/dist/context.js +109 -0
- package/dist/context.js.map +1 -0
- package/dist/createNadoClient.cjs +35 -0
- package/dist/createNadoClient.cjs.map +1 -0
- package/dist/createNadoClient.d.cts +42 -0
- package/dist/createNadoClient.d.ts +42 -0
- package/dist/createNadoClient.js +12 -0
- package/dist/createNadoClient.js.map +1 -0
- package/dist/index.cjs +47 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/package.json +54 -0
- package/src/apis/base.ts +52 -0
- package/src/apis/market/MarketExecuteAPI.ts +169 -0
- package/src/apis/market/MarketQueryAPI.ts +214 -0
- package/src/apis/market/index.ts +7 -0
- package/src/apis/market/types.ts +58 -0
- package/src/apis/perp/PerpExecuteAPI.ts +8 -0
- package/src/apis/perp/PerpQueryAPI.ts +25 -0
- package/src/apis/perp/index.ts +5 -0
- package/src/apis/spot/BaseSpotAPI.ts +30 -0
- package/src/apis/spot/SpotExecuteAPI.ts +102 -0
- package/src/apis/spot/SpotQueryAPI.ts +53 -0
- package/src/apis/spot/index.ts +10 -0
- package/src/apis/spot/types.ts +44 -0
- package/src/apis/subaccount/SubaccountExecuteAPI.ts +32 -0
- package/src/apis/subaccount/SubaccountQueryAPI.ts +78 -0
- package/src/apis/subaccount/index.ts +44 -0
- package/src/apis/subaccount/types.ts +16 -0
- package/src/apis/types.ts +11 -0
- package/src/apis/ws/WebSocketExecuteAPI.ts +70 -0
- package/src/apis/ws/WebSocketQueryAPI.ts +25 -0
- package/src/apis/ws/WebSocketSubscriptionAPI.ts +62 -0
- package/src/apis/ws/index.ts +21 -0
- package/src/client.ts +67 -0
- package/src/context.ts +165 -0
- package/src/createNadoClient.ts +20 -0
- package/src/index.ts +15 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/apis/market/MarketQueryAPI.ts
|
|
21
|
+
var MarketQueryAPI_exports = {};
|
|
22
|
+
__export(MarketQueryAPI_exports, {
|
|
23
|
+
MarketQueryAPI: () => MarketQueryAPI
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(MarketQueryAPI_exports);
|
|
26
|
+
var import_contracts = require("@nadohq/contracts");
|
|
27
|
+
var import_base = require("../base.cjs");
|
|
28
|
+
var MarketQueryAPI = class extends import_base.BaseNadoAPI {
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves all market states from the on-chain contracts
|
|
31
|
+
*/
|
|
32
|
+
async getAllMarkets() {
|
|
33
|
+
return (0, import_contracts.getAllMarkets)(this.context.contracts);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves all market states from the offchain engine
|
|
37
|
+
*/
|
|
38
|
+
async getAllEngineMarkets() {
|
|
39
|
+
return this.context.engineClient.getAllMarkets();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get all edge engine markets
|
|
43
|
+
*/
|
|
44
|
+
async getEdgeAllEngineMarkets() {
|
|
45
|
+
return this.context.engineClient.getEdgeAllMarkets();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves all spread health groups
|
|
49
|
+
*/
|
|
50
|
+
async getHealthGroups() {
|
|
51
|
+
return this.context.engineClient.getHealthGroups();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Queries engine to determine if the order can be submitted within health requirements
|
|
55
|
+
*/
|
|
56
|
+
async validateOrderParams(params) {
|
|
57
|
+
return this.context.engineClient.validateOrderParams(params);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Queries the offchain engine to retrieve status of any open orders for the given subaccount
|
|
61
|
+
* @param params
|
|
62
|
+
*/
|
|
63
|
+
async getOpenSubaccountOrders(params) {
|
|
64
|
+
return this.context.engineClient.getSubaccountOrders(params);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Queries the offchain engine to retrieve status of any open orders for the given subaccount for multiple products
|
|
68
|
+
* @param params
|
|
69
|
+
*/
|
|
70
|
+
async getOpenSubaccountMultiProductOrders(params) {
|
|
71
|
+
return this.context.engineClient.getSubaccountMultiProductOrders(params);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Queries the offchain trigger service to list trigger orders. Requires a signature
|
|
75
|
+
* @param params
|
|
76
|
+
*/
|
|
77
|
+
async getTriggerOrders(params) {
|
|
78
|
+
return this.context.triggerClient.listOrders({
|
|
79
|
+
...params,
|
|
80
|
+
chainId: this.getWalletClientChainIdIfNeeded(params),
|
|
81
|
+
verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress()
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Queries indexer to fetch historical orders
|
|
86
|
+
*
|
|
87
|
+
* @param params
|
|
88
|
+
*/
|
|
89
|
+
async getHistoricalOrders(params) {
|
|
90
|
+
return this.context.indexerClient.getOrders(params);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Queries engine to determine maximum order size
|
|
94
|
+
* @param params
|
|
95
|
+
*/
|
|
96
|
+
async getMaxOrderSize(params) {
|
|
97
|
+
return this.context.engineClient.getMaxOrderSize(params);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Retrieves liquidity per price tick from the engine. The engine will skip price levels that have no liquidity,
|
|
101
|
+
* so it is not guaranteed that the bids/asks are evenly spaced
|
|
102
|
+
*/
|
|
103
|
+
async getMarketLiquidity(params) {
|
|
104
|
+
return this.context.engineClient.getMarketLiquidity(params);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Historical candlesticks from the indexer, use getLatestMarketPrice for the latest orderbook prices
|
|
108
|
+
*
|
|
109
|
+
* @param params
|
|
110
|
+
*/
|
|
111
|
+
async getCandlesticks(params) {
|
|
112
|
+
return this.context.indexerClient.getCandlesticks(params);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Historical candlesticks from Edge, use getLatestMarketPrice for the latest orderbook prices
|
|
116
|
+
*
|
|
117
|
+
* @param params
|
|
118
|
+
*/
|
|
119
|
+
async getEdgeCandlesticks(params) {
|
|
120
|
+
return this.context.indexerClient.getEdgeCandlesticks(params);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Retrieves the latest off-chain orderbook price from the engine
|
|
124
|
+
*
|
|
125
|
+
* @param params
|
|
126
|
+
*/
|
|
127
|
+
async getLatestMarketPrice(params) {
|
|
128
|
+
return this.context.engineClient.getMarketPrice(params);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Retrieves the latest off-chain orderbook price from the engine for multiple markets
|
|
132
|
+
*
|
|
133
|
+
* @param params
|
|
134
|
+
*/
|
|
135
|
+
async getLatestMarketPrices(params) {
|
|
136
|
+
return this.context.engineClient.getMarketPrices(params);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Retrieves the latest funding rate for a perp product
|
|
140
|
+
*
|
|
141
|
+
* @param params
|
|
142
|
+
*/
|
|
143
|
+
async getFundingRate(params) {
|
|
144
|
+
return this.context.indexerClient.getFundingRate(params);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Retrieves the latest funding rate for multiple perp products
|
|
148
|
+
*
|
|
149
|
+
* @param params
|
|
150
|
+
*/
|
|
151
|
+
async getMultiProductFundingRates(params) {
|
|
152
|
+
return this.context.indexerClient.getMultiProductFundingRates(params);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Retrieves the historical snapshots for a product from the indexer
|
|
156
|
+
*
|
|
157
|
+
* @param params
|
|
158
|
+
*/
|
|
159
|
+
async getProductSnapshots(params) {
|
|
160
|
+
return this.context.indexerClient.getProductSnapshots(params);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Retrieves the historical snapshots for a market from the indexer
|
|
164
|
+
*
|
|
165
|
+
* @param params
|
|
166
|
+
*/
|
|
167
|
+
async getMarketSnapshots(params) {
|
|
168
|
+
return this.context.indexerClient.getMarketSnapshots(params);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Retrieves the historical snapshots for a market from Edge
|
|
172
|
+
*
|
|
173
|
+
* @param params
|
|
174
|
+
*/
|
|
175
|
+
async getEdgeMarketSnapshots(params) {
|
|
176
|
+
return this.context.indexerClient.getEdgeMarketSnapshots(params);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Retrieves the historical snapshots for multiple products from the indexer
|
|
180
|
+
*
|
|
181
|
+
* @param params
|
|
182
|
+
*/
|
|
183
|
+
async getMultiProductSnapshots(params) {
|
|
184
|
+
return this.context.indexerClient.getMultiProductSnapshots(params);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
188
|
+
0 && (module.exports = {
|
|
189
|
+
MarketQueryAPI
|
|
190
|
+
});
|
|
191
|
+
//# sourceMappingURL=MarketQueryAPI.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/apis/market/MarketQueryAPI.ts"],"sourcesContent":["import { getAllMarkets, GetAllMarketsResponse } from '@nadohq/contracts';\nimport {\n GetEngineMarketLiquidityParams,\n GetEngineMarketPriceParams,\n GetEngineMarketPricesParams,\n GetEngineMaxOrderSizeParams,\n GetEngineSubaccountOrdersParams,\n GetEngineSubaccountProductOrdersParams,\n ValidateEngineOrderParams,\n} from '@nadohq/engine-client';\nimport {\n GetIndexerCandlesticksParams,\n GetIndexerEdgeCandlesticksParams,\n GetIndexerEdgeMarketSnapshotsParams,\n GetIndexerFundingRateParams,\n GetIndexerMarketSnapshotsParams,\n GetIndexerMultiProductFundingRatesParams,\n GetIndexerMultiProductSnapshotsParams,\n GetIndexerOrdersParams,\n GetIndexerOrdersResponse,\n GetIndexerProductSnapshotsParams,\n} from '@nadohq/indexer-client';\nimport { BaseNadoAPI } from '../base';\nimport { GetTriggerOrdersParams } from './types';\n\nexport class MarketQueryAPI extends BaseNadoAPI {\n /**\n * Retrieves all market states from the on-chain contracts\n */\n async getAllMarkets(): Promise<GetAllMarketsResponse> {\n return getAllMarkets(this.context.contracts);\n }\n\n /**\n * Retrieves all market states from the offchain engine\n */\n async getAllEngineMarkets(): Promise<GetAllMarketsResponse> {\n return this.context.engineClient.getAllMarkets();\n }\n\n /**\n * Get all edge engine markets\n */\n async getEdgeAllEngineMarkets(): Promise<\n Record<number, GetAllMarketsResponse>\n > {\n return this.context.engineClient.getEdgeAllMarkets();\n }\n\n /**\n * Retrieves all spread health groups\n */\n async getHealthGroups() {\n return this.context.engineClient.getHealthGroups();\n }\n\n /**\n * Queries engine to determine if the order can be submitted within health requirements\n */\n async validateOrderParams(params: ValidateEngineOrderParams) {\n return this.context.engineClient.validateOrderParams(params);\n }\n\n /**\n * Queries the offchain engine to retrieve status of any open orders for the given subaccount\n * @param params\n */\n async getOpenSubaccountOrders(params: GetEngineSubaccountOrdersParams) {\n return this.context.engineClient.getSubaccountOrders(params);\n }\n\n /**\n * Queries the offchain engine to retrieve status of any open orders for the given subaccount for multiple products\n * @param params\n */\n async getOpenSubaccountMultiProductOrders(\n params: GetEngineSubaccountProductOrdersParams,\n ) {\n return this.context.engineClient.getSubaccountMultiProductOrders(params);\n }\n\n /**\n * Queries the offchain trigger service to list trigger orders. Requires a signature\n * @param params\n */\n async getTriggerOrders(params: GetTriggerOrdersParams) {\n return this.context.triggerClient.listOrders({\n ...params,\n chainId: this.getWalletClientChainIdIfNeeded(params),\n verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress(),\n });\n }\n\n /**\n * Queries indexer to fetch historical orders\n *\n * @param params\n */\n async getHistoricalOrders(\n params: GetIndexerOrdersParams,\n ): Promise<GetIndexerOrdersResponse> {\n return this.context.indexerClient.getOrders(params);\n }\n\n /**\n * Queries engine to determine maximum order size\n * @param params\n */\n async getMaxOrderSize(params: GetEngineMaxOrderSizeParams) {\n return this.context.engineClient.getMaxOrderSize(params);\n }\n\n /**\n * Retrieves liquidity per price tick from the engine. The engine will skip price levels that have no liquidity,\n * so it is not guaranteed that the bids/asks are evenly spaced\n */\n async getMarketLiquidity(params: GetEngineMarketLiquidityParams) {\n return this.context.engineClient.getMarketLiquidity(params);\n }\n\n /**\n * Historical candlesticks from the indexer, use getLatestMarketPrice for the latest orderbook prices\n *\n * @param params\n */\n async getCandlesticks(params: GetIndexerCandlesticksParams) {\n return this.context.indexerClient.getCandlesticks(params);\n }\n\n /**\n * Historical candlesticks from Edge, use getLatestMarketPrice for the latest orderbook prices\n *\n * @param params\n */\n async getEdgeCandlesticks(params: GetIndexerEdgeCandlesticksParams) {\n return this.context.indexerClient.getEdgeCandlesticks(params);\n }\n\n /**\n * Retrieves the latest off-chain orderbook price from the engine\n *\n * @param params\n */\n async getLatestMarketPrice(params: GetEngineMarketPriceParams) {\n return this.context.engineClient.getMarketPrice(params);\n }\n\n /**\n * Retrieves the latest off-chain orderbook price from the engine for multiple markets\n *\n * @param params\n */\n async getLatestMarketPrices(params: GetEngineMarketPricesParams) {\n return this.context.engineClient.getMarketPrices(params);\n }\n\n /**\n * Retrieves the latest funding rate for a perp product\n *\n * @param params\n */\n async getFundingRate(params: GetIndexerFundingRateParams) {\n return this.context.indexerClient.getFundingRate(params);\n }\n\n /**\n * Retrieves the latest funding rate for multiple perp products\n *\n * @param params\n */\n async getMultiProductFundingRates(\n params: GetIndexerMultiProductFundingRatesParams,\n ) {\n return this.context.indexerClient.getMultiProductFundingRates(params);\n }\n\n /**\n * Retrieves the historical snapshots for a product from the indexer\n *\n * @param params\n */\n async getProductSnapshots(params: GetIndexerProductSnapshotsParams) {\n return this.context.indexerClient.getProductSnapshots(params);\n }\n\n /**\n * Retrieves the historical snapshots for a market from the indexer\n *\n * @param params\n */\n async getMarketSnapshots(params: GetIndexerMarketSnapshotsParams) {\n return this.context.indexerClient.getMarketSnapshots(params);\n }\n\n /**\n * Retrieves the historical snapshots for a market from Edge\n *\n * @param params\n */\n async getEdgeMarketSnapshots(params: GetIndexerEdgeMarketSnapshotsParams) {\n return this.context.indexerClient.getEdgeMarketSnapshots(params);\n }\n\n /**\n * Retrieves the historical snapshots for multiple products from the indexer\n *\n * @param params\n */\n async getMultiProductSnapshots(\n params: GetIndexerMultiProductSnapshotsParams,\n ) {\n return this.context.indexerClient.getMultiProductSnapshots(params);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqD;AAsBrD,kBAA4B;AAGrB,IAAM,iBAAN,cAA6B,wBAAY;AAAA;AAAA;AAAA;AAAA,EAI9C,MAAM,gBAAgD;AACpD,eAAO,gCAAc,KAAK,QAAQ,SAAS;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,sBAAsD;AAC1D,WAAO,KAAK,QAAQ,aAAa,cAAc;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,0BAEJ;AACA,WAAO,KAAK,QAAQ,aAAa,kBAAkB;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,kBAAkB;AACtB,WAAO,KAAK,QAAQ,aAAa,gBAAgB;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,oBAAoB,QAAmC;AAC3D,WAAO,KAAK,QAAQ,aAAa,oBAAoB,MAAM;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,wBAAwB,QAAyC;AACrE,WAAO,KAAK,QAAQ,aAAa,oBAAoB,MAAM;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,oCACJ,QACA;AACA,WAAO,KAAK,QAAQ,aAAa,gCAAgC,MAAM;AAAA,EACzE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,iBAAiB,QAAgC;AACrD,WAAO,KAAK,QAAQ,cAAc,WAAW;AAAA,MAC3C,GAAG;AAAA,MACH,SAAS,KAAK,+BAA+B,MAAM;AAAA,MACnD,eAAe,OAAO,iBAAiB,KAAK,mBAAmB;AAAA,IACjE,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,oBACJ,QACmC;AACnC,WAAO,KAAK,QAAQ,cAAc,UAAU,MAAM;AAAA,EACpD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,gBAAgB,QAAqC;AACzD,WAAO,KAAK,QAAQ,aAAa,gBAAgB,MAAM;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,mBAAmB,QAAwC;AAC/D,WAAO,KAAK,QAAQ,aAAa,mBAAmB,MAAM;AAAA,EAC5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,gBAAgB,QAAsC;AAC1D,WAAO,KAAK,QAAQ,cAAc,gBAAgB,MAAM;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,oBAAoB,QAA0C;AAClE,WAAO,KAAK,QAAQ,cAAc,oBAAoB,MAAM;AAAA,EAC9D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,qBAAqB,QAAoC;AAC7D,WAAO,KAAK,QAAQ,aAAa,eAAe,MAAM;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,sBAAsB,QAAqC;AAC/D,WAAO,KAAK,QAAQ,aAAa,gBAAgB,MAAM;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,eAAe,QAAqC;AACxD,WAAO,KAAK,QAAQ,cAAc,eAAe,MAAM;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,4BACJ,QACA;AACA,WAAO,KAAK,QAAQ,cAAc,4BAA4B,MAAM;AAAA,EACtE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,oBAAoB,QAA0C;AAClE,WAAO,KAAK,QAAQ,cAAc,oBAAoB,MAAM;AAAA,EAC9D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,mBAAmB,QAAyC;AAChE,WAAO,KAAK,QAAQ,cAAc,mBAAmB,MAAM;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,uBAAuB,QAA6C;AACxE,WAAO,KAAK,QAAQ,cAAc,uBAAuB,MAAM;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,yBACJ,QACA;AACA,WAAO,KAAK,QAAQ,cAAc,yBAAyB,MAAM;AAAA,EACnE;AACF;","names":[]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as _nadohq_indexer_client from '@nadohq/indexer-client';
|
|
2
|
+
import { GetIndexerOrdersParams, GetIndexerOrdersResponse, GetIndexerCandlesticksParams, GetIndexerEdgeCandlesticksParams, GetIndexerFundingRateParams, GetIndexerMultiProductFundingRatesParams, GetIndexerProductSnapshotsParams, GetIndexerMarketSnapshotsParams, GetIndexerEdgeMarketSnapshotsParams, GetIndexerMultiProductSnapshotsParams } from '@nadohq/indexer-client';
|
|
3
|
+
import * as _nadohq_trigger_client from '@nadohq/trigger-client';
|
|
4
|
+
import * as _nadohq_engine_client from '@nadohq/engine-client';
|
|
5
|
+
import { ValidateEngineOrderParams, GetEngineSubaccountOrdersParams, GetEngineSubaccountProductOrdersParams, GetEngineMaxOrderSizeParams, GetEngineMarketLiquidityParams, GetEngineMarketPriceParams, GetEngineMarketPricesParams } from '@nadohq/engine-client';
|
|
6
|
+
import { GetAllMarketsResponse } from '@nadohq/contracts';
|
|
7
|
+
import { BaseNadoAPI } from '../base.cjs';
|
|
8
|
+
import { GetTriggerOrdersParams } from './types.cjs';
|
|
9
|
+
import '../../context.cjs';
|
|
10
|
+
import 'viem';
|
|
11
|
+
import '../types.cjs';
|
|
12
|
+
|
|
13
|
+
declare class MarketQueryAPI extends BaseNadoAPI {
|
|
14
|
+
/**
|
|
15
|
+
* Retrieves all market states from the on-chain contracts
|
|
16
|
+
*/
|
|
17
|
+
getAllMarkets(): Promise<GetAllMarketsResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves all market states from the offchain engine
|
|
20
|
+
*/
|
|
21
|
+
getAllEngineMarkets(): Promise<GetAllMarketsResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Get all edge engine markets
|
|
24
|
+
*/
|
|
25
|
+
getEdgeAllEngineMarkets(): Promise<Record<number, GetAllMarketsResponse>>;
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves all spread health groups
|
|
28
|
+
*/
|
|
29
|
+
getHealthGroups(): Promise<_nadohq_engine_client.GetEngineHealthGroupsResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Queries engine to determine if the order can be submitted within health requirements
|
|
32
|
+
*/
|
|
33
|
+
validateOrderParams(params: ValidateEngineOrderParams): Promise<_nadohq_engine_client.ValidateEngineOrderResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Queries the offchain engine to retrieve status of any open orders for the given subaccount
|
|
36
|
+
* @param params
|
|
37
|
+
*/
|
|
38
|
+
getOpenSubaccountOrders(params: GetEngineSubaccountOrdersParams): Promise<_nadohq_engine_client.EngineSubaccountOrders>;
|
|
39
|
+
/**
|
|
40
|
+
* Queries the offchain engine to retrieve status of any open orders for the given subaccount for multiple products
|
|
41
|
+
* @param params
|
|
42
|
+
*/
|
|
43
|
+
getOpenSubaccountMultiProductOrders(params: GetEngineSubaccountProductOrdersParams): Promise<_nadohq_engine_client.GetEngineSubaccountProductOrdersResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Queries the offchain trigger service to list trigger orders. Requires a signature
|
|
46
|
+
* @param params
|
|
47
|
+
*/
|
|
48
|
+
getTriggerOrders(params: GetTriggerOrdersParams): Promise<_nadohq_trigger_client.TriggerListOrdersResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Queries indexer to fetch historical orders
|
|
51
|
+
*
|
|
52
|
+
* @param params
|
|
53
|
+
*/
|
|
54
|
+
getHistoricalOrders(params: GetIndexerOrdersParams): Promise<GetIndexerOrdersResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Queries engine to determine maximum order size
|
|
57
|
+
* @param params
|
|
58
|
+
*/
|
|
59
|
+
getMaxOrderSize(params: GetEngineMaxOrderSizeParams): Promise<BigNumber>;
|
|
60
|
+
/**
|
|
61
|
+
* Retrieves liquidity per price tick from the engine. The engine will skip price levels that have no liquidity,
|
|
62
|
+
* so it is not guaranteed that the bids/asks are evenly spaced
|
|
63
|
+
*/
|
|
64
|
+
getMarketLiquidity(params: GetEngineMarketLiquidityParams): Promise<_nadohq_engine_client.GetEngineMarketLiquidityResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Historical candlesticks from the indexer, use getLatestMarketPrice for the latest orderbook prices
|
|
67
|
+
*
|
|
68
|
+
* @param params
|
|
69
|
+
*/
|
|
70
|
+
getCandlesticks(params: GetIndexerCandlesticksParams): Promise<_nadohq_indexer_client.GetIndexerCandlesticksResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Historical candlesticks from Edge, use getLatestMarketPrice for the latest orderbook prices
|
|
73
|
+
*
|
|
74
|
+
* @param params
|
|
75
|
+
*/
|
|
76
|
+
getEdgeCandlesticks(params: GetIndexerEdgeCandlesticksParams): Promise<_nadohq_indexer_client.GetIndexerCandlesticksResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Retrieves the latest off-chain orderbook price from the engine
|
|
79
|
+
*
|
|
80
|
+
* @param params
|
|
81
|
+
*/
|
|
82
|
+
getLatestMarketPrice(params: GetEngineMarketPriceParams): Promise<_nadohq_engine_client.EngineMarketPrice>;
|
|
83
|
+
/**
|
|
84
|
+
* Retrieves the latest off-chain orderbook price from the engine for multiple markets
|
|
85
|
+
*
|
|
86
|
+
* @param params
|
|
87
|
+
*/
|
|
88
|
+
getLatestMarketPrices(params: GetEngineMarketPricesParams): Promise<_nadohq_engine_client.GetEngineMarketPricesResponse>;
|
|
89
|
+
/**
|
|
90
|
+
* Retrieves the latest funding rate for a perp product
|
|
91
|
+
*
|
|
92
|
+
* @param params
|
|
93
|
+
*/
|
|
94
|
+
getFundingRate(params: GetIndexerFundingRateParams): Promise<_nadohq_indexer_client.IndexerFundingRate>;
|
|
95
|
+
/**
|
|
96
|
+
* Retrieves the latest funding rate for multiple perp products
|
|
97
|
+
*
|
|
98
|
+
* @param params
|
|
99
|
+
*/
|
|
100
|
+
getMultiProductFundingRates(params: GetIndexerMultiProductFundingRatesParams): Promise<_nadohq_indexer_client.GetIndexerMultiProductFundingRatesResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* Retrieves the historical snapshots for a product from the indexer
|
|
103
|
+
*
|
|
104
|
+
* @param params
|
|
105
|
+
*/
|
|
106
|
+
getProductSnapshots(params: GetIndexerProductSnapshotsParams): Promise<_nadohq_indexer_client.GetIndexerProductSnapshotsResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Retrieves the historical snapshots for a market from the indexer
|
|
109
|
+
*
|
|
110
|
+
* @param params
|
|
111
|
+
*/
|
|
112
|
+
getMarketSnapshots(params: GetIndexerMarketSnapshotsParams): Promise<_nadohq_indexer_client.GetIndexerMarketSnapshotsResponse>;
|
|
113
|
+
/**
|
|
114
|
+
* Retrieves the historical snapshots for a market from Edge
|
|
115
|
+
*
|
|
116
|
+
* @param params
|
|
117
|
+
*/
|
|
118
|
+
getEdgeMarketSnapshots(params: GetIndexerEdgeMarketSnapshotsParams): Promise<_nadohq_indexer_client.GetIndexerEdgeMarketSnapshotResponse>;
|
|
119
|
+
/**
|
|
120
|
+
* Retrieves the historical snapshots for multiple products from the indexer
|
|
121
|
+
*
|
|
122
|
+
* @param params
|
|
123
|
+
*/
|
|
124
|
+
getMultiProductSnapshots(params: GetIndexerMultiProductSnapshotsParams): Promise<_nadohq_indexer_client.GetIndexerMultiProductSnapshotsResponse>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { MarketQueryAPI };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as _nadohq_indexer_client from '@nadohq/indexer-client';
|
|
2
|
+
import { GetIndexerOrdersParams, GetIndexerOrdersResponse, GetIndexerCandlesticksParams, GetIndexerEdgeCandlesticksParams, GetIndexerFundingRateParams, GetIndexerMultiProductFundingRatesParams, GetIndexerProductSnapshotsParams, GetIndexerMarketSnapshotsParams, GetIndexerEdgeMarketSnapshotsParams, GetIndexerMultiProductSnapshotsParams } from '@nadohq/indexer-client';
|
|
3
|
+
import * as _nadohq_trigger_client from '@nadohq/trigger-client';
|
|
4
|
+
import * as _nadohq_engine_client from '@nadohq/engine-client';
|
|
5
|
+
import { ValidateEngineOrderParams, GetEngineSubaccountOrdersParams, GetEngineSubaccountProductOrdersParams, GetEngineMaxOrderSizeParams, GetEngineMarketLiquidityParams, GetEngineMarketPriceParams, GetEngineMarketPricesParams } from '@nadohq/engine-client';
|
|
6
|
+
import { GetAllMarketsResponse } from '@nadohq/contracts';
|
|
7
|
+
import { BaseNadoAPI } from '../base.js';
|
|
8
|
+
import { GetTriggerOrdersParams } from './types.js';
|
|
9
|
+
import '../../context.js';
|
|
10
|
+
import 'viem';
|
|
11
|
+
import '../types.js';
|
|
12
|
+
|
|
13
|
+
declare class MarketQueryAPI extends BaseNadoAPI {
|
|
14
|
+
/**
|
|
15
|
+
* Retrieves all market states from the on-chain contracts
|
|
16
|
+
*/
|
|
17
|
+
getAllMarkets(): Promise<GetAllMarketsResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves all market states from the offchain engine
|
|
20
|
+
*/
|
|
21
|
+
getAllEngineMarkets(): Promise<GetAllMarketsResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Get all edge engine markets
|
|
24
|
+
*/
|
|
25
|
+
getEdgeAllEngineMarkets(): Promise<Record<number, GetAllMarketsResponse>>;
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves all spread health groups
|
|
28
|
+
*/
|
|
29
|
+
getHealthGroups(): Promise<_nadohq_engine_client.GetEngineHealthGroupsResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Queries engine to determine if the order can be submitted within health requirements
|
|
32
|
+
*/
|
|
33
|
+
validateOrderParams(params: ValidateEngineOrderParams): Promise<_nadohq_engine_client.ValidateEngineOrderResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Queries the offchain engine to retrieve status of any open orders for the given subaccount
|
|
36
|
+
* @param params
|
|
37
|
+
*/
|
|
38
|
+
getOpenSubaccountOrders(params: GetEngineSubaccountOrdersParams): Promise<_nadohq_engine_client.EngineSubaccountOrders>;
|
|
39
|
+
/**
|
|
40
|
+
* Queries the offchain engine to retrieve status of any open orders for the given subaccount for multiple products
|
|
41
|
+
* @param params
|
|
42
|
+
*/
|
|
43
|
+
getOpenSubaccountMultiProductOrders(params: GetEngineSubaccountProductOrdersParams): Promise<_nadohq_engine_client.GetEngineSubaccountProductOrdersResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Queries the offchain trigger service to list trigger orders. Requires a signature
|
|
46
|
+
* @param params
|
|
47
|
+
*/
|
|
48
|
+
getTriggerOrders(params: GetTriggerOrdersParams): Promise<_nadohq_trigger_client.TriggerListOrdersResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Queries indexer to fetch historical orders
|
|
51
|
+
*
|
|
52
|
+
* @param params
|
|
53
|
+
*/
|
|
54
|
+
getHistoricalOrders(params: GetIndexerOrdersParams): Promise<GetIndexerOrdersResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Queries engine to determine maximum order size
|
|
57
|
+
* @param params
|
|
58
|
+
*/
|
|
59
|
+
getMaxOrderSize(params: GetEngineMaxOrderSizeParams): Promise<BigNumber>;
|
|
60
|
+
/**
|
|
61
|
+
* Retrieves liquidity per price tick from the engine. The engine will skip price levels that have no liquidity,
|
|
62
|
+
* so it is not guaranteed that the bids/asks are evenly spaced
|
|
63
|
+
*/
|
|
64
|
+
getMarketLiquidity(params: GetEngineMarketLiquidityParams): Promise<_nadohq_engine_client.GetEngineMarketLiquidityResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Historical candlesticks from the indexer, use getLatestMarketPrice for the latest orderbook prices
|
|
67
|
+
*
|
|
68
|
+
* @param params
|
|
69
|
+
*/
|
|
70
|
+
getCandlesticks(params: GetIndexerCandlesticksParams): Promise<_nadohq_indexer_client.GetIndexerCandlesticksResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Historical candlesticks from Edge, use getLatestMarketPrice for the latest orderbook prices
|
|
73
|
+
*
|
|
74
|
+
* @param params
|
|
75
|
+
*/
|
|
76
|
+
getEdgeCandlesticks(params: GetIndexerEdgeCandlesticksParams): Promise<_nadohq_indexer_client.GetIndexerCandlesticksResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Retrieves the latest off-chain orderbook price from the engine
|
|
79
|
+
*
|
|
80
|
+
* @param params
|
|
81
|
+
*/
|
|
82
|
+
getLatestMarketPrice(params: GetEngineMarketPriceParams): Promise<_nadohq_engine_client.EngineMarketPrice>;
|
|
83
|
+
/**
|
|
84
|
+
* Retrieves the latest off-chain orderbook price from the engine for multiple markets
|
|
85
|
+
*
|
|
86
|
+
* @param params
|
|
87
|
+
*/
|
|
88
|
+
getLatestMarketPrices(params: GetEngineMarketPricesParams): Promise<_nadohq_engine_client.GetEngineMarketPricesResponse>;
|
|
89
|
+
/**
|
|
90
|
+
* Retrieves the latest funding rate for a perp product
|
|
91
|
+
*
|
|
92
|
+
* @param params
|
|
93
|
+
*/
|
|
94
|
+
getFundingRate(params: GetIndexerFundingRateParams): Promise<_nadohq_indexer_client.IndexerFundingRate>;
|
|
95
|
+
/**
|
|
96
|
+
* Retrieves the latest funding rate for multiple perp products
|
|
97
|
+
*
|
|
98
|
+
* @param params
|
|
99
|
+
*/
|
|
100
|
+
getMultiProductFundingRates(params: GetIndexerMultiProductFundingRatesParams): Promise<_nadohq_indexer_client.GetIndexerMultiProductFundingRatesResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* Retrieves the historical snapshots for a product from the indexer
|
|
103
|
+
*
|
|
104
|
+
* @param params
|
|
105
|
+
*/
|
|
106
|
+
getProductSnapshots(params: GetIndexerProductSnapshotsParams): Promise<_nadohq_indexer_client.GetIndexerProductSnapshotsResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Retrieves the historical snapshots for a market from the indexer
|
|
109
|
+
*
|
|
110
|
+
* @param params
|
|
111
|
+
*/
|
|
112
|
+
getMarketSnapshots(params: GetIndexerMarketSnapshotsParams): Promise<_nadohq_indexer_client.GetIndexerMarketSnapshotsResponse>;
|
|
113
|
+
/**
|
|
114
|
+
* Retrieves the historical snapshots for a market from Edge
|
|
115
|
+
*
|
|
116
|
+
* @param params
|
|
117
|
+
*/
|
|
118
|
+
getEdgeMarketSnapshots(params: GetIndexerEdgeMarketSnapshotsParams): Promise<_nadohq_indexer_client.GetIndexerEdgeMarketSnapshotResponse>;
|
|
119
|
+
/**
|
|
120
|
+
* Retrieves the historical snapshots for multiple products from the indexer
|
|
121
|
+
*
|
|
122
|
+
* @param params
|
|
123
|
+
*/
|
|
124
|
+
getMultiProductSnapshots(params: GetIndexerMultiProductSnapshotsParams): Promise<_nadohq_indexer_client.GetIndexerMultiProductSnapshotsResponse>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { MarketQueryAPI };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// src/apis/market/MarketQueryAPI.ts
|
|
2
|
+
import { getAllMarkets } from "@nadohq/contracts";
|
|
3
|
+
import { BaseNadoAPI } from "../base.js";
|
|
4
|
+
var MarketQueryAPI = class extends BaseNadoAPI {
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves all market states from the on-chain contracts
|
|
7
|
+
*/
|
|
8
|
+
async getAllMarkets() {
|
|
9
|
+
return getAllMarkets(this.context.contracts);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves all market states from the offchain engine
|
|
13
|
+
*/
|
|
14
|
+
async getAllEngineMarkets() {
|
|
15
|
+
return this.context.engineClient.getAllMarkets();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get all edge engine markets
|
|
19
|
+
*/
|
|
20
|
+
async getEdgeAllEngineMarkets() {
|
|
21
|
+
return this.context.engineClient.getEdgeAllMarkets();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves all spread health groups
|
|
25
|
+
*/
|
|
26
|
+
async getHealthGroups() {
|
|
27
|
+
return this.context.engineClient.getHealthGroups();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Queries engine to determine if the order can be submitted within health requirements
|
|
31
|
+
*/
|
|
32
|
+
async validateOrderParams(params) {
|
|
33
|
+
return this.context.engineClient.validateOrderParams(params);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Queries the offchain engine to retrieve status of any open orders for the given subaccount
|
|
37
|
+
* @param params
|
|
38
|
+
*/
|
|
39
|
+
async getOpenSubaccountOrders(params) {
|
|
40
|
+
return this.context.engineClient.getSubaccountOrders(params);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Queries the offchain engine to retrieve status of any open orders for the given subaccount for multiple products
|
|
44
|
+
* @param params
|
|
45
|
+
*/
|
|
46
|
+
async getOpenSubaccountMultiProductOrders(params) {
|
|
47
|
+
return this.context.engineClient.getSubaccountMultiProductOrders(params);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Queries the offchain trigger service to list trigger orders. Requires a signature
|
|
51
|
+
* @param params
|
|
52
|
+
*/
|
|
53
|
+
async getTriggerOrders(params) {
|
|
54
|
+
return this.context.triggerClient.listOrders({
|
|
55
|
+
...params,
|
|
56
|
+
chainId: this.getWalletClientChainIdIfNeeded(params),
|
|
57
|
+
verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress()
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Queries indexer to fetch historical orders
|
|
62
|
+
*
|
|
63
|
+
* @param params
|
|
64
|
+
*/
|
|
65
|
+
async getHistoricalOrders(params) {
|
|
66
|
+
return this.context.indexerClient.getOrders(params);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Queries engine to determine maximum order size
|
|
70
|
+
* @param params
|
|
71
|
+
*/
|
|
72
|
+
async getMaxOrderSize(params) {
|
|
73
|
+
return this.context.engineClient.getMaxOrderSize(params);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Retrieves liquidity per price tick from the engine. The engine will skip price levels that have no liquidity,
|
|
77
|
+
* so it is not guaranteed that the bids/asks are evenly spaced
|
|
78
|
+
*/
|
|
79
|
+
async getMarketLiquidity(params) {
|
|
80
|
+
return this.context.engineClient.getMarketLiquidity(params);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Historical candlesticks from the indexer, use getLatestMarketPrice for the latest orderbook prices
|
|
84
|
+
*
|
|
85
|
+
* @param params
|
|
86
|
+
*/
|
|
87
|
+
async getCandlesticks(params) {
|
|
88
|
+
return this.context.indexerClient.getCandlesticks(params);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Historical candlesticks from Edge, use getLatestMarketPrice for the latest orderbook prices
|
|
92
|
+
*
|
|
93
|
+
* @param params
|
|
94
|
+
*/
|
|
95
|
+
async getEdgeCandlesticks(params) {
|
|
96
|
+
return this.context.indexerClient.getEdgeCandlesticks(params);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Retrieves the latest off-chain orderbook price from the engine
|
|
100
|
+
*
|
|
101
|
+
* @param params
|
|
102
|
+
*/
|
|
103
|
+
async getLatestMarketPrice(params) {
|
|
104
|
+
return this.context.engineClient.getMarketPrice(params);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Retrieves the latest off-chain orderbook price from the engine for multiple markets
|
|
108
|
+
*
|
|
109
|
+
* @param params
|
|
110
|
+
*/
|
|
111
|
+
async getLatestMarketPrices(params) {
|
|
112
|
+
return this.context.engineClient.getMarketPrices(params);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Retrieves the latest funding rate for a perp product
|
|
116
|
+
*
|
|
117
|
+
* @param params
|
|
118
|
+
*/
|
|
119
|
+
async getFundingRate(params) {
|
|
120
|
+
return this.context.indexerClient.getFundingRate(params);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Retrieves the latest funding rate for multiple perp products
|
|
124
|
+
*
|
|
125
|
+
* @param params
|
|
126
|
+
*/
|
|
127
|
+
async getMultiProductFundingRates(params) {
|
|
128
|
+
return this.context.indexerClient.getMultiProductFundingRates(params);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Retrieves the historical snapshots for a product from the indexer
|
|
132
|
+
*
|
|
133
|
+
* @param params
|
|
134
|
+
*/
|
|
135
|
+
async getProductSnapshots(params) {
|
|
136
|
+
return this.context.indexerClient.getProductSnapshots(params);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Retrieves the historical snapshots for a market from the indexer
|
|
140
|
+
*
|
|
141
|
+
* @param params
|
|
142
|
+
*/
|
|
143
|
+
async getMarketSnapshots(params) {
|
|
144
|
+
return this.context.indexerClient.getMarketSnapshots(params);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Retrieves the historical snapshots for a market from Edge
|
|
148
|
+
*
|
|
149
|
+
* @param params
|
|
150
|
+
*/
|
|
151
|
+
async getEdgeMarketSnapshots(params) {
|
|
152
|
+
return this.context.indexerClient.getEdgeMarketSnapshots(params);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Retrieves the historical snapshots for multiple products from the indexer
|
|
156
|
+
*
|
|
157
|
+
* @param params
|
|
158
|
+
*/
|
|
159
|
+
async getMultiProductSnapshots(params) {
|
|
160
|
+
return this.context.indexerClient.getMultiProductSnapshots(params);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
export {
|
|
164
|
+
MarketQueryAPI
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=MarketQueryAPI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/apis/market/MarketQueryAPI.ts"],"sourcesContent":["import { getAllMarkets, GetAllMarketsResponse } from '@nadohq/contracts';\nimport {\n GetEngineMarketLiquidityParams,\n GetEngineMarketPriceParams,\n GetEngineMarketPricesParams,\n GetEngineMaxOrderSizeParams,\n GetEngineSubaccountOrdersParams,\n GetEngineSubaccountProductOrdersParams,\n ValidateEngineOrderParams,\n} from '@nadohq/engine-client';\nimport {\n GetIndexerCandlesticksParams,\n GetIndexerEdgeCandlesticksParams,\n GetIndexerEdgeMarketSnapshotsParams,\n GetIndexerFundingRateParams,\n GetIndexerMarketSnapshotsParams,\n GetIndexerMultiProductFundingRatesParams,\n GetIndexerMultiProductSnapshotsParams,\n GetIndexerOrdersParams,\n GetIndexerOrdersResponse,\n GetIndexerProductSnapshotsParams,\n} from '@nadohq/indexer-client';\nimport { BaseNadoAPI } from '../base';\nimport { GetTriggerOrdersParams } from './types';\n\nexport class MarketQueryAPI extends BaseNadoAPI {\n /**\n * Retrieves all market states from the on-chain contracts\n */\n async getAllMarkets(): Promise<GetAllMarketsResponse> {\n return getAllMarkets(this.context.contracts);\n }\n\n /**\n * Retrieves all market states from the offchain engine\n */\n async getAllEngineMarkets(): Promise<GetAllMarketsResponse> {\n return this.context.engineClient.getAllMarkets();\n }\n\n /**\n * Get all edge engine markets\n */\n async getEdgeAllEngineMarkets(): Promise<\n Record<number, GetAllMarketsResponse>\n > {\n return this.context.engineClient.getEdgeAllMarkets();\n }\n\n /**\n * Retrieves all spread health groups\n */\n async getHealthGroups() {\n return this.context.engineClient.getHealthGroups();\n }\n\n /**\n * Queries engine to determine if the order can be submitted within health requirements\n */\n async validateOrderParams(params: ValidateEngineOrderParams) {\n return this.context.engineClient.validateOrderParams(params);\n }\n\n /**\n * Queries the offchain engine to retrieve status of any open orders for the given subaccount\n * @param params\n */\n async getOpenSubaccountOrders(params: GetEngineSubaccountOrdersParams) {\n return this.context.engineClient.getSubaccountOrders(params);\n }\n\n /**\n * Queries the offchain engine to retrieve status of any open orders for the given subaccount for multiple products\n * @param params\n */\n async getOpenSubaccountMultiProductOrders(\n params: GetEngineSubaccountProductOrdersParams,\n ) {\n return this.context.engineClient.getSubaccountMultiProductOrders(params);\n }\n\n /**\n * Queries the offchain trigger service to list trigger orders. Requires a signature\n * @param params\n */\n async getTriggerOrders(params: GetTriggerOrdersParams) {\n return this.context.triggerClient.listOrders({\n ...params,\n chainId: this.getWalletClientChainIdIfNeeded(params),\n verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress(),\n });\n }\n\n /**\n * Queries indexer to fetch historical orders\n *\n * @param params\n */\n async getHistoricalOrders(\n params: GetIndexerOrdersParams,\n ): Promise<GetIndexerOrdersResponse> {\n return this.context.indexerClient.getOrders(params);\n }\n\n /**\n * Queries engine to determine maximum order size\n * @param params\n */\n async getMaxOrderSize(params: GetEngineMaxOrderSizeParams) {\n return this.context.engineClient.getMaxOrderSize(params);\n }\n\n /**\n * Retrieves liquidity per price tick from the engine. The engine will skip price levels that have no liquidity,\n * so it is not guaranteed that the bids/asks are evenly spaced\n */\n async getMarketLiquidity(params: GetEngineMarketLiquidityParams) {\n return this.context.engineClient.getMarketLiquidity(params);\n }\n\n /**\n * Historical candlesticks from the indexer, use getLatestMarketPrice for the latest orderbook prices\n *\n * @param params\n */\n async getCandlesticks(params: GetIndexerCandlesticksParams) {\n return this.context.indexerClient.getCandlesticks(params);\n }\n\n /**\n * Historical candlesticks from Edge, use getLatestMarketPrice for the latest orderbook prices\n *\n * @param params\n */\n async getEdgeCandlesticks(params: GetIndexerEdgeCandlesticksParams) {\n return this.context.indexerClient.getEdgeCandlesticks(params);\n }\n\n /**\n * Retrieves the latest off-chain orderbook price from the engine\n *\n * @param params\n */\n async getLatestMarketPrice(params: GetEngineMarketPriceParams) {\n return this.context.engineClient.getMarketPrice(params);\n }\n\n /**\n * Retrieves the latest off-chain orderbook price from the engine for multiple markets\n *\n * @param params\n */\n async getLatestMarketPrices(params: GetEngineMarketPricesParams) {\n return this.context.engineClient.getMarketPrices(params);\n }\n\n /**\n * Retrieves the latest funding rate for a perp product\n *\n * @param params\n */\n async getFundingRate(params: GetIndexerFundingRateParams) {\n return this.context.indexerClient.getFundingRate(params);\n }\n\n /**\n * Retrieves the latest funding rate for multiple perp products\n *\n * @param params\n */\n async getMultiProductFundingRates(\n params: GetIndexerMultiProductFundingRatesParams,\n ) {\n return this.context.indexerClient.getMultiProductFundingRates(params);\n }\n\n /**\n * Retrieves the historical snapshots for a product from the indexer\n *\n * @param params\n */\n async getProductSnapshots(params: GetIndexerProductSnapshotsParams) {\n return this.context.indexerClient.getProductSnapshots(params);\n }\n\n /**\n * Retrieves the historical snapshots for a market from the indexer\n *\n * @param params\n */\n async getMarketSnapshots(params: GetIndexerMarketSnapshotsParams) {\n return this.context.indexerClient.getMarketSnapshots(params);\n }\n\n /**\n * Retrieves the historical snapshots for a market from Edge\n *\n * @param params\n */\n async getEdgeMarketSnapshots(params: GetIndexerEdgeMarketSnapshotsParams) {\n return this.context.indexerClient.getEdgeMarketSnapshots(params);\n }\n\n /**\n * Retrieves the historical snapshots for multiple products from the indexer\n *\n * @param params\n */\n async getMultiProductSnapshots(\n params: GetIndexerMultiProductSnapshotsParams,\n ) {\n return this.context.indexerClient.getMultiProductSnapshots(params);\n }\n}\n"],"mappings":"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","names":[]}
|