@n1xyz/nord-ts 0.0.1 → 0.0.4
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/.eslintrc.js +11 -0
- package/README.md +148 -65
- package/dist/bridge/NordUser.d.ts +78 -0
- package/dist/bridge/NordUser.js +196 -0
- package/dist/bridge/client.d.ts +150 -0
- package/dist/bridge/client.js +394 -0
- package/dist/bridge/const.d.ts +23 -0
- package/dist/bridge/const.js +47 -0
- package/dist/bridge/index.d.ts +5 -0
- package/dist/bridge/index.js +23 -0
- package/dist/bridge/types.d.ts +118 -0
- package/dist/bridge/types.js +16 -0
- package/dist/bridge/utils.d.ts +64 -0
- package/dist/bridge/utils.js +131 -0
- package/dist/client.d.ts +70 -0
- package/dist/client.js +129 -0
- package/dist/const.d.ts +2 -5
- package/dist/const.js +18 -22
- package/dist/constants/endpoints.d.ts +65 -0
- package/dist/constants/endpoints.js +68 -0
- package/dist/gen/common.d.ts +6 -1
- package/dist/gen/common.js +19 -9
- package/dist/gen/nord.d.ts +75 -17
- package/dist/gen/nord.js +987 -423
- package/dist/idl/bridge.d.ts +2 -0
- package/dist/idl/bridge.js +703 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.js +18 -2
- package/dist/models/account.d.ts +58 -0
- package/dist/models/account.js +6 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.js +28 -0
- package/dist/models/market.d.ts +137 -0
- package/dist/models/market.js +6 -0
- package/dist/models/order.d.ts +211 -0
- package/dist/models/order.js +6 -0
- package/dist/models/token.d.ts +50 -0
- package/dist/models/token.js +6 -0
- package/dist/nord/Nord.d.ts +222 -49
- package/dist/nord/Nord.js +290 -278
- package/dist/nord/NordError.d.ts +23 -0
- package/dist/nord/NordError.js +48 -0
- package/dist/nord/NordImpl.d.ts +6 -2
- package/dist/nord/NordImpl.js +21 -1
- package/dist/nord/NordUser.d.ts +208 -42
- package/dist/nord/NordUser.js +389 -157
- package/dist/nord/Subscriber.d.ts +37 -0
- package/dist/nord/Subscriber.js +29 -0
- package/dist/nord/api/actions.d.ts +101 -0
- package/dist/nord/api/actions.js +250 -0
- package/dist/nord/api/core.d.ts +49 -0
- package/dist/nord/api/core.js +121 -0
- package/dist/nord/api/index.d.ts +1 -0
- package/dist/nord/api/index.js +17 -0
- package/dist/nord/api/market.d.ts +36 -0
- package/dist/nord/api/market.js +98 -0
- package/dist/nord/api/metrics.d.ts +67 -0
- package/dist/nord/api/metrics.js +132 -0
- package/dist/nord/api/orderFunctions.d.ts +168 -0
- package/dist/nord/api/orderFunctions.js +133 -0
- package/dist/nord/api/queries.d.ts +81 -0
- package/dist/nord/api/queries.js +187 -0
- package/dist/nord/client/Nord.d.ts +335 -0
- package/dist/nord/client/Nord.js +532 -0
- package/dist/nord/client/NordUser.d.ts +320 -0
- package/dist/nord/client/NordUser.js +701 -0
- package/dist/nord/core.d.ts +48 -0
- package/dist/nord/core.js +97 -0
- package/dist/nord/index.d.ts +9 -2
- package/dist/nord/index.js +30 -6
- package/dist/nord/market.d.ts +36 -0
- package/dist/nord/market.js +90 -0
- package/dist/nord/metrics.d.ts +67 -0
- package/dist/nord/metrics.js +124 -0
- package/dist/nord/models/Subscriber.d.ts +37 -0
- package/dist/nord/models/Subscriber.js +29 -0
- package/dist/nord/queries.d.ts +81 -0
- package/dist/nord/queries.js +181 -0
- package/dist/nord/types.d.ts +88 -0
- package/dist/nord/types.js +2 -0
- package/dist/nord/utils/NordError.d.ts +35 -0
- package/dist/nord/utils/NordError.js +46 -0
- package/dist/nord/websocket.d.ts +49 -0
- package/dist/nord/websocket.js +107 -0
- package/dist/operations/account.d.ts +58 -0
- package/dist/operations/account.js +112 -0
- package/dist/operations/market.d.ts +65 -0
- package/dist/operations/market.js +131 -0
- package/dist/operations/orders.d.ts +57 -0
- package/dist/operations/orders.js +129 -0
- package/dist/solana/NordUser.d.ts +78 -0
- package/dist/solana/NordUser.js +196 -0
- package/dist/solana/client.d.ts +139 -0
- package/dist/solana/client.js +360 -0
- package/dist/solana/const.d.ts +23 -0
- package/dist/solana/const.js +47 -0
- package/dist/solana/index.d.ts +5 -0
- package/dist/solana/index.js +23 -0
- package/dist/solana/types.d.ts +118 -0
- package/dist/solana/types.js +16 -0
- package/dist/solana/utils.d.ts +64 -0
- package/dist/solana/utils.js +131 -0
- package/dist/types/api.d.ts +152 -0
- package/dist/types/api.js +6 -0
- package/dist/types/config.d.ts +34 -0
- package/dist/types/config.js +6 -0
- package/dist/types.d.ts +144 -87
- package/dist/types.js +13 -2
- package/dist/utils/errors.d.ts +96 -0
- package/dist/utils/errors.js +132 -0
- package/dist/utils/http.d.ts +35 -0
- package/dist/utils/http.js +105 -0
- package/dist/utils.d.ts +14 -5
- package/dist/utils.js +26 -7
- package/dist/websocket/NordWebSocketClient.d.ts +71 -0
- package/dist/websocket/NordWebSocketClient.js +343 -0
- package/dist/websocket/client.d.ts +93 -0
- package/dist/websocket/client.js +222 -0
- package/dist/websocket/events.d.ts +19 -0
- package/dist/websocket/events.js +2 -0
- package/dist/websocket/index.d.ts +2 -0
- package/dist/websocket/index.js +5 -0
- package/dist/websocket.d.ts +55 -0
- package/dist/websocket.js +211 -0
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Nord.html +2 -15
- package/docs/classes/NordUser.html +4 -4
- package/docs/enums/FillMode.html +2 -2
- package/docs/enums/KeyType.html +2 -2
- package/docs/enums/PeakTpsPeriodUnit.html +2 -2
- package/docs/enums/Side.html +2 -2
- package/docs/functions/assert.html +1 -1
- package/docs/functions/bigIntToProtoU128.html +1 -1
- package/docs/functions/checkPubKeyLength.html +1 -1
- package/docs/functions/checkedFetch.html +1 -1
- package/docs/functions/decodeLengthDelimited.html +1 -1
- package/docs/functions/encodeLengthDelimited.html +1 -1
- package/docs/functions/fillModeToProtoFillMode.html +1 -1
- package/docs/functions/findMarket.html +1 -1
- package/docs/functions/findToken.html +1 -1
- package/docs/functions/makeWalletSignFn.html +1 -1
- package/docs/functions/optExpect.html +1 -1
- package/docs/functions/optMap.html +1 -1
- package/docs/functions/optUnwrap.html +1 -1
- package/docs/functions/panic.html +1 -1
- package/docs/functions/signAction.html +1 -1
- package/docs/functions/toScaledU128.html +1 -1
- package/docs/functions/toScaledU64.html +1 -1
- package/docs/interfaces/Account.html +2 -2
- package/docs/interfaces/ActionInfo.html +2 -2
- package/docs/interfaces/ActionQuery.html +2 -2
- package/docs/interfaces/ActionResponse.html +2 -2
- package/docs/interfaces/ActionsExtendedInfo.html +2 -2
- package/docs/interfaces/ActionsQuery.html +2 -2
- package/docs/interfaces/ActionsResponse.html +2 -2
- package/docs/interfaces/AggregateMetrics.html +2 -2
- package/docs/interfaces/BlockQuery.html +2 -2
- package/docs/interfaces/BlockResponse.html +2 -2
- package/docs/interfaces/BlockSummary.html +2 -2
- package/docs/interfaces/BlockSummaryResponse.html +2 -2
- package/docs/interfaces/DeltaEvent.html +2 -2
- package/docs/interfaces/ERC20TokenInfo.html +2 -2
- package/docs/interfaces/Info.html +2 -2
- package/docs/interfaces/Market.html +2 -2
- package/docs/interfaces/MarketStats.html +2 -2
- package/docs/interfaces/MarketsStatsResponse.html +2 -2
- package/docs/interfaces/NordConfig.html +2 -2
- package/docs/interfaces/Order.html +2 -2
- package/docs/interfaces/OrderInfo.html +2 -2
- package/docs/interfaces/PerpMarketStats.html +2 -2
- package/docs/interfaces/RollmanActionExtendedInfo.html +2 -2
- package/docs/interfaces/RollmanActionInfo.html +2 -2
- package/docs/interfaces/RollmanActionResponse.html +2 -2
- package/docs/interfaces/RollmanActionsResponse.html +2 -2
- package/docs/interfaces/RollmanBlockResponse.html +2 -2
- package/docs/interfaces/SubscriberConfig.html +2 -2
- package/docs/interfaces/Token.html +2 -2
- package/docs/interfaces/Trade.html +2 -2
- package/docs/interfaces/Trades.html +2 -2
- package/docs/modules.html +0 -7
- package/docs/types/BigIntValue.html +1 -1
- package/docs/variables/DEBUG_KEYS.html +1 -1
- package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -1
- package/docs/variables/DEV_CONTRACT_ADDRESS.html +1 -1
- package/docs/variables/DEV_TOKEN_INFOS.html +1 -1
- package/docs/variables/DEV_URL.html +1 -1
- package/docs/variables/ERC20_ABI.html +1 -1
- package/docs/variables/EVM_DEV_URL.html +1 -1
- package/docs/variables/FAUCET_PRIVATE_ADDRESS.html +1 -1
- package/docs/variables/MAX_BUFFER_LEN.html +1 -1
- package/docs/variables/NORD_GETTERS_FACET_ABI.html +1 -1
- package/docs/variables/NORD_RAMP_FACET_ABI.html +1 -1
- package/docs/variables/SESSION_TTL.html +1 -1
- package/docs/variables/WEBSERVER_DEV_URL.html +1 -1
- package/docs/variables/ZERO_DECIMAL.html +1 -1
- package/package.json +10 -12
- package/src/bridge/client.ts +487 -0
- package/src/bridge/const.ts +53 -0
- package/src/bridge/index.ts +7 -0
- package/src/bridge/types.ts +127 -0
- package/src/bridge/utils.ts +140 -0
- package/src/const.ts +20 -25
- package/src/gen/common.ts +27 -10
- package/src/gen/nord.ts +1044 -483
- package/src/idl/bridge.ts +702 -0
- package/src/index.ts +24 -5
- package/src/nord/{actions.ts → api/actions.ts} +33 -37
- package/src/nord/api/core.ts +130 -0
- package/src/nord/api/market.ts +125 -0
- package/src/nord/api/metrics.ts +154 -0
- package/src/nord/api/queries.ts +236 -0
- package/src/nord/client/Nord.ts +652 -0
- package/src/nord/client/NordUser.ts +1105 -0
- package/src/nord/index.ts +16 -2
- package/src/nord/models/Subscriber.ts +57 -0
- package/src/nord/utils/NordError.ts +72 -0
- package/src/types.ts +170 -99
- package/src/utils.ts +40 -19
- package/src/websocket/NordWebSocketClient.ts +432 -0
- package/src/websocket/events.ts +31 -0
- package/src/websocket/index.ts +2 -0
- package/tests/utils.spec.ts +24 -24
- package/docs/classes/Subscriber.html +0 -6
- package/docs/functions/createWebSocketSubscription.html +0 -12
- package/docs/interfaces/OrderbookOrder.html +0 -6
- package/docs/interfaces/OrderbookResponse.html +0 -10
- package/docs/interfaces/TradeInfo.html +0 -20
- package/docs/interfaces/TradesQueryParams.html +0 -10
- package/docs/interfaces/TradesResponse.html +0 -12
- package/src/abis/ERC20_ABI.ts +0 -310
- package/src/abis/NORD_GETTERS_FACET_ABI.ts +0 -192
- package/src/abis/NORD_RAMP_FACET_ABI.ts +0 -141
- package/src/abis/index.ts +0 -3
- package/src/nord/Nord.ts +0 -504
- package/src/nord/NordImpl.ts +0 -8
- package/src/nord/NordUser.ts +0 -469
package/dist/nord/Nord.d.ts
CHANGED
|
@@ -1,76 +1,249 @@
|
|
|
1
|
-
import { ActionQuery, ActionResponse, ActionsResponse, AggregateMetrics, BlockQuery, BlockResponse, BlockSummaryResponse,
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Account, ActionQuery, ActionResponse, ActionsResponse, AggregateMetrics, BlockQuery, BlockResponse, BlockSummaryResponse, Info, Market, MarketsStatsResponse, NordConfig, OrderbookQuery, OrderbookResponse, PeakTpsPeriodUnit, RollmanActionResponse, RollmanActionsResponse, RollmanBlockResponse, Token, TokenInfo, TradesQuery, TradesResponse, UserAccountIdsQuery, UserAccountIdsResponse } from "../types";
|
|
2
|
+
import { NordWebSocketClient } from "../websocket/index";
|
|
3
|
+
import { OrderbookSubscription, TradeSubscription } from "./Subscriber";
|
|
4
|
+
/**
|
|
5
|
+
* Main Nord client class for interacting with the Nord API
|
|
6
|
+
*/
|
|
5
7
|
export declare class Nord {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
/** Base URL for the Nord web server */
|
|
9
|
+
readonly webServerUrl: string;
|
|
10
|
+
/** Token information */
|
|
11
|
+
readonly tokenInfos: TokenInfo[];
|
|
12
|
+
/** Solana program ID */
|
|
13
|
+
readonly solanaProgramId?: string;
|
|
14
|
+
/** Solana RPC URL */
|
|
15
|
+
readonly solanaUrl?: string;
|
|
16
|
+
/** Available markets */
|
|
11
17
|
markets: Market[];
|
|
18
|
+
/** Available tokens */
|
|
12
19
|
tokens: Token[];
|
|
13
|
-
|
|
20
|
+
/** WebSocket client for real-time updates */
|
|
21
|
+
private readonly ws;
|
|
22
|
+
/**
|
|
23
|
+
* Create a new Nord client instance
|
|
24
|
+
*
|
|
25
|
+
* @param config - Configuration options for the Nord client
|
|
26
|
+
* @throws {Error} If required configuration is missing
|
|
27
|
+
*/
|
|
28
|
+
constructor({ webServerUrl, tokenInfos, solanaProgramId, solanaUrl, }: NordConfig);
|
|
29
|
+
/**
|
|
30
|
+
* Get the current timestamp from the Nord server
|
|
31
|
+
*
|
|
32
|
+
* @returns Current timestamp as a bigint
|
|
33
|
+
* @throws {NordError} If the request fails
|
|
34
|
+
*/
|
|
14
35
|
getTimestamp(): Promise<bigint>;
|
|
36
|
+
/**
|
|
37
|
+
* Get the next action nonce from the Nord server
|
|
38
|
+
*
|
|
39
|
+
* @returns Next action nonce
|
|
40
|
+
* @throws {NordError} If the request fails
|
|
41
|
+
*/
|
|
15
42
|
getActionNonce(): Promise<number>;
|
|
43
|
+
/**
|
|
44
|
+
* Fetch information about Nord markets and tokens
|
|
45
|
+
*
|
|
46
|
+
* @throws {NordError} If the request fails
|
|
47
|
+
*/
|
|
16
48
|
fetchNordInfo(): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Initialize a new Nord client
|
|
51
|
+
*
|
|
52
|
+
* @param nordConfig - Configuration options for the Nord client
|
|
53
|
+
* @returns Initialized Nord client
|
|
54
|
+
* @throws {NordError} If initialization fails
|
|
55
|
+
*/
|
|
17
56
|
static initNord(nordConfig: NordConfig): Promise<Nord>;
|
|
18
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Get market statistics
|
|
59
|
+
*
|
|
60
|
+
* @returns Market statistics response
|
|
61
|
+
* @throws {NordError} If the request fails
|
|
62
|
+
*/
|
|
19
63
|
marketsStats(): Promise<MarketsStatsResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* Query a specific block
|
|
66
|
+
*
|
|
67
|
+
* @param query - Block query parameters
|
|
68
|
+
* @returns Block response
|
|
69
|
+
* @throws {NordError} If the request fails
|
|
70
|
+
*/
|
|
20
71
|
queryBlock(query: BlockQuery): Promise<BlockResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* Query the last N blocks
|
|
74
|
+
*
|
|
75
|
+
* @returns Block response for the last N blocks
|
|
76
|
+
* @throws {NordError} If the request fails
|
|
77
|
+
*/
|
|
21
78
|
queryLastNBlocks(): Promise<BlockResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Query recent blocks
|
|
81
|
+
*
|
|
82
|
+
* @param last_n - Number of recent blocks to query
|
|
83
|
+
* @returns Block summary response
|
|
84
|
+
* @throws {NordError} If the request fails
|
|
85
|
+
*/
|
|
22
86
|
queryRecentBlocks(last_n: number): Promise<BlockSummaryResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* Query a specific action
|
|
89
|
+
*
|
|
90
|
+
* @param query - Action query parameters
|
|
91
|
+
* @returns Action response
|
|
92
|
+
* @throws {NordError} If the request fails
|
|
93
|
+
*/
|
|
23
94
|
queryAction(query: ActionQuery): Promise<ActionResponse>;
|
|
95
|
+
/**
|
|
96
|
+
* Query recent actions
|
|
97
|
+
*
|
|
98
|
+
* @param last_n - Number of recent actions to query
|
|
99
|
+
* @returns Actions response
|
|
100
|
+
* @throws {NordError} If the request fails
|
|
101
|
+
*/
|
|
24
102
|
queryRecentActions(last_n: number): Promise<ActionsResponse>;
|
|
103
|
+
/**
|
|
104
|
+
* Fetch aggregate metrics from the Nord API
|
|
105
|
+
*
|
|
106
|
+
* @param txPeakTpsPeriod - Period for peak TPS calculation
|
|
107
|
+
* @param txPeakTpsPeriodUnit - Unit for peak TPS period
|
|
108
|
+
* @returns Aggregate metrics
|
|
109
|
+
* @throws {NordError} If the request fails
|
|
110
|
+
*/
|
|
25
111
|
aggregateMetrics(txPeakTpsPeriod?: number, txPeakTpsPeriodUnit?: PeakTpsPeriodUnit): Promise<AggregateMetrics>;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Get current transactions per second
|
|
114
|
+
*
|
|
115
|
+
* @param period - Time period for the query
|
|
116
|
+
* @returns Current TPS value
|
|
117
|
+
* @throws {NordError} If the request fails
|
|
118
|
+
*/
|
|
119
|
+
getCurrentTps(period?: string): Promise<any>;
|
|
120
|
+
/**
|
|
121
|
+
* Get peak transactions per second
|
|
122
|
+
*
|
|
123
|
+
* @param period - Time period for the query
|
|
124
|
+
* @returns Peak TPS value
|
|
125
|
+
* @throws {NordError} If the request fails
|
|
126
|
+
*/
|
|
127
|
+
getPeakTps(period?: string): Promise<any>;
|
|
128
|
+
/**
|
|
129
|
+
* Get median transaction latency
|
|
130
|
+
*
|
|
131
|
+
* @param period - Time period for the query
|
|
132
|
+
* @returns Median latency in milliseconds
|
|
133
|
+
* @throws {NordError} If the request fails
|
|
134
|
+
*/
|
|
135
|
+
getMedianLatency(period?: string): Promise<any>;
|
|
136
|
+
/**
|
|
137
|
+
* Get total transaction count
|
|
138
|
+
*
|
|
139
|
+
* @returns Total transaction count
|
|
140
|
+
* @throws {NordError} If the request fails
|
|
141
|
+
*/
|
|
142
|
+
getTotalTransactions(): Promise<any>;
|
|
143
|
+
/**
|
|
144
|
+
* Query a block from Rollman
|
|
145
|
+
*
|
|
146
|
+
* @param query - Block query parameters
|
|
147
|
+
* @returns Rollman block response
|
|
148
|
+
* @throws {NordError} If the request fails
|
|
149
|
+
*/
|
|
30
150
|
blockQueryRollman(query: BlockQuery): Promise<RollmanBlockResponse>;
|
|
151
|
+
/**
|
|
152
|
+
* Query block summaries from Rollman
|
|
153
|
+
*
|
|
154
|
+
* @param last_n - Number of recent blocks to query
|
|
155
|
+
* @returns Block summary response
|
|
156
|
+
* @throws {NordError} If the request fails
|
|
157
|
+
*/
|
|
31
158
|
blockSummaryQueryRollman(last_n: number): Promise<BlockSummaryResponse>;
|
|
159
|
+
/**
|
|
160
|
+
* Query an action from Rollman
|
|
161
|
+
*
|
|
162
|
+
* @param query - Action query parameters
|
|
163
|
+
* @returns Rollman action response
|
|
164
|
+
* @throws {NordError} If the request fails
|
|
165
|
+
*/
|
|
32
166
|
actionQueryRollman(query: ActionQuery): Promise<RollmanActionResponse>;
|
|
167
|
+
/**
|
|
168
|
+
* Query actions from Rollman
|
|
169
|
+
*
|
|
170
|
+
* @param last_n - Number of recent actions to query
|
|
171
|
+
* @returns Rollman actions response
|
|
172
|
+
* @throws {NordError} If the request fails
|
|
173
|
+
*/
|
|
33
174
|
actionsQueryRollman(last_n: number): Promise<RollmanActionsResponse>;
|
|
175
|
+
/**
|
|
176
|
+
* Query Prometheus metrics
|
|
177
|
+
*
|
|
178
|
+
* @param params - Prometheus query parameters
|
|
179
|
+
* @returns Query result as a number
|
|
180
|
+
* @throws {NordError} If the request fails
|
|
181
|
+
*/
|
|
34
182
|
queryPrometheus(params: string): Promise<number>;
|
|
35
|
-
static approveTx(privateAddress: string, erc20address: string, contractAddress: string): Promise<void>;
|
|
36
183
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @
|
|
40
|
-
* @returns A promise that resolves to an ActionsResponse
|
|
184
|
+
* Get the WebSocket client
|
|
185
|
+
*
|
|
186
|
+
* @returns WebSocket client
|
|
41
187
|
*/
|
|
42
|
-
|
|
188
|
+
getWebSocketClient(): NordWebSocketClient;
|
|
43
189
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* @
|
|
190
|
+
* Subscribe to orderbook updates for a market
|
|
191
|
+
*
|
|
192
|
+
* @param symbol - Market symbol
|
|
193
|
+
* @returns Orderbook subscription
|
|
47
194
|
*/
|
|
48
|
-
|
|
195
|
+
subscribeOrderbook(symbol: string): OrderbookSubscription;
|
|
49
196
|
/**
|
|
50
|
-
*
|
|
197
|
+
* Subscribe to trade updates for a market
|
|
198
|
+
*
|
|
51
199
|
* @param symbol - Market symbol
|
|
52
|
-
* @returns
|
|
200
|
+
* @returns Trade subscription
|
|
53
201
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
202
|
+
subscribeTrades(symbol: string): TradeSubscription;
|
|
203
|
+
/**
|
|
204
|
+
* Get trades for a market
|
|
205
|
+
*
|
|
206
|
+
* @param query - Trades query parameters
|
|
207
|
+
* @returns Trades response
|
|
208
|
+
* @throws {NordError} If the request fails
|
|
209
|
+
*/
|
|
210
|
+
getTrades(query: TradesQuery): Promise<TradesResponse>;
|
|
211
|
+
/**
|
|
212
|
+
* Get user account IDs
|
|
213
|
+
*
|
|
214
|
+
* @param query - User account IDs query parameters
|
|
215
|
+
* @returns User account IDs response
|
|
216
|
+
* @throws {NordError} If the request fails
|
|
217
|
+
*/
|
|
218
|
+
getUserAccountIds(query: UserAccountIdsQuery): Promise<UserAccountIdsResponse>;
|
|
219
|
+
/**
|
|
220
|
+
* Get orderbook for a market
|
|
221
|
+
*
|
|
222
|
+
* @param query - Orderbook query parameters
|
|
223
|
+
* @returns Orderbook response
|
|
224
|
+
* @throws {NordError} If the request fails
|
|
225
|
+
*/
|
|
226
|
+
getOrderbook(query: OrderbookQuery): Promise<OrderbookResponse>;
|
|
227
|
+
/**
|
|
228
|
+
* Get information about the Nord server
|
|
229
|
+
*
|
|
230
|
+
* @returns Information about markets and tokens
|
|
231
|
+
* @throws {NordError} If the request fails
|
|
232
|
+
*/
|
|
233
|
+
getInfo(): Promise<Info>;
|
|
234
|
+
/**
|
|
235
|
+
* Get account information
|
|
236
|
+
*
|
|
237
|
+
* @param accountId - Account ID to get information for
|
|
238
|
+
* @returns Account information
|
|
239
|
+
* @throws {NordError} If the request fails
|
|
240
|
+
*/
|
|
241
|
+
getAccount(accountId: number): Promise<Account>;
|
|
242
|
+
/**
|
|
243
|
+
* Get market statistics (alias for marketsStats for backward compatibility)
|
|
244
|
+
*
|
|
245
|
+
* @deprecated Use marketsStats instead
|
|
246
|
+
* @returns Market statistics response
|
|
247
|
+
*/
|
|
248
|
+
getMarketStats(): Promise<MarketsStatsResponse>;
|
|
62
249
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Creates a WebSocket subscription to specified streams
|
|
65
|
-
* @param baseUrl - Base URL of the API
|
|
66
|
-
* @param streams - Array of streams to subscribe to
|
|
67
|
-
* @returns A Subscriber instance
|
|
68
|
-
*
|
|
69
|
-
* Syntax for streams:
|
|
70
|
-
* - trades@<symbol>: Subscribe to trades for a market
|
|
71
|
-
* - deltas@<symbol>: Subscribe to orderbook deltas for a market
|
|
72
|
-
* - user@<user id>: Subscribe to user account updates
|
|
73
|
-
*
|
|
74
|
-
* Example: createWebSocketSubscription('https://alpha-api.layern.network', ['trades@BTCUSDC', 'deltas@BTCUSDC', 'user@0'])
|
|
75
|
-
*/
|
|
76
|
-
export declare function createWebSocketSubscription(baseUrl: string, streams: string[]): Subscriber;
|