@n1xyz/nord-ts 0.4.3 → 0.5.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/actions.d.ts +3 -0
- package/dist/client/Nord.d.ts +38 -12
- package/dist/client/NordUser.d.ts +29 -14
- package/dist/gen/nord_pb.d.ts +621 -193
- package/dist/gen/openapi.d.ts +484 -97
- package/dist/index.browser.js +298 -149
- package/dist/index.common.js +301 -152
- package/dist/types.d.ts +7 -2
- package/dist/utils.d.ts +5 -0
- package/dist/websocket/NordWebSocketClient.d.ts +1 -0
- package/package.json +1 -1
package/dist/actions.d.ts
CHANGED
|
@@ -53,12 +53,15 @@ export type AtomicSubaction = {
|
|
|
53
53
|
price?: Decimal.Value;
|
|
54
54
|
quoteSize?: Decimal.Value;
|
|
55
55
|
clientOrderId?: BigIntValue;
|
|
56
|
+
delegatorAccountId?: number;
|
|
56
57
|
} | {
|
|
57
58
|
kind: "cancel";
|
|
58
59
|
orderId: BigIntValue;
|
|
60
|
+
delegatorAccountId?: number;
|
|
59
61
|
} | {
|
|
60
62
|
kind: "cancelByClientId";
|
|
61
63
|
clientOrderId: BigIntValue;
|
|
64
|
+
delegatorAccountId?: number;
|
|
62
65
|
};
|
|
63
66
|
export declare function atomic(client: Client<paths>, signFn: (message: Uint8Array) => Promise<Uint8Array>, currentTimestamp: bigint, nonce: number, params: {
|
|
64
67
|
sessionId: BigIntValue;
|
package/dist/client/Nord.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Connection, PublicKey } from "@solana/web3.js";
|
|
|
3
3
|
import { EventEmitter } from "events";
|
|
4
4
|
import { Client } from "openapi-fetch";
|
|
5
5
|
import type { paths } from "../gen/openapi.ts";
|
|
6
|
-
import { Account, AccountPnlInfoPage, AccountPnlSummaryResult, GetAccountPnlQuery, PagedQuery, ActionResponse, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, Token, TradesResponse, User, AccountTriggerInfo,
|
|
6
|
+
import { Account, AccountPnlInfoPage, AccountPositionInfoPage, AccountPnlSummaryResult, GetAccountPnlQuery, PagedQuery, ActionResponse, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, Token, TradesResponse, User, AccountTriggerInfo, TriggerPlaceHistoryPage, TriggerFinaliseHistoryPage, WithdrawalHistoryPage, FeeTierId, AccountFeeTierPage, PageResultStringOrderInfo, PageResultStringTrade, OrderInfoFromApi, TokenStats, FillRole, AdminInfo, AccountVolumeInfo, GetAccountVolumeQuery, CandleResolution, TakeAllInfo, MarketsLiveInfo, MarketLiveInfo } from "../types";
|
|
7
7
|
import { NordWebSocketClient } from "../websocket/index";
|
|
8
8
|
import { OrderbookSubscription, TradeSubscription, CandleSubscription } from "../websocket/Subscriber";
|
|
9
9
|
/**
|
|
@@ -202,11 +202,12 @@ export declare class Nord {
|
|
|
202
202
|
* @param pageSize - Maximum number of trades to return
|
|
203
203
|
* @param since - RFC3339 timestamp to start from (inclusive)
|
|
204
204
|
* @param until - RFC3339 timestamp to end at (exclusive)
|
|
205
|
-
* @param
|
|
205
|
+
* @param startInclusive - Pagination cursor returned from a prior call. Interpreted as a trade ID by default, or an action ID when paginationMode is "actionId".
|
|
206
|
+
* @param paginationMode - Selects whether pagination cursors are trade IDs or action IDs
|
|
206
207
|
* @returns Trades response
|
|
207
208
|
* @throws {NordError} If the request fails
|
|
208
209
|
*/
|
|
209
|
-
getTrades({ marketId, takerId, makerId, takerSide, pageSize, since, until, startInclusive, }: Readonly<{
|
|
210
|
+
getTrades({ marketId, takerId, makerId, takerSide, pageSize, since, until, startInclusive, paginationMode, }: Readonly<{
|
|
210
211
|
marketId?: number;
|
|
211
212
|
takerId?: number;
|
|
212
213
|
makerId?: number;
|
|
@@ -215,6 +216,7 @@ export declare class Nord {
|
|
|
215
216
|
since?: string;
|
|
216
217
|
until?: string;
|
|
217
218
|
startInclusive?: number;
|
|
219
|
+
paginationMode?: "tradeId" | "actionId";
|
|
218
220
|
}>): Promise<TradesResponse>;
|
|
219
221
|
/**
|
|
220
222
|
* Get user account IDs
|
|
@@ -330,15 +332,26 @@ export declare class Nord {
|
|
|
330
332
|
* @returns Per-market pnl totals for the requested window
|
|
331
333
|
* @throws {NordError} If the request fails
|
|
332
334
|
*/
|
|
333
|
-
getAccountPnlSummary(accountId: number, { since, until, marketId }?: Readonly<Partial<GetAccountPnlQuery>>): Promise<AccountPnlSummaryResult>;
|
|
334
335
|
/**
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* @param marketId - Market identifier
|
|
336
|
+
* Fetch full history of position updates for an account.
|
|
339
337
|
*
|
|
340
|
-
* @
|
|
338
|
+
* @param accountId - Account ID to query
|
|
339
|
+
* @param since - RFC3339 timestamp to start from (inclusive)
|
|
340
|
+
* @param until - RFC3339 timestamp to end at (inclusive)
|
|
341
|
+
* @param marketId - Optional market identifier to scope the totals
|
|
342
|
+
* @param pageSize - Maximum number of entries to return
|
|
343
|
+
* @param startInclusive - Pagination cursor to resume from
|
|
344
|
+
* @returns History of position updates
|
|
345
|
+
* @throws {NordError} If the request fails
|
|
341
346
|
*/
|
|
347
|
+
getAccountPositionHistory(accountId: number, { since, until, marketId, pageSize, startInclusive, }?: Readonly<Partial<GetAccountPnlQuery & Omit<PagedQuery, "startInclusive">> & {
|
|
348
|
+
startInclusive?: string;
|
|
349
|
+
}>): Promise<AccountPositionInfoPage>;
|
|
350
|
+
getAccountPnlSummary(accountId: number, { since, until, marketId }?: Readonly<Partial<GetAccountPnlQuery>>): Promise<AccountPnlSummaryResult>;
|
|
351
|
+
getMarketsLive(): Promise<MarketsLiveInfo>;
|
|
352
|
+
getMarketLive({ marketId, }: Readonly<{
|
|
353
|
+
marketId: number;
|
|
354
|
+
}>): Promise<MarketLiveInfo>;
|
|
342
355
|
getMarketStats({ marketId, }: Readonly<{
|
|
343
356
|
marketId: number;
|
|
344
357
|
}>): Promise<MarketStats>;
|
|
@@ -403,7 +416,20 @@ export declare class Nord {
|
|
|
403
416
|
accountId?: number;
|
|
404
417
|
}>): Promise<AccountTriggerInfo[]>;
|
|
405
418
|
/**
|
|
406
|
-
* Fetch trigger history for an account.
|
|
419
|
+
* Fetch trigger placement history for an account.
|
|
420
|
+
*
|
|
421
|
+
* @param accountId - Account identifier owning the triggers
|
|
422
|
+
* @param since - RFC3339 timestamp to start from (inclusive)
|
|
423
|
+
* @param until - RFC3339 timestamp to end at (exclusive)
|
|
424
|
+
* @param pageSize - Maximum number of entries to return
|
|
425
|
+
* @param startInclusive - Pagination cursor to resume from
|
|
426
|
+
* @throws {NordError} If no account can be resolved or the request fails.
|
|
427
|
+
*/
|
|
428
|
+
getAccountTriggerPlaceHistory({ accountId, since, until, pageSize, startInclusive, }: Readonly<PagedQuery & {
|
|
429
|
+
accountId?: number;
|
|
430
|
+
}>): Promise<TriggerPlaceHistoryPage>;
|
|
431
|
+
/**
|
|
432
|
+
* Fetch trigger finalisation history for an account.
|
|
407
433
|
*
|
|
408
434
|
* @param accountId - Account identifier owning the triggers
|
|
409
435
|
* @param since - RFC3339 timestamp to start from (inclusive)
|
|
@@ -412,9 +438,9 @@ export declare class Nord {
|
|
|
412
438
|
* @param startInclusive - Pagination cursor to resume from
|
|
413
439
|
* @throws {NordError} If no account can be resolved or the request fails.
|
|
414
440
|
*/
|
|
415
|
-
|
|
441
|
+
getAccountTriggerFinaliseHistory({ accountId, since, until, pageSize, startInclusive, }: Readonly<PagedQuery & {
|
|
416
442
|
accountId?: number;
|
|
417
|
-
}>): Promise<
|
|
443
|
+
}>): Promise<TriggerFinaliseHistoryPage>;
|
|
418
444
|
/**
|
|
419
445
|
* Fetch withdrawal history for an account.
|
|
420
446
|
*
|
|
@@ -28,6 +28,8 @@ export interface UserAtomicSubaction {
|
|
|
28
28
|
quoteSize?: Decimal.Value;
|
|
29
29
|
/** The client order ID of the order. */
|
|
30
30
|
clientOrderId?: BigIntValue;
|
|
31
|
+
/** Optional account to delegate this subaction to. */
|
|
32
|
+
delegatorAccountId?: number;
|
|
31
33
|
}
|
|
32
34
|
export interface NormalizedReceiptTrade {
|
|
33
35
|
orderId: bigint;
|
|
@@ -328,8 +330,8 @@ export declare class NordUser {
|
|
|
328
330
|
* @returns Object containing the actionId of the submitted trigger
|
|
329
331
|
* @throws {NordError} If the operation fails
|
|
330
332
|
*
|
|
331
|
-
* Trigger identity is
|
|
332
|
-
*
|
|
333
|
+
* Trigger identity is a unique triggerId assigned by engine.
|
|
334
|
+
* Multiple triggers can share the same triggerPrice and limits.
|
|
333
335
|
* If both `limitBaseSize` and `limitQuoteSize` are omitted, trigger executes with max reduce size
|
|
334
336
|
*
|
|
335
337
|
* Max triggers per position: 16
|
|
@@ -345,27 +347,41 @@ export declare class NordUser {
|
|
|
345
347
|
accountId?: number;
|
|
346
348
|
}>): Promise<{
|
|
347
349
|
actionId: bigint;
|
|
350
|
+
triggerId: bigint;
|
|
348
351
|
}>;
|
|
349
352
|
/**
|
|
350
353
|
* Remove a trigger for the current session
|
|
351
354
|
*
|
|
352
355
|
* @param marketId - Market the trigger belongs to
|
|
353
|
-
* @param
|
|
354
|
-
* @param kind - Stop-loss or take-profit trigger type
|
|
355
|
-
* @param triggerPrice - Trigger price of the trigger to remove
|
|
356
|
-
* @param limitPrice - Optional limit price of the trigger to remove
|
|
357
|
-
* @param limitBaseSize - Optional base size limit of the trigger to remove
|
|
358
|
-
* @param limitQuoteSize - Optional quote size limit of the trigger to remove
|
|
356
|
+
* @param triggerId - Unique trigger identifier to remove
|
|
359
357
|
* @param accountId - Account executing the trigger
|
|
360
358
|
* @returns Object containing the actionId of the removal action
|
|
361
359
|
* @throws {NordError} If the operation fails
|
|
360
|
+
*/
|
|
361
|
+
removeTrigger({ marketId, triggerId, accountId, }: Readonly<{
|
|
362
|
+
marketId: number;
|
|
363
|
+
triggerId: bigint;
|
|
364
|
+
accountId?: number;
|
|
365
|
+
}>): Promise<{
|
|
366
|
+
actionId: bigint;
|
|
367
|
+
}>;
|
|
368
|
+
/**
|
|
369
|
+
* Edit an existing trigger for the current session
|
|
362
370
|
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
371
|
+
* @param triggerId - Unique trigger identifier to edit
|
|
372
|
+
* @param marketId - Market to watch
|
|
373
|
+
* @param side - Order side for the trigger
|
|
374
|
+
* @param kind - Stop-loss or take-profit trigger type
|
|
375
|
+
* @param triggerPrice - Price that activates the trigger
|
|
376
|
+
* @param limitPrice - Optional limit price used once the trigger fires
|
|
377
|
+
* @param limitBaseSize - Optional base size limit used once the trigger fires
|
|
378
|
+
* @param limitQuoteSize - Optional quote size limit used once the trigger fires
|
|
379
|
+
* @param accountId - Account executing the trigger
|
|
380
|
+
* @returns Object containing the actionId of the edit action
|
|
381
|
+
* @throws {NordError} If the operation fails
|
|
367
382
|
*/
|
|
368
|
-
|
|
383
|
+
editTrigger({ triggerId, marketId, side, kind, triggerPrice, limitPrice, limitBaseSize, limitQuoteSize, accountId, }: Readonly<{
|
|
384
|
+
triggerId: bigint;
|
|
369
385
|
marketId: number;
|
|
370
386
|
side: Side;
|
|
371
387
|
kind: TriggerKind;
|
|
@@ -473,6 +489,5 @@ export declare class NordUser {
|
|
|
473
489
|
};
|
|
474
490
|
}>;
|
|
475
491
|
protected submitSignedAction(kind: proto.Action["kind"], makeSignedMessage: (message: Uint8Array) => Promise<Uint8Array>): Promise<proto.Receipt>;
|
|
476
|
-
private buildTriggerKey;
|
|
477
492
|
private buildLimits;
|
|
478
493
|
}
|