@n1xyz/nord-ts 0.7.3 → 0.8.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 CHANGED
@@ -2,7 +2,7 @@ import Decimal from "decimal.js";
2
2
  import * as proto from "./gen/nord_pb";
3
3
  import { paths } from "./gen/openapi";
4
4
  import { Client } from "openapi-fetch";
5
- import { type Duration, FillMode, Side, TriggerKind } from "./types";
5
+ import { type AttachedTriggers, type Duration, FillMode, Side, TriggerKind } from "./types";
6
6
  import { BigIntValue } from "./utils";
7
7
  import { PublicKey, Transaction } from "@solana/web3.js";
8
8
  type ReceiptKind = NonNullable<proto.Receipt["kind"]>;
@@ -14,6 +14,7 @@ export declare function expectReceiptKind<K extends ReceiptKind["case"]>(receipt
14
14
  kind: ExtractReceiptKind<K>;
15
15
  };
16
16
  export declare function buildLimits(marketPriceDecimals: number, marketSizeDecimals: number, limitPrice?: Decimal.Value, limitBaseSize?: Decimal.Value, limitQuoteSize?: Decimal.Value): proto.OrderLimit | undefined;
17
+ export declare function toProtoAttachedTriggers(triggers: AttachedTriggers | undefined, priceDecimals: number): proto.OcoTriggers | undefined;
17
18
  export declare function toProtoU128(value: BigIntValue): proto.U128;
18
19
  export declare function createAction(currentTimestamp: bigint, nonce: number, kind: proto.Action["kind"]): proto.Action;
19
20
  export declare function sendAction(client: Client<paths>, makeSignedMessage: (message: Uint8Array) => Promise<Uint8Array>, action: proto.Action): Promise<proto.Receipt>;
@@ -85,6 +86,7 @@ export type AtomicSubaction = (AtomicTarget & ({
85
86
  quoteSize?: Decimal.Value;
86
87
  clientOrderId?: BigIntValue;
87
88
  referrer?: BigIntValue;
89
+ triggers?: AttachedTriggers;
88
90
  } | {
89
91
  kind: "cancel";
90
92
  orderId: BigIntValue;
@@ -104,18 +106,19 @@ export type AtomicSubaction = (AtomicTarget & ({
104
106
  size: Decimal.Value;
105
107
  timeout?: Duration;
106
108
  clientOrderId?: BigIntValue;
107
- minimumSize?: BigIntValue;
108
- maximumSize?: BigIntValue;
109
+ referrer?: BigIntValue;
110
+ minimalFill?: Decimal.Value;
109
111
  isReduceOnly?: boolean;
110
112
  } | {
111
113
  kind: "rfqFill";
112
114
  marketId: number;
113
115
  orderId: BigIntValue;
114
116
  priceDecimals: number;
117
+ sizeDecimals: number;
115
118
  price: Decimal.Value;
116
119
  timeout?: Duration;
117
- minimumSize?: BigIntValue;
118
- maximumSize?: BigIntValue;
120
+ minimumSize?: Decimal.Value;
121
+ maximumSize?: Decimal.Value;
119
122
  isReduceOnly?: boolean;
120
123
  } | {
121
124
  kind: "addTrigger";
@@ -130,9 +133,8 @@ export type AtomicSubaction = (AtomicTarget & ({
130
133
  limitQuoteSize?: Decimal.Value;
131
134
  referrer?: BigIntValue;
132
135
  } | {
133
- kind: "editTrigger";
136
+ kind: "replaceTrigger";
134
137
  triggerId: BigIntValue;
135
- marketId: number;
136
138
  side: Side;
137
139
  triggerKind: TriggerKind;
138
140
  triggerPrice: Decimal.Value;
@@ -141,9 +143,9 @@ export type AtomicSubaction = (AtomicTarget & ({
141
143
  limitPrice?: Decimal.Value;
142
144
  limitBaseSize?: Decimal.Value;
143
145
  limitQuoteSize?: Decimal.Value;
146
+ referrer?: BigIntValue;
144
147
  } | {
145
148
  kind: "removeTrigger";
146
- marketId: number;
147
149
  triggerId: BigIntValue;
148
150
  }));
149
151
  export declare function atomicSubactionToProto(currentTimestamp: bigint, a: AtomicSubaction): proto.AtomicSubaction;
@@ -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, TriggerHistCursor, 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;
@@ -419,7 +428,7 @@ export declare class Nord {
419
428
  */
420
429
  accountExists(pubkey: string | PublicKey): Promise<boolean>;
421
430
  /**
422
- * Fetch active triggers for an account.
431
+ * Fetch pending and active triggers for an account.
423
432
  *
424
433
  * @param accountId - Account identifier owning the triggers
425
434
  * @throws {NordError} If no account can be resolved or the request fails.
@@ -439,7 +448,7 @@ export declare class Nord {
439
448
  */
440
449
  getAccountTriggerPlaceHistory({ accountId, since, until, pageSize, startInclusive, }: Readonly<Omit<PagedQuery, "startInclusive"> & {
441
450
  accountId?: number;
442
- startInclusive?: AtomicActionId;
451
+ startInclusive?: TriggerHistCursor;
443
452
  }>): Promise<TriggerPlaceHistoryPage>;
444
453
  /**
445
454
  * Fetch trigger finalisation history for an account.
@@ -451,8 +460,9 @@ export declare class Nord {
451
460
  * @param startInclusive - Pagination cursor to resume from
452
461
  * @throws {NordError} If no account can be resolved or the request fails.
453
462
  */
454
- getAccountTriggerFinaliseHistory({ accountId, since, until, pageSize, startInclusive, }: Readonly<PagedQuery & {
463
+ getAccountTriggerFinaliseHistory({ accountId, since, until, pageSize, startInclusive, }: Readonly<Omit<PagedQuery, "startInclusive"> & {
455
464
  accountId?: number;
465
+ startInclusive?: string;
456
466
  }>): Promise<TriggerFinaliseHistoryPage>;
457
467
  /**
458
468
  * Fetch withdrawal history for an account.
@@ -1,29 +1,29 @@
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,
8
7
  MARKET_MANAGER = 2,
8
+ ORACLE = 4,
9
9
  ADMIN = 2147483648
10
10
  }
11
11
  /**
12
- * Pyth Lazer ed25519 trusted signer configuration.
12
+ * Pyth Pro ed25519 trusted signer configuration.
13
13
  *
14
14
  * This mirrors the Pyth Solana contract manager shape:
15
15
  * `{ publicKey: string; expiresAt: bigint }`.
16
16
  */
17
- export type PythLazerTrustedSigner = Readonly<{
17
+ export type PythProTrustedSigner = Readonly<{
18
18
  /** Base58 Solana public key, or a `PublicKey` instance. */
19
19
  publicKey: PublicKey;
20
20
  /** Solana timestamp */
21
21
  expiresAt: number;
22
22
  }>;
23
- export type PythLazerFeedSymbolInput = Readonly<{
24
- feedId: number;
25
- oracleSymbol: string;
26
- }>;
23
+ export type OracleSourceInput = proto.OracleSource | {
24
+ pythProFeedId?: number;
25
+ customFeedId?: number;
26
+ };
27
27
  /**
28
28
  * Administrative client capable of submitting privileged configuration actions.
29
29
  */
@@ -73,15 +73,17 @@ export declare class NordAdmin {
73
73
  * @param viewSymbol - Symbol surfaced to Nord clients
74
74
  * @param oracleSymbol - Symbol resolved by the oracle adapter
75
75
  * @param mintAddr - Solana mint backing this token
76
+ * @param pythProFeedId - Pyth Pro feed ID used for token pricing
76
77
  * @returns Action identifier and resulting token metadata
77
78
  * @throws {NordError} If the action submission fails
78
79
  */
79
- createToken({ tokenDecimals, weightBps, viewSymbol, oracleSymbol, mintAddr, }: Readonly<{
80
+ createToken({ tokenDecimals, weightBps, viewSymbol, oracleSymbol, mintAddr, pythProFeedId, }: Readonly<{
80
81
  tokenDecimals: number;
81
82
  weightBps: number;
82
83
  viewSymbol: string;
83
84
  oracleSymbol: string;
84
85
  mintAddr: PublicKey;
86
+ pythProFeedId: number;
85
87
  }>): Promise<{
86
88
  actionId: bigint;
87
89
  } & proto.Receipt_InsertTokenResult>;
@@ -97,10 +99,12 @@ export declare class NordAdmin {
97
99
  * @param viewSymbol - Symbol exposed to Nord clients
98
100
  * @param oracleSymbol - Symbol resolved by the oracle adapter
99
101
  * @param baseTokenId - Registered base token backing this market
102
+ * @param oracleSource - Oracle source specification (Pyth Pro or Custom feed). If omitted or neither is set, oracleSource is omitted
103
+ * @param pythProFeedId - Optional legacy Pyth Pro feed ID used for market pricing
100
104
  * @returns Action identifier and resulting market metadata
101
105
  * @throws {NordError} If the action submission fails
102
106
  */
103
- createMarket({ sizeDecimals, priceDecimals, imfBps, cmfBps, mmfBps, marketType, viewSymbol, oracleSymbol, baseTokenId, }: Readonly<{
107
+ createMarket({ sizeDecimals, priceDecimals, imfBps, cmfBps, mmfBps, marketType, viewSymbol, oracleSymbol, baseTokenId, oracleSource, pythProFeedId, }: Readonly<{
104
108
  sizeDecimals: number;
105
109
  priceDecimals: number;
106
110
  imfBps: number;
@@ -110,10 +114,12 @@ export declare class NordAdmin {
110
114
  viewSymbol: string;
111
115
  oracleSymbol: string;
112
116
  baseTokenId: number;
117
+ oracleSource?: OracleSourceInput;
118
+ pythProFeedId?: number;
113
119
  }>): Promise<{
114
120
  actionId: bigint;
115
121
  } & proto.Receipt_InsertMarketResult>;
116
- createRfqMarket({ sizeDecimals, priceDecimals, imfBps, cmfBps, mmfBps, viewSymbol, oracleSymbol, }: Readonly<{
122
+ createRfqMarket({ sizeDecimals, priceDecimals, imfBps, cmfBps, mmfBps, viewSymbol, oracleSymbol, oracleSource, pythProFeedId, }: Readonly<{
117
123
  sizeDecimals: number;
118
124
  priceDecimals: number;
119
125
  imfBps: number;
@@ -121,6 +127,8 @@ export declare class NordAdmin {
121
127
  mmfBps: number;
122
128
  viewSymbol: string;
123
129
  oracleSymbol: string;
130
+ oracleSource?: OracleSourceInput;
131
+ pythProFeedId?: number;
124
132
  }>): Promise<{
125
133
  actionId: bigint;
126
134
  } & proto.Receipt_InsertMarketResult>;
@@ -149,44 +157,57 @@ export declare class NordAdmin {
149
157
  }>): Promise<{
150
158
  actionId: bigint;
151
159
  } & proto.RfqMakersSet>;
152
- /**
153
- * Update the Pyth guardian set used for verifying Wormhole messages.
154
- *
155
- * Each address must decode from a 20-byte hex string (with or without a
156
- * leading `0x` prefix). The engine validates the supplied guardian set index
157
- * before applying the update.
158
- *
159
- * @param guardianSetIndex - Wormhole guardian set index that must already exist
160
- * @param addresses - 20-byte hex-encoded guardian addresses
161
- * @returns Action identifier and guardian update receipt
162
- * @throws {NordError} If the action submission fails
163
- */
164
- pythSetWormholeGuardians({ guardianSetIndex, addresses, }: Readonly<{
165
- guardianSetIndex: number;
166
- addresses: readonly string[];
160
+ /** Assign or repair the oracle route for an existing token. */
161
+ setTokenOracleSource({ tokenId, oracleSource, }: Readonly<{
162
+ tokenId: number;
163
+ oracleSource?: OracleSourceInput;
167
164
  }>): Promise<{
168
165
  actionId: bigint;
169
- } & proto.Receipt_UpdateGuardianSetResult>;
166
+ } & proto.TokenOracleSourceSet>;
167
+ /** Assign or repair the Pyth Pro feed route for an existing token. */
168
+ setTokenPythProFeed({ tokenId, pythProFeedId, }: Readonly<{
169
+ tokenId: number;
170
+ pythProFeedId: number;
171
+ }>): Promise<{
172
+ actionId: bigint;
173
+ } & proto.TokenOracleSourceSet>;
174
+ /** Assign or repair the oracle route for an existing market. */
175
+ setMarketOracleSource({ marketId, oracleSource, }: Readonly<{
176
+ marketId: number;
177
+ oracleSource?: OracleSourceInput;
178
+ }>): Promise<{
179
+ actionId: bigint;
180
+ } & proto.MarketOracleSourceSet>;
181
+ /** Assign or repair the Pyth Pro feed route for an existing market. */
182
+ setMarketPythProFeed({ marketId, pythProFeedId, }: Readonly<{
183
+ marketId: number;
184
+ pythProFeedId: number;
185
+ }>): Promise<{
186
+ actionId: bigint;
187
+ } & proto.MarketOracleSourceSet>;
170
188
  /**
171
- * Link an oracle symbol to a specific Pyth price feed.
189
+ * Publish one or more custom oracle price observations.
172
190
  *
173
- * The price feed identifier must decode to 32 bytes (with or without a
174
- * leading `0x` prefix). Use this call to create or update the mapping used
175
- * by the oracle integration.
191
+ * The signing key must have the {@link AclRole.ORACLE} role. Prices and
192
+ * confidence intervals are supplied as integer mantissas sharing `decimals`.
176
193
  *
177
- * @param oracleSymbol - Symbol resolved by the oracle adapter
178
- * @param priceFeedId - 32-byte hex-encoded Pyth price feed identifier
179
- * @returns Action identifier and symbol feed receipt
194
+ * @param feeds - Custom oracle observations to publish atomically
195
+ * @returns Action identifier and the IDs of feeds that were updated
180
196
  * @throws {NordError} If the action submission fails
181
197
  */
182
- pythSetSymbolFeed({ oracleSymbol, priceFeedId: priceFeedIdHex, }: Readonly<{
183
- oracleSymbol: string;
184
- priceFeedId: string;
198
+ customOraclePriceUpdates({ feeds, }: Readonly<{
199
+ feeds: readonly Readonly<{
200
+ feedId: number;
201
+ median: bigint;
202
+ confidence: bigint;
203
+ decimals: number;
204
+ publishedAtMillis: bigint;
205
+ }>[];
185
206
  }>): Promise<{
186
207
  actionId: bigint;
187
- } & proto.Receipt_OracleSymbolFeedResult>;
208
+ } & proto.Receipt_CustomOracleUpdateResult>;
188
209
  /**
189
- * Configure the fixed Pyth Lazer ed25519 trusted signer set.
210
+ * Configure the fixed Pyth Pro ed25519 trusted signer set.
190
211
  *
191
212
  * The input must contain exactly five unique Solana public keys. Signer
192
213
  * entries use the same external shape as Pyth's Solana contract manager:
@@ -196,34 +217,11 @@ export declare class NordAdmin {
196
217
  * @returns Action identifier and trusted signer receipt
197
218
  * @throws {NordError} If the signer shape is invalid or submission fails
198
219
  */
199
- pythLazerSetTrustedSigners({ trustedSigners, }: Readonly<{
200
- trustedSigners: readonly PythLazerTrustedSigner[];
220
+ pythProSetTrustedSigners({ trustedSigners, }: Readonly<{
221
+ trustedSigners: readonly PythProTrustedSigner[];
201
222
  }>): Promise<{
202
223
  actionId: bigint;
203
- } & proto.Receipt_PythLazerTrustedSignersSetResult>;
204
- /**
205
- * Link one or more Pyth Lazer feed ids to Nord oracle symbols.
206
- *
207
- * @param feeds - Feed id to oracle symbol mappings
208
- * @returns Action identifier and feed-symbol receipt
209
- * @throws {NordError} If the feed mapping shape is invalid or submission fails
210
- */
211
- pythLazerSetFeedSymbols({ feeds, }: Readonly<{
212
- feeds: readonly PythLazerFeedSymbolInput[];
213
- }>): Promise<{
214
- actionId: bigint;
215
- } & proto.Receipt_PythLazerFeedSymbolSetResult>;
216
- /**
217
- * Link a single Pyth Lazer feed id to a Nord oracle symbol.
218
- *
219
- * @param feedId - Pyth Lazer feed id
220
- * @param oracleSymbol - Symbol resolved by the oracle adapter
221
- * @returns Action identifier and feed-symbol receipt
222
- * @throws {NordError} If the feed mapping shape is invalid or submission fails
223
- */
224
- pythLazerSetFeedSymbol({ feedId, oracleSymbol, }: PythLazerFeedSymbolInput): Promise<{
225
- actionId: bigint;
226
- } & proto.Receipt_PythLazerFeedSymbolSetResult>;
224
+ } & proto.Receipt_PythProTrustedSignersSetResult>;
227
225
  /**
228
226
  * Pause all trading activity on the exchange.
229
227
  *
@@ -242,8 +240,9 @@ export declare class NordAdmin {
242
240
  unpause(): Promise<{
243
241
  actionId: bigint;
244
242
  }>;
245
- setBackstopAccount({ accountId, }: Readonly<{
243
+ setBackstopAccount({ accountId, marketMode, }: Readonly<{
246
244
  accountId: number;
245
+ marketMode?: proto.MarketMode;
247
246
  }>): Promise<{
248
247
  actionId: bigint;
249
248
  } & proto.Receipt_BackstopAccountSet>;
@@ -332,28 +331,19 @@ export declare class NordAdmin {
332
331
  * @returns Action identifier and fee tier addition receipt
333
332
  * @throws {NordError} If the action submission fails or the new tier exceeds the maximum range (0-15).
334
333
  */
335
- addFeeTier({ config, }: Readonly<{
336
- config: FeeTierConfig;
334
+ addFeeTier({ marketType, config, }: Readonly<{
335
+ marketType?: proto.MarketType;
336
+ config: proto.FeeTierTypeConfig;
337
337
  }>): Promise<{
338
338
  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<{
339
+ } & proto.Receipt_FeeTierTypeAdded>;
340
+ updateFeeTier({ tierId, marketType, config, }: Readonly<{
352
341
  tierId: number;
353
- config: FeeTierConfig;
342
+ marketType?: proto.MarketType;
343
+ config: proto.FeeTierTypeConfig;
354
344
  }>): Promise<{
355
345
  actionId: bigint;
356
- } & proto.Receipt_FeeTierUpdated>;
346
+ } & proto.Receipt_FeeTierTypeUpdated>;
357
347
  /**
358
348
  * Assign a fee tier to one or more accounts.
359
349
  *
@@ -366,9 +356,13 @@ export declare class NordAdmin {
366
356
  * @returns Action identifier and accounts-tier receipt
367
357
  * @throws {NordError} If the tier id exceeds the configured range or an account id is invalid.
368
358
  */
369
- updateAccountsTier(accounts: number[], tierId: number): Promise<{
359
+ updateAccountsTier({ accounts, tierId, marketType, }: Readonly<{
360
+ accounts: number[];
361
+ tierId: number;
362
+ marketType?: proto.MarketType;
363
+ }>): Promise<{
370
364
  actionId: bigint;
371
- } & proto.Receipt_AccountsTierUpdated>;
365
+ } & proto.Receipt_AccountsFeeTierTypeModeUpdated>;
372
366
  feeVaultTransfer({ recipient, tokenId, amount, }: Readonly<{
373
367
  recipient: number;
374
368
  tokenId: number;
@@ -1,6 +1,6 @@
1
1
  import { PublicKey, Transaction, SendOptions } from "@solana/web3.js";
2
2
  import Decimal from "decimal.js";
3
- import { FillMode, Side, SPLTokenInfo, TriggerKind, SelfTradePrevention, VaultWithdrawRequestKind, type Duration, type RfqFillResult } from "../types";
3
+ import { FillMode, Side, SPLTokenInfo, TriggerKind, SelfTradePrevention, VaultWithdrawRequestKind, type AttachedTriggers, type Duration, type RfqFillResult } from "../types";
4
4
  import * as proto from "../gen/nord_pb";
5
5
  import { BigIntValue } from "../utils";
6
6
  import { AtomicDelegatedTarget, AtomicSelfOrKeyedTarget, AtomicTarget } from "../actions";
@@ -16,6 +16,7 @@ export type UserAtomicSubaction = (AtomicTarget & ({
16
16
  quoteSize?: Decimal.Value;
17
17
  clientOrderId?: BigIntValue;
18
18
  referrer?: BigIntValue;
19
+ triggers?: AttachedTriggers;
19
20
  } | {
20
21
  kind: "cancel";
21
22
  orderId: BigIntValue;
@@ -33,8 +34,8 @@ export type UserAtomicSubaction = (AtomicTarget & ({
33
34
  size: Decimal.Value;
34
35
  timeout?: Duration;
35
36
  clientOrderId?: BigIntValue;
36
- minimumSize?: BigIntValue;
37
- maximumSize?: BigIntValue;
37
+ referrer?: BigIntValue;
38
+ minimalFill?: Decimal.Value;
38
39
  isReduceOnly?: boolean;
39
40
  } | {
40
41
  kind: "rfqFill";
@@ -42,8 +43,8 @@ export type UserAtomicSubaction = (AtomicTarget & ({
42
43
  orderId: BigIntValue;
43
44
  price: Decimal.Value;
44
45
  timeout?: Duration;
45
- minimumSize?: BigIntValue;
46
- maximumSize?: BigIntValue;
46
+ minimumSize?: Decimal.Value;
47
+ maximumSize?: Decimal.Value;
47
48
  isReduceOnly?: boolean;
48
49
  } | {
49
50
  kind: "addTrigger";
@@ -56,7 +57,7 @@ export type UserAtomicSubaction = (AtomicTarget & ({
56
57
  limitQuoteSize?: Decimal.Value;
57
58
  referrer?: BigIntValue;
58
59
  } | {
59
- kind: "editTrigger";
60
+ kind: "replaceTrigger";
60
61
  triggerId: BigIntValue;
61
62
  marketId: number;
62
63
  side: Side;
@@ -65,9 +66,9 @@ export type UserAtomicSubaction = (AtomicTarget & ({
65
66
  limitPrice?: Decimal.Value;
66
67
  limitBaseSize?: Decimal.Value;
67
68
  limitQuoteSize?: Decimal.Value;
69
+ referrer?: BigIntValue;
68
70
  } | {
69
71
  kind: "removeTrigger";
70
- marketId: number;
71
72
  triggerId: BigIntValue;
72
73
  }));
73
74
  export declare function decodeRfqFillResult(actionId: bigint, result: proto.Receipt_AtomicSubactionResultKind["inner"] | undefined): RfqFillResult;
@@ -77,6 +78,27 @@ export interface NormalizedReceiptTrade {
77
78
  size: number;
78
79
  accountId: number;
79
80
  }
81
+ export interface NormalizedTriggerMutation {
82
+ accountId: number;
83
+ triggerId: bigint;
84
+ marketId: number;
85
+ marketMode: proto.MarketMode;
86
+ trigger: {
87
+ triggerPrice: number;
88
+ kind: proto.TriggerKind;
89
+ side: proto.Side;
90
+ limits?: {
91
+ price: number;
92
+ size: number;
93
+ quoteSize?: number;
94
+ };
95
+ };
96
+ }
97
+ export interface NormalizedTriggerMutations {
98
+ placed: NormalizedTriggerMutation[];
99
+ activated: NormalizedTriggerMutation[];
100
+ cancelled: NormalizedTriggerMutation[];
101
+ }
80
102
  export interface NormalizedTakeAllBalance {
81
103
  tokenId: number;
82
104
  amount: number;
@@ -87,6 +109,11 @@ export interface NormalizedTakeAllPosition {
87
109
  settlementPrice: number;
88
110
  bankruptcyPrice: number;
89
111
  }
112
+ export interface NormalizedTakeAllTakerResult {
113
+ takerAccountId: number;
114
+ takenBalances: NormalizedTakeAllBalance[];
115
+ takenPositions: NormalizedTakeAllPosition[];
116
+ }
90
117
  /**
91
118
  * User class for interacting with the Nord protocol
92
119
  */
@@ -353,10 +380,11 @@ export declare class NordUser {
353
380
  * @param accountId - Account executing the order
354
381
  * @param clientOrderId - Optional client-specified identifier
355
382
  * @param referrer - Optional referrer ID. Tracks which frontend/referral source placed order.
356
- * @returns Object containing actionId, orderId (if posted), fills, and reducedOrders (reduce-only orders fully or partially cancelled by maintenance)
383
+ * @param triggers - Optional take-profit and stop-loss triggers attached to the order.
384
+ * @returns Object containing actionId, orderId (if posted), fills, reducedOrders (reduce-only orders fully or partially cancelled by maintenance), selfTradeCancels, and triggerMutations
357
385
  * @throws {NordError} If the operation fails
358
386
  */
359
- placeOrder({ marketId, side, fillMode, isReduceOnly, size, price, quoteSize, selfTradePrevention, accountId, clientOrderId, referrer, }: Readonly<{
387
+ placeOrder({ marketId, side, fillMode, isReduceOnly, size, price, quoteSize, selfTradePrevention, accountId, clientOrderId, referrer, triggers, }: Readonly<{
360
388
  marketId: number;
361
389
  side: Side;
362
390
  fillMode: FillMode;
@@ -368,6 +396,7 @@ export declare class NordUser {
368
396
  accountId?: number;
369
397
  clientOrderId?: BigIntValue;
370
398
  referrer?: BigIntValue;
399
+ triggers?: AttachedTriggers;
371
400
  }>): Promise<{
372
401
  actionId: bigint;
373
402
  orderId?: bigint;
@@ -384,21 +413,23 @@ export declare class NordUser {
384
413
  cancelledSize: number;
385
414
  price: number;
386
415
  }[];
416
+ triggerMutations: NormalizedTriggerMutations;
387
417
  }>;
388
418
  /**
389
419
  * Cancel an order
390
420
  *
391
421
  * @param orderId - Order ID to cancel
392
422
  * @param providedAccountId - Account ID that placed the order
393
- * @returns Object containing actionId, cancelled orderId, and accountId
423
+ * @returns Object containing actionId, cancelled order result, and trigger mutations
394
424
  * @throws {NordError} If the operation fails
395
425
  */
396
426
  cancelOrder(orderId: BigIntValue, accountId?: number): Promise<{
397
427
  actionId: bigint;
398
428
  orderId: bigint;
399
429
  accountId: number;
430
+ triggerMutations: NormalizedTriggerMutations;
400
431
  }>;
401
- placeRfqOrder({ marketId, side, size, price, timeout, accountId, clientOrderId, minimumSize, maximumSize, isReduceOnly, }: Readonly<{
432
+ placeRfqOrder({ marketId, side, size, price, timeout, accountId, clientOrderId, referrer, minimalFill, isReduceOnly, }: Readonly<{
402
433
  marketId: number;
403
434
  side: Side;
404
435
  size: Decimal.Value;
@@ -406,8 +437,8 @@ export declare class NordUser {
406
437
  timeout?: Duration;
407
438
  accountId?: number;
408
439
  clientOrderId?: BigIntValue;
409
- minimumSize?: BigIntValue;
410
- maximumSize?: BigIntValue;
440
+ referrer?: BigIntValue;
441
+ minimalFill?: Decimal.Value;
411
442
  isReduceOnly?: boolean;
412
443
  }>): Promise<{
413
444
  actionId: bigint;
@@ -428,21 +459,20 @@ export declare class NordUser {
428
459
  *
429
460
  * @param clientOrderId - Client order ID to cancel
430
461
  * @param providedAccountId - Account ID that placed the order (defaults to the first account)
431
- * @returns Object containing actionId, cancelled orderId, and accountId
462
+ * @returns Object containing actionId, cancelled orderId, accountId, and triggerMutations
432
463
  * @throws {NordError} If the operation fails
433
464
  */
434
465
  cancelOrderByClientId(clientOrderId: BigIntValue, accountId?: number): Promise<{
435
466
  actionId: bigint;
436
467
  orderId: bigint;
437
468
  accountId: number;
469
+ triggerMutations: NormalizedTriggerMutations;
438
470
  }>;
439
471
  takePositions({ targetAccountId, }: Readonly<{
440
472
  targetAccountId: number;
441
473
  }>): Promise<{
442
474
  actionId: bigint;
443
- takerAccountId: number;
444
- takenBalances: NormalizedTakeAllBalance[];
445
- takenPositions: NormalizedTakeAllPosition[];
475
+ takers: NormalizedTakeAllTakerResult[];
446
476
  }>;
447
477
  /**
448
478
  * Add a trigger for the current session
@@ -482,23 +512,19 @@ export declare class NordUser {
482
512
  /**
483
513
  * Remove a trigger for the current session
484
514
  *
485
- * @param marketId - Market the trigger belongs to
486
515
  * @param triggerId - Unique trigger identifier to remove
487
- * @param accountId - Account executing the trigger
488
516
  * @returns Object containing the actionId of the removal action
489
517
  * @throws {NordError} If the operation fails
490
518
  */
491
- removeTrigger({ marketId, triggerId, accountId, }: Readonly<{
492
- marketId: number;
519
+ removeTrigger({ triggerId, }: Readonly<{
493
520
  triggerId: bigint;
494
- accountId?: number;
495
521
  }>): Promise<{
496
522
  actionId: bigint;
497
523
  }>;
498
524
  /**
499
- * Edit an existing trigger for the current session
525
+ * Replace an existing trigger for the current session
500
526
  *
501
- * @param triggerId - Unique trigger identifier to edit
527
+ * @param triggerId - Unique trigger identifier to replace
502
528
  * @param marketId - Market to watch
503
529
  * @param side - Order side for the trigger
504
530
  * @param kind - Stop-loss or take-profit trigger type
@@ -506,11 +532,11 @@ export declare class NordUser {
506
532
  * @param limitPrice - Optional limit price used once the trigger fires
507
533
  * @param limitBaseSize - Optional base size limit used once the trigger fires
508
534
  * @param limitQuoteSize - Optional quote size limit used once the trigger fires
509
- * @param accountId - Account executing the trigger
510
- * @returns Object containing the actionId of the edit action
535
+ * @param referrer - Optional frontend or referral source
536
+ * @returns Object containing the actionId of the replacement action
511
537
  * @throws {NordError} If the operation fails
512
538
  */
513
- editTrigger({ triggerId, marketId, side, kind, triggerPrice, limitPrice, limitBaseSize, limitQuoteSize, accountId, }: Readonly<{
539
+ replaceTrigger({ triggerId, marketId, side, kind, triggerPrice, limitPrice, limitBaseSize, limitQuoteSize, referrer, }: Readonly<{
514
540
  triggerId: bigint;
515
541
  marketId: number;
516
542
  side: Side;
@@ -519,7 +545,7 @@ export declare class NordUser {
519
545
  limitPrice?: Decimal.Value;
520
546
  limitBaseSize?: Decimal.Value;
521
547
  limitQuoteSize?: Decimal.Value;
522
- accountId?: number;
548
+ referrer?: BigIntValue;
523
549
  }>): Promise<{
524
550
  actionId: bigint;
525
551
  }>;
@@ -577,18 +603,18 @@ export declare class NordUser {
577
603
  * - cancel
578
604
  * - cancelByClientId
579
605
  * - addTrigger
580
- * - editTrigger
606
+ * - replaceTrigger
581
607
  * - removeTrigger
582
608
  *
583
609
  * Per market, market-scoped subactions are phase-validated:
584
610
  * 1. cancels and trigger removals can only be at the start
585
611
  * 2. intermediate trades can trade only
586
- * 3. placements and trigger adds/edits go last
612
+ * 3. placements and trigger adds/replacements go last
587
613
  *
588
614
  * Across markets, market-scoped subactions can be in any order.
589
615
  *
590
616
  * Trigger subactions are account-scoped. In one atomic sequence, the same
591
- * trigger target cannot be added, edited, or removed more than once.
617
+ * trigger target cannot be added, replaced, or removed more than once.
592
618
  *
593
619
  * @param userActions array of user-friendly subactions
594
620
  * @param providedAccountId optional account performing the action (defaults to first account)