@n1xyz/nord-ts 0.1.3 → 0.1.5
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/README.md +2 -2
- package/dist/gen/nord_pb.d.ts +399 -3
- package/dist/gen/nord_pb.js +119 -61
- package/dist/gen/openapi.d.ts +216 -3
- package/dist/nord/api/actions.d.ts +11 -0
- package/dist/nord/api/actions.js +18 -0
- package/dist/nord/client/Nord.d.ts +113 -8
- package/dist/nord/client/Nord.js +206 -8
- package/dist/nord/client/NordAdmin.d.ts +236 -0
- package/dist/nord/client/NordAdmin.js +337 -0
- package/dist/nord/client/NordClient.d.ts +33 -0
- package/dist/nord/client/NordClient.js +45 -0
- package/dist/nord/client/NordUser.d.ts +6 -50
- package/dist/nord/client/NordUser.js +162 -133
- package/dist/nord/index.d.ts +4 -0
- package/dist/nord/index.js +5 -1
- package/dist/types.d.ts +13 -5
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +5 -0
- package/package.json +2 -2
- package/src/gen/nord_pb.ts +499 -60
- package/src/gen/openapi.ts +216 -3
- package/src/nord/api/actions.ts +28 -4
- package/src/nord/client/Nord.ts +258 -15
- package/src/nord/client/NordAdmin.ts +441 -0
- package/src/nord/client/NordClient.ts +79 -0
- package/src/nord/client/NordUser.ts +176 -229
- package/src/nord/index.ts +11 -0
- package/src/types.ts +15 -5
- package/src/utils.ts +5 -0
- package/src/nord/api/triggers.ts +0 -57
package/dist/gen/openapi.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export interface paths {
|
|
|
59
59
|
[name: string]: unknown;
|
|
60
60
|
};
|
|
61
61
|
content: {
|
|
62
|
-
"application/json": components["schemas"]["
|
|
62
|
+
"application/json": components["schemas"]["MarketsInfo"];
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
65
|
};
|
|
@@ -361,6 +361,14 @@ export interface paths {
|
|
|
361
361
|
"application/json": number;
|
|
362
362
|
};
|
|
363
363
|
};
|
|
364
|
+
404: {
|
|
365
|
+
headers: {
|
|
366
|
+
[name: string]: unknown;
|
|
367
|
+
};
|
|
368
|
+
content: {
|
|
369
|
+
"application/json": components["schemas"]["UserNotFound"];
|
|
370
|
+
};
|
|
371
|
+
};
|
|
364
372
|
};
|
|
365
373
|
};
|
|
366
374
|
put?: never;
|
|
@@ -1068,6 +1076,161 @@ export interface paths {
|
|
|
1068
1076
|
patch?: never;
|
|
1069
1077
|
trace?: never;
|
|
1070
1078
|
};
|
|
1079
|
+
"/state/info": {
|
|
1080
|
+
parameters: {
|
|
1081
|
+
query?: never;
|
|
1082
|
+
header?: never;
|
|
1083
|
+
path?: never;
|
|
1084
|
+
cookie?: never;
|
|
1085
|
+
};
|
|
1086
|
+
get: {
|
|
1087
|
+
parameters: {
|
|
1088
|
+
query?: never;
|
|
1089
|
+
header?: never;
|
|
1090
|
+
path?: never;
|
|
1091
|
+
cookie?: never;
|
|
1092
|
+
};
|
|
1093
|
+
requestBody?: never;
|
|
1094
|
+
responses: {
|
|
1095
|
+
200: {
|
|
1096
|
+
headers: {
|
|
1097
|
+
[name: string]: unknown;
|
|
1098
|
+
};
|
|
1099
|
+
content: {
|
|
1100
|
+
"application/json": components["schemas"]["StateInfo"];
|
|
1101
|
+
};
|
|
1102
|
+
};
|
|
1103
|
+
};
|
|
1104
|
+
};
|
|
1105
|
+
put?: never;
|
|
1106
|
+
post?: never;
|
|
1107
|
+
delete?: never;
|
|
1108
|
+
options?: never;
|
|
1109
|
+
head?: never;
|
|
1110
|
+
patch?: never;
|
|
1111
|
+
trace?: never;
|
|
1112
|
+
};
|
|
1113
|
+
"/fee/brackets/info": {
|
|
1114
|
+
parameters: {
|
|
1115
|
+
query?: never;
|
|
1116
|
+
header?: never;
|
|
1117
|
+
path?: never;
|
|
1118
|
+
cookie?: never;
|
|
1119
|
+
};
|
|
1120
|
+
get: {
|
|
1121
|
+
parameters: {
|
|
1122
|
+
query?: never;
|
|
1123
|
+
header?: never;
|
|
1124
|
+
path?: never;
|
|
1125
|
+
cookie?: never;
|
|
1126
|
+
};
|
|
1127
|
+
requestBody?: never;
|
|
1128
|
+
responses: {
|
|
1129
|
+
200: {
|
|
1130
|
+
headers: {
|
|
1131
|
+
[name: string]: unknown;
|
|
1132
|
+
};
|
|
1133
|
+
content: {
|
|
1134
|
+
"application/json": [
|
|
1135
|
+
components["schemas"]["FeeTierId"],
|
|
1136
|
+
components["schemas"]["FeeTierConfig"]
|
|
1137
|
+
][];
|
|
1138
|
+
};
|
|
1139
|
+
};
|
|
1140
|
+
};
|
|
1141
|
+
};
|
|
1142
|
+
put?: never;
|
|
1143
|
+
post?: never;
|
|
1144
|
+
delete?: never;
|
|
1145
|
+
options?: never;
|
|
1146
|
+
head?: never;
|
|
1147
|
+
patch?: never;
|
|
1148
|
+
trace?: never;
|
|
1149
|
+
};
|
|
1150
|
+
"/account/{account_id}/fee/tier": {
|
|
1151
|
+
parameters: {
|
|
1152
|
+
query?: never;
|
|
1153
|
+
header?: never;
|
|
1154
|
+
path?: never;
|
|
1155
|
+
cookie?: never;
|
|
1156
|
+
};
|
|
1157
|
+
get: {
|
|
1158
|
+
parameters: {
|
|
1159
|
+
query?: never;
|
|
1160
|
+
header?: never;
|
|
1161
|
+
path: {
|
|
1162
|
+
account_id: number;
|
|
1163
|
+
};
|
|
1164
|
+
cookie?: never;
|
|
1165
|
+
};
|
|
1166
|
+
requestBody?: never;
|
|
1167
|
+
responses: {
|
|
1168
|
+
200: {
|
|
1169
|
+
headers: {
|
|
1170
|
+
[name: string]: unknown;
|
|
1171
|
+
};
|
|
1172
|
+
content: {
|
|
1173
|
+
"application/json": components["schemas"]["FeeTierId"];
|
|
1174
|
+
};
|
|
1175
|
+
};
|
|
1176
|
+
404: {
|
|
1177
|
+
headers: {
|
|
1178
|
+
[name: string]: unknown;
|
|
1179
|
+
};
|
|
1180
|
+
content: {
|
|
1181
|
+
"application/json": components["schemas"]["UserNotFound"];
|
|
1182
|
+
};
|
|
1183
|
+
};
|
|
1184
|
+
};
|
|
1185
|
+
};
|
|
1186
|
+
put?: never;
|
|
1187
|
+
post?: never;
|
|
1188
|
+
delete?: never;
|
|
1189
|
+
options?: never;
|
|
1190
|
+
head?: never;
|
|
1191
|
+
patch?: never;
|
|
1192
|
+
trace?: never;
|
|
1193
|
+
};
|
|
1194
|
+
"/accounts/fee-tiers": {
|
|
1195
|
+
parameters: {
|
|
1196
|
+
query?: never;
|
|
1197
|
+
header?: never;
|
|
1198
|
+
path?: never;
|
|
1199
|
+
cookie?: never;
|
|
1200
|
+
};
|
|
1201
|
+
/** @description List fee tiers assigned to accounts. */
|
|
1202
|
+
get: {
|
|
1203
|
+
parameters: {
|
|
1204
|
+
query?: {
|
|
1205
|
+
/** @description fetch results starting with this page; query starts with first entry if page isn't specified */
|
|
1206
|
+
startInclusive?: number | null;
|
|
1207
|
+
/** @description Query returns up to 50 trades in one go. */
|
|
1208
|
+
pageSize?: number | null;
|
|
1209
|
+
};
|
|
1210
|
+
header?: never;
|
|
1211
|
+
path?: never;
|
|
1212
|
+
cookie?: never;
|
|
1213
|
+
};
|
|
1214
|
+
requestBody?: never;
|
|
1215
|
+
responses: {
|
|
1216
|
+
200: {
|
|
1217
|
+
headers: {
|
|
1218
|
+
[name: string]: unknown;
|
|
1219
|
+
};
|
|
1220
|
+
content: {
|
|
1221
|
+
"application/json": components["schemas"]["PageResult_for_uint32_and_AccountFeeTier"];
|
|
1222
|
+
};
|
|
1223
|
+
};
|
|
1224
|
+
};
|
|
1225
|
+
};
|
|
1226
|
+
put?: never;
|
|
1227
|
+
post?: never;
|
|
1228
|
+
delete?: never;
|
|
1229
|
+
options?: never;
|
|
1230
|
+
head?: never;
|
|
1231
|
+
patch?: never;
|
|
1232
|
+
trace?: never;
|
|
1233
|
+
};
|
|
1071
1234
|
"/tv": {
|
|
1072
1235
|
parameters: {
|
|
1073
1236
|
query?: never;
|
|
@@ -1967,7 +2130,7 @@ export interface components {
|
|
|
1967
2130
|
} & {
|
|
1968
2131
|
[key: string]: unknown;
|
|
1969
2132
|
};
|
|
1970
|
-
|
|
2133
|
+
MarketsInfo: {
|
|
1971
2134
|
markets: components["schemas"]["MarketInfo"][];
|
|
1972
2135
|
tokens: components["schemas"]["TokenInfo"][];
|
|
1973
2136
|
};
|
|
@@ -2041,6 +2204,7 @@ export interface components {
|
|
|
2041
2204
|
ActionNotFound: null;
|
|
2042
2205
|
/** @description Returns fee parts per market per balance change per action per account. Fee is taken from user without return. Please note that some operations need some deposit which will be returned - these are not part of fees. */
|
|
2043
2206
|
FillRole: "maker" | "taker";
|
|
2207
|
+
UserNotFound: null;
|
|
2044
2208
|
OrderbookInfo: {
|
|
2045
2209
|
/** Format: uint64 */
|
|
2046
2210
|
updateId: number;
|
|
@@ -2118,7 +2282,6 @@ export interface components {
|
|
|
2118
2282
|
pubkey: string;
|
|
2119
2283
|
expiry: string;
|
|
2120
2284
|
};
|
|
2121
|
-
UserNotFound: null;
|
|
2122
2285
|
PageQueryPart_for_String: {
|
|
2123
2286
|
/** @description fetch results starting with this page; query starts with first entry if page isn't specified */
|
|
2124
2287
|
startInclusive?: string | null;
|
|
@@ -2475,6 +2638,56 @@ export interface components {
|
|
|
2475
2638
|
version?: components["schemas"]["BinaryId"] | null;
|
|
2476
2639
|
};
|
|
2477
2640
|
BinaryId: string;
|
|
2641
|
+
StateInfo: {
|
|
2642
|
+
version: components["schemas"]["ExecutableVersion"];
|
|
2643
|
+
state: components["schemas"]["EngineStateHeader"];
|
|
2644
|
+
};
|
|
2645
|
+
EngineStateHeader: {
|
|
2646
|
+
/** Format: uint16 */
|
|
2647
|
+
version: number;
|
|
2648
|
+
/** Format: uint64 */
|
|
2649
|
+
action_id: number;
|
|
2650
|
+
/** Format: uint64 */
|
|
2651
|
+
action_nonce: number;
|
|
2652
|
+
/** Format: uint64 */
|
|
2653
|
+
timestamp: number;
|
|
2654
|
+
paused: boolean;
|
|
2655
|
+
};
|
|
2656
|
+
/** Format: uint32 */
|
|
2657
|
+
FeeTierId: number;
|
|
2658
|
+
FeeTierConfig: {
|
|
2659
|
+
/** Format: uint16 */
|
|
2660
|
+
maker_fee_bps: number;
|
|
2661
|
+
/** Format: uint16 */
|
|
2662
|
+
taker_fee_bps: number;
|
|
2663
|
+
};
|
|
2664
|
+
PageQueryPart_for_uint32: {
|
|
2665
|
+
/**
|
|
2666
|
+
* Format: uint32
|
|
2667
|
+
* @description fetch results starting with this page; query starts with first entry if page isn't specified
|
|
2668
|
+
*/
|
|
2669
|
+
startInclusive?: number | null;
|
|
2670
|
+
/**
|
|
2671
|
+
* Format: uint8
|
|
2672
|
+
* @description Query returns up to 50 trades in one go.
|
|
2673
|
+
* @default null
|
|
2674
|
+
*/
|
|
2675
|
+
pageSize: number | null;
|
|
2676
|
+
};
|
|
2677
|
+
PageResult_for_uint32_and_AccountFeeTier: {
|
|
2678
|
+
/** @description Set of items for requested by query. */
|
|
2679
|
+
items: components["schemas"]["AccountFeeTier"][];
|
|
2680
|
+
/**
|
|
2681
|
+
* Format: uint32
|
|
2682
|
+
* @description If request contains more data, this is the id is set with which next request should be performed to get next page. If no more data, then it is undefined.
|
|
2683
|
+
*/
|
|
2684
|
+
nextStartInclusive?: number | null;
|
|
2685
|
+
};
|
|
2686
|
+
AccountFeeTier: {
|
|
2687
|
+
/** Format: uint32 */
|
|
2688
|
+
accountId: number;
|
|
2689
|
+
feeTier: components["schemas"]["FeeTierId"];
|
|
2690
|
+
};
|
|
2478
2691
|
/** @description TV config query response https://www.tradingview.com/charting-library-docs/latest/connecting_data/UDF/#data-feed-configuration-data */
|
|
2479
2692
|
TvConfigResponse: {
|
|
2480
2693
|
supported_resolutions: components["schemas"]["Resolution"][];
|
|
@@ -2,6 +2,16 @@ import Decimal from "decimal.js";
|
|
|
2
2
|
import * as proto from "../../gen/nord_pb";
|
|
3
3
|
import { FillMode, Side, QuoteSize, TriggerKind } from "../../types";
|
|
4
4
|
import { BigIntValue } from "../../utils";
|
|
5
|
+
type ReceiptKind = NonNullable<proto.Receipt["kind"]>;
|
|
6
|
+
type ExtractReceiptKind<K extends ReceiptKind["case"]> = Extract<ReceiptKind, {
|
|
7
|
+
case: K;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function formatReceiptError(receipt: proto.Receipt): string;
|
|
10
|
+
export declare function expectReceiptKind<K extends ReceiptKind["case"]>(receipt: proto.Receipt, expected: K, action: string): asserts receipt is proto.Receipt & {
|
|
11
|
+
kind: ExtractReceiptKind<K>;
|
|
12
|
+
};
|
|
13
|
+
export declare function createAction(currentTimestamp: bigint, nonce: number, kind: proto.Action["kind"]): proto.Action;
|
|
14
|
+
export declare function sendAction(serverUrl: string, makeSignedMessage: (message: Uint8Array) => Promise<Uint8Array>, action: proto.Action): Promise<proto.Receipt>;
|
|
5
15
|
export declare function prepareAction(action: proto.Action, makeSignedMessage: (message: Uint8Array) => Promise<Uint8Array>): Promise<Uint8Array<ArrayBufferLike>>;
|
|
6
16
|
export declare function createSession(serverUrl: string, walletSignFn: (message: string | Uint8Array) => Promise<Uint8Array>, currentTimestamp: bigint, nonce: number, params: {
|
|
7
17
|
userPubkey: Uint8Array;
|
|
@@ -113,3 +123,4 @@ export declare function atomic(serverUrl: string, signFn: (message: Uint8Array)
|
|
|
113
123
|
actionId: bigint;
|
|
114
124
|
results: proto.Receipt_AtomicSubactionResultKind[];
|
|
115
125
|
}>;
|
|
126
|
+
export {};
|
package/dist/nord/api/actions.js
CHANGED
|
@@ -36,6 +36,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.formatReceiptError = formatReceiptError;
|
|
40
|
+
exports.expectReceiptKind = expectReceiptKind;
|
|
41
|
+
exports.createAction = createAction;
|
|
42
|
+
exports.sendAction = sendAction;
|
|
39
43
|
exports.prepareAction = prepareAction;
|
|
40
44
|
exports.createSession = createSession;
|
|
41
45
|
exports.revokeSession = revokeSession;
|
|
@@ -52,6 +56,20 @@ const protobuf_1 = require("@bufbuild/protobuf");
|
|
|
52
56
|
const types_1 = require("../../types");
|
|
53
57
|
const utils_1 = require("../../utils");
|
|
54
58
|
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
59
|
+
const NordError_1 = require("../utils/NordError");
|
|
60
|
+
function formatReceiptError(receipt) {
|
|
61
|
+
if (receipt.kind?.case === "err") {
|
|
62
|
+
const err = receipt.kind.value;
|
|
63
|
+
return proto.Error[err] ?? err.toString();
|
|
64
|
+
}
|
|
65
|
+
return receipt.kind?.case ?? "unknown";
|
|
66
|
+
}
|
|
67
|
+
function expectReceiptKind(receipt, expected, action) {
|
|
68
|
+
if (receipt.kind?.case !== expected) {
|
|
69
|
+
const label = formatReceiptError(receipt);
|
|
70
|
+
throw new NordError_1.NordError(`Failed to ${action}: ${label}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
55
73
|
async function sessionSign(signFn, message) {
|
|
56
74
|
const signature = await signFn(message);
|
|
57
75
|
return new Uint8Array([...message, ...signature]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ProtonClient } from "@n1xyz/proton";
|
|
2
2
|
import { PublicKey } from "@solana/web3.js";
|
|
3
3
|
import { EventEmitter } from "events";
|
|
4
|
-
import { Account, AccountPnlPage, AccountPnlQuery, ActionResponse, AggregateMetrics,
|
|
4
|
+
import { Account, AccountPnlPage, AccountPnlQuery, ActionResponse, AggregateMetrics, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, PeakTpsPeriodUnit, Token, TradesResponse, User, AccountTriggerInfo, HistoryTriggerQuery, TriggerHistoryPage, FeeTierId, AccountFeeTierPage, PageResultStringOrderInfo, PageResultStringTrade, OrderInfoFromApi, TokenStats, FillRole } from "../../types";
|
|
5
5
|
import { NordWebSocketClient } from "../../websocket/index";
|
|
6
6
|
import { OrderbookSubscription, TradeSubscription } from "../models/Subscriber";
|
|
7
7
|
/**
|
|
@@ -27,8 +27,6 @@ export interface WebSocketSubscriptionOptions {
|
|
|
27
27
|
export declare class Nord {
|
|
28
28
|
/** Base URL for the Nord web server */
|
|
29
29
|
readonly webServerUrl: string;
|
|
30
|
-
/** Bridge verification key */
|
|
31
|
-
readonly bridgeVk: PublicKey;
|
|
32
30
|
/** Solana RPC URL */
|
|
33
31
|
readonly solanaUrl: string;
|
|
34
32
|
/** Available markets */
|
|
@@ -37,7 +35,7 @@ export declare class Nord {
|
|
|
37
35
|
tokens: Token[];
|
|
38
36
|
/** Map of symbol to market_id */
|
|
39
37
|
private symbolToMarketId;
|
|
40
|
-
/** Proton client for
|
|
38
|
+
/** Proton client for proton related operations */
|
|
41
39
|
protonClient: ProtonClient;
|
|
42
40
|
/** HTTP client for Nord operations */
|
|
43
41
|
private httpClient;
|
|
@@ -46,7 +44,6 @@ export declare class Nord {
|
|
|
46
44
|
*
|
|
47
45
|
* @param config - Configuration options for the Nord client
|
|
48
46
|
* @param config.webServerUrl - Base URL for the Nord web server
|
|
49
|
-
* @param config.bridgeVk - Bridge verification key
|
|
50
47
|
* @param config.solanaUrl - Solana cluster URL
|
|
51
48
|
* @throws {Error} If required configuration is missing
|
|
52
49
|
*/
|
|
@@ -99,12 +96,12 @@ export declare class Nord {
|
|
|
99
96
|
*
|
|
100
97
|
* @param nordConfig - Configuration options for the Nord client
|
|
101
98
|
* @param nordConfig.webServerUrl - Base URL for the Nord web server
|
|
102
|
-
* @param nordConfig.
|
|
99
|
+
* @param nordConfig.app - App address
|
|
103
100
|
* @param nordConfig.solanaUrl - Solana cluster URL
|
|
104
101
|
* @returns Initialized Nord client
|
|
105
102
|
* @throws {NordError} If initialization fails
|
|
106
103
|
*/
|
|
107
|
-
static initNord({
|
|
104
|
+
static initNord({ app, solanaUrl, webServerUrl, }: Readonly<NordConfig>): Promise<Nord>;
|
|
108
105
|
/**
|
|
109
106
|
* Initialize the Nord client
|
|
110
107
|
* @private
|
|
@@ -254,7 +251,22 @@ export declare class Nord {
|
|
|
254
251
|
* @returns Information about markets and tokens
|
|
255
252
|
* @throws {NordError} If the request fails
|
|
256
253
|
*/
|
|
257
|
-
getInfo(): Promise<
|
|
254
|
+
getInfo(): Promise<MarketsInfo>;
|
|
255
|
+
/**
|
|
256
|
+
* Fetch the current fee tier brackets configured on Nord.
|
|
257
|
+
*
|
|
258
|
+
* @returns Array of fee tier identifiers paired with their configuration
|
|
259
|
+
* @throws {NordError} If the request fails
|
|
260
|
+
*/
|
|
261
|
+
getFeeBrackets(): Promise<Array<[FeeTierId, FeeTierConfig]>>;
|
|
262
|
+
/**
|
|
263
|
+
* Retrieve the fee tier assigned to a specific account.
|
|
264
|
+
*
|
|
265
|
+
* @param accountId - Account identifier to query
|
|
266
|
+
* @returns Fee tier details for the requested account
|
|
267
|
+
* @throws {NordError} If the request fails
|
|
268
|
+
*/
|
|
269
|
+
getAccountFeeTier(accountId: number): Promise<FeeTierId>;
|
|
258
270
|
/**
|
|
259
271
|
* Get account information
|
|
260
272
|
*
|
|
@@ -263,6 +275,41 @@ export declare class Nord {
|
|
|
263
275
|
* @throws {NordError} If the request fails
|
|
264
276
|
*/
|
|
265
277
|
getAccount(accountId: number): Promise<Account>;
|
|
278
|
+
/**
|
|
279
|
+
* Get the public key associated with an account id.
|
|
280
|
+
*
|
|
281
|
+
* @param accountId - Account id to query
|
|
282
|
+
* @returns Base58-encoded account public key
|
|
283
|
+
* @throws {NordError} If the request fails
|
|
284
|
+
*/
|
|
285
|
+
getAccountPubkey(accountId: number): Promise<string>;
|
|
286
|
+
/**
|
|
287
|
+
* Get the withdrawal fee charged for an account.
|
|
288
|
+
*
|
|
289
|
+
* @param accountId - Account id to query
|
|
290
|
+
* @returns Withdrawal fee quoted in quote token units
|
|
291
|
+
* @throws {NordError} If the request fails
|
|
292
|
+
*/
|
|
293
|
+
getAccountWithdrawalFee(accountId: number): Promise<number>;
|
|
294
|
+
/**
|
|
295
|
+
* Get open orders for an account.
|
|
296
|
+
*
|
|
297
|
+
* @param accountId - Account id to query
|
|
298
|
+
* @param query - Optional pagination parameters
|
|
299
|
+
* @returns Page of orders keyed by client order id
|
|
300
|
+
* @throws {NordError} If the request fails
|
|
301
|
+
*/
|
|
302
|
+
getAccountOrders(accountId: number, query?: {
|
|
303
|
+
startInclusive?: string | null;
|
|
304
|
+
pageSize?: number | null;
|
|
305
|
+
}): Promise<PageResultStringOrderInfo>;
|
|
306
|
+
/**
|
|
307
|
+
* List account fee tiers with pagination support.
|
|
308
|
+
*/
|
|
309
|
+
getAccountsFeeTiers(query?: {
|
|
310
|
+
startInclusive?: number | null;
|
|
311
|
+
pageSize?: number | null;
|
|
312
|
+
}): Promise<AccountFeeTierPage>;
|
|
266
313
|
/**
|
|
267
314
|
* Get profit and loss history for an account
|
|
268
315
|
*
|
|
@@ -280,6 +327,46 @@ export declare class Nord {
|
|
|
280
327
|
getMarketStats({ marketId, }: {
|
|
281
328
|
marketId: number;
|
|
282
329
|
}): Promise<MarketStats>;
|
|
330
|
+
/**
|
|
331
|
+
* Fetch the per-market fee quote for an account.
|
|
332
|
+
*
|
|
333
|
+
* @param params - Market id, fee kind, and account id to quote
|
|
334
|
+
* @returns Fee in quote token units (negative means fee is charged)
|
|
335
|
+
* @throws {NordError} If the request fails
|
|
336
|
+
*/
|
|
337
|
+
getMarketFee({ marketId, feeKind, accountId, }: {
|
|
338
|
+
marketId: number;
|
|
339
|
+
feeKind: FillRole;
|
|
340
|
+
accountId: number;
|
|
341
|
+
}): Promise<number>;
|
|
342
|
+
/**
|
|
343
|
+
* Fetch token statistics such as index price and oracle metadata.
|
|
344
|
+
*
|
|
345
|
+
* @param tokenId - Token identifier
|
|
346
|
+
* @returns Token stats
|
|
347
|
+
* @throws {NordError} If the request fails
|
|
348
|
+
*/
|
|
349
|
+
getTokenStats(tokenId: number): Promise<TokenStats>;
|
|
350
|
+
/**
|
|
351
|
+
* Get order summary by order id.
|
|
352
|
+
*
|
|
353
|
+
* @param orderId - Order identifier
|
|
354
|
+
* @returns Order information
|
|
355
|
+
* @throws {NordError} If the request fails
|
|
356
|
+
*/
|
|
357
|
+
getOrder(orderId: string): Promise<OrderInfoFromApi>;
|
|
358
|
+
/**
|
|
359
|
+
* Get trade history for a specific order.
|
|
360
|
+
*
|
|
361
|
+
* @param orderId - Order identifier
|
|
362
|
+
* @param query - Optional pagination parameters
|
|
363
|
+
* @returns Page of trades associated with the order
|
|
364
|
+
* @throws {NordError} If the request fails
|
|
365
|
+
*/
|
|
366
|
+
getOrderTrades(orderId: string, query?: {
|
|
367
|
+
startInclusive?: string | null;
|
|
368
|
+
pageSize?: number | null;
|
|
369
|
+
}): Promise<PageResultStringTrade>;
|
|
283
370
|
/**
|
|
284
371
|
* Check if an account exists for the given address
|
|
285
372
|
*
|
|
@@ -288,4 +375,22 @@ export declare class Nord {
|
|
|
288
375
|
* @deprecated use getUser instead
|
|
289
376
|
*/
|
|
290
377
|
accountExists(pubkey: string | PublicKey): Promise<boolean>;
|
|
378
|
+
/**
|
|
379
|
+
* Fetch active triggers for an account.
|
|
380
|
+
*
|
|
381
|
+
* @param params Optional parameters containing an explicit account id.
|
|
382
|
+
* @throws {NordError} If no account can be resolved or the request fails.
|
|
383
|
+
*/
|
|
384
|
+
getAccountTriggers(params?: {
|
|
385
|
+
accountId?: number;
|
|
386
|
+
}): Promise<AccountTriggerInfo[]>;
|
|
387
|
+
/**
|
|
388
|
+
* Fetch trigger history for an account.
|
|
389
|
+
*
|
|
390
|
+
* @param params Optional parameters with account id and history query filters.
|
|
391
|
+
* @throws {NordError} If no account can be resolved or the request fails.
|
|
392
|
+
*/
|
|
393
|
+
getAccountTriggerHistory(params: HistoryTriggerQuery & {
|
|
394
|
+
accountId?: number;
|
|
395
|
+
}): Promise<TriggerHistoryPage>;
|
|
291
396
|
}
|