@nadohq/client 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseSpotAPI-BeTjhXT_.d.cts +14 -0
- package/dist/BaseSpotAPI-BeTjhXT_.d.cts.map +1 -0
- package/dist/BaseSpotAPI-Ck64kyYt.d.ts +14 -0
- package/dist/BaseSpotAPI-Ck64kyYt.d.ts.map +1 -0
- package/dist/MarketExecuteAPI-BBp0Nn6N.d.cts +55 -0
- package/dist/MarketExecuteAPI-BBp0Nn6N.d.cts.map +1 -0
- package/dist/MarketExecuteAPI-_S9-rNsv.d.ts +55 -0
- package/dist/MarketExecuteAPI-_S9-rNsv.d.ts.map +1 -0
- package/dist/MarketQueryAPI-Dhb8hWiD.d.cts +118 -0
- package/dist/MarketQueryAPI-Dhb8hWiD.d.cts.map +1 -0
- package/dist/MarketQueryAPI-Dz8FrVPK.d.ts +118 -0
- package/dist/MarketQueryAPI-Dz8FrVPK.d.ts.map +1 -0
- package/dist/PerpExecuteAPI-C0APgWq4.d.cts +7 -0
- package/dist/PerpExecuteAPI-C0APgWq4.d.cts.map +1 -0
- package/dist/PerpExecuteAPI-DPNJdARF.d.ts +7 -0
- package/dist/PerpExecuteAPI-DPNJdARF.d.ts.map +1 -0
- package/dist/PerpQueryAPI-RGhdNhoJ.d.cts +19 -0
- package/dist/PerpQueryAPI-RGhdNhoJ.d.cts.map +1 -0
- package/dist/PerpQueryAPI-tJbMmCcO.d.ts +19 -0
- package/dist/PerpQueryAPI-tJbMmCcO.d.ts.map +1 -0
- package/dist/SpotExecuteAPI-UWnX_Hm4.d.ts +22 -0
- package/dist/SpotExecuteAPI-UWnX_Hm4.d.ts.map +1 -0
- package/dist/SpotExecuteAPI-b07ixUz2.d.cts +22 -0
- package/dist/SpotExecuteAPI-b07ixUz2.d.cts.map +1 -0
- package/dist/SpotQueryAPI-CfZcvt4p.d.ts +36 -0
- package/dist/SpotQueryAPI-CfZcvt4p.d.ts.map +1 -0
- package/dist/SpotQueryAPI-DS85MzQB.d.cts +36 -0
- package/dist/SpotQueryAPI-DS85MzQB.d.cts.map +1 -0
- package/dist/SubaccountExecuteAPI-DhHBzzdk.d.cts +21 -0
- package/dist/SubaccountExecuteAPI-DhHBzzdk.d.cts.map +1 -0
- package/dist/SubaccountExecuteAPI-KApMbONz.d.ts +21 -0
- package/dist/SubaccountExecuteAPI-KApMbONz.d.ts.map +1 -0
- package/dist/SubaccountQueryAPI-C9h3epmM.d.cts +40 -0
- package/dist/SubaccountQueryAPI-C9h3epmM.d.cts.map +1 -0
- package/dist/SubaccountQueryAPI-DnLcgfiM.d.ts +40 -0
- package/dist/SubaccountQueryAPI-DnLcgfiM.d.ts.map +1 -0
- package/dist/WebSocketExecuteAPI-7gLrCoXN.d.cts +44 -0
- package/dist/WebSocketExecuteAPI-7gLrCoXN.d.cts.map +1 -0
- package/dist/WebSocketExecuteAPI-DHhKag16.d.ts +44 -0
- package/dist/WebSocketExecuteAPI-DHhKag16.d.ts.map +1 -0
- package/dist/WebSocketQueryAPI-B9vBQo5q.d.ts +20 -0
- package/dist/WebSocketQueryAPI-B9vBQo5q.d.ts.map +1 -0
- package/dist/WebSocketQueryAPI-BMLp4dCH.d.cts +20 -0
- package/dist/WebSocketQueryAPI-BMLp4dCH.d.cts.map +1 -0
- package/dist/WebSocketSubscriptionAPI-bApRHac8.d.cts +34 -0
- package/dist/WebSocketSubscriptionAPI-bApRHac8.d.cts.map +1 -0
- package/dist/WebSocketSubscriptionAPI-qUFRFcRI.d.ts +34 -0
- package/dist/WebSocketSubscriptionAPI-qUFRFcRI.d.ts.map +1 -0
- package/dist/apis/base.cjs +30 -60
- package/dist/apis/base.cjs.map +1 -1
- package/dist/apis/base.d.cts +2 -22
- package/dist/apis/base.d.ts +2 -22
- package/dist/apis/base.js +28 -34
- package/dist/apis/base.js.map +1 -1
- package/dist/apis/market/MarketExecuteAPI.cjs +164 -190
- package/dist/apis/market/MarketExecuteAPI.cjs.map +1 -1
- package/dist/apis/market/MarketExecuteAPI.d.cts +2 -61
- package/dist/apis/market/MarketExecuteAPI.d.ts +2 -61
- package/dist/apis/market/MarketExecuteAPI.js +162 -164
- package/dist/apis/market/MarketExecuteAPI.js.map +1 -1
- package/dist/apis/market/MarketQueryAPI.cjs +157 -181
- package/dist/apis/market/MarketQueryAPI.cjs.map +1 -1
- package/dist/apis/market/MarketQueryAPI.d.cts +2 -124
- package/dist/apis/market/MarketQueryAPI.d.ts +2 -124
- package/dist/apis/market/MarketQueryAPI.js +155 -155
- package/dist/apis/market/MarketQueryAPI.js.map +1 -1
- package/dist/apis/market/index.cjs +8 -36
- package/dist/apis/market/index.cjs.map +1 -1
- package/dist/apis/market/index.d.cts +3 -19
- package/dist/apis/market/index.d.ts +3 -19
- package/dist/apis/market/index.js +6 -8
- package/dist/apis/market/index.js.map +1 -1
- package/dist/apis/market/types.cjs +0 -19
- package/dist/apis/market/types.d.cts +2 -41
- package/dist/apis/market/types.d.ts +2 -41
- package/dist/apis/market/types.js +1 -1
- package/dist/apis/perp/PerpExecuteAPI.cjs +6 -31
- package/dist/apis/perp/PerpExecuteAPI.cjs.map +1 -1
- package/dist/apis/perp/PerpExecuteAPI.d.cts +2 -12
- package/dist/apis/perp/PerpExecuteAPI.d.ts +2 -12
- package/dist/apis/perp/PerpExecuteAPI.js +5 -6
- package/dist/apis/perp/PerpExecuteAPI.js.map +1 -1
- package/dist/apis/perp/PerpQueryAPI.cjs +20 -44
- package/dist/apis/perp/PerpQueryAPI.cjs.map +1 -1
- package/dist/apis/perp/PerpQueryAPI.d.cts +2 -23
- package/dist/apis/perp/PerpQueryAPI.d.ts +2 -23
- package/dist/apis/perp/PerpQueryAPI.js +18 -18
- package/dist/apis/perp/PerpQueryAPI.js.map +1 -1
- package/dist/apis/perp/index.cjs +8 -33
- package/dist/apis/perp/index.cjs.map +1 -1
- package/dist/apis/perp/index.d.cts +2 -16
- package/dist/apis/perp/index.d.ts +2 -16
- package/dist/apis/perp/index.js +6 -7
- package/dist/apis/perp/index.js.map +1 -1
- package/dist/apis/spot/BaseSpotAPI.cjs +21 -51
- package/dist/apis/spot/BaseSpotAPI.cjs.map +1 -1
- package/dist/apis/spot/BaseSpotAPI.d.cts +2 -18
- package/dist/apis/spot/BaseSpotAPI.d.ts +2 -18
- package/dist/apis/spot/BaseSpotAPI.js +19 -28
- package/dist/apis/spot/BaseSpotAPI.js.map +1 -1
- package/dist/apis/spot/SpotExecuteAPI.cjs +72 -104
- package/dist/apis/spot/SpotExecuteAPI.cjs.map +1 -1
- package/dist/apis/spot/SpotExecuteAPI.d.cts +2 -27
- package/dist/apis/spot/SpotExecuteAPI.d.ts +2 -27
- package/dist/apis/spot/SpotExecuteAPI.js +70 -85
- package/dist/apis/spot/SpotExecuteAPI.js.map +1 -1
- package/dist/apis/spot/SpotQueryAPI.cjs +34 -71
- package/dist/apis/spot/SpotQueryAPI.cjs.map +1 -1
- package/dist/apis/spot/SpotQueryAPI.d.cts +2 -35
- package/dist/apis/spot/SpotQueryAPI.d.ts +2 -35
- package/dist/apis/spot/SpotQueryAPI.js +32 -45
- package/dist/apis/spot/SpotQueryAPI.js.map +1 -1
- package/dist/apis/spot/index.cjs +11 -36
- package/dist/apis/spot/index.cjs.map +1 -1
- package/dist/apis/spot/index.d.cts +3 -23
- package/dist/apis/spot/index.d.ts +3 -23
- package/dist/apis/spot/index.js +9 -8
- package/dist/apis/spot/index.js.map +1 -1
- package/dist/apis/spot/types.cjs +0 -19
- package/dist/apis/spot/types.d.cts +2 -27
- package/dist/apis/spot/types.d.ts +2 -27
- package/dist/apis/spot/types.js +1 -1
- package/dist/apis/subaccount/SubaccountExecuteAPI.cjs +32 -56
- package/dist/apis/subaccount/SubaccountExecuteAPI.cjs.map +1 -1
- package/dist/apis/subaccount/SubaccountExecuteAPI.d.cts +2 -26
- package/dist/apis/subaccount/SubaccountExecuteAPI.d.ts +2 -26
- package/dist/apis/subaccount/SubaccountExecuteAPI.js +30 -30
- package/dist/apis/subaccount/SubaccountExecuteAPI.js.map +1 -1
- package/dist/apis/subaccount/SubaccountQueryAPI.cjs +48 -72
- package/dist/apis/subaccount/SubaccountQueryAPI.cjs.map +1 -1
- package/dist/apis/subaccount/SubaccountQueryAPI.d.cts +2 -44
- package/dist/apis/subaccount/SubaccountQueryAPI.d.ts +2 -44
- package/dist/apis/subaccount/SubaccountQueryAPI.js +46 -46
- package/dist/apis/subaccount/SubaccountQueryAPI.js.map +1 -1
- package/dist/apis/subaccount/index.cjs +32 -64
- package/dist/apis/subaccount/index.cjs.map +1 -1
- package/dist/apis/subaccount/index.d.cts +3 -27
- package/dist/apis/subaccount/index.d.ts +3 -27
- package/dist/apis/subaccount/index.js +30 -39
- package/dist/apis/subaccount/index.js.map +1 -1
- package/dist/apis/subaccount/types.cjs +0 -19
- package/dist/apis/subaccount/types.d.cts +2 -9
- package/dist/apis/subaccount/types.d.ts +2 -9
- package/dist/apis/subaccount/types.js +1 -1
- package/dist/apis/types.cjs +0 -19
- package/dist/apis/types.d.cts +2 -9
- package/dist/apis/types.d.ts +2 -9
- package/dist/apis/types.js +1 -1
- package/dist/apis/ws/WebSocketExecuteAPI.cjs +42 -70
- package/dist/apis/ws/WebSocketExecuteAPI.cjs.map +1 -1
- package/dist/apis/ws/WebSocketExecuteAPI.d.cts +2 -48
- package/dist/apis/ws/WebSocketExecuteAPI.d.ts +2 -48
- package/dist/apis/ws/WebSocketExecuteAPI.js +40 -44
- package/dist/apis/ws/WebSocketExecuteAPI.js.map +1 -1
- package/dist/apis/ws/WebSocketQueryAPI.cjs +19 -39
- package/dist/apis/ws/WebSocketQueryAPI.cjs.map +1 -1
- package/dist/apis/ws/WebSocketQueryAPI.d.cts +2 -23
- package/dist/apis/ws/WebSocketQueryAPI.d.ts +2 -23
- package/dist/apis/ws/WebSocketQueryAPI.js +17 -13
- package/dist/apis/ws/WebSocketQueryAPI.js.map +1 -1
- package/dist/apis/ws/WebSocketSubscriptionAPI.cjs +40 -58
- package/dist/apis/ws/WebSocketSubscriptionAPI.cjs.map +1 -1
- package/dist/apis/ws/WebSocketSubscriptionAPI.d.cts +2 -37
- package/dist/apis/ws/WebSocketSubscriptionAPI.d.ts +2 -37
- package/dist/apis/ws/WebSocketSubscriptionAPI.js +38 -32
- package/dist/apis/ws/WebSocketSubscriptionAPI.js.map +1 -1
- package/dist/apis/ws/index.cjs +18 -39
- package/dist/apis/ws/index.cjs.map +1 -1
- package/dist/apis/ws/index.d.cts +2 -22
- package/dist/apis/ws/index.d.ts +2 -22
- package/dist/apis/ws/index.js +13 -10
- package/dist/apis/ws/index.js.map +1 -1
- package/dist/base-B92wTsrc.d.ts +20 -0
- package/dist/base-B92wTsrc.d.ts.map +1 -0
- package/dist/base-BYkH_-5-.d.cts +20 -0
- package/dist/base-BYkH_-5-.d.cts.map +1 -0
- package/dist/client.cjs +53 -77
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +28 -49
- package/dist/client.d.cts.map +1 -0
- package/dist/client.d.ts +28 -49
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +46 -46
- package/dist/client.js.map +1 -1
- package/dist/context-YHVv2kD4.d.cts +44 -0
- package/dist/context-YHVv2kD4.d.cts.map +1 -0
- package/dist/context-YfcGQ0Sr.d.ts +44 -0
- package/dist/context-YfcGQ0Sr.d.ts.map +1 -0
- package/dist/context.cjs +92 -122
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +2 -42
- package/dist/context.d.ts +2 -42
- package/dist/context.js +90 -105
- package/dist/context.js.map +1 -1
- package/dist/createNadoClient.cjs +15 -32
- package/dist/createNadoClient.cjs.map +1 -1
- package/dist/createNadoClient.d.cts +5 -32
- package/dist/createNadoClient.d.cts.map +1 -0
- package/dist/createNadoClient.d.ts +5 -32
- package/dist/createNadoClient.d.ts.map +1 -0
- package/dist/createNadoClient.js +13 -8
- package/dist/createNadoClient.js.map +1 -1
- package/dist/index-BFQPcj2w.d.cts +9 -0
- package/dist/index-BFQPcj2w.d.cts.map +1 -0
- package/dist/index-CSG04f_b.d.cts +12 -0
- package/dist/index-CSG04f_b.d.cts.map +1 -0
- package/dist/index-Cc2RdeRK.d.cts +19 -0
- package/dist/index-Cc2RdeRK.d.cts.map +1 -0
- package/dist/index-DIX4yJe-.d.ts +9 -0
- package/dist/index-DIX4yJe-.d.ts.map +1 -0
- package/dist/index-DVJ1Mu6s.d.ts +9 -0
- package/dist/index-DVJ1Mu6s.d.ts.map +1 -0
- package/dist/index-DkTJs2nZ.d.cts +9 -0
- package/dist/index-DkTJs2nZ.d.cts.map +1 -0
- package/dist/index-Dw9iFeeU.d.ts +19 -0
- package/dist/index-Dw9iFeeU.d.ts.map +1 -0
- package/dist/index-Mhjd1FK8.d.ts +12 -0
- package/dist/index-Mhjd1FK8.d.ts.map +1 -0
- package/dist/index-RtQYDuRY.d.ts +19 -0
- package/dist/index-RtQYDuRY.d.ts.map +1 -0
- package/dist/index-jTtf55U_.d.cts +19 -0
- package/dist/index-jTtf55U_.d.cts.map +1 -0
- package/dist/index.cjs +50 -44
- package/dist/index.d.cts +15 -32
- package/dist/index.d.ts +15 -32
- package/dist/index.js +9 -10
- package/dist/types-B-tOIIKl.d.ts +29 -0
- package/dist/types-B-tOIIKl.d.ts.map +1 -0
- package/dist/types-B6oFoDTo.d.ts +11 -0
- package/dist/types-B6oFoDTo.d.ts.map +1 -0
- package/dist/types-BFFzjzRy.d.ts +43 -0
- package/dist/types-BFFzjzRy.d.ts.map +1 -0
- package/dist/types-BWRdhQd_.d.cts +11 -0
- package/dist/types-BWRdhQd_.d.cts.map +1 -0
- package/dist/types-C5DKLOen.d.ts +11 -0
- package/dist/types-C5DKLOen.d.ts.map +1 -0
- package/dist/types-CCj4QJO8.d.cts +29 -0
- package/dist/types-CCj4QJO8.d.cts.map +1 -0
- package/dist/types-D27__G6_.d.cts +11 -0
- package/dist/types-D27__G6_.d.cts.map +1 -0
- package/dist/types-YBdM1sun.d.cts +43 -0
- package/dist/types-YBdM1sun.d.cts.map +1 -0
- package/package.json +11 -11
- package/dist/apis/market/types.cjs.map +0 -1
- package/dist/apis/market/types.js.map +0 -1
- package/dist/apis/spot/types.cjs.map +0 -1
- package/dist/apis/spot/types.js.map +0 -1
- package/dist/apis/subaccount/types.cjs.map +0 -1
- package/dist/apis/subaccount/types.js.map +0 -1
- package/dist/apis/types.cjs.map +0 -1
- package/dist/apis/types.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -1,61 +1,43 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_apis_base = require("../base.cjs");
|
|
3
|
+
//#region src/apis/ws/WebSocketSubscriptionAPI.ts
|
|
4
|
+
/**
|
|
5
|
+
* Builds subscription messages as expected by the server to send over Websocket.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const tradeSubscriptionParams = nadoClient.ws.subscription.buildSubscriptionParams('trade', ...);
|
|
9
|
+
* const tradeSubscriptionMessage = nadoClient.ws.subscription.buildSubscriptionMessage(
|
|
10
|
+
* 'subscribe', tradeSubscriptionParams);
|
|
11
|
+
*/
|
|
12
|
+
var WebSocketSubscriptionAPI = class extends require_apis_base.BaseNadoAPI {
|
|
13
|
+
/**
|
|
14
|
+
* Builds a subscription request message as expected by the server via Websocket.
|
|
15
|
+
* @param requestType name of request to build message for.
|
|
16
|
+
* @param id identifier to associate messages with responses.
|
|
17
|
+
* @param params request message params.
|
|
18
|
+
* @returns subscription request message.
|
|
19
|
+
*/
|
|
20
|
+
buildSubscriptionMessage(id, requestType, params) {
|
|
21
|
+
return {
|
|
22
|
+
id,
|
|
23
|
+
method: requestType,
|
|
24
|
+
...params
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Builds a subscription stream param as expected by the server via Websocket.
|
|
29
|
+
* @param streamType name of stream to build params for.
|
|
30
|
+
* @param params
|
|
31
|
+
* @returns subscription stream params.
|
|
32
|
+
*/
|
|
33
|
+
buildSubscriptionParams(streamType, params) {
|
|
34
|
+
return { stream: {
|
|
35
|
+
type: streamType,
|
|
36
|
+
...params
|
|
37
|
+
} };
|
|
38
|
+
}
|
|
9
39
|
};
|
|
10
|
-
|
|
11
|
-
|
|
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);
|
|
40
|
+
//#endregion
|
|
41
|
+
exports.WebSocketSubscriptionAPI = WebSocketSubscriptionAPI;
|
|
19
42
|
|
|
20
|
-
// src/apis/ws/WebSocketSubscriptionAPI.ts
|
|
21
|
-
var WebSocketSubscriptionAPI_exports = {};
|
|
22
|
-
__export(WebSocketSubscriptionAPI_exports, {
|
|
23
|
-
WebSocketSubscriptionAPI: () => WebSocketSubscriptionAPI
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(WebSocketSubscriptionAPI_exports);
|
|
26
|
-
var import_base = require("../base.cjs");
|
|
27
|
-
var WebSocketSubscriptionAPI = class extends import_base.BaseNadoAPI {
|
|
28
|
-
/**
|
|
29
|
-
* Builds a subscription request message as expected by the server via Websocket.
|
|
30
|
-
* @param requestType name of request to build message for.
|
|
31
|
-
* @param id identifier to associate messages with responses.
|
|
32
|
-
* @param params request message params.
|
|
33
|
-
* @returns subscription request message.
|
|
34
|
-
*/
|
|
35
|
-
buildSubscriptionMessage(id, requestType, params) {
|
|
36
|
-
return {
|
|
37
|
-
id,
|
|
38
|
-
method: requestType,
|
|
39
|
-
...params
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Builds a subscription stream param as expected by the server via Websocket.
|
|
44
|
-
* @param streamType name of stream to build params for.
|
|
45
|
-
* @param params
|
|
46
|
-
* @returns subscription stream params.
|
|
47
|
-
*/
|
|
48
|
-
buildSubscriptionParams(streamType, params) {
|
|
49
|
-
return {
|
|
50
|
-
stream: {
|
|
51
|
-
type: streamType,
|
|
52
|
-
...params
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
-
0 && (module.exports = {
|
|
59
|
-
WebSocketSubscriptionAPI
|
|
60
|
-
});
|
|
61
43
|
//# sourceMappingURL=WebSocketSubscriptionAPI.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/apis/ws/WebSocketSubscriptionAPI.ts"],"sourcesContent":["import {\n EngineServerSubscriptionRequest,\n EngineServerSubscriptionRequestByType,\n EngineServerSubscriptionRequestType,\n EngineServerSubscriptionStream,\n EngineServerSubscriptionStreamParamsByType,\n EngineServerSubscriptionStreamParamsType,\n} from '@nadohq/engine-client';\nimport { BaseNadoAPI } from '../base';\n\n/**\n * Builds subscription messages as expected by the server to send over Websocket.\n *\n * @example\n * const tradeSubscriptionParams = nadoClient.ws.subscription.buildSubscriptionParams('trade', ...);\n * const tradeSubscriptionMessage = nadoClient.ws.subscription.buildSubscriptionMessage(\n * 'subscribe', tradeSubscriptionParams);\n */\nexport class WebSocketSubscriptionAPI extends BaseNadoAPI {\n /**\n * Builds a subscription request message as expected by the server via Websocket.\n * @param requestType name of request to build message for.\n * @param id identifier to associate messages with responses.\n * @param params request message params.\n * @returns subscription request message.\n */\n public buildSubscriptionMessage<\n TRequestType extends EngineServerSubscriptionRequestType,\n >(\n id: number,\n requestType: TRequestType,\n params: EngineServerSubscriptionRequestByType[TRequestType],\n ): EngineServerSubscriptionRequest<TRequestType> {\n return {\n id,\n method: requestType,\n ...params,\n };\n }\n\n /**\n * Builds a subscription stream param as expected by the server via Websocket.\n * @param streamType name of stream to build params for.\n * @param params\n * @returns subscription stream params.\n */\n public buildSubscriptionParams<\n TStreamType extends EngineServerSubscriptionStreamParamsType,\n >(\n streamType: TStreamType,\n params: EngineServerSubscriptionStreamParamsByType[TStreamType],\n ): {\n stream: EngineServerSubscriptionStream<TStreamType>;\n } {\n return {\n stream: {\n type: streamType,\n ...params,\n },\n };\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebSocketSubscriptionAPI.cjs","names":["BaseNadoAPI"],"sources":["../../../src/apis/ws/WebSocketSubscriptionAPI.ts"],"sourcesContent":["import {\n EngineServerSubscriptionRequest,\n EngineServerSubscriptionRequestByType,\n EngineServerSubscriptionRequestType,\n EngineServerSubscriptionStream,\n EngineServerSubscriptionStreamParamsByType,\n EngineServerSubscriptionStreamParamsType,\n} from '@nadohq/engine-client';\nimport { BaseNadoAPI } from '../base';\n\n/**\n * Builds subscription messages as expected by the server to send over Websocket.\n *\n * @example\n * const tradeSubscriptionParams = nadoClient.ws.subscription.buildSubscriptionParams('trade', ...);\n * const tradeSubscriptionMessage = nadoClient.ws.subscription.buildSubscriptionMessage(\n * 'subscribe', tradeSubscriptionParams);\n */\nexport class WebSocketSubscriptionAPI extends BaseNadoAPI {\n /**\n * Builds a subscription request message as expected by the server via Websocket.\n * @param requestType name of request to build message for.\n * @param id identifier to associate messages with responses.\n * @param params request message params.\n * @returns subscription request message.\n */\n public buildSubscriptionMessage<\n TRequestType extends EngineServerSubscriptionRequestType,\n >(\n id: number,\n requestType: TRequestType,\n params: EngineServerSubscriptionRequestByType[TRequestType],\n ): EngineServerSubscriptionRequest<TRequestType> {\n return {\n id,\n method: requestType,\n ...params,\n };\n }\n\n /**\n * Builds a subscription stream param as expected by the server via Websocket.\n * @param streamType name of stream to build params for.\n * @param params\n * @returns subscription stream params.\n */\n public buildSubscriptionParams<\n TStreamType extends EngineServerSubscriptionStreamParamsType,\n >(\n streamType: TStreamType,\n params: EngineServerSubscriptionStreamParamsByType[TStreamType],\n ): {\n stream: EngineServerSubscriptionStream<TStreamType>;\n } {\n return {\n stream: {\n type: streamType,\n ...params,\n },\n };\n }\n}\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,2BAAb,cAA8CA,kBAAAA,YAAY;;;;;;;;CAQxD,yBAGE,IACA,aACA,QAC+C;EAC/C,OAAO;GACL;GACA,QAAQ;GACR,GAAG;EACL;CACF;;;;;;;CAQA,wBAGE,YACA,QAGA;EACA,OAAO,EACL,QAAQ;GACN,MAAM;GACN,GAAG;EACL,EACF;CACF;AACF"}
|
|
@@ -1,37 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import '@nadohq/shared';
|
|
4
|
-
import '../../context.cjs';
|
|
5
|
-
import '@nadohq/indexer-client';
|
|
6
|
-
import '@nadohq/trigger-client';
|
|
7
|
-
import 'viem';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Builds subscription messages as expected by the server to send over Websocket.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* const tradeSubscriptionParams = nadoClient.ws.subscription.buildSubscriptionParams('trade', ...);
|
|
14
|
-
* const tradeSubscriptionMessage = nadoClient.ws.subscription.buildSubscriptionMessage(
|
|
15
|
-
* 'subscribe', tradeSubscriptionParams);
|
|
16
|
-
*/
|
|
17
|
-
declare class WebSocketSubscriptionAPI extends BaseNadoAPI {
|
|
18
|
-
/**
|
|
19
|
-
* Builds a subscription request message as expected by the server via Websocket.
|
|
20
|
-
* @param requestType name of request to build message for.
|
|
21
|
-
* @param id identifier to associate messages with responses.
|
|
22
|
-
* @param params request message params.
|
|
23
|
-
* @returns subscription request message.
|
|
24
|
-
*/
|
|
25
|
-
buildSubscriptionMessage<TRequestType extends EngineServerSubscriptionRequestType>(id: number, requestType: TRequestType, params: EngineServerSubscriptionRequestByType[TRequestType]): EngineServerSubscriptionRequest<TRequestType>;
|
|
26
|
-
/**
|
|
27
|
-
* Builds a subscription stream param as expected by the server via Websocket.
|
|
28
|
-
* @param streamType name of stream to build params for.
|
|
29
|
-
* @param params
|
|
30
|
-
* @returns subscription stream params.
|
|
31
|
-
*/
|
|
32
|
-
buildSubscriptionParams<TStreamType extends EngineServerSubscriptionStreamParamsType>(streamType: TStreamType, params: EngineServerSubscriptionStreamParamsByType[TStreamType]): {
|
|
33
|
-
stream: EngineServerSubscriptionStream<TStreamType>;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { WebSocketSubscriptionAPI };
|
|
1
|
+
import { t as WebSocketSubscriptionAPI } from "../../WebSocketSubscriptionAPI-bApRHac8.cjs";
|
|
2
|
+
export { WebSocketSubscriptionAPI };
|
|
@@ -1,37 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import '@nadohq/shared';
|
|
4
|
-
import '../../context.js';
|
|
5
|
-
import '@nadohq/indexer-client';
|
|
6
|
-
import '@nadohq/trigger-client';
|
|
7
|
-
import 'viem';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Builds subscription messages as expected by the server to send over Websocket.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* const tradeSubscriptionParams = nadoClient.ws.subscription.buildSubscriptionParams('trade', ...);
|
|
14
|
-
* const tradeSubscriptionMessage = nadoClient.ws.subscription.buildSubscriptionMessage(
|
|
15
|
-
* 'subscribe', tradeSubscriptionParams);
|
|
16
|
-
*/
|
|
17
|
-
declare class WebSocketSubscriptionAPI extends BaseNadoAPI {
|
|
18
|
-
/**
|
|
19
|
-
* Builds a subscription request message as expected by the server via Websocket.
|
|
20
|
-
* @param requestType name of request to build message for.
|
|
21
|
-
* @param id identifier to associate messages with responses.
|
|
22
|
-
* @param params request message params.
|
|
23
|
-
* @returns subscription request message.
|
|
24
|
-
*/
|
|
25
|
-
buildSubscriptionMessage<TRequestType extends EngineServerSubscriptionRequestType>(id: number, requestType: TRequestType, params: EngineServerSubscriptionRequestByType[TRequestType]): EngineServerSubscriptionRequest<TRequestType>;
|
|
26
|
-
/**
|
|
27
|
-
* Builds a subscription stream param as expected by the server via Websocket.
|
|
28
|
-
* @param streamType name of stream to build params for.
|
|
29
|
-
* @param params
|
|
30
|
-
* @returns subscription stream params.
|
|
31
|
-
*/
|
|
32
|
-
buildSubscriptionParams<TStreamType extends EngineServerSubscriptionStreamParamsType>(streamType: TStreamType, params: EngineServerSubscriptionStreamParamsByType[TStreamType]): {
|
|
33
|
-
stream: EngineServerSubscriptionStream<TStreamType>;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { WebSocketSubscriptionAPI };
|
|
1
|
+
import { t as WebSocketSubscriptionAPI } from "../../WebSocketSubscriptionAPI-qUFRFcRI.js";
|
|
2
|
+
export { WebSocketSubscriptionAPI };
|
|
@@ -1,36 +1,42 @@
|
|
|
1
|
-
// src/apis/ws/WebSocketSubscriptionAPI.ts
|
|
2
1
|
import { BaseNadoAPI } from "../base.js";
|
|
2
|
+
//#region src/apis/ws/WebSocketSubscriptionAPI.ts
|
|
3
|
+
/**
|
|
4
|
+
* Builds subscription messages as expected by the server to send over Websocket.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const tradeSubscriptionParams = nadoClient.ws.subscription.buildSubscriptionParams('trade', ...);
|
|
8
|
+
* const tradeSubscriptionMessage = nadoClient.ws.subscription.buildSubscriptionMessage(
|
|
9
|
+
* 'subscribe', tradeSubscriptionParams);
|
|
10
|
+
*/
|
|
3
11
|
var WebSocketSubscriptionAPI = class extends BaseNadoAPI {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
export {
|
|
34
|
-
WebSocketSubscriptionAPI
|
|
12
|
+
/**
|
|
13
|
+
* Builds a subscription request message as expected by the server via Websocket.
|
|
14
|
+
* @param requestType name of request to build message for.
|
|
15
|
+
* @param id identifier to associate messages with responses.
|
|
16
|
+
* @param params request message params.
|
|
17
|
+
* @returns subscription request message.
|
|
18
|
+
*/
|
|
19
|
+
buildSubscriptionMessage(id, requestType, params) {
|
|
20
|
+
return {
|
|
21
|
+
id,
|
|
22
|
+
method: requestType,
|
|
23
|
+
...params
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Builds a subscription stream param as expected by the server via Websocket.
|
|
28
|
+
* @param streamType name of stream to build params for.
|
|
29
|
+
* @param params
|
|
30
|
+
* @returns subscription stream params.
|
|
31
|
+
*/
|
|
32
|
+
buildSubscriptionParams(streamType, params) {
|
|
33
|
+
return { stream: {
|
|
34
|
+
type: streamType,
|
|
35
|
+
...params
|
|
36
|
+
} };
|
|
37
|
+
}
|
|
35
38
|
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { WebSocketSubscriptionAPI };
|
|
41
|
+
|
|
36
42
|
//# sourceMappingURL=WebSocketSubscriptionAPI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/apis/ws/WebSocketSubscriptionAPI.ts"],"sourcesContent":["import {\n EngineServerSubscriptionRequest,\n EngineServerSubscriptionRequestByType,\n EngineServerSubscriptionRequestType,\n EngineServerSubscriptionStream,\n EngineServerSubscriptionStreamParamsByType,\n EngineServerSubscriptionStreamParamsType,\n} from '@nadohq/engine-client';\nimport { BaseNadoAPI } from '../base';\n\n/**\n * Builds subscription messages as expected by the server to send over Websocket.\n *\n * @example\n * const tradeSubscriptionParams = nadoClient.ws.subscription.buildSubscriptionParams('trade', ...);\n * const tradeSubscriptionMessage = nadoClient.ws.subscription.buildSubscriptionMessage(\n * 'subscribe', tradeSubscriptionParams);\n */\nexport class WebSocketSubscriptionAPI extends BaseNadoAPI {\n /**\n * Builds a subscription request message as expected by the server via Websocket.\n * @param requestType name of request to build message for.\n * @param id identifier to associate messages with responses.\n * @param params request message params.\n * @returns subscription request message.\n */\n public buildSubscriptionMessage<\n TRequestType extends EngineServerSubscriptionRequestType,\n >(\n id: number,\n requestType: TRequestType,\n params: EngineServerSubscriptionRequestByType[TRequestType],\n ): EngineServerSubscriptionRequest<TRequestType> {\n return {\n id,\n method: requestType,\n ...params,\n };\n }\n\n /**\n * Builds a subscription stream param as expected by the server via Websocket.\n * @param streamType name of stream to build params for.\n * @param params\n * @returns subscription stream params.\n */\n public buildSubscriptionParams<\n TStreamType extends EngineServerSubscriptionStreamParamsType,\n >(\n streamType: TStreamType,\n params: EngineServerSubscriptionStreamParamsByType[TStreamType],\n ): {\n stream: EngineServerSubscriptionStream<TStreamType>;\n } {\n return {\n stream: {\n type: streamType,\n ...params,\n },\n };\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebSocketSubscriptionAPI.js","names":[],"sources":["../../../src/apis/ws/WebSocketSubscriptionAPI.ts"],"sourcesContent":["import {\n EngineServerSubscriptionRequest,\n EngineServerSubscriptionRequestByType,\n EngineServerSubscriptionRequestType,\n EngineServerSubscriptionStream,\n EngineServerSubscriptionStreamParamsByType,\n EngineServerSubscriptionStreamParamsType,\n} from '@nadohq/engine-client';\nimport { BaseNadoAPI } from '../base';\n\n/**\n * Builds subscription messages as expected by the server to send over Websocket.\n *\n * @example\n * const tradeSubscriptionParams = nadoClient.ws.subscription.buildSubscriptionParams('trade', ...);\n * const tradeSubscriptionMessage = nadoClient.ws.subscription.buildSubscriptionMessage(\n * 'subscribe', tradeSubscriptionParams);\n */\nexport class WebSocketSubscriptionAPI extends BaseNadoAPI {\n /**\n * Builds a subscription request message as expected by the server via Websocket.\n * @param requestType name of request to build message for.\n * @param id identifier to associate messages with responses.\n * @param params request message params.\n * @returns subscription request message.\n */\n public buildSubscriptionMessage<\n TRequestType extends EngineServerSubscriptionRequestType,\n >(\n id: number,\n requestType: TRequestType,\n params: EngineServerSubscriptionRequestByType[TRequestType],\n ): EngineServerSubscriptionRequest<TRequestType> {\n return {\n id,\n method: requestType,\n ...params,\n };\n }\n\n /**\n * Builds a subscription stream param as expected by the server via Websocket.\n * @param streamType name of stream to build params for.\n * @param params\n * @returns subscription stream params.\n */\n public buildSubscriptionParams<\n TStreamType extends EngineServerSubscriptionStreamParamsType,\n >(\n streamType: TStreamType,\n params: EngineServerSubscriptionStreamParamsByType[TStreamType],\n ): {\n stream: EngineServerSubscriptionStream<TStreamType>;\n } {\n return {\n stream: {\n type: streamType,\n ...params,\n },\n };\n }\n}\n"],"mappings":";;;;;;;;;;AAkBA,IAAa,2BAAb,cAA8C,YAAY;;;;;;;;CAQxD,yBAGE,IACA,aACA,QAC+C;EAC/C,OAAO;GACL;GACA,QAAQ;GACR,GAAG;EACL;CACF;;;;;;;CAQA,wBAGE,YACA,QAGA;EACA,OAAO,EACL,QAAQ;GACN,MAAM;GACN,GAAG;EACL,EACF;CACF;AACF"}
|
package/dist/apis/ws/index.cjs
CHANGED
|
@@ -1,42 +1,21 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_apis_base = require("../base.cjs");
|
|
3
|
+
const require_apis_ws_WebSocketExecuteAPI = require("./WebSocketExecuteAPI.cjs");
|
|
4
|
+
const require_apis_ws_WebSocketQueryAPI = require("./WebSocketQueryAPI.cjs");
|
|
5
|
+
const require_apis_ws_WebSocketSubscriptionAPI = require("./WebSocketSubscriptionAPI.cjs");
|
|
6
|
+
//#region src/apis/ws/index.ts
|
|
7
|
+
/**
|
|
8
|
+
* Builds ws messages as expected by the server to send over Websocket.
|
|
9
|
+
*/
|
|
10
|
+
var WebsocketAPI = class extends require_apis_base.BaseNadoAPI {
|
|
11
|
+
constructor(context) {
|
|
12
|
+
super(context);
|
|
13
|
+
this.query = new require_apis_ws_WebSocketQueryAPI.WebSocketQueryAPI(context);
|
|
14
|
+
this.execute = new require_apis_ws_WebSocketExecuteAPI.WebSocketExecuteAPI(context);
|
|
15
|
+
this.subscription = new require_apis_ws_WebSocketSubscriptionAPI.WebSocketSubscriptionAPI(context);
|
|
16
|
+
}
|
|
9
17
|
};
|
|
10
|
-
|
|
11
|
-
|
|
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);
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.WebsocketAPI = WebsocketAPI;
|
|
19
20
|
|
|
20
|
-
// src/apis/ws/index.ts
|
|
21
|
-
var ws_exports = {};
|
|
22
|
-
__export(ws_exports, {
|
|
23
|
-
WebsocketAPI: () => WebsocketAPI
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(ws_exports);
|
|
26
|
-
var import_base = require("../base.cjs");
|
|
27
|
-
var import_WebSocketExecuteAPI = require("./WebSocketExecuteAPI.cjs");
|
|
28
|
-
var import_WebSocketQueryAPI = require("./WebSocketQueryAPI.cjs");
|
|
29
|
-
var import_WebSocketSubscriptionAPI = require("./WebSocketSubscriptionAPI.cjs");
|
|
30
|
-
var WebsocketAPI = class extends import_base.BaseNadoAPI {
|
|
31
|
-
constructor(context) {
|
|
32
|
-
super(context);
|
|
33
|
-
this.query = new import_WebSocketQueryAPI.WebSocketQueryAPI(context);
|
|
34
|
-
this.execute = new import_WebSocketExecuteAPI.WebSocketExecuteAPI(context);
|
|
35
|
-
this.subscription = new import_WebSocketSubscriptionAPI.WebSocketSubscriptionAPI(context);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
-
0 && (module.exports = {
|
|
40
|
-
WebsocketAPI
|
|
41
|
-
});
|
|
42
21
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/apis/ws/index.ts"],"sourcesContent":["import { NadoClientContext } from '../../context';\nimport { BaseNadoAPI } from '../base';\nimport { WebSocketExecuteAPI } from './WebSocketExecuteAPI';\nimport { WebSocketQueryAPI } from './WebSocketQueryAPI';\nimport { WebSocketSubscriptionAPI } from './WebSocketSubscriptionAPI';\n\n/**\n * Builds ws messages as expected by the server to send over Websocket.\n */\nexport class WebsocketAPI extends BaseNadoAPI {\n readonly query: WebSocketQueryAPI;\n readonly execute: WebSocketExecuteAPI;\n readonly subscription: WebSocketSubscriptionAPI;\n\n constructor(context: NadoClientContext) {\n super(context);\n this.query = new WebSocketQueryAPI(context);\n this.execute = new WebSocketExecuteAPI(context);\n this.subscription = new WebSocketSubscriptionAPI(context);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["BaseNadoAPI","WebSocketQueryAPI","WebSocketExecuteAPI","WebSocketSubscriptionAPI"],"sources":["../../../src/apis/ws/index.ts"],"sourcesContent":["import { NadoClientContext } from '../../context';\nimport { BaseNadoAPI } from '../base';\nimport { WebSocketExecuteAPI } from './WebSocketExecuteAPI';\nimport { WebSocketQueryAPI } from './WebSocketQueryAPI';\nimport { WebSocketSubscriptionAPI } from './WebSocketSubscriptionAPI';\n\n/**\n * Builds ws messages as expected by the server to send over Websocket.\n */\nexport class WebsocketAPI extends BaseNadoAPI {\n readonly query: WebSocketQueryAPI;\n readonly execute: WebSocketExecuteAPI;\n readonly subscription: WebSocketSubscriptionAPI;\n\n constructor(context: NadoClientContext) {\n super(context);\n this.query = new WebSocketQueryAPI(context);\n this.execute = new WebSocketExecuteAPI(context);\n this.subscription = new WebSocketSubscriptionAPI(context);\n }\n}\n"],"mappings":";;;;;;;;;AASA,IAAa,eAAb,cAAkCA,kBAAAA,YAAY;CAK5C,YAAY,SAA4B;EACtC,MAAM,OAAO;EACb,KAAK,QAAQ,IAAIC,kCAAAA,kBAAkB,OAAO;EAC1C,KAAK,UAAU,IAAIC,oCAAAA,oBAAoB,OAAO;EAC9C,KAAK,eAAe,IAAIC,yCAAAA,yBAAyB,OAAO;CAC1D;AACF"}
|
package/dist/apis/ws/index.d.cts
CHANGED
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { WebSocketExecuteAPI } from './WebSocketExecuteAPI.cjs';
|
|
4
|
-
import { WebSocketQueryAPI } from './WebSocketQueryAPI.cjs';
|
|
5
|
-
import { WebSocketSubscriptionAPI } from './WebSocketSubscriptionAPI.cjs';
|
|
6
|
-
import '@nadohq/engine-client';
|
|
7
|
-
import '@nadohq/indexer-client';
|
|
8
|
-
import '@nadohq/shared';
|
|
9
|
-
import '@nadohq/trigger-client';
|
|
10
|
-
import 'viem';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Builds ws messages as expected by the server to send over Websocket.
|
|
14
|
-
*/
|
|
15
|
-
declare class WebsocketAPI extends BaseNadoAPI {
|
|
16
|
-
readonly query: WebSocketQueryAPI;
|
|
17
|
-
readonly execute: WebSocketExecuteAPI;
|
|
18
|
-
readonly subscription: WebSocketSubscriptionAPI;
|
|
19
|
-
constructor(context: NadoClientContext);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { WebsocketAPI };
|
|
1
|
+
import { t as WebsocketAPI } from "../../index-Cc2RdeRK.cjs";
|
|
2
|
+
export { WebsocketAPI };
|
package/dist/apis/ws/index.d.ts
CHANGED
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { WebSocketExecuteAPI } from './WebSocketExecuteAPI.js';
|
|
4
|
-
import { WebSocketQueryAPI } from './WebSocketQueryAPI.js';
|
|
5
|
-
import { WebSocketSubscriptionAPI } from './WebSocketSubscriptionAPI.js';
|
|
6
|
-
import '@nadohq/engine-client';
|
|
7
|
-
import '@nadohq/indexer-client';
|
|
8
|
-
import '@nadohq/shared';
|
|
9
|
-
import '@nadohq/trigger-client';
|
|
10
|
-
import 'viem';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Builds ws messages as expected by the server to send over Websocket.
|
|
14
|
-
*/
|
|
15
|
-
declare class WebsocketAPI extends BaseNadoAPI {
|
|
16
|
-
readonly query: WebSocketQueryAPI;
|
|
17
|
-
readonly execute: WebSocketExecuteAPI;
|
|
18
|
-
readonly subscription: WebSocketSubscriptionAPI;
|
|
19
|
-
constructor(context: NadoClientContext);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { WebsocketAPI };
|
|
1
|
+
import { t as WebsocketAPI } from "../../index-RtQYDuRY.js";
|
|
2
|
+
export { WebsocketAPI };
|
package/dist/apis/ws/index.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
// src/apis/ws/index.ts
|
|
2
1
|
import { BaseNadoAPI } from "../base.js";
|
|
3
2
|
import { WebSocketExecuteAPI } from "./WebSocketExecuteAPI.js";
|
|
4
3
|
import { WebSocketQueryAPI } from "./WebSocketQueryAPI.js";
|
|
5
4
|
import { WebSocketSubscriptionAPI } from "./WebSocketSubscriptionAPI.js";
|
|
5
|
+
//#region src/apis/ws/index.ts
|
|
6
|
+
/**
|
|
7
|
+
* Builds ws messages as expected by the server to send over Websocket.
|
|
8
|
+
*/
|
|
6
9
|
var WebsocketAPI = class extends BaseNadoAPI {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
WebsocketAPI
|
|
10
|
+
constructor(context) {
|
|
11
|
+
super(context);
|
|
12
|
+
this.query = new WebSocketQueryAPI(context);
|
|
13
|
+
this.execute = new WebSocketExecuteAPI(context);
|
|
14
|
+
this.subscription = new WebSocketSubscriptionAPI(context);
|
|
15
|
+
}
|
|
16
16
|
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { WebsocketAPI };
|
|
19
|
+
|
|
17
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/apis/ws/index.ts"],"sourcesContent":["import { NadoClientContext } from '../../context';\nimport { BaseNadoAPI } from '../base';\nimport { WebSocketExecuteAPI } from './WebSocketExecuteAPI';\nimport { WebSocketQueryAPI } from './WebSocketQueryAPI';\nimport { WebSocketSubscriptionAPI } from './WebSocketSubscriptionAPI';\n\n/**\n * Builds ws messages as expected by the server to send over Websocket.\n */\nexport class WebsocketAPI extends BaseNadoAPI {\n readonly query: WebSocketQueryAPI;\n readonly execute: WebSocketExecuteAPI;\n readonly subscription: WebSocketSubscriptionAPI;\n\n constructor(context: NadoClientContext) {\n super(context);\n this.query = new WebSocketQueryAPI(context);\n this.execute = new WebSocketExecuteAPI(context);\n this.subscription = new WebSocketSubscriptionAPI(context);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/apis/ws/index.ts"],"sourcesContent":["import { NadoClientContext } from '../../context';\nimport { BaseNadoAPI } from '../base';\nimport { WebSocketExecuteAPI } from './WebSocketExecuteAPI';\nimport { WebSocketQueryAPI } from './WebSocketQueryAPI';\nimport { WebSocketSubscriptionAPI } from './WebSocketSubscriptionAPI';\n\n/**\n * Builds ws messages as expected by the server to send over Websocket.\n */\nexport class WebsocketAPI extends BaseNadoAPI {\n readonly query: WebSocketQueryAPI;\n readonly execute: WebSocketExecuteAPI;\n readonly subscription: WebSocketSubscriptionAPI;\n\n constructor(context: NadoClientContext) {\n super(context);\n this.query = new WebSocketQueryAPI(context);\n this.execute = new WebSocketExecuteAPI(context);\n this.subscription = new WebSocketSubscriptionAPI(context);\n }\n}\n"],"mappings":";;;;;;;;AASA,IAAa,eAAb,cAAkC,YAAY;CAK5C,YAAY,SAA4B;EACtC,MAAM,OAAO;EACb,KAAK,QAAQ,IAAI,kBAAkB,OAAO;EAC1C,KAAK,UAAU,IAAI,oBAAoB,OAAO;EAC9C,KAAK,eAAe,IAAI,yBAAyB,OAAO;CAC1D;AACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { r as NadoClientContext } from "./context-YfcGQ0Sr.js";
|
|
2
|
+
import { WithContracts } from "@nadohq/shared";
|
|
3
|
+
|
|
4
|
+
//#region src/apis/base.d.ts
|
|
5
|
+
declare class BaseNadoAPI {
|
|
6
|
+
readonly context: NadoClientContext;
|
|
7
|
+
constructor(context: NadoClientContext);
|
|
8
|
+
protected getWalletClientAddress(): `0x${string}`;
|
|
9
|
+
protected getWalletClientChainIdIfNeeded(params: {
|
|
10
|
+
chainId?: number;
|
|
11
|
+
}): number;
|
|
12
|
+
protected getEndpointAddress(): `0x${string}`;
|
|
13
|
+
protected getSubaccountOwnerIfNeeded(params: {
|
|
14
|
+
subaccountOwner?: string;
|
|
15
|
+
}): string;
|
|
16
|
+
protected paramsWithContracts<T>(params: T): WithContracts<T>;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { BaseNadoAPI as t };
|
|
20
|
+
//# sourceMappingURL=base-B92wTsrc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-B92wTsrc.d.ts","names":[],"sources":["../src/apis/src/apis/base.ts"],"mappings":";;;;cAIa,WAAA;EAAA,SACF,OAAA,EAAS,iBAAA;cAEN,OAAA,EAAS,iBAAA;EAAA,UAIX,sBAAA,CAAA;EAAA,UAOA,8BAAA,CAA+B,MAAA;IACvC,OAAA;EAAA;EAAA,UAWQ,kBAAA,CAAA;EAAA,UAIA,0BAAA,CAA2B,MAAA;IACnC,eAAA;EAAA;EAAA,UAKQ,mBAAA,GAAA,CAAuB,MAAA,EAAQ,CAAA,GAAI,aAAA,CAAc,CAAA;AAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { r as NadoClientContext } from "./context-YHVv2kD4.cjs";
|
|
2
|
+
import { WithContracts } from "@nadohq/shared";
|
|
3
|
+
|
|
4
|
+
//#region src/apis/base.d.ts
|
|
5
|
+
declare class BaseNadoAPI {
|
|
6
|
+
readonly context: NadoClientContext;
|
|
7
|
+
constructor(context: NadoClientContext);
|
|
8
|
+
protected getWalletClientAddress(): `0x${string}`;
|
|
9
|
+
protected getWalletClientChainIdIfNeeded(params: {
|
|
10
|
+
chainId?: number;
|
|
11
|
+
}): number;
|
|
12
|
+
protected getEndpointAddress(): `0x${string}`;
|
|
13
|
+
protected getSubaccountOwnerIfNeeded(params: {
|
|
14
|
+
subaccountOwner?: string;
|
|
15
|
+
}): string;
|
|
16
|
+
protected paramsWithContracts<T>(params: T): WithContracts<T>;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { BaseNadoAPI as t };
|
|
20
|
+
//# sourceMappingURL=base-BYkH_-5-.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-BYkH_-5-.d.cts","names":[],"sources":["../src/apis/src/apis/base.ts"],"mappings":";;;;cAIa,WAAA;EAAA,SACF,OAAA,EAAS,iBAAA;cAEN,OAAA,EAAS,iBAAA;EAAA,UAIX,sBAAA,CAAA;EAAA,UAOA,8BAAA,CAA+B,MAAA;IACvC,OAAA;EAAA;EAAA,UAWQ,kBAAA,CAAA;EAAA,UAIA,0BAAA,CAA2B,MAAA;IACnC,eAAA;EAAA;EAAA,UAKQ,mBAAA,GAAA,CAAuB,MAAA,EAAQ,CAAA,GAAI,aAAA,CAAc,CAAA;AAAA"}
|
package/dist/client.cjs
CHANGED
|
@@ -1,80 +1,56 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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/client.ts
|
|
21
|
-
var client_exports = {};
|
|
22
|
-
__export(client_exports, {
|
|
23
|
-
NadoClient: () => NadoClient
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(client_exports);
|
|
26
|
-
var import_market = require("./apis/market/index.cjs");
|
|
27
|
-
var import_perp = require("./apis/perp/index.cjs");
|
|
28
|
-
var import_spot = require("./apis/spot/index.cjs");
|
|
29
|
-
var import_subaccount = require("./apis/subaccount/index.cjs");
|
|
30
|
-
var import_ws = require("./apis/ws/index.cjs");
|
|
31
|
-
var import_context = require("./context.cjs");
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_apis_market_index = require("./apis/market/index.cjs");
|
|
3
|
+
const require_apis_perp_index = require("./apis/perp/index.cjs");
|
|
4
|
+
const require_apis_spot_index = require("./apis/spot/index.cjs");
|
|
5
|
+
const require_apis_subaccount_index = require("./apis/subaccount/index.cjs");
|
|
6
|
+
const require_apis_ws_index = require("./apis/ws/index.cjs");
|
|
7
|
+
const require_context = require("./context.cjs");
|
|
8
|
+
//#region src/client.ts
|
|
9
|
+
/**
|
|
10
|
+
* Client for querying and executing against Nado Clearinghouse.
|
|
11
|
+
* Usually not instantiated directly. Instead, use {@link createNadoClient:CLIENT}.
|
|
12
|
+
*/
|
|
32
13
|
var NadoClient = class {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.spot = new import_spot.SpotAPI(context);
|
|
72
|
-
this.perp = new import_perp.PerpAPI(context);
|
|
73
|
-
this.ws = new import_ws.WebsocketAPI(context);
|
|
74
|
-
}
|
|
14
|
+
constructor(context) {
|
|
15
|
+
this.setupFromContext(context);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Sets the linked signer for the client. Set to null to revert to the chain signer.
|
|
19
|
+
* @param linkedSignerWalletClient
|
|
20
|
+
*/
|
|
21
|
+
setLinkedSigner(linkedSignerWalletClient) {
|
|
22
|
+
this.context.linkedSignerWalletClient = linkedSignerWalletClient ?? void 0;
|
|
23
|
+
this.context.engineClient.setLinkedSigner(linkedSignerWalletClient);
|
|
24
|
+
this.context.indexerClient.setLinkedSigner(linkedSignerWalletClient);
|
|
25
|
+
this.context.triggerClient.setLinkedSigner(linkedSignerWalletClient);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Sets the WalletClient for the client. Will cause a full reload of the current context.
|
|
29
|
+
* @param walletClient
|
|
30
|
+
*/
|
|
31
|
+
setWalletClient(walletClient) {
|
|
32
|
+
const newContext = require_context.createClientContext({
|
|
33
|
+
contractAddresses: this.context.contractAddresses,
|
|
34
|
+
engineEndpoint: this.context.engineClient.opts.url,
|
|
35
|
+
indexerEndpoint: this.context.indexerClient.opts.url,
|
|
36
|
+
triggerEndpoint: this.context.triggerClient.opts.url
|
|
37
|
+
}, {
|
|
38
|
+
walletClient,
|
|
39
|
+
linkedSignerWalletClient: this.context.linkedSignerWalletClient,
|
|
40
|
+
publicClient: this.context.publicClient
|
|
41
|
+
});
|
|
42
|
+
this.setupFromContext(newContext);
|
|
43
|
+
}
|
|
44
|
+
setupFromContext(context) {
|
|
45
|
+
this.context = context;
|
|
46
|
+
this.market = new require_apis_market_index.MarketAPI(context);
|
|
47
|
+
this.subaccount = new require_apis_subaccount_index.SubaccountAPI(context);
|
|
48
|
+
this.spot = new require_apis_spot_index.SpotAPI(context);
|
|
49
|
+
this.perp = new require_apis_perp_index.PerpAPI(context);
|
|
50
|
+
this.ws = new require_apis_ws_index.WebsocketAPI(context);
|
|
51
|
+
}
|
|
75
52
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
53
|
+
//#endregion
|
|
54
|
+
exports.NadoClient = NadoClient;
|
|
55
|
+
|
|
80
56
|
//# sourceMappingURL=client.cjs.map
|