@n1xyz/nord-ts 0.4.2 → 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 +47 -10
- package/dist/client/NordUser.d.ts +31 -16
- package/dist/gen/nord_pb.d.ts +627 -193
- package/dist/gen/openapi.d.ts +934 -146
- package/dist/index.browser.js +326 -155
- package/dist/index.common.js +329 -158
- package/dist/types.d.ts +26 -87
- package/dist/utils.d.ts +5 -0
- package/dist/websocket/NordWebSocketClient.d.ts +1 -0
- package/package.json +16 -16
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, 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
|
|
@@ -321,13 +323,35 @@ export declare class Nord {
|
|
|
321
323
|
*/
|
|
322
324
|
getAccountPnl(accountId: number, { since, until, startInclusive, pageSize, }?: Readonly<Partial<PagedQuery>>): Promise<AccountPnlInfoPage>;
|
|
323
325
|
/**
|
|
324
|
-
* Get
|
|
326
|
+
* Get profit and loss totals for an account over a time window.
|
|
325
327
|
*
|
|
328
|
+
* @param accountId - Account ID to query
|
|
329
|
+
* @param since - RFC3339 timestamp to start from (inclusive)
|
|
330
|
+
* @param until - RFC3339 timestamp to end at (inclusive)
|
|
331
|
+
* @param marketId - Optional market identifier to scope the totals
|
|
332
|
+
* @returns Per-market pnl totals for the requested window
|
|
333
|
+
* @throws {NordError} If the request fails
|
|
334
|
+
*/
|
|
335
|
+
/**
|
|
336
|
+
* Fetch full history of position updates for an account.
|
|
326
337
|
*
|
|
327
|
-
* @param
|
|
328
|
-
*
|
|
329
|
-
* @
|
|
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
|
|
330
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>;
|
|
331
355
|
getMarketStats({ marketId, }: Readonly<{
|
|
332
356
|
marketId: number;
|
|
333
357
|
}>): Promise<MarketStats>;
|
|
@@ -392,7 +416,20 @@ export declare class Nord {
|
|
|
392
416
|
accountId?: number;
|
|
393
417
|
}>): Promise<AccountTriggerInfo[]>;
|
|
394
418
|
/**
|
|
395
|
-
* 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.
|
|
396
433
|
*
|
|
397
434
|
* @param accountId - Account identifier owning the triggers
|
|
398
435
|
* @param since - RFC3339 timestamp to start from (inclusive)
|
|
@@ -401,9 +438,9 @@ export declare class Nord {
|
|
|
401
438
|
* @param startInclusive - Pagination cursor to resume from
|
|
402
439
|
* @throws {NordError} If no account can be resolved or the request fails.
|
|
403
440
|
*/
|
|
404
|
-
|
|
441
|
+
getAccountTriggerFinaliseHistory({ accountId, since, until, pageSize, startInclusive, }: Readonly<PagedQuery & {
|
|
405
442
|
accountId?: number;
|
|
406
|
-
}>): Promise<
|
|
443
|
+
}>): Promise<TriggerFinaliseHistoryPage>;
|
|
407
444
|
/**
|
|
408
445
|
* Fetch withdrawal history for an account.
|
|
409
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;
|
|
@@ -383,14 +399,14 @@ export declare class NordUser {
|
|
|
383
399
|
* @param tokenId - Token identifier to move
|
|
384
400
|
* @param amount - Amount to transfer
|
|
385
401
|
* @param fromAccountId - Source account id
|
|
386
|
-
* @param toAccountId - Destination account id
|
|
402
|
+
* @param toAccountId - Destination account id; omit to create a new owned subaccount
|
|
387
403
|
* @throws {NordError} If the operation fails
|
|
388
404
|
*/
|
|
389
405
|
transferOwned({ tokenId, amount, fromAccountId, toAccountId, }: Readonly<{
|
|
390
406
|
tokenId: number;
|
|
391
407
|
amount: Decimal.Value;
|
|
392
408
|
fromAccountId: number;
|
|
393
|
-
toAccountId
|
|
409
|
+
toAccountId?: number;
|
|
394
410
|
}>): Promise<{
|
|
395
411
|
actionId: bigint;
|
|
396
412
|
newAccountId?: number;
|
|
@@ -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
|
}
|