@n1xyz/nord-ts 0.7.3 → 0.7.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/dist/actions.d.ts CHANGED
@@ -104,18 +104,18 @@ export type AtomicSubaction = (AtomicTarget & ({
104
104
  size: Decimal.Value;
105
105
  timeout?: Duration;
106
106
  clientOrderId?: BigIntValue;
107
- minimumSize?: BigIntValue;
108
- maximumSize?: BigIntValue;
107
+ minimalFill?: Decimal.Value;
109
108
  isReduceOnly?: boolean;
110
109
  } | {
111
110
  kind: "rfqFill";
112
111
  marketId: number;
113
112
  orderId: BigIntValue;
114
113
  priceDecimals: number;
114
+ sizeDecimals: number;
115
115
  price: Decimal.Value;
116
116
  timeout?: Duration;
117
- minimumSize?: BigIntValue;
118
- maximumSize?: BigIntValue;
117
+ minimumSize?: Decimal.Value;
118
+ maximumSize?: Decimal.Value;
119
119
  isReduceOnly?: boolean;
120
120
  } | {
121
121
  kind: "addTrigger";
@@ -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, AccountPositionInfoPage, AccountPnlSummaryResult, ActionIdSubActionIdMarketIdCursor, AtomicActionId, GetAccountPositionHistoryQuery, GetAccountPnlQuery, PagedQuery, ActionResponse, MarketsInfo, Market, MarketSymbol, 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";
6
+ import { Account, AccountPnlInfoPage, AccountPositionInfoPage, AccountPnlSummaryResult, AccountPositionSummaryResult, ActionIdSubActionIdMarketIdCursor, AtomicActionId, GetAccountPositionHistoryQuery, GetAccountPnlQuery, GetAccountPositionSummaryQuery, PagedQuery, ActionResponse, MarketsInfo, Market, MarketSymbol, 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, RfqFillsSubscription } from "../websocket/Subscriber";
9
9
  /**
@@ -360,6 +360,15 @@ export declare class Nord {
360
360
  */
361
361
  getAccountPositionHistory(accountId: number, { since, until, marketId, pageSize, startInclusive, }?: Readonly<Partial<GetAccountPositionHistoryQuery>>): Promise<AccountPositionInfoPage>;
362
362
  getAccountPnlSummary(accountId: number, { since, until, marketId }?: Readonly<Partial<GetAccountPnlQuery>>): Promise<AccountPnlSummaryResult>;
363
+ /**
364
+ * get per-market position pnl totals for an account.
365
+ *
366
+ * @param accountId - account id to query
367
+ * @param marketId - optional perpetual market id to restrict the result
368
+ * @returns per-market trading and funding pnl with materializer progress
369
+ * @throws {NordError} if the request fails
370
+ */
371
+ getAccountPositionSummary(accountId: number, { marketId }?: Readonly<Partial<GetAccountPositionSummaryQuery>>): Promise<AccountPositionSummaryResult>;
363
372
  getMarketsLive(): Promise<MarketsLiveInfo>;
364
373
  getMarketLive({ marketId, }: Readonly<{
365
374
  marketId: number;
@@ -1,7 +1,6 @@
1
1
  import { PublicKey, Transaction } from "@solana/web3.js";
2
2
  import * as proto from "../gen/nord_pb";
3
3
  import { Nord } from "./Nord";
4
- import { FeeTierConfig } from "../gen/nord_pb";
5
4
  import Decimal from "decimal.js";
6
5
  export declare enum AclRole {
7
6
  FEE_MANAGER = 1,
@@ -242,8 +241,9 @@ export declare class NordAdmin {
242
241
  unpause(): Promise<{
243
242
  actionId: bigint;
244
243
  }>;
245
- setBackstopAccount({ accountId, }: Readonly<{
244
+ setBackstopAccount({ accountId, marketMode, }: Readonly<{
246
245
  accountId: number;
246
+ marketMode?: proto.MarketMode;
247
247
  }>): Promise<{
248
248
  actionId: bigint;
249
249
  } & proto.Receipt_BackstopAccountSet>;
@@ -332,28 +332,19 @@ export declare class NordAdmin {
332
332
  * @returns Action identifier and fee tier addition receipt
333
333
  * @throws {NordError} If the action submission fails or the new tier exceeds the maximum range (0-15).
334
334
  */
335
- addFeeTier({ config, }: Readonly<{
336
- config: FeeTierConfig;
335
+ addFeeTier({ marketType, config, }: Readonly<{
336
+ marketType?: proto.MarketType;
337
+ config: proto.FeeTierTypeConfig;
337
338
  }>): Promise<{
338
339
  actionId: bigint;
339
- } & proto.Receipt_FeeTierAdded>;
340
- /**
341
- * Update an existing fee tier with new maker/taker rates.
342
- *
343
- * Tier identifiers must already exist; attempting to update a missing tier
344
- * causes the action to fail.
345
- *
346
- * @param tierId - Existing fee tier identifier to update
347
- * @param config - Replacement configuration for the tier
348
- * @returns Action identifier and fee tier update receipt
349
- * @throws {NordError} If the action submission fails or the tier ID exceeds the configured range.
350
- */
351
- updateFeeTier({ tierId, config, }: Readonly<{
340
+ } & proto.Receipt_FeeTierTypeAdded>;
341
+ updateFeeTier({ tierId, marketType, config, }: Readonly<{
352
342
  tierId: number;
353
- config: FeeTierConfig;
343
+ marketType?: proto.MarketType;
344
+ config: proto.FeeTierTypeConfig;
354
345
  }>): Promise<{
355
346
  actionId: bigint;
356
- } & proto.Receipt_FeeTierUpdated>;
347
+ } & proto.Receipt_FeeTierTypeUpdated>;
357
348
  /**
358
349
  * Assign a fee tier to one or more accounts.
359
350
  *
@@ -366,9 +357,13 @@ export declare class NordAdmin {
366
357
  * @returns Action identifier and accounts-tier receipt
367
358
  * @throws {NordError} If the tier id exceeds the configured range or an account id is invalid.
368
359
  */
369
- updateAccountsTier(accounts: number[], tierId: number): Promise<{
360
+ updateAccountsTier({ accounts, tierId, marketType, }: Readonly<{
361
+ accounts: number[];
362
+ tierId: number;
363
+ marketType?: proto.MarketType;
364
+ }>): Promise<{
370
365
  actionId: bigint;
371
- } & proto.Receipt_AccountsTierUpdated>;
366
+ } & proto.Receipt_AccountsFeeTierTypeModeUpdated>;
372
367
  feeVaultTransfer({ recipient, tokenId, amount, }: Readonly<{
373
368
  recipient: number;
374
369
  tokenId: number;
@@ -33,8 +33,7 @@ export type UserAtomicSubaction = (AtomicTarget & ({
33
33
  size: Decimal.Value;
34
34
  timeout?: Duration;
35
35
  clientOrderId?: BigIntValue;
36
- minimumSize?: BigIntValue;
37
- maximumSize?: BigIntValue;
36
+ minimalFill?: Decimal.Value;
38
37
  isReduceOnly?: boolean;
39
38
  } | {
40
39
  kind: "rfqFill";
@@ -42,8 +41,8 @@ export type UserAtomicSubaction = (AtomicTarget & ({
42
41
  orderId: BigIntValue;
43
42
  price: Decimal.Value;
44
43
  timeout?: Duration;
45
- minimumSize?: BigIntValue;
46
- maximumSize?: BigIntValue;
44
+ minimumSize?: Decimal.Value;
45
+ maximumSize?: Decimal.Value;
47
46
  isReduceOnly?: boolean;
48
47
  } | {
49
48
  kind: "addTrigger";
@@ -87,6 +86,11 @@ export interface NormalizedTakeAllPosition {
87
86
  settlementPrice: number;
88
87
  bankruptcyPrice: number;
89
88
  }
89
+ export interface NormalizedTakeAllTakerResult {
90
+ takerAccountId: number;
91
+ takenBalances: NormalizedTakeAllBalance[];
92
+ takenPositions: NormalizedTakeAllPosition[];
93
+ }
90
94
  /**
91
95
  * User class for interacting with the Nord protocol
92
96
  */
@@ -398,7 +402,7 @@ export declare class NordUser {
398
402
  orderId: bigint;
399
403
  accountId: number;
400
404
  }>;
401
- placeRfqOrder({ marketId, side, size, price, timeout, accountId, clientOrderId, minimumSize, maximumSize, isReduceOnly, }: Readonly<{
405
+ placeRfqOrder({ marketId, side, size, price, timeout, accountId, clientOrderId, minimalFill, isReduceOnly, }: Readonly<{
402
406
  marketId: number;
403
407
  side: Side;
404
408
  size: Decimal.Value;
@@ -406,8 +410,7 @@ export declare class NordUser {
406
410
  timeout?: Duration;
407
411
  accountId?: number;
408
412
  clientOrderId?: BigIntValue;
409
- minimumSize?: BigIntValue;
410
- maximumSize?: BigIntValue;
413
+ minimalFill?: Decimal.Value;
411
414
  isReduceOnly?: boolean;
412
415
  }>): Promise<{
413
416
  actionId: bigint;
@@ -440,9 +443,7 @@ export declare class NordUser {
440
443
  targetAccountId: number;
441
444
  }>): Promise<{
442
445
  actionId: bigint;
443
- takerAccountId: number;
444
- takenBalances: NormalizedTakeAllBalance[];
445
- takenPositions: NormalizedTakeAllPosition[];
446
+ takers: NormalizedTakeAllTakerResult[];
446
447
  }>;
447
448
  /**
448
449
  * Add a trigger for the current session