@n1xyz/nord-ts 0.0.18-8121ed05.0 → 0.0.18
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/.local/qa.ts +77 -0
- package/.local/test-atomic.ts +112 -0
- package/check.sh +4 -0
- package/default.nix +47 -0
- package/dist/api/client.d.ts +14 -0
- package/dist/api/client.js +45 -0
- package/dist/gen/nord.d.ts +52 -23
- package/dist/gen/nord.js +322 -170
- package/dist/gen/openapi.d.ts +2244 -0
- package/dist/gen/openapi.js +6 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -9
- package/dist/nord/api/actions.d.ts +30 -1
- package/dist/nord/api/actions.js +60 -3
- package/dist/nord/api/core.d.ts +1 -34
- package/dist/nord/api/core.js +0 -71
- package/dist/nord/client/Nord.d.ts +31 -33
- package/dist/nord/client/Nord.js +100 -60
- package/dist/nord/client/NordUser.d.ts +64 -11
- package/dist/nord/client/NordUser.js +90 -33
- package/dist/nord/index.d.ts +0 -2
- package/dist/nord/index.js +0 -2
- package/dist/nord/models/Subscriber.d.ts +2 -2
- package/dist/types.d.ts +43 -190
- package/dist/utils.d.ts +1 -19
- package/dist/utils.js +5 -39
- package/dist/websocket/NordWebSocketClient.js +18 -13
- package/dist/websocket/index.d.ts +1 -1
- package/package.json +20 -27
- package/src/index.ts +0 -16
- package/src/nord/api/actions.ts +131 -9
- package/src/nord/api/core.ts +0 -71
- package/src/nord/client/Nord.ts +142 -76
- package/src/nord/client/NordUser.ts +171 -50
- package/src/nord/index.ts +0 -2
- package/src/nord/models/Subscriber.ts +2 -2
- package/src/types.ts +55 -216
- package/src/utils.ts +6 -42
- package/src/websocket/NordWebSocketClient.ts +23 -15
- package/src/websocket/index.ts +1 -1
- package/tests/utils.spec.ts +1 -34
- package/dist/idl/bridge.json +0 -1506
- package/jest.config.ts +0 -9
- package/nodemon.json +0 -4
- package/protoc-generate.sh +0 -23
- package/src/idl/bridge.json +0 -1506
- package/src/nord/api/market.ts +0 -122
- package/src/nord/api/queries.ts +0 -135
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,3 @@ export * from "./utils";
|
|
|
3
3
|
export * from "./const";
|
|
4
4
|
export * from "./nord";
|
|
5
5
|
export * from "./websocket/index";
|
|
6
|
-
export { ProtonClient, buildDepositTx, createTokenAccountIfNeeded, type DepositSplParams, type WithdrawalParams, type WithdrawalClaim, type SPLTokenInfo, } from "@n1xyz/proton";
|
package/dist/index.js
CHANGED
|
@@ -14,17 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.createTokenAccountIfNeeded = exports.buildDepositTx = exports.ProtonClient = void 0;
|
|
18
|
-
// Export types
|
|
19
17
|
__exportStar(require("./types"), exports);
|
|
20
18
|
__exportStar(require("./utils"), exports);
|
|
21
19
|
__exportStar(require("./const"), exports);
|
|
22
|
-
// Export Nord modules
|
|
23
20
|
__exportStar(require("./nord"), exports);
|
|
24
|
-
// Export WebSocket modules
|
|
25
21
|
__exportStar(require("./websocket/index"), exports);
|
|
26
|
-
// Re-export proton bridge functionality for backward compatibility
|
|
27
|
-
var proton_1 = require("@n1xyz/proton");
|
|
28
|
-
Object.defineProperty(exports, "ProtonClient", { enumerable: true, get: function () { return proton_1.ProtonClient; } });
|
|
29
|
-
Object.defineProperty(exports, "buildDepositTx", { enumerable: true, get: function () { return proton_1.buildDepositTx; } });
|
|
30
|
-
Object.defineProperty(exports, "createTokenAccountIfNeeded", { enumerable: true, get: function () { return proton_1.createTokenAccountIfNeeded; } });
|
|
@@ -46,7 +46,8 @@ declare function placeOrderImpl(sendFn: (encoded: Uint8Array) => Promise<Uint8Ar
|
|
|
46
46
|
isReduceOnly: boolean;
|
|
47
47
|
size?: Decimal.Value;
|
|
48
48
|
price?: Decimal.Value;
|
|
49
|
-
|
|
49
|
+
quoteSizeSize?: Decimal.Value;
|
|
50
|
+
quoteSizePrice?: Decimal.Value;
|
|
50
51
|
clientOrderId?: BigIntValue;
|
|
51
52
|
}): Promise<bigint | undefined>;
|
|
52
53
|
export declare function placeOrder(serverUrl: string, signFn: (message: Uint8Array) => Promise<Uint8Array>, currentTimestamp: bigint, nonce: number, params: {
|
|
@@ -92,6 +93,33 @@ export declare function transfer(serverUrl: string, signFn: (message: Uint8Array
|
|
|
92
93
|
tokenDecimals: number;
|
|
93
94
|
amount: Decimal.Value;
|
|
94
95
|
}): Promise<number | undefined>;
|
|
96
|
+
export type AtomicSubaction = {
|
|
97
|
+
kind: "place";
|
|
98
|
+
marketId: number;
|
|
99
|
+
side: Side;
|
|
100
|
+
fillMode: FillMode;
|
|
101
|
+
isReduceOnly: boolean;
|
|
102
|
+
sizeDecimals: number;
|
|
103
|
+
priceDecimals: number;
|
|
104
|
+
size?: Decimal.Value;
|
|
105
|
+
price?: Decimal.Value;
|
|
106
|
+
quoteSizeSize?: Decimal.Value;
|
|
107
|
+
quoteSizePrice?: Decimal.Value;
|
|
108
|
+
clientOrderId?: BigIntValue;
|
|
109
|
+
} | {
|
|
110
|
+
kind: "cancel";
|
|
111
|
+
orderId: BigIntValue;
|
|
112
|
+
};
|
|
113
|
+
declare function atomicImpl(sendFn: (encoded: Uint8Array) => Promise<Uint8Array>, signFn: (message: Uint8Array) => Promise<Uint8Array>, currentTimestamp: bigint, nonce: number, params: {
|
|
114
|
+
sessionId: BigIntValue;
|
|
115
|
+
accountId?: number;
|
|
116
|
+
actions: AtomicSubaction[];
|
|
117
|
+
}): Promise<proto.Receipt_AtomicResult>;
|
|
118
|
+
export declare function atomic(serverUrl: string, signFn: (message: Uint8Array) => Promise<Uint8Array>, currentTimestamp: bigint, nonce: number, params: {
|
|
119
|
+
sessionId: BigIntValue;
|
|
120
|
+
accountId?: number;
|
|
121
|
+
actions: AtomicSubaction[];
|
|
122
|
+
}): Promise<proto.Receipt_AtomicResult>;
|
|
95
123
|
/**
|
|
96
124
|
* For testing purposes
|
|
97
125
|
*/
|
|
@@ -102,5 +130,6 @@ export declare const _private: {
|
|
|
102
130
|
placeOrderImpl: typeof placeOrderImpl;
|
|
103
131
|
cancelOrderImpl: typeof cancelOrderImpl;
|
|
104
132
|
transferImpl: typeof transferImpl;
|
|
133
|
+
atomicImpl: typeof atomicImpl;
|
|
105
134
|
};
|
|
106
135
|
export {};
|
package/dist/nord/api/actions.js
CHANGED
|
@@ -40,6 +40,7 @@ exports.withdraw = withdraw;
|
|
|
40
40
|
exports.placeOrder = placeOrder;
|
|
41
41
|
exports.cancelOrder = cancelOrder;
|
|
42
42
|
exports.transfer = transfer;
|
|
43
|
+
exports.atomic = atomic;
|
|
43
44
|
const proto = __importStar(require("../../gen/nord"));
|
|
44
45
|
const types_1 = require("../../types");
|
|
45
46
|
const utils_1 = require("../../utils");
|
|
@@ -53,6 +54,7 @@ async function walletSign(walletSignFn, message) {
|
|
|
53
54
|
}
|
|
54
55
|
function makeSendHttp(serverUrl) {
|
|
55
56
|
return async (body) => {
|
|
57
|
+
// TODO: this should be changed to use openapi
|
|
56
58
|
const response = await (0, utils_1.checkedFetch)(`${serverUrl}/action`, {
|
|
57
59
|
method: "POST",
|
|
58
60
|
headers: {
|
|
@@ -154,7 +156,8 @@ async function withdraw(serverUrl, signFn, currentTimestamp, nonce, params) {
|
|
|
154
156
|
async function placeOrderImpl(sendFn, signFn, currentTimestamp, nonce, params) {
|
|
155
157
|
const price = (0, utils_1.toScaledU64)(params.price ?? 0, params.priceDecimals);
|
|
156
158
|
const size = (0, utils_1.toScaledU64)(params.size ?? 0, params.sizeDecimals);
|
|
157
|
-
const quoteSize = (0, utils_1.
|
|
159
|
+
const quoteSize = (0, utils_1.toScaledU64)(params.quoteSizeSize ?? 0, params.sizeDecimals);
|
|
160
|
+
const quotePrice = (0, utils_1.toScaledU64)(params.quoteSizePrice ?? 0, params.priceDecimals);
|
|
158
161
|
// Compose action object
|
|
159
162
|
const action = {
|
|
160
163
|
currentTimestamp,
|
|
@@ -170,8 +173,10 @@ async function placeOrderImpl(sendFn, signFn, currentTimestamp, nonce, params) {
|
|
|
170
173
|
isReduceOnly: params.isReduceOnly,
|
|
171
174
|
price,
|
|
172
175
|
size,
|
|
173
|
-
quoteSize:
|
|
174
|
-
clientOrderId:
|
|
176
|
+
quoteSize: { size: quoteSize, price: quotePrice },
|
|
177
|
+
clientOrderId: params.clientOrderId === undefined
|
|
178
|
+
? undefined
|
|
179
|
+
: BigInt(params.clientOrderId),
|
|
175
180
|
delegatorAccountId: params.liquidateeId,
|
|
176
181
|
},
|
|
177
182
|
},
|
|
@@ -243,6 +248,57 @@ async function transferImpl(sendFn, signFn, currentTimestamp, nonce, params) {
|
|
|
243
248
|
async function transfer(serverUrl, signFn, currentTimestamp, nonce, params) {
|
|
244
249
|
return transferImpl(makeSendHttp(serverUrl), signFn, currentTimestamp, nonce, params);
|
|
245
250
|
}
|
|
251
|
+
async function atomicImpl(sendFn, signFn, currentTimestamp, nonce, params) {
|
|
252
|
+
(0, utils_1.assert)(params.actions.length > 0 && params.actions.length <= 4, "Atomic action must contain between 1 and 4 sub-actions");
|
|
253
|
+
const subactions = params.actions.map((a) => {
|
|
254
|
+
if (a.kind === "place") {
|
|
255
|
+
const price = (0, utils_1.toScaledU64)(a.price ?? 0, a.priceDecimals);
|
|
256
|
+
const size = (0, utils_1.toScaledU64)(a.size ?? 0, a.sizeDecimals);
|
|
257
|
+
const quoteSizeSize = (0, utils_1.toScaledU64)(a.quoteSizeSize ?? 0, a.sizeDecimals);
|
|
258
|
+
const quoteSizePrice = (0, utils_1.toScaledU64)(a.quoteSizePrice ?? 0, a.priceDecimals);
|
|
259
|
+
const tradeOrPlace = {
|
|
260
|
+
marketId: a.marketId,
|
|
261
|
+
orderType: {
|
|
262
|
+
side: a.side === types_1.Side.Bid ? proto.Side.BID : proto.Side.ASK,
|
|
263
|
+
fillMode: (0, types_1.fillModeToProtoFillMode)(a.fillMode),
|
|
264
|
+
isReduceOnly: a.isReduceOnly,
|
|
265
|
+
},
|
|
266
|
+
limit: {
|
|
267
|
+
price,
|
|
268
|
+
size,
|
|
269
|
+
quoteSize: { size: quoteSizeSize, price: quoteSizePrice },
|
|
270
|
+
},
|
|
271
|
+
clientOrderId: a.clientOrderId === undefined ? undefined : BigInt(a.clientOrderId),
|
|
272
|
+
};
|
|
273
|
+
return {
|
|
274
|
+
inner: { $case: "tradeOrPlace", value: tradeOrPlace },
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
inner: { $case: "cancelOrder", value: { orderId: BigInt(a.orderId) } },
|
|
279
|
+
};
|
|
280
|
+
});
|
|
281
|
+
const action = {
|
|
282
|
+
currentTimestamp,
|
|
283
|
+
nonce,
|
|
284
|
+
kind: {
|
|
285
|
+
$case: "atomic",
|
|
286
|
+
value: {
|
|
287
|
+
sessionId: BigInt(params.sessionId),
|
|
288
|
+
accountId: params.accountId, // optional
|
|
289
|
+
actions: subactions,
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
const resp = await sendAction(sendFn, (m) => sessionSign(signFn, m), action, "execute atomic action");
|
|
294
|
+
if (resp.kind?.$case === "atomic") {
|
|
295
|
+
return resp.kind.value;
|
|
296
|
+
}
|
|
297
|
+
throw new Error(`Unexpected receipt kind ${resp.kind?.$case}`);
|
|
298
|
+
}
|
|
299
|
+
async function atomic(serverUrl, signFn, currentTimestamp, nonce, params) {
|
|
300
|
+
return atomicImpl(makeSendHttp(serverUrl), signFn, currentTimestamp, nonce, params);
|
|
301
|
+
}
|
|
246
302
|
/**
|
|
247
303
|
* For testing purposes
|
|
248
304
|
*/
|
|
@@ -253,4 +309,5 @@ exports._private = {
|
|
|
253
309
|
placeOrderImpl,
|
|
254
310
|
cancelOrderImpl,
|
|
255
311
|
transferImpl,
|
|
312
|
+
atomicImpl,
|
|
256
313
|
};
|
package/dist/nord/api/core.d.ts
CHANGED
|
@@ -1,38 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SubscriptionPattern } from "../../types";
|
|
2
2
|
import { NordWebSocketClient } from "../../websocket/index";
|
|
3
|
-
/**
|
|
4
|
-
* Get the current timestamp from the Nord server
|
|
5
|
-
*
|
|
6
|
-
* @param webServerUrl - Base URL for the Nord web server
|
|
7
|
-
* @returns Current timestamp as a bigint
|
|
8
|
-
* @throws {NordError} If the request fails
|
|
9
|
-
*/
|
|
10
|
-
export declare function getTimestamp(webServerUrl: string): Promise<bigint>;
|
|
11
|
-
/**
|
|
12
|
-
* Get the next action nonce from the Nord server
|
|
13
|
-
*
|
|
14
|
-
* @param webServerUrl - Base URL for the Nord web server
|
|
15
|
-
* @returns Next action nonce
|
|
16
|
-
* @throws {NordError} If the request fails
|
|
17
|
-
*/
|
|
18
|
-
export declare function getLastEventNonce(webServerUrl: string): Promise<number>;
|
|
19
|
-
/**
|
|
20
|
-
* Get information about the Nord server
|
|
21
|
-
*
|
|
22
|
-
* @param webServerUrl - Base URL for the Nord web server
|
|
23
|
-
* @returns Information about markets and tokens
|
|
24
|
-
* @throws {NordError} If the request fails
|
|
25
|
-
*/
|
|
26
|
-
export declare function getInfo(webServerUrl: string): Promise<Info>;
|
|
27
|
-
/**
|
|
28
|
-
* Get account information
|
|
29
|
-
*
|
|
30
|
-
* @param webServerUrl - Base URL for the Nord web server
|
|
31
|
-
* @param accountId - Account ID to get information for
|
|
32
|
-
* @returns Account information
|
|
33
|
-
* @throws {NordError} If the request fails
|
|
34
|
-
*/
|
|
35
|
-
export declare function getAccount(webServerUrl: string, accountId: number): Promise<Account>;
|
|
36
3
|
/**
|
|
37
4
|
* Initialize a WebSocket client for Nord
|
|
38
5
|
*
|
package/dist/nord/api/core.js
CHANGED
|
@@ -1,79 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTimestamp = getTimestamp;
|
|
4
|
-
exports.getLastEventNonce = getLastEventNonce;
|
|
5
|
-
exports.getInfo = getInfo;
|
|
6
|
-
exports.getAccount = getAccount;
|
|
7
3
|
exports.initWebSocketClient = initWebSocketClient;
|
|
8
|
-
const utils_1 = require("../../utils");
|
|
9
4
|
const index_1 = require("../../websocket/index");
|
|
10
5
|
const NordError_1 = require("../utils/NordError");
|
|
11
|
-
/**
|
|
12
|
-
* Get the current timestamp from the Nord server
|
|
13
|
-
*
|
|
14
|
-
* @param webServerUrl - Base URL for the Nord web server
|
|
15
|
-
* @returns Current timestamp as a bigint
|
|
16
|
-
* @throws {NordError} If the request fails
|
|
17
|
-
*/
|
|
18
|
-
async function getTimestamp(webServerUrl) {
|
|
19
|
-
try {
|
|
20
|
-
const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/timestamp`);
|
|
21
|
-
return BigInt(await response.json());
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
throw new NordError_1.NordError("Failed to get timestamp", { cause: error });
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Get the next action nonce from the Nord server
|
|
29
|
-
*
|
|
30
|
-
* @param webServerUrl - Base URL for the Nord web server
|
|
31
|
-
* @returns Next action nonce
|
|
32
|
-
* @throws {NordError} If the request fails
|
|
33
|
-
*/
|
|
34
|
-
async function getLastEventNonce(webServerUrl) {
|
|
35
|
-
try {
|
|
36
|
-
const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/event/last-acked-nonce`);
|
|
37
|
-
const data = await response.json();
|
|
38
|
-
return data.nonce;
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
throw new NordError_1.NordError("Failed to get action nonce", { cause: error });
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Get information about the Nord server
|
|
46
|
-
*
|
|
47
|
-
* @param webServerUrl - Base URL for the Nord web server
|
|
48
|
-
* @returns Information about markets and tokens
|
|
49
|
-
* @throws {NordError} If the request fails
|
|
50
|
-
*/
|
|
51
|
-
async function getInfo(webServerUrl) {
|
|
52
|
-
try {
|
|
53
|
-
const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/info`);
|
|
54
|
-
return await response.json();
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
throw new NordError_1.NordError("Failed to get info", { cause: error });
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Get account information
|
|
62
|
-
*
|
|
63
|
-
* @param webServerUrl - Base URL for the Nord web server
|
|
64
|
-
* @param accountId - Account ID to get information for
|
|
65
|
-
* @returns Account information
|
|
66
|
-
* @throws {NordError} If the request fails
|
|
67
|
-
*/
|
|
68
|
-
async function getAccount(webServerUrl, accountId) {
|
|
69
|
-
try {
|
|
70
|
-
const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/account/${accountId}`);
|
|
71
|
-
return await response.json();
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
throw new NordError_1.NordError(`Failed to get account ${accountId}`, { cause: error });
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
6
|
/**
|
|
78
7
|
* Initialize a WebSocket client for Nord
|
|
79
8
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EventEmitter } from "events";
|
|
2
|
-
import {
|
|
2
|
+
import { PublicKey } from "@solana/web3.js";
|
|
3
|
+
import { Info, Account, ActionResponse, AggregateMetrics, Market, NordConfig, OrderbookQuery, OrderbookResponse, PeakTpsPeriodUnit, Token, TradesResponse, User, MarketStats } from "../../types";
|
|
3
4
|
import { ProtonClient } from "@n1xyz/proton";
|
|
4
5
|
import { NordWebSocketClient } from "../../websocket/index";
|
|
5
6
|
import { OrderbookSubscription, TradeSubscription } from "../models/Subscriber";
|
|
6
|
-
import { PublicKey } from "@solana/web3.js";
|
|
7
7
|
/**
|
|
8
8
|
* User subscription interface
|
|
9
9
|
*/
|
|
@@ -37,8 +37,10 @@ export declare class Nord {
|
|
|
37
37
|
tokens: Token[];
|
|
38
38
|
/** Map of symbol to market_id */
|
|
39
39
|
private symbolToMarketId;
|
|
40
|
-
/** Proton client for bridge and
|
|
40
|
+
/** Proton client for bridge and hansel operations */
|
|
41
41
|
protonClient: ProtonClient;
|
|
42
|
+
/** HTTP client for Nord operations */
|
|
43
|
+
private httpClient;
|
|
42
44
|
/**
|
|
43
45
|
* Create a new Nord client
|
|
44
46
|
*
|
|
@@ -71,6 +73,7 @@ export declare class Nord {
|
|
|
71
73
|
* });
|
|
72
74
|
*/
|
|
73
75
|
createWebSocketClient(options: WebSocketSubscriptionOptions): NordWebSocketClient;
|
|
76
|
+
private GET;
|
|
74
77
|
/**
|
|
75
78
|
* Get the current timestamp from the Nord server
|
|
76
79
|
*
|
|
@@ -107,13 +110,6 @@ export declare class Nord {
|
|
|
107
110
|
* @private
|
|
108
111
|
*/
|
|
109
112
|
private init;
|
|
110
|
-
/**
|
|
111
|
-
* Get market statistics
|
|
112
|
-
*
|
|
113
|
-
* @returns Market statistics response
|
|
114
|
-
* @throws {NordError} If the request fails
|
|
115
|
-
*/
|
|
116
|
-
marketsStats(): Promise<MarketsStatsResponse>;
|
|
117
113
|
/**
|
|
118
114
|
* Query a specific action
|
|
119
115
|
*
|
|
@@ -121,7 +117,9 @@ export declare class Nord {
|
|
|
121
117
|
* @returns Action response
|
|
122
118
|
* @throws {NordError} If the request fails
|
|
123
119
|
*/
|
|
124
|
-
queryAction(
|
|
120
|
+
queryAction({ action_id, }: {
|
|
121
|
+
action_id: number;
|
|
122
|
+
}): Promise<ActionResponse | null>;
|
|
125
123
|
/**
|
|
126
124
|
* Query recent actions
|
|
127
125
|
*
|
|
@@ -130,7 +128,10 @@ export declare class Nord {
|
|
|
130
128
|
* @returns Actions response
|
|
131
129
|
* @throws {NordError} If the request fails
|
|
132
130
|
*/
|
|
133
|
-
queryRecentActions(
|
|
131
|
+
queryRecentActions(query: {
|
|
132
|
+
from: number;
|
|
133
|
+
to: number;
|
|
134
|
+
}): Promise<ActionResponse[]>;
|
|
134
135
|
/**
|
|
135
136
|
* Get the last action ID
|
|
136
137
|
*
|
|
@@ -178,22 +179,6 @@ export declare class Nord {
|
|
|
178
179
|
* @throws {NordError} If the request fails
|
|
179
180
|
*/
|
|
180
181
|
getTotalTransactions(): Promise<number>;
|
|
181
|
-
/**
|
|
182
|
-
* Query an action from Rollman
|
|
183
|
-
*
|
|
184
|
-
* @param query - Action query parameters
|
|
185
|
-
* @returns Rollman action response
|
|
186
|
-
* @throws {NordError} If the request fails
|
|
187
|
-
*/
|
|
188
|
-
actionQueryRollman(query: ActionQuery): Promise<RollmanActionResponse>;
|
|
189
|
-
/**
|
|
190
|
-
* Query actions from Rollman
|
|
191
|
-
*
|
|
192
|
-
* @param last_n - Number of recent actions to query
|
|
193
|
-
* @returns Rollman actions response
|
|
194
|
-
* @throws {NordError} If the request fails
|
|
195
|
-
*/
|
|
196
|
-
actionsQueryRollman(last_n: number): Promise<RollmanActionsResponse>;
|
|
197
182
|
/**
|
|
198
183
|
* Query Prometheus metrics
|
|
199
184
|
*
|
|
@@ -233,7 +218,16 @@ export declare class Nord {
|
|
|
233
218
|
* @returns Trades response
|
|
234
219
|
* @throws {NordError} If the request fails
|
|
235
220
|
*/
|
|
236
|
-
getTrades(query:
|
|
221
|
+
getTrades(query: Readonly<{
|
|
222
|
+
marketId?: number;
|
|
223
|
+
takerId?: number;
|
|
224
|
+
makerId?: number;
|
|
225
|
+
takerSide?: "bid" | "ask";
|
|
226
|
+
pageSize?: number;
|
|
227
|
+
sinceRcf3339?: string;
|
|
228
|
+
untilRfc3339?: string;
|
|
229
|
+
pageId?: string;
|
|
230
|
+
}>): Promise<TradesResponse>;
|
|
237
231
|
/**
|
|
238
232
|
* Get user account IDs
|
|
239
233
|
*
|
|
@@ -241,7 +235,9 @@ export declare class Nord {
|
|
|
241
235
|
* @returns User account IDs response
|
|
242
236
|
* @throws {NordError} If the request fails
|
|
243
237
|
*/
|
|
244
|
-
|
|
238
|
+
getUser(query: {
|
|
239
|
+
pubkey: string | PublicKey;
|
|
240
|
+
}): Promise<User | null>;
|
|
245
241
|
/**
|
|
246
242
|
* Get orderbook for a market
|
|
247
243
|
*
|
|
@@ -270,15 +266,17 @@ export declare class Nord {
|
|
|
270
266
|
/**
|
|
271
267
|
* Get market statistics (alias for marketsStats for backward compatibility)
|
|
272
268
|
*
|
|
273
|
-
* @deprecated Use marketsStats instead
|
|
274
269
|
* @returns Market statistics response
|
|
275
270
|
*/
|
|
276
|
-
getMarketStats(
|
|
271
|
+
getMarketStats({ marketId, }: {
|
|
272
|
+
marketId: number;
|
|
273
|
+
}): Promise<MarketStats>;
|
|
277
274
|
/**
|
|
278
275
|
* Check if an account exists for the given address
|
|
279
276
|
*
|
|
280
277
|
* @param address - The public key address to check
|
|
281
278
|
* @returns True if the account exists, false otherwise
|
|
279
|
+
* @deprecated use getUser instead
|
|
282
280
|
*/
|
|
283
|
-
accountExists(
|
|
281
|
+
accountExists(pubkey: string | PublicKey): Promise<boolean>;
|
|
284
282
|
}
|