@n1xyz/nord-ts 0.3.3 → 0.3.4-alpha.1
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 +3 -1
- package/dist/client/Nord.d.ts +13 -23
- package/dist/client/NordAdmin.d.ts +8 -0
- package/dist/client/NordUser.d.ts +11 -2
- package/dist/gen/nord_pb.d.ts +335 -105
- package/dist/gen/openapi.d.ts +288 -197
- package/dist/index.browser.js +64990 -83973
- package/dist/index.common.js +60126 -86733
- package/dist/types.d.ts +8 -10
- package/dist/utils.d.ts +2 -2
- package/package.json +1 -1
package/dist/actions.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { paths } from "./gen/openapi";
|
|
|
4
4
|
import { Client } from "openapi-fetch";
|
|
5
5
|
import { FillMode, Side, QuoteSize } from "./types";
|
|
6
6
|
import { BigIntValue } from "./utils";
|
|
7
|
-
import { PublicKey } from "@solana/web3.js";
|
|
7
|
+
import { PublicKey, Transaction } from "@solana/web3.js";
|
|
8
8
|
type ReceiptKind = NonNullable<proto.Receipt["kind"]>;
|
|
9
9
|
type ExtractReceiptKind<K extends ReceiptKind["case"]> = Extract<ReceiptKind, {
|
|
10
10
|
case: K;
|
|
@@ -19,7 +19,9 @@ export declare function prepareAction(action: proto.Action, makeSignedMessage: (
|
|
|
19
19
|
export declare function createSession(client: Client<paths>, signMessage: (_: Uint8Array) => Promise<Uint8Array>, currentTimestamp: bigint, nonce: number, params: {
|
|
20
20
|
userPubkey: PublicKey;
|
|
21
21
|
sessionPubkey: PublicKey;
|
|
22
|
+
signatureFraming: "hex" | "solanaTransaction";
|
|
22
23
|
expiryTimestamp?: bigint;
|
|
24
|
+
signTransactionFn: (tx: Transaction) => Promise<Transaction>;
|
|
23
25
|
}): Promise<{
|
|
24
26
|
actionId: bigint;
|
|
25
27
|
sessionId: bigint;
|
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, PagedQuery, ActionResponse, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, Token, TradesResponse, User, AccountTriggerInfo, TriggerHistoryPage, WithdrawalHistoryPage, FeeTierId, AccountFeeTierPage, PageResultStringOrderInfo, PageResultStringTrade, OrderInfoFromApi, TokenStats, FillRole, AdminInfo, AccountVolumeInfo, GetAccountVolumeQuery,
|
|
6
|
+
import { Account, AccountPnlInfoPage, PagedQuery, ActionResponse, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, Token, TradesResponse, User, AccountTriggerInfo, TriggerHistoryPage, WithdrawalHistoryPage, FeeTierId, AccountFeeTierPage, PageResultStringOrderInfo, PageResultStringTrade, OrderInfoFromApi, TokenStats, FillRole, AdminInfo, AccountVolumeInfo, GetAccountVolumeQuery, CandleResolution } from "../types";
|
|
7
7
|
import { NordWebSocketClient } from "../websocket/index";
|
|
8
8
|
import { OrderbookSubscription, TradeSubscription, CandleSubscription } from "../websocket/Subscriber";
|
|
9
9
|
/**
|
|
@@ -205,7 +205,7 @@ export declare class Nord {
|
|
|
205
205
|
pageSize?: number;
|
|
206
206
|
since?: string;
|
|
207
207
|
until?: string;
|
|
208
|
-
startInclusive?:
|
|
208
|
+
startInclusive?: number;
|
|
209
209
|
}>): Promise<TradesResponse>;
|
|
210
210
|
/**
|
|
211
211
|
* Get user account IDs
|
|
@@ -284,18 +284,20 @@ export declare class Nord {
|
|
|
284
284
|
* @throws {NordError} If the request fails
|
|
285
285
|
*/
|
|
286
286
|
getAccountOrders(accountId: number, { startInclusive, pageSize, }?: Readonly<{
|
|
287
|
-
startInclusive?:
|
|
288
|
-
pageSize?: number
|
|
287
|
+
startInclusive?: number;
|
|
288
|
+
pageSize?: number;
|
|
289
289
|
}>): Promise<PageResultStringOrderInfo>;
|
|
290
290
|
/**
|
|
291
291
|
* List account fee tiers with pagination support.
|
|
292
292
|
*
|
|
293
293
|
* @param startInclusive - Account id cursor to resume from
|
|
294
294
|
* @param pageSize - Maximum number of entries to return
|
|
295
|
+
* @param tier - Optional fee tier filter
|
|
295
296
|
*/
|
|
296
|
-
getAccountsFeeTiers({ startInclusive, pageSize, }?: Readonly<{
|
|
297
|
-
startInclusive?: number
|
|
298
|
-
pageSize?: number
|
|
297
|
+
getAccountsFeeTiers({ startInclusive, pageSize, tier, }?: Readonly<{
|
|
298
|
+
startInclusive?: number;
|
|
299
|
+
pageSize?: number;
|
|
300
|
+
tier?: FeeTierId;
|
|
299
301
|
}>): Promise<AccountFeeTierPage>;
|
|
300
302
|
/**
|
|
301
303
|
* Get profit and loss history for an account
|
|
@@ -334,18 +336,6 @@ export declare class Nord {
|
|
|
334
336
|
feeKind: FillRole;
|
|
335
337
|
accountId: number;
|
|
336
338
|
}>): Promise<number>;
|
|
337
|
-
/**
|
|
338
|
-
* Fetch the latest available market price at or before the given timestamp.
|
|
339
|
-
*
|
|
340
|
-
* @param marketId - Market identifier
|
|
341
|
-
* @param atOrBefore - RFC3339 timestamp to look back from (returns the latest price at or before this time)
|
|
342
|
-
* @returns Previous market price record; price is `null` if no trades exist at or before `at`
|
|
343
|
-
* @throws {NordError} If the request fails
|
|
344
|
-
*/
|
|
345
|
-
getPrevMarketPrice({ marketId, atOrBefore, }: Readonly<{
|
|
346
|
-
marketId: number;
|
|
347
|
-
atOrBefore: string;
|
|
348
|
-
}>): Promise<PreviousMarketPrice>;
|
|
349
339
|
/**
|
|
350
340
|
* Fetch token statistics such as index price and oracle metadata.
|
|
351
341
|
*
|
|
@@ -361,7 +351,7 @@ export declare class Nord {
|
|
|
361
351
|
* @returns Order information
|
|
362
352
|
* @throws {NordError} If the request fails
|
|
363
353
|
*/
|
|
364
|
-
getOrder(orderId:
|
|
354
|
+
getOrder(orderId: number): Promise<OrderInfoFromApi>;
|
|
365
355
|
/**
|
|
366
356
|
* Get trade history for a specific order.
|
|
367
357
|
*
|
|
@@ -371,9 +361,9 @@ export declare class Nord {
|
|
|
371
361
|
* @returns Page of trades associated with the order
|
|
372
362
|
* @throws {NordError} If the request fails
|
|
373
363
|
*/
|
|
374
|
-
getOrderTrades(orderId:
|
|
375
|
-
startInclusive?:
|
|
376
|
-
pageSize?: number
|
|
364
|
+
getOrderTrades(orderId: number, { startInclusive, pageSize, }?: Readonly<{
|
|
365
|
+
startInclusive?: number;
|
|
366
|
+
pageSize?: number;
|
|
377
367
|
}>): Promise<PageResultStringTrade>;
|
|
378
368
|
/**
|
|
379
369
|
* Check if an account exists for the given address
|
|
@@ -2,6 +2,7 @@ import { PublicKey, Transaction } from "@solana/web3.js";
|
|
|
2
2
|
import * as proto from "../gen/nord_pb";
|
|
3
3
|
import { Nord } from "./Nord";
|
|
4
4
|
import { FeeTierConfig } from "../gen/nord_pb";
|
|
5
|
+
import Decimal from "decimal.js";
|
|
5
6
|
export declare enum AclRole {
|
|
6
7
|
FEE_MANAGER = 1,
|
|
7
8
|
MARKET_MANAGER = 2,
|
|
@@ -222,4 +223,11 @@ export declare class NordAdmin {
|
|
|
222
223
|
updateAccountsTier(accounts: number[], tierId: number): Promise<{
|
|
223
224
|
actionId: bigint;
|
|
224
225
|
} & proto.Receipt_AccountsTierUpdated>;
|
|
226
|
+
feeVaultTransfer({ recipient, tokenId, amount, }: Readonly<{
|
|
227
|
+
recipient: number;
|
|
228
|
+
tokenId: number;
|
|
229
|
+
amount: Decimal.Value;
|
|
230
|
+
}>): Promise<{
|
|
231
|
+
actionId: bigint;
|
|
232
|
+
} & proto.Receipt_FeeVaultTransferred>;
|
|
225
233
|
}
|
|
@@ -36,6 +36,13 @@ export declare class NordUser {
|
|
|
36
36
|
private readonly signSessionMessage;
|
|
37
37
|
private readonly signMessage;
|
|
38
38
|
private readonly signTransaction;
|
|
39
|
+
/** If set, will use signTransaction instead of signMessage for session creation.
|
|
40
|
+
* Because ledgers don't support signMessage, we have an escape hatch for them.
|
|
41
|
+
* However, the escape hatch is brittle and we recommend avoiditing as much as
|
|
42
|
+
* possible. Thus, _only_ use this if you are forced to use ledgers.
|
|
43
|
+
* To use this, just set it to true in your NordUser instance.
|
|
44
|
+
*/
|
|
45
|
+
__use_solana_transaction_framing__: boolean;
|
|
39
46
|
readonly nord: Nord;
|
|
40
47
|
sessionId?: bigint;
|
|
41
48
|
sessionPubKey: PublicKey;
|
|
@@ -52,7 +59,7 @@ export declare class NordUser {
|
|
|
52
59
|
};
|
|
53
60
|
orders: {
|
|
54
61
|
[key: string]: {
|
|
55
|
-
orderId:
|
|
62
|
+
orderId: number;
|
|
56
63
|
marketId: number;
|
|
57
64
|
side: "ask" | "bid";
|
|
58
65
|
size: number;
|
|
@@ -211,11 +218,13 @@ export declare class NordUser {
|
|
|
211
218
|
*
|
|
212
219
|
* @param tokenId - Token ID to withdraw
|
|
213
220
|
* @param amount - Amount to withdraw
|
|
221
|
+
* @param destPubkey - Optional destination registration pubkey (base58); defaults to session owner
|
|
214
222
|
* @throws {NordError} If the operation fails
|
|
215
223
|
*/
|
|
216
|
-
withdraw({ amount, tokenId, }: Readonly<{
|
|
224
|
+
withdraw({ amount, tokenId, destPubkey, }: Readonly<{
|
|
217
225
|
tokenId: number;
|
|
218
226
|
amount: number;
|
|
227
|
+
destPubkey?: string;
|
|
219
228
|
}>): Promise<{
|
|
220
229
|
actionId: bigint;
|
|
221
230
|
}>;
|