@n1xyz/nord-ts 0.1.8 → 0.1.10
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/client/Nord.d.ts +12 -1
- package/dist/client/Nord.js +22 -0
- package/dist/client/NordUser.d.ts +10 -2
- package/dist/client/NordUser.js +11 -3
- package/dist/gen/openapi.d.ts +78 -0
- package/dist/types.d.ts +2 -0
- package/package.json +2 -2
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, AccountPnlPage, AccountPnlQuery, ActionResponse, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, Token, TradesResponse, User, AccountTriggerInfo, HistoryTriggerQuery, TriggerHistoryPage, FeeTierId, AccountFeeTierPage, PageResultStringOrderInfo, PageResultStringTrade, OrderInfoFromApi, TokenStats, FillRole, AdminInfo } from "../types";
|
|
6
|
+
import { Account, AccountPnlPage, AccountPnlQuery, ActionResponse, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, Token, TradesResponse, User, AccountTriggerInfo, HistoryTriggerQuery, TriggerHistoryPage, FeeTierId, AccountFeeTierPage, PageResultStringOrderInfo, PageResultStringTrade, OrderInfoFromApi, TokenStats, FillRole, AdminInfo, AccountVolumeInfo, GetAccountVolumeQuery } from "../types";
|
|
7
7
|
import { NordWebSocketClient } from "../websocket/index";
|
|
8
8
|
import { OrderbookSubscription, TradeSubscription } from "../websocket/Subscriber";
|
|
9
9
|
/**
|
|
@@ -89,6 +89,17 @@ export declare class Nord {
|
|
|
89
89
|
* @throws {NordError} If the request fails
|
|
90
90
|
*/
|
|
91
91
|
getAdminList(): Promise<Array<AdminInfo>>;
|
|
92
|
+
/**
|
|
93
|
+
* Get account volume across all markets, optionally for a specific market.
|
|
94
|
+
*
|
|
95
|
+
* @param accountId - Account identifier
|
|
96
|
+
* @param since - RFC3339 timestamp marking the inclusive start of the window
|
|
97
|
+
* @param until - RFC3339 timestamp marking the exclusive end of the window
|
|
98
|
+
* @param marketId - Optional market identifier to scope the volume
|
|
99
|
+
* @returns Array of market volumes (single entry when `marketId` is provided)
|
|
100
|
+
* @throws {NordError} If the request fails
|
|
101
|
+
*/
|
|
102
|
+
getAccountVolume({ accountId, since, until, marketId, }: Readonly<GetAccountVolumeQuery>): Promise<Array<AccountVolumeInfo>>;
|
|
92
103
|
/**
|
|
93
104
|
* Fetch information about Nord markets and tokens
|
|
94
105
|
*
|
package/dist/client/Nord.js
CHANGED
|
@@ -130,6 +130,28 @@ export class Nord {
|
|
|
130
130
|
async getAdminList() {
|
|
131
131
|
return await this.GET("/admin", {});
|
|
132
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Get account volume across all markets, optionally for a specific market.
|
|
135
|
+
*
|
|
136
|
+
* @param accountId - Account identifier
|
|
137
|
+
* @param since - RFC3339 timestamp marking the inclusive start of the window
|
|
138
|
+
* @param until - RFC3339 timestamp marking the exclusive end of the window
|
|
139
|
+
* @param marketId - Optional market identifier to scope the volume
|
|
140
|
+
* @returns Array of market volumes (single entry when `marketId` is provided)
|
|
141
|
+
* @throws {NordError} If the request fails
|
|
142
|
+
*/
|
|
143
|
+
async getAccountVolume({ accountId, since, until, marketId, }) {
|
|
144
|
+
return await this.GET("/account/volume", {
|
|
145
|
+
params: {
|
|
146
|
+
query: {
|
|
147
|
+
accountId,
|
|
148
|
+
since,
|
|
149
|
+
until,
|
|
150
|
+
marketId,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
}
|
|
133
155
|
/**
|
|
134
156
|
* Fetch information about Nord markets and tokens
|
|
135
157
|
*
|
|
@@ -136,15 +136,23 @@ export declare class NordUser {
|
|
|
136
136
|
* @param tokenId - Token ID
|
|
137
137
|
* @param recipient - Recipient address; defaults to the user's address
|
|
138
138
|
* @param sendOptions - Send options for .sendTransaction
|
|
139
|
-
* @returns Transaction signature
|
|
139
|
+
* @returns Transaction signature and buffer account
|
|
140
140
|
* @throws {NordError} If required parameters are missing or operation fails
|
|
141
|
+
*
|
|
142
|
+
* The buffer account is used to correlate the deposit for when it gets queued.
|
|
143
|
+
* Note that even though there may technically be multiple deposits with the same
|
|
144
|
+
* buffer account, in the case of this method, there will only be one as it discards
|
|
145
|
+
* the buffer after performing the deposit.
|
|
141
146
|
*/
|
|
142
147
|
deposit({ amount, tokenId, recipient, sendOptions, }: Readonly<{
|
|
143
148
|
amount: number;
|
|
144
149
|
tokenId: number;
|
|
145
150
|
recipient?: PublicKey;
|
|
146
151
|
sendOptions?: SendOptions;
|
|
147
|
-
}>): Promise<
|
|
152
|
+
}>): Promise<{
|
|
153
|
+
signature: string;
|
|
154
|
+
buffer: PublicKey;
|
|
155
|
+
}>;
|
|
148
156
|
/**
|
|
149
157
|
* Get a new nonce for actions
|
|
150
158
|
*
|
package/dist/client/NordUser.js
CHANGED
|
@@ -132,7 +132,7 @@ export class NordUser {
|
|
|
132
132
|
* @throws {NordError} If required parameters are missing or operation fails
|
|
133
133
|
*/
|
|
134
134
|
async depositSpl(amount, tokenId, recipient) {
|
|
135
|
-
return this.deposit({ amount, tokenId, recipient });
|
|
135
|
+
return this.deposit({ amount, tokenId, recipient }).then((x) => x.signature);
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
138
|
* Deposit SPL tokens to the app
|
|
@@ -141,8 +141,13 @@ export class NordUser {
|
|
|
141
141
|
* @param tokenId - Token ID
|
|
142
142
|
* @param recipient - Recipient address; defaults to the user's address
|
|
143
143
|
* @param sendOptions - Send options for .sendTransaction
|
|
144
|
-
* @returns Transaction signature
|
|
144
|
+
* @returns Transaction signature and buffer account
|
|
145
145
|
* @throws {NordError} If required parameters are missing or operation fails
|
|
146
|
+
*
|
|
147
|
+
* The buffer account is used to correlate the deposit for when it gets queued.
|
|
148
|
+
* Note that even though there may technically be multiple deposits with the same
|
|
149
|
+
* buffer account, in the case of this method, there will only be one as it discards
|
|
150
|
+
* the buffer after performing the deposit.
|
|
146
151
|
*/
|
|
147
152
|
async deposit({ amount, tokenId, recipient, sendOptions, }) {
|
|
148
153
|
try {
|
|
@@ -169,7 +174,10 @@ export class NordUser {
|
|
|
169
174
|
const signedTx = await this.transactionSignFn(tx);
|
|
170
175
|
signedTx.partialSign(extraSigner);
|
|
171
176
|
const signature = await this.nord.solanaConnection.sendRawTransaction(signedTx.serialize(), sendOptions);
|
|
172
|
-
return
|
|
177
|
+
return {
|
|
178
|
+
signature,
|
|
179
|
+
buffer: extraSigner.publicKey,
|
|
180
|
+
};
|
|
173
181
|
}
|
|
174
182
|
catch (error) {
|
|
175
183
|
throw new NordError(`Failed to deposit ${amount} of token ID ${tokenId}`, { cause: error });
|
package/dist/gen/openapi.d.ts
CHANGED
|
@@ -1266,6 +1266,60 @@ export interface paths {
|
|
|
1266
1266
|
patch?: never;
|
|
1267
1267
|
trace?: never;
|
|
1268
1268
|
};
|
|
1269
|
+
"/account/volume": {
|
|
1270
|
+
parameters: {
|
|
1271
|
+
query?: never;
|
|
1272
|
+
header?: never;
|
|
1273
|
+
path?: never;
|
|
1274
|
+
cookie?: never;
|
|
1275
|
+
};
|
|
1276
|
+
/** @description Get trading volume for an account
|
|
1277
|
+
*
|
|
1278
|
+
* Optionally, you can specify a market to get volume for. If not specified, array of (MarketId, Volume) is returned.
|
|
1279
|
+
*
|
|
1280
|
+
* Returns raw values, caller must rescale to base token decimals */
|
|
1281
|
+
get: {
|
|
1282
|
+
parameters: {
|
|
1283
|
+
query: {
|
|
1284
|
+
accountId: number;
|
|
1285
|
+
marketId?: number | null;
|
|
1286
|
+
/** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
|
|
1287
|
+
since?: string;
|
|
1288
|
+
/** @description end with this timestamp (RFC3339); defaults to current date-time */
|
|
1289
|
+
until?: string;
|
|
1290
|
+
};
|
|
1291
|
+
header?: never;
|
|
1292
|
+
path?: never;
|
|
1293
|
+
cookie?: never;
|
|
1294
|
+
};
|
|
1295
|
+
requestBody?: never;
|
|
1296
|
+
responses: {
|
|
1297
|
+
200: {
|
|
1298
|
+
headers: {
|
|
1299
|
+
[name: string]: unknown;
|
|
1300
|
+
};
|
|
1301
|
+
content: {
|
|
1302
|
+
"application/json": components["schemas"]["AccountVolumeInfo"][];
|
|
1303
|
+
};
|
|
1304
|
+
};
|
|
1305
|
+
404: {
|
|
1306
|
+
headers: {
|
|
1307
|
+
[name: string]: unknown;
|
|
1308
|
+
};
|
|
1309
|
+
content: {
|
|
1310
|
+
"application/json": components["schemas"]["UserNotFound"];
|
|
1311
|
+
};
|
|
1312
|
+
};
|
|
1313
|
+
};
|
|
1314
|
+
};
|
|
1315
|
+
put?: never;
|
|
1316
|
+
post?: never;
|
|
1317
|
+
delete?: never;
|
|
1318
|
+
options?: never;
|
|
1319
|
+
head?: never;
|
|
1320
|
+
patch?: never;
|
|
1321
|
+
trace?: never;
|
|
1322
|
+
};
|
|
1269
1323
|
"/tv": {
|
|
1270
1324
|
parameters: {
|
|
1271
1325
|
query?: never;
|
|
@@ -2276,6 +2330,8 @@ export interface components {
|
|
|
2276
2330
|
high24h: number;
|
|
2277
2331
|
/** Format: double */
|
|
2278
2332
|
low24h: number;
|
|
2333
|
+
/** Format: double */
|
|
2334
|
+
closePrice24h: number;
|
|
2279
2335
|
perpStats?: components["schemas"]["PerpMarketStats"] | null;
|
|
2280
2336
|
};
|
|
2281
2337
|
PerpMarketStats: {
|
|
@@ -2727,6 +2783,28 @@ export interface components {
|
|
|
2727
2783
|
key: string;
|
|
2728
2784
|
roles: string[];
|
|
2729
2785
|
};
|
|
2786
|
+
GetAccountVolumeQuery: {
|
|
2787
|
+
/** Format: uint32 */
|
|
2788
|
+
accountId: number;
|
|
2789
|
+
/** Format: uint32 */
|
|
2790
|
+
marketId?: number | null;
|
|
2791
|
+
/**
|
|
2792
|
+
* @description start with this timestamp (RFC3339); defaults to UNIX epoch start
|
|
2793
|
+
* @default null
|
|
2794
|
+
*/
|
|
2795
|
+
since: string;
|
|
2796
|
+
/**
|
|
2797
|
+
* @description end with this timestamp (RFC3339); defaults to current date-time
|
|
2798
|
+
* @default null
|
|
2799
|
+
*/
|
|
2800
|
+
until: string;
|
|
2801
|
+
};
|
|
2802
|
+
AccountVolumeInfo: {
|
|
2803
|
+
/** Format: uint32 */
|
|
2804
|
+
marketId: number;
|
|
2805
|
+
/** Format: double */
|
|
2806
|
+
volume: number;
|
|
2807
|
+
};
|
|
2730
2808
|
/** @description TV config query response https://www.tradingview.com/charting-library-docs/latest/connecting_data/UDF/#data-feed-configuration-data */
|
|
2731
2809
|
TvConfigResponse: {
|
|
2732
2810
|
supported_resolutions: components["schemas"]["Resolution"][];
|
package/dist/types.d.ts
CHANGED
|
@@ -71,6 +71,8 @@ export type TokenStats = components["schemas"]["TokenStats"];
|
|
|
71
71
|
export type AccountFeeTier = components["schemas"]["AccountFeeTier"];
|
|
72
72
|
export type AccountFeeTierPage = components["schemas"]["PageResult_for_uint32_and_AccountFeeTier"];
|
|
73
73
|
export type AdminInfo = components["schemas"]["AdminInfo"];
|
|
74
|
+
export type GetAccountVolumeQuery = components["schemas"]["GetAccountVolumeQuery"];
|
|
75
|
+
export type AccountVolumeInfo = components["schemas"]["AccountVolumeInfo"];
|
|
74
76
|
/**
|
|
75
77
|
* Configuration options for the Nord client
|
|
76
78
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n1xyz/nord-ts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Typescript for Nord",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@bufbuild/protobuf": "^2.6.3",
|
|
47
|
-
"@n1xyz/proton": "0.0.
|
|
47
|
+
"@n1xyz/proton": "0.0.7",
|
|
48
48
|
"@noble/curves": "^1.9.6",
|
|
49
49
|
"@noble/ed25519": "^2.3.0",
|
|
50
50
|
"@noble/hashes": "^1.8.0",
|