@n1xyz/nord-ts 0.7.4 → 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 +6 -4
- package/dist/client/Nord.d.ts +5 -4
- package/dist/client/NordAdmin.d.ts +62 -63
- package/dist/client/NordUser.d.ts +47 -22
- package/dist/gen/nord_pb.d.ts +757 -791
- package/dist/gen/openapi.d.ts +192 -97
- package/dist/index.browser.js +420 -338
- package/dist/index.common.js +423 -341
- package/dist/types.d.ts +5 -4
- package/package.json +1 -1
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,6 +106,7 @@ export type AtomicSubaction = (AtomicTarget & ({
|
|
|
104
106
|
size: Decimal.Value;
|
|
105
107
|
timeout?: Duration;
|
|
106
108
|
clientOrderId?: BigIntValue;
|
|
109
|
+
referrer?: BigIntValue;
|
|
107
110
|
minimalFill?: Decimal.Value;
|
|
108
111
|
isReduceOnly?: boolean;
|
|
109
112
|
} | {
|
|
@@ -130,9 +133,8 @@ export type AtomicSubaction = (AtomicTarget & ({
|
|
|
130
133
|
limitQuoteSize?: Decimal.Value;
|
|
131
134
|
referrer?: BigIntValue;
|
|
132
135
|
} | {
|
|
133
|
-
kind: "
|
|
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;
|
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, AccountPositionInfoPage, AccountPnlSummaryResult, AccountPositionSummaryResult, ActionIdSubActionIdMarketIdCursor,
|
|
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
|
/**
|
|
@@ -428,7 +428,7 @@ export declare class Nord {
|
|
|
428
428
|
*/
|
|
429
429
|
accountExists(pubkey: string | PublicKey): Promise<boolean>;
|
|
430
430
|
/**
|
|
431
|
-
* Fetch active triggers for an account.
|
|
431
|
+
* Fetch pending and active triggers for an account.
|
|
432
432
|
*
|
|
433
433
|
* @param accountId - Account identifier owning the triggers
|
|
434
434
|
* @throws {NordError} If no account can be resolved or the request fails.
|
|
@@ -448,7 +448,7 @@ export declare class Nord {
|
|
|
448
448
|
*/
|
|
449
449
|
getAccountTriggerPlaceHistory({ accountId, since, until, pageSize, startInclusive, }: Readonly<Omit<PagedQuery, "startInclusive"> & {
|
|
450
450
|
accountId?: number;
|
|
451
|
-
startInclusive?:
|
|
451
|
+
startInclusive?: TriggerHistCursor;
|
|
452
452
|
}>): Promise<TriggerPlaceHistoryPage>;
|
|
453
453
|
/**
|
|
454
454
|
* Fetch trigger finalisation history for an account.
|
|
@@ -460,8 +460,9 @@ export declare class Nord {
|
|
|
460
460
|
* @param startInclusive - Pagination cursor to resume from
|
|
461
461
|
* @throws {NordError} If no account can be resolved or the request fails.
|
|
462
462
|
*/
|
|
463
|
-
getAccountTriggerFinaliseHistory({ accountId, since, until, pageSize, startInclusive, }: Readonly<PagedQuery & {
|
|
463
|
+
getAccountTriggerFinaliseHistory({ accountId, since, until, pageSize, startInclusive, }: Readonly<Omit<PagedQuery, "startInclusive"> & {
|
|
464
464
|
accountId?: number;
|
|
465
|
+
startInclusive?: string;
|
|
465
466
|
}>): Promise<TriggerFinaliseHistoryPage>;
|
|
466
467
|
/**
|
|
467
468
|
* Fetch withdrawal history for an account.
|
|
@@ -5,24 +5,25 @@ import Decimal from "decimal.js";
|
|
|
5
5
|
export declare enum AclRole {
|
|
6
6
|
FEE_MANAGER = 1,
|
|
7
7
|
MARKET_MANAGER = 2,
|
|
8
|
+
ORACLE = 4,
|
|
8
9
|
ADMIN = 2147483648
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
|
-
* Pyth
|
|
12
|
+
* Pyth Pro ed25519 trusted signer configuration.
|
|
12
13
|
*
|
|
13
14
|
* This mirrors the Pyth Solana contract manager shape:
|
|
14
15
|
* `{ publicKey: string; expiresAt: bigint }`.
|
|
15
16
|
*/
|
|
16
|
-
export type
|
|
17
|
+
export type PythProTrustedSigner = Readonly<{
|
|
17
18
|
/** Base58 Solana public key, or a `PublicKey` instance. */
|
|
18
19
|
publicKey: PublicKey;
|
|
19
20
|
/** Solana timestamp */
|
|
20
21
|
expiresAt: number;
|
|
21
22
|
}>;
|
|
22
|
-
export type
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
23
|
+
export type OracleSourceInput = proto.OracleSource | {
|
|
24
|
+
pythProFeedId?: number;
|
|
25
|
+
customFeedId?: number;
|
|
26
|
+
};
|
|
26
27
|
/**
|
|
27
28
|
* Administrative client capable of submitting privileged configuration actions.
|
|
28
29
|
*/
|
|
@@ -72,15 +73,17 @@ export declare class NordAdmin {
|
|
|
72
73
|
* @param viewSymbol - Symbol surfaced to Nord clients
|
|
73
74
|
* @param oracleSymbol - Symbol resolved by the oracle adapter
|
|
74
75
|
* @param mintAddr - Solana mint backing this token
|
|
76
|
+
* @param pythProFeedId - Pyth Pro feed ID used for token pricing
|
|
75
77
|
* @returns Action identifier and resulting token metadata
|
|
76
78
|
* @throws {NordError} If the action submission fails
|
|
77
79
|
*/
|
|
78
|
-
createToken({ tokenDecimals, weightBps, viewSymbol, oracleSymbol, mintAddr, }: Readonly<{
|
|
80
|
+
createToken({ tokenDecimals, weightBps, viewSymbol, oracleSymbol, mintAddr, pythProFeedId, }: Readonly<{
|
|
79
81
|
tokenDecimals: number;
|
|
80
82
|
weightBps: number;
|
|
81
83
|
viewSymbol: string;
|
|
82
84
|
oracleSymbol: string;
|
|
83
85
|
mintAddr: PublicKey;
|
|
86
|
+
pythProFeedId: number;
|
|
84
87
|
}>): Promise<{
|
|
85
88
|
actionId: bigint;
|
|
86
89
|
} & proto.Receipt_InsertTokenResult>;
|
|
@@ -96,10 +99,12 @@ export declare class NordAdmin {
|
|
|
96
99
|
* @param viewSymbol - Symbol exposed to Nord clients
|
|
97
100
|
* @param oracleSymbol - Symbol resolved by the oracle adapter
|
|
98
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
|
|
99
104
|
* @returns Action identifier and resulting market metadata
|
|
100
105
|
* @throws {NordError} If the action submission fails
|
|
101
106
|
*/
|
|
102
|
-
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<{
|
|
103
108
|
sizeDecimals: number;
|
|
104
109
|
priceDecimals: number;
|
|
105
110
|
imfBps: number;
|
|
@@ -109,10 +114,12 @@ export declare class NordAdmin {
|
|
|
109
114
|
viewSymbol: string;
|
|
110
115
|
oracleSymbol: string;
|
|
111
116
|
baseTokenId: number;
|
|
117
|
+
oracleSource?: OracleSourceInput;
|
|
118
|
+
pythProFeedId?: number;
|
|
112
119
|
}>): Promise<{
|
|
113
120
|
actionId: bigint;
|
|
114
121
|
} & proto.Receipt_InsertMarketResult>;
|
|
115
|
-
createRfqMarket({ sizeDecimals, priceDecimals, imfBps, cmfBps, mmfBps, viewSymbol, oracleSymbol, }: Readonly<{
|
|
122
|
+
createRfqMarket({ sizeDecimals, priceDecimals, imfBps, cmfBps, mmfBps, viewSymbol, oracleSymbol, oracleSource, pythProFeedId, }: Readonly<{
|
|
116
123
|
sizeDecimals: number;
|
|
117
124
|
priceDecimals: number;
|
|
118
125
|
imfBps: number;
|
|
@@ -120,6 +127,8 @@ export declare class NordAdmin {
|
|
|
120
127
|
mmfBps: number;
|
|
121
128
|
viewSymbol: string;
|
|
122
129
|
oracleSymbol: string;
|
|
130
|
+
oracleSource?: OracleSourceInput;
|
|
131
|
+
pythProFeedId?: number;
|
|
123
132
|
}>): Promise<{
|
|
124
133
|
actionId: bigint;
|
|
125
134
|
} & proto.Receipt_InsertMarketResult>;
|
|
@@ -148,44 +157,57 @@ export declare class NordAdmin {
|
|
|
148
157
|
}>): Promise<{
|
|
149
158
|
actionId: bigint;
|
|
150
159
|
} & proto.RfqMakersSet>;
|
|
151
|
-
/**
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
160
|
+
/** Assign or repair the oracle route for an existing token. */
|
|
161
|
+
setTokenOracleSource({ tokenId, oracleSource, }: Readonly<{
|
|
162
|
+
tokenId: number;
|
|
163
|
+
oracleSource?: OracleSourceInput;
|
|
164
|
+
}>): Promise<{
|
|
165
|
+
actionId: bigint;
|
|
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;
|
|
166
185
|
}>): Promise<{
|
|
167
186
|
actionId: bigint;
|
|
168
|
-
} & proto.
|
|
187
|
+
} & proto.MarketOracleSourceSet>;
|
|
169
188
|
/**
|
|
170
|
-
*
|
|
189
|
+
* Publish one or more custom oracle price observations.
|
|
171
190
|
*
|
|
172
|
-
* The
|
|
173
|
-
*
|
|
174
|
-
* 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`.
|
|
175
193
|
*
|
|
176
|
-
* @param
|
|
177
|
-
* @
|
|
178
|
-
* @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
|
|
179
196
|
* @throws {NordError} If the action submission fails
|
|
180
197
|
*/
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
198
|
+
customOraclePriceUpdates({ feeds, }: Readonly<{
|
|
199
|
+
feeds: readonly Readonly<{
|
|
200
|
+
feedId: number;
|
|
201
|
+
median: bigint;
|
|
202
|
+
confidence: bigint;
|
|
203
|
+
decimals: number;
|
|
204
|
+
publishedAtMillis: bigint;
|
|
205
|
+
}>[];
|
|
184
206
|
}>): Promise<{
|
|
185
207
|
actionId: bigint;
|
|
186
|
-
} & proto.
|
|
208
|
+
} & proto.Receipt_CustomOracleUpdateResult>;
|
|
187
209
|
/**
|
|
188
|
-
* Configure the fixed Pyth
|
|
210
|
+
* Configure the fixed Pyth Pro ed25519 trusted signer set.
|
|
189
211
|
*
|
|
190
212
|
* The input must contain exactly five unique Solana public keys. Signer
|
|
191
213
|
* entries use the same external shape as Pyth's Solana contract manager:
|
|
@@ -195,34 +217,11 @@ export declare class NordAdmin {
|
|
|
195
217
|
* @returns Action identifier and trusted signer receipt
|
|
196
218
|
* @throws {NordError} If the signer shape is invalid or submission fails
|
|
197
219
|
*/
|
|
198
|
-
|
|
199
|
-
trustedSigners: readonly
|
|
200
|
-
}>): Promise<{
|
|
201
|
-
actionId: bigint;
|
|
202
|
-
} & proto.Receipt_PythLazerTrustedSignersSetResult>;
|
|
203
|
-
/**
|
|
204
|
-
* Link one or more Pyth Lazer feed ids to Nord oracle symbols.
|
|
205
|
-
*
|
|
206
|
-
* @param feeds - Feed id to oracle symbol mappings
|
|
207
|
-
* @returns Action identifier and feed-symbol receipt
|
|
208
|
-
* @throws {NordError} If the feed mapping shape is invalid or submission fails
|
|
209
|
-
*/
|
|
210
|
-
pythLazerSetFeedSymbols({ feeds, }: Readonly<{
|
|
211
|
-
feeds: readonly PythLazerFeedSymbolInput[];
|
|
220
|
+
pythProSetTrustedSigners({ trustedSigners, }: Readonly<{
|
|
221
|
+
trustedSigners: readonly PythProTrustedSigner[];
|
|
212
222
|
}>): Promise<{
|
|
213
223
|
actionId: bigint;
|
|
214
|
-
} & proto.
|
|
215
|
-
/**
|
|
216
|
-
* Link a single Pyth Lazer feed id to a Nord oracle symbol.
|
|
217
|
-
*
|
|
218
|
-
* @param feedId - Pyth Lazer feed id
|
|
219
|
-
* @param oracleSymbol - Symbol resolved by the oracle adapter
|
|
220
|
-
* @returns Action identifier and feed-symbol receipt
|
|
221
|
-
* @throws {NordError} If the feed mapping shape is invalid or submission fails
|
|
222
|
-
*/
|
|
223
|
-
pythLazerSetFeedSymbol({ feedId, oracleSymbol, }: PythLazerFeedSymbolInput): Promise<{
|
|
224
|
-
actionId: bigint;
|
|
225
|
-
} & proto.Receipt_PythLazerFeedSymbolSetResult>;
|
|
224
|
+
} & proto.Receipt_PythProTrustedSignersSetResult>;
|
|
226
225
|
/**
|
|
227
226
|
* Pause all trading activity on the exchange.
|
|
228
227
|
*
|
|
@@ -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,6 +34,7 @@ export type UserAtomicSubaction = (AtomicTarget & ({
|
|
|
33
34
|
size: Decimal.Value;
|
|
34
35
|
timeout?: Duration;
|
|
35
36
|
clientOrderId?: BigIntValue;
|
|
37
|
+
referrer?: BigIntValue;
|
|
36
38
|
minimalFill?: Decimal.Value;
|
|
37
39
|
isReduceOnly?: boolean;
|
|
38
40
|
} | {
|
|
@@ -55,7 +57,7 @@ export type UserAtomicSubaction = (AtomicTarget & ({
|
|
|
55
57
|
limitQuoteSize?: Decimal.Value;
|
|
56
58
|
referrer?: BigIntValue;
|
|
57
59
|
} | {
|
|
58
|
-
kind: "
|
|
60
|
+
kind: "replaceTrigger";
|
|
59
61
|
triggerId: BigIntValue;
|
|
60
62
|
marketId: number;
|
|
61
63
|
side: Side;
|
|
@@ -64,9 +66,9 @@ export type UserAtomicSubaction = (AtomicTarget & ({
|
|
|
64
66
|
limitPrice?: Decimal.Value;
|
|
65
67
|
limitBaseSize?: Decimal.Value;
|
|
66
68
|
limitQuoteSize?: Decimal.Value;
|
|
69
|
+
referrer?: BigIntValue;
|
|
67
70
|
} | {
|
|
68
71
|
kind: "removeTrigger";
|
|
69
|
-
marketId: number;
|
|
70
72
|
triggerId: BigIntValue;
|
|
71
73
|
}));
|
|
72
74
|
export declare function decodeRfqFillResult(actionId: bigint, result: proto.Receipt_AtomicSubactionResultKind["inner"] | undefined): RfqFillResult;
|
|
@@ -76,6 +78,27 @@ export interface NormalizedReceiptTrade {
|
|
|
76
78
|
size: number;
|
|
77
79
|
accountId: number;
|
|
78
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
|
+
}
|
|
79
102
|
export interface NormalizedTakeAllBalance {
|
|
80
103
|
tokenId: number;
|
|
81
104
|
amount: number;
|
|
@@ -357,10 +380,11 @@ export declare class NordUser {
|
|
|
357
380
|
* @param accountId - Account executing the order
|
|
358
381
|
* @param clientOrderId - Optional client-specified identifier
|
|
359
382
|
* @param referrer - Optional referrer ID. Tracks which frontend/referral source placed order.
|
|
360
|
-
* @
|
|
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
|
|
361
385
|
* @throws {NordError} If the operation fails
|
|
362
386
|
*/
|
|
363
|
-
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<{
|
|
364
388
|
marketId: number;
|
|
365
389
|
side: Side;
|
|
366
390
|
fillMode: FillMode;
|
|
@@ -372,6 +396,7 @@ export declare class NordUser {
|
|
|
372
396
|
accountId?: number;
|
|
373
397
|
clientOrderId?: BigIntValue;
|
|
374
398
|
referrer?: BigIntValue;
|
|
399
|
+
triggers?: AttachedTriggers;
|
|
375
400
|
}>): Promise<{
|
|
376
401
|
actionId: bigint;
|
|
377
402
|
orderId?: bigint;
|
|
@@ -388,21 +413,23 @@ export declare class NordUser {
|
|
|
388
413
|
cancelledSize: number;
|
|
389
414
|
price: number;
|
|
390
415
|
}[];
|
|
416
|
+
triggerMutations: NormalizedTriggerMutations;
|
|
391
417
|
}>;
|
|
392
418
|
/**
|
|
393
419
|
* Cancel an order
|
|
394
420
|
*
|
|
395
421
|
* @param orderId - Order ID to cancel
|
|
396
422
|
* @param providedAccountId - Account ID that placed the order
|
|
397
|
-
* @returns Object containing actionId, cancelled
|
|
423
|
+
* @returns Object containing actionId, cancelled order result, and trigger mutations
|
|
398
424
|
* @throws {NordError} If the operation fails
|
|
399
425
|
*/
|
|
400
426
|
cancelOrder(orderId: BigIntValue, accountId?: number): Promise<{
|
|
401
427
|
actionId: bigint;
|
|
402
428
|
orderId: bigint;
|
|
403
429
|
accountId: number;
|
|
430
|
+
triggerMutations: NormalizedTriggerMutations;
|
|
404
431
|
}>;
|
|
405
|
-
placeRfqOrder({ marketId, side, size, price, timeout, accountId, clientOrderId, minimalFill, isReduceOnly, }: Readonly<{
|
|
432
|
+
placeRfqOrder({ marketId, side, size, price, timeout, accountId, clientOrderId, referrer, minimalFill, isReduceOnly, }: Readonly<{
|
|
406
433
|
marketId: number;
|
|
407
434
|
side: Side;
|
|
408
435
|
size: Decimal.Value;
|
|
@@ -410,6 +437,7 @@ export declare class NordUser {
|
|
|
410
437
|
timeout?: Duration;
|
|
411
438
|
accountId?: number;
|
|
412
439
|
clientOrderId?: BigIntValue;
|
|
440
|
+
referrer?: BigIntValue;
|
|
413
441
|
minimalFill?: Decimal.Value;
|
|
414
442
|
isReduceOnly?: boolean;
|
|
415
443
|
}>): Promise<{
|
|
@@ -431,13 +459,14 @@ export declare class NordUser {
|
|
|
431
459
|
*
|
|
432
460
|
* @param clientOrderId - Client order ID to cancel
|
|
433
461
|
* @param providedAccountId - Account ID that placed the order (defaults to the first account)
|
|
434
|
-
* @returns Object containing actionId, cancelled orderId, and
|
|
462
|
+
* @returns Object containing actionId, cancelled orderId, accountId, and triggerMutations
|
|
435
463
|
* @throws {NordError} If the operation fails
|
|
436
464
|
*/
|
|
437
465
|
cancelOrderByClientId(clientOrderId: BigIntValue, accountId?: number): Promise<{
|
|
438
466
|
actionId: bigint;
|
|
439
467
|
orderId: bigint;
|
|
440
468
|
accountId: number;
|
|
469
|
+
triggerMutations: NormalizedTriggerMutations;
|
|
441
470
|
}>;
|
|
442
471
|
takePositions({ targetAccountId, }: Readonly<{
|
|
443
472
|
targetAccountId: number;
|
|
@@ -483,23 +512,19 @@ export declare class NordUser {
|
|
|
483
512
|
/**
|
|
484
513
|
* Remove a trigger for the current session
|
|
485
514
|
*
|
|
486
|
-
* @param marketId - Market the trigger belongs to
|
|
487
515
|
* @param triggerId - Unique trigger identifier to remove
|
|
488
|
-
* @param accountId - Account executing the trigger
|
|
489
516
|
* @returns Object containing the actionId of the removal action
|
|
490
517
|
* @throws {NordError} If the operation fails
|
|
491
518
|
*/
|
|
492
|
-
removeTrigger({
|
|
493
|
-
marketId: number;
|
|
519
|
+
removeTrigger({ triggerId, }: Readonly<{
|
|
494
520
|
triggerId: bigint;
|
|
495
|
-
accountId?: number;
|
|
496
521
|
}>): Promise<{
|
|
497
522
|
actionId: bigint;
|
|
498
523
|
}>;
|
|
499
524
|
/**
|
|
500
|
-
*
|
|
525
|
+
* Replace an existing trigger for the current session
|
|
501
526
|
*
|
|
502
|
-
* @param triggerId - Unique trigger identifier to
|
|
527
|
+
* @param triggerId - Unique trigger identifier to replace
|
|
503
528
|
* @param marketId - Market to watch
|
|
504
529
|
* @param side - Order side for the trigger
|
|
505
530
|
* @param kind - Stop-loss or take-profit trigger type
|
|
@@ -507,11 +532,11 @@ export declare class NordUser {
|
|
|
507
532
|
* @param limitPrice - Optional limit price used once the trigger fires
|
|
508
533
|
* @param limitBaseSize - Optional base size limit used once the trigger fires
|
|
509
534
|
* @param limitQuoteSize - Optional quote size limit used once the trigger fires
|
|
510
|
-
* @param
|
|
511
|
-
* @returns Object containing the actionId of the
|
|
535
|
+
* @param referrer - Optional frontend or referral source
|
|
536
|
+
* @returns Object containing the actionId of the replacement action
|
|
512
537
|
* @throws {NordError} If the operation fails
|
|
513
538
|
*/
|
|
514
|
-
|
|
539
|
+
replaceTrigger({ triggerId, marketId, side, kind, triggerPrice, limitPrice, limitBaseSize, limitQuoteSize, referrer, }: Readonly<{
|
|
515
540
|
triggerId: bigint;
|
|
516
541
|
marketId: number;
|
|
517
542
|
side: Side;
|
|
@@ -520,7 +545,7 @@ export declare class NordUser {
|
|
|
520
545
|
limitPrice?: Decimal.Value;
|
|
521
546
|
limitBaseSize?: Decimal.Value;
|
|
522
547
|
limitQuoteSize?: Decimal.Value;
|
|
523
|
-
|
|
548
|
+
referrer?: BigIntValue;
|
|
524
549
|
}>): Promise<{
|
|
525
550
|
actionId: bigint;
|
|
526
551
|
}>;
|
|
@@ -578,18 +603,18 @@ export declare class NordUser {
|
|
|
578
603
|
* - cancel
|
|
579
604
|
* - cancelByClientId
|
|
580
605
|
* - addTrigger
|
|
581
|
-
* -
|
|
606
|
+
* - replaceTrigger
|
|
582
607
|
* - removeTrigger
|
|
583
608
|
*
|
|
584
609
|
* Per market, market-scoped subactions are phase-validated:
|
|
585
610
|
* 1. cancels and trigger removals can only be at the start
|
|
586
611
|
* 2. intermediate trades can trade only
|
|
587
|
-
* 3. placements and trigger adds/
|
|
612
|
+
* 3. placements and trigger adds/replacements go last
|
|
588
613
|
*
|
|
589
614
|
* Across markets, market-scoped subactions can be in any order.
|
|
590
615
|
*
|
|
591
616
|
* Trigger subactions are account-scoped. In one atomic sequence, the same
|
|
592
|
-
* trigger target cannot be added,
|
|
617
|
+
* trigger target cannot be added, replaced, or removed more than once.
|
|
593
618
|
*
|
|
594
619
|
* @param userActions array of user-friendly subactions
|
|
595
620
|
* @param providedAccountId optional account performing the action (defaults to first account)
|