@n1xyz/nord-ts 0.4.2 → 0.4.3
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/NordUser.d.ts +2 -2
- package/dist/gen/nord_pb.d.ts +6 -0
- package/dist/gen/openapi.d.ts +405 -4
- package/dist/index.browser.js +28 -6
- package/dist/index.common.js +31 -9
- package/dist/types.d.ts +19 -85
- package/package.json +16 -16
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, CandleResolution, TakeAllInfo } from "../types";
|
|
6
|
+
import { Account, AccountPnlInfoPage, AccountPnlSummaryResult, GetAccountPnlQuery, 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, TakeAllInfo } from "../types";
|
|
7
7
|
import { NordWebSocketClient } from "../websocket/index";
|
|
8
8
|
import { OrderbookSubscription, TradeSubscription, CandleSubscription } from "../websocket/Subscriber";
|
|
9
9
|
/**
|
|
@@ -320,6 +320,17 @@ export declare class Nord {
|
|
|
320
320
|
* @throws {NordError} If the request fails
|
|
321
321
|
*/
|
|
322
322
|
getAccountPnl(accountId: number, { since, until, startInclusive, pageSize, }?: Readonly<Partial<PagedQuery>>): Promise<AccountPnlInfoPage>;
|
|
323
|
+
/**
|
|
324
|
+
* Get profit and loss totals for an account over a time window.
|
|
325
|
+
*
|
|
326
|
+
* @param accountId - Account ID to query
|
|
327
|
+
* @param since - RFC3339 timestamp to start from (inclusive)
|
|
328
|
+
* @param until - RFC3339 timestamp to end at (inclusive)
|
|
329
|
+
* @param marketId - Optional market identifier to scope the totals
|
|
330
|
+
* @returns Per-market pnl totals for the requested window
|
|
331
|
+
* @throws {NordError} If the request fails
|
|
332
|
+
*/
|
|
333
|
+
getAccountPnlSummary(accountId: number, { since, until, marketId }?: Readonly<Partial<GetAccountPnlQuery>>): Promise<AccountPnlSummaryResult>;
|
|
323
334
|
/**
|
|
324
335
|
* Get market statistics (alias for marketsStats for backward compatibility)
|
|
325
336
|
*
|
|
@@ -383,14 +383,14 @@ export declare class NordUser {
|
|
|
383
383
|
* @param tokenId - Token identifier to move
|
|
384
384
|
* @param amount - Amount to transfer
|
|
385
385
|
* @param fromAccountId - Source account id
|
|
386
|
-
* @param toAccountId - Destination account id
|
|
386
|
+
* @param toAccountId - Destination account id; omit to create a new owned subaccount
|
|
387
387
|
* @throws {NordError} If the operation fails
|
|
388
388
|
*/
|
|
389
389
|
transferOwned({ tokenId, amount, fromAccountId, toAccountId, }: Readonly<{
|
|
390
390
|
tokenId: number;
|
|
391
391
|
amount: Decimal.Value;
|
|
392
392
|
fromAccountId: number;
|
|
393
|
-
toAccountId
|
|
393
|
+
toAccountId?: number;
|
|
394
394
|
}>): Promise<{
|
|
395
395
|
actionId: bigint;
|
|
396
396
|
newAccountId?: number;
|
package/dist/gen/nord_pb.d.ts
CHANGED
|
@@ -2383,6 +2383,9 @@ export type Action_UpdateAccountsTier = Message<"nord.Action.UpdateAccountsTier"
|
|
|
2383
2383
|
*/
|
|
2384
2384
|
tierId: number;
|
|
2385
2385
|
/**
|
|
2386
|
+
* Must not contain duplicates; deserialization will fail if any
|
|
2387
|
+
* account id appears more than once.
|
|
2388
|
+
*
|
|
2386
2389
|
* @generated from field: repeated uint32 accounts = 2;
|
|
2387
2390
|
*/
|
|
2388
2391
|
accounts: number[];
|
|
@@ -2400,6 +2403,9 @@ export type Action_UpdateAccountsTierJson = {
|
|
|
2400
2403
|
*/
|
|
2401
2404
|
tierId?: number;
|
|
2402
2405
|
/**
|
|
2406
|
+
* Must not contain duplicates; deserialization will fail if any
|
|
2407
|
+
* account id appears more than once.
|
|
2408
|
+
*
|
|
2403
2409
|
* @generated from field: repeated uint32 accounts = 2;
|
|
2404
2410
|
*/
|
|
2405
2411
|
accounts?: number[];
|
package/dist/gen/openapi.d.ts
CHANGED
|
@@ -814,6 +814,67 @@ export interface paths {
|
|
|
814
814
|
patch?: never;
|
|
815
815
|
trace?: never;
|
|
816
816
|
};
|
|
817
|
+
"/account/{account_id}/pnl/summary": {
|
|
818
|
+
parameters: {
|
|
819
|
+
query?: never;
|
|
820
|
+
header?: never;
|
|
821
|
+
path?: never;
|
|
822
|
+
cookie?: never;
|
|
823
|
+
};
|
|
824
|
+
/** @description Fetch cumulative PnL totals for an account over a time window. */
|
|
825
|
+
get: {
|
|
826
|
+
parameters: {
|
|
827
|
+
query?: {
|
|
828
|
+
/** @description Optional market filter by market id. */
|
|
829
|
+
marketId?: number | null;
|
|
830
|
+
/** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
|
|
831
|
+
since?: string;
|
|
832
|
+
/** @description end with this timestamp (RFC3339); defaults to current date-time */
|
|
833
|
+
until?: string;
|
|
834
|
+
};
|
|
835
|
+
header?: never;
|
|
836
|
+
path: {
|
|
837
|
+
/** @description Account for which to retrieve PnL totals. */
|
|
838
|
+
account_id: number;
|
|
839
|
+
};
|
|
840
|
+
cookie?: never;
|
|
841
|
+
};
|
|
842
|
+
requestBody?: never;
|
|
843
|
+
responses: {
|
|
844
|
+
200: {
|
|
845
|
+
headers: {
|
|
846
|
+
[name: string]: unknown;
|
|
847
|
+
};
|
|
848
|
+
content: {
|
|
849
|
+
"application/json": components["schemas"]["AccountPnlSummaryResult"];
|
|
850
|
+
};
|
|
851
|
+
};
|
|
852
|
+
400: {
|
|
853
|
+
headers: {
|
|
854
|
+
[name: string]: unknown;
|
|
855
|
+
};
|
|
856
|
+
content: {
|
|
857
|
+
"application/json": components["schemas"]["BadRequest"];
|
|
858
|
+
};
|
|
859
|
+
};
|
|
860
|
+
404: {
|
|
861
|
+
headers: {
|
|
862
|
+
[name: string]: unknown;
|
|
863
|
+
};
|
|
864
|
+
content: {
|
|
865
|
+
"application/json": components["schemas"]["UserNotFound"];
|
|
866
|
+
};
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
};
|
|
870
|
+
put?: never;
|
|
871
|
+
post?: never;
|
|
872
|
+
delete?: never;
|
|
873
|
+
options?: never;
|
|
874
|
+
head?: never;
|
|
875
|
+
patch?: never;
|
|
876
|
+
trace?: never;
|
|
877
|
+
};
|
|
817
878
|
"/account/{account_id}/history/funding": {
|
|
818
879
|
parameters: {
|
|
819
880
|
query?: never;
|
|
@@ -879,6 +940,69 @@ export interface paths {
|
|
|
879
940
|
patch?: never;
|
|
880
941
|
trace?: never;
|
|
881
942
|
};
|
|
943
|
+
"/account/{account_id}/history/fee-tier": {
|
|
944
|
+
parameters: {
|
|
945
|
+
query?: never;
|
|
946
|
+
header?: never;
|
|
947
|
+
path?: never;
|
|
948
|
+
cookie?: never;
|
|
949
|
+
};
|
|
950
|
+
/** @description Fetch full history of fee-tier assignment changes for an account. */
|
|
951
|
+
get: {
|
|
952
|
+
parameters: {
|
|
953
|
+
query?: {
|
|
954
|
+
/** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
|
|
955
|
+
since?: string;
|
|
956
|
+
/** @description end with this timestamp (RFC3339); defaults to current date-time */
|
|
957
|
+
until?: string;
|
|
958
|
+
/** @description fetch results starting with this page; query starts with first entry if page isn't specified */
|
|
959
|
+
startInclusive?: number | null;
|
|
960
|
+
/** @description Query returns up to 50 trades in one go. */
|
|
961
|
+
pageSize?: number | null;
|
|
962
|
+
};
|
|
963
|
+
header?: never;
|
|
964
|
+
path: {
|
|
965
|
+
/** @description Account ID for which to fetch fee-tier history. */
|
|
966
|
+
account_id: number;
|
|
967
|
+
};
|
|
968
|
+
cookie?: never;
|
|
969
|
+
};
|
|
970
|
+
requestBody?: never;
|
|
971
|
+
responses: {
|
|
972
|
+
200: {
|
|
973
|
+
headers: {
|
|
974
|
+
[name: string]: unknown;
|
|
975
|
+
};
|
|
976
|
+
content: {
|
|
977
|
+
"application/json": components["schemas"]["PageResult_for_uint64_and_AccountFeeTierHistory"];
|
|
978
|
+
};
|
|
979
|
+
};
|
|
980
|
+
400: {
|
|
981
|
+
headers: {
|
|
982
|
+
[name: string]: unknown;
|
|
983
|
+
};
|
|
984
|
+
content: {
|
|
985
|
+
"application/json": components["schemas"]["BadRequest"];
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
404: {
|
|
989
|
+
headers: {
|
|
990
|
+
[name: string]: unknown;
|
|
991
|
+
};
|
|
992
|
+
content: {
|
|
993
|
+
"application/json": components["schemas"]["UserNotFound"];
|
|
994
|
+
};
|
|
995
|
+
};
|
|
996
|
+
};
|
|
997
|
+
};
|
|
998
|
+
put?: never;
|
|
999
|
+
post?: never;
|
|
1000
|
+
delete?: never;
|
|
1001
|
+
options?: never;
|
|
1002
|
+
head?: never;
|
|
1003
|
+
patch?: never;
|
|
1004
|
+
trace?: never;
|
|
1005
|
+
};
|
|
882
1006
|
"/account/{account_id}/triggers/history": {
|
|
883
1007
|
parameters: {
|
|
884
1008
|
query?: never;
|
|
@@ -1548,7 +1672,9 @@ export interface paths {
|
|
|
1548
1672
|
parameters: {
|
|
1549
1673
|
query: {
|
|
1550
1674
|
accountId: number;
|
|
1675
|
+
/** @description DEPRECATED, use `market_ids` instead. */
|
|
1551
1676
|
marketId?: number | null;
|
|
1677
|
+
marketIds?: number[];
|
|
1552
1678
|
/** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
|
|
1553
1679
|
since?: string;
|
|
1554
1680
|
/** @description end with this timestamp (RFC3339); defaults to current date-time */
|
|
@@ -3000,6 +3126,7 @@ export interface components {
|
|
|
3000
3126
|
/** Format: uint64 */
|
|
3001
3127
|
actionId: number;
|
|
3002
3128
|
physicalTime: string;
|
|
3129
|
+
/** @description Payload which is enough to replay original action. */
|
|
3003
3130
|
payload: string;
|
|
3004
3131
|
};
|
|
3005
3132
|
RangeTooLarge: {
|
|
@@ -3341,6 +3468,39 @@ export interface components {
|
|
|
3341
3468
|
*/
|
|
3342
3469
|
entryPrice?: number | null;
|
|
3343
3470
|
};
|
|
3471
|
+
GetAccountPnlQuery: {
|
|
3472
|
+
/**
|
|
3473
|
+
* Format: uint32
|
|
3474
|
+
* @description Optional market filter by market id.
|
|
3475
|
+
* @default null
|
|
3476
|
+
*/
|
|
3477
|
+
marketId: number | null;
|
|
3478
|
+
/**
|
|
3479
|
+
* @description start with this timestamp (RFC3339); defaults to UNIX epoch start
|
|
3480
|
+
* @default null
|
|
3481
|
+
*/
|
|
3482
|
+
since: string;
|
|
3483
|
+
/**
|
|
3484
|
+
* @description end with this timestamp (RFC3339); defaults to current date-time
|
|
3485
|
+
* @default null
|
|
3486
|
+
*/
|
|
3487
|
+
until: string;
|
|
3488
|
+
};
|
|
3489
|
+
AccountPnlSummaryResult: {
|
|
3490
|
+
items: components["schemas"]["AccountPnlSummaryInfo"][];
|
|
3491
|
+
lastUpdatedAtTimestamp: string;
|
|
3492
|
+
/** Format: uint64 */
|
|
3493
|
+
lastUpdatedAtActionId: number;
|
|
3494
|
+
};
|
|
3495
|
+
AccountPnlSummaryInfo: {
|
|
3496
|
+
/** Format: uint32 */
|
|
3497
|
+
marketId: number;
|
|
3498
|
+
/** Format: double */
|
|
3499
|
+
tradingPnl: number;
|
|
3500
|
+
/** Format: double */
|
|
3501
|
+
settledFundingPnl: number;
|
|
3502
|
+
};
|
|
3503
|
+
BadRequest: null;
|
|
3344
3504
|
GetAccountFundingHistoryQuery: {
|
|
3345
3505
|
/**
|
|
3346
3506
|
* Format: uint32
|
|
@@ -3397,7 +3557,52 @@ export interface components {
|
|
|
3397
3557
|
*/
|
|
3398
3558
|
fundingPnl: number;
|
|
3399
3559
|
};
|
|
3400
|
-
|
|
3560
|
+
GetAccountFeeTierHistoryQuery: {
|
|
3561
|
+
/**
|
|
3562
|
+
* @description start with this timestamp (RFC3339); defaults to UNIX epoch start
|
|
3563
|
+
* @default null
|
|
3564
|
+
*/
|
|
3565
|
+
since: string;
|
|
3566
|
+
/**
|
|
3567
|
+
* @description end with this timestamp (RFC3339); defaults to current date-time
|
|
3568
|
+
* @default null
|
|
3569
|
+
*/
|
|
3570
|
+
until: string;
|
|
3571
|
+
/**
|
|
3572
|
+
* Format: uint64
|
|
3573
|
+
* @description fetch results starting with this page; query starts with first entry if page isn't specified
|
|
3574
|
+
*/
|
|
3575
|
+
startInclusive?: number | null;
|
|
3576
|
+
/**
|
|
3577
|
+
* Format: uint8
|
|
3578
|
+
* @description Query returns up to 50 trades in one go.
|
|
3579
|
+
* @default null
|
|
3580
|
+
*/
|
|
3581
|
+
pageSize: number | null;
|
|
3582
|
+
};
|
|
3583
|
+
PageResult_for_uint64_and_AccountFeeTierHistory: {
|
|
3584
|
+
/** @description Set of items for requested by query. */
|
|
3585
|
+
items: components["schemas"]["AccountFeeTierHistory"][];
|
|
3586
|
+
/**
|
|
3587
|
+
* Format: uint64
|
|
3588
|
+
* @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.
|
|
3589
|
+
*/
|
|
3590
|
+
nextStartInclusive?: number | null;
|
|
3591
|
+
};
|
|
3592
|
+
AccountFeeTierHistory: {
|
|
3593
|
+
time: string;
|
|
3594
|
+
/** Format: uint64 */
|
|
3595
|
+
actionId: number;
|
|
3596
|
+
/** Format: uint32 */
|
|
3597
|
+
accountId: number;
|
|
3598
|
+
feeTier: components["schemas"]["FeeTierId"];
|
|
3599
|
+
/** Format: uint32 */
|
|
3600
|
+
makerFeePpm: number;
|
|
3601
|
+
/** Format: uint32 */
|
|
3602
|
+
takerFeePpm: number;
|
|
3603
|
+
};
|
|
3604
|
+
/** Format: uint32 */
|
|
3605
|
+
FeeTierId: number;
|
|
3401
3606
|
PagedQuery: {
|
|
3402
3607
|
/**
|
|
3403
3608
|
* @description start with this timestamp (RFC3339); defaults to UNIX epoch start
|
|
@@ -3612,8 +3817,6 @@ export interface components {
|
|
|
3612
3817
|
components["schemas"]["ExecutableVersion"]
|
|
3613
3818
|
][];
|
|
3614
3819
|
};
|
|
3615
|
-
/** Format: uint32 */
|
|
3616
|
-
FeeTierId: number;
|
|
3617
3820
|
/** @description Use 1/1_000_000 granularity (ppm)
|
|
3618
3821
|
*
|
|
3619
3822
|
* | ppm | decimal | percent | |------|----------|---------| | 1 | 0.000001 | 0.0001% | | 5 | 0.000005 | 0.0005% | | 10 | 0.00001 | 0.001% | | 50 | 0.00005 | 0.005% | | 100 | 0.0001 | 0.01% | | 500 | 0.0005 | 0.05% | | 1000 | 0.001 | 0.10% | | 5000 | 0.005 | 0.50% | | 10000| 0.01 | 1.00% | */
|
|
@@ -3659,8 +3862,13 @@ export interface components {
|
|
|
3659
3862
|
GetAccountVolumeQuery: {
|
|
3660
3863
|
/** Format: uint32 */
|
|
3661
3864
|
accountId: number;
|
|
3662
|
-
/**
|
|
3865
|
+
/**
|
|
3866
|
+
* Format: uint32
|
|
3867
|
+
* @description DEPRECATED, use `market_ids` instead.
|
|
3868
|
+
*/
|
|
3663
3869
|
marketId?: number | null;
|
|
3870
|
+
/** @default */
|
|
3871
|
+
marketIds: number[];
|
|
3664
3872
|
/**
|
|
3665
3873
|
* @description start with this timestamp (RFC3339); defaults to UNIX epoch start
|
|
3666
3874
|
* @default null
|
|
@@ -3679,6 +3887,10 @@ export interface components {
|
|
|
3679
3887
|
volumeBase: number;
|
|
3680
3888
|
/** Format: double */
|
|
3681
3889
|
volumeQuote: number;
|
|
3890
|
+
/** Format: double */
|
|
3891
|
+
volumeQuoteMaker: number;
|
|
3892
|
+
/** Format: double */
|
|
3893
|
+
volumeQuoteTaker: number;
|
|
3682
3894
|
};
|
|
3683
3895
|
PageResult_for_uint64_and_WithdrawalInfo: {
|
|
3684
3896
|
/** @description Set of items for requested by query. */
|
|
@@ -3846,6 +4058,7 @@ export interface components {
|
|
|
3846
4058
|
watermarks: components["schemas"]["HealthWatermarks"];
|
|
3847
4059
|
history: components["schemas"]["HealthProgressInfo"];
|
|
3848
4060
|
status: components["schemas"]["HealthStatus"];
|
|
4061
|
+
oracle: components["schemas"]["HealthOracle"];
|
|
3849
4062
|
};
|
|
3850
4063
|
HealthWatermarks: {
|
|
3851
4064
|
/** Format: uint64 */
|
|
@@ -3859,6 +4072,10 @@ export interface components {
|
|
|
3859
4072
|
};
|
|
3860
4073
|
HealthStatus: {
|
|
3861
4074
|
historyStalled: boolean;
|
|
4075
|
+
oracleStalled: boolean;
|
|
4076
|
+
};
|
|
4077
|
+
HealthOracle: {
|
|
4078
|
+
timestamp: string;
|
|
3862
4079
|
};
|
|
3863
4080
|
/** @description TV config query response https://www.tradingview.com/charting-library-docs/latest/connecting_data/UDF/#data-feed-configuration-data */
|
|
3864
4081
|
TvConfigResponse: {
|
|
@@ -4064,6 +4281,190 @@ export interface components {
|
|
|
4064
4281
|
* @description Consist of some sum of `SignedPerMillion` weighted by `PriceMantissa`(with market decimals). Funding rate jitters around 0, so really hard to get big numbers. Is `basic points numerator * market price mantissa` unit.
|
|
4065
4282
|
*/
|
|
4066
4283
|
FundingIndexMantissa: number;
|
|
4284
|
+
UpdatePayload: {
|
|
4285
|
+
delta: {
|
|
4286
|
+
/** Format: uint64 */
|
|
4287
|
+
last_update_id: number;
|
|
4288
|
+
/** Format: uint64 */
|
|
4289
|
+
update_id: number;
|
|
4290
|
+
market_symbol: string;
|
|
4291
|
+
asks: [
|
|
4292
|
+
number,
|
|
4293
|
+
number
|
|
4294
|
+
][];
|
|
4295
|
+
bids: [
|
|
4296
|
+
number,
|
|
4297
|
+
number
|
|
4298
|
+
][];
|
|
4299
|
+
};
|
|
4300
|
+
} | {
|
|
4301
|
+
trades: {
|
|
4302
|
+
/** Format: uint64 */
|
|
4303
|
+
last_update_id: number;
|
|
4304
|
+
/** Format: uint64 */
|
|
4305
|
+
update_id: number;
|
|
4306
|
+
market_symbol: string;
|
|
4307
|
+
trades: components["schemas"]["TradeUpdate"][];
|
|
4308
|
+
};
|
|
4309
|
+
} | {
|
|
4310
|
+
account: {
|
|
4311
|
+
/** Format: uint64 */
|
|
4312
|
+
last_update_id: number;
|
|
4313
|
+
/** Format: uint64 */
|
|
4314
|
+
update_id: number;
|
|
4315
|
+
/** Format: uint32 */
|
|
4316
|
+
account_id: number;
|
|
4317
|
+
fills: {
|
|
4318
|
+
[key: string]: components["schemas"]["FillUpdate"];
|
|
4319
|
+
};
|
|
4320
|
+
places: {
|
|
4321
|
+
[key: string]: components["schemas"]["OrderUpdate"];
|
|
4322
|
+
};
|
|
4323
|
+
cancels: {
|
|
4324
|
+
[key: string]: components["schemas"]["OrderUpdate"];
|
|
4325
|
+
};
|
|
4326
|
+
/** @description Reduce orders: fully cancelled or partially cancelled (shrunk in-place). */
|
|
4327
|
+
reduced_orders: {
|
|
4328
|
+
[key: string]: components["schemas"]["OrderUpdate"];
|
|
4329
|
+
};
|
|
4330
|
+
balances: {
|
|
4331
|
+
[key: string]: number;
|
|
4332
|
+
};
|
|
4333
|
+
};
|
|
4334
|
+
} | {
|
|
4335
|
+
liquidation: {
|
|
4336
|
+
/** Format: uint64 */
|
|
4337
|
+
last_update_id: number;
|
|
4338
|
+
/** Format: uint64 */
|
|
4339
|
+
update_id: number;
|
|
4340
|
+
liquidations: components["schemas"]["LiquidationUpdate"][];
|
|
4341
|
+
};
|
|
4342
|
+
};
|
|
4343
|
+
TradeUpdate: {
|
|
4344
|
+
side: components["schemas"]["Side"];
|
|
4345
|
+
/** Format: double */
|
|
4346
|
+
price: number;
|
|
4347
|
+
/** Format: double */
|
|
4348
|
+
size: number;
|
|
4349
|
+
/** Format: uint64 */
|
|
4350
|
+
order_id: number;
|
|
4351
|
+
/**
|
|
4352
|
+
* Format: uint64
|
|
4353
|
+
* @deprecated
|
|
4354
|
+
*/
|
|
4355
|
+
sender_tracking_id?: number | null;
|
|
4356
|
+
};
|
|
4357
|
+
FillUpdate: {
|
|
4358
|
+
side: components["schemas"]["Side"];
|
|
4359
|
+
/** Format: double */
|
|
4360
|
+
quantity: number;
|
|
4361
|
+
/** Format: double */
|
|
4362
|
+
remaining: number;
|
|
4363
|
+
/** Format: double */
|
|
4364
|
+
price: number;
|
|
4365
|
+
/** Format: uint64 */
|
|
4366
|
+
order_id: number;
|
|
4367
|
+
/** Format: uint32 */
|
|
4368
|
+
market_id: number;
|
|
4369
|
+
/** Format: uint32 */
|
|
4370
|
+
maker_id: number;
|
|
4371
|
+
/** Format: uint32 */
|
|
4372
|
+
taker_id: number;
|
|
4373
|
+
/**
|
|
4374
|
+
* Format: uint64
|
|
4375
|
+
* @deprecated
|
|
4376
|
+
*/
|
|
4377
|
+
sender_tracking_id?: number | null;
|
|
4378
|
+
/** Format: uint64 */
|
|
4379
|
+
client_order_id?: number | null;
|
|
4380
|
+
};
|
|
4381
|
+
OrderUpdate: {
|
|
4382
|
+
side: components["schemas"]["Side"];
|
|
4383
|
+
/**
|
|
4384
|
+
* Format: double
|
|
4385
|
+
* @description Absolute size of order as it became after some change.
|
|
4386
|
+
*/
|
|
4387
|
+
current_size: number;
|
|
4388
|
+
/** Format: double */
|
|
4389
|
+
price: number;
|
|
4390
|
+
/** Format: uint32 */
|
|
4391
|
+
market_id: number;
|
|
4392
|
+
/**
|
|
4393
|
+
* Format: uint64
|
|
4394
|
+
* @deprecated
|
|
4395
|
+
*/
|
|
4396
|
+
sender_tracking_id?: number | null;
|
|
4397
|
+
/** Format: uint64 */
|
|
4398
|
+
client_order_id?: number | null;
|
|
4399
|
+
};
|
|
4400
|
+
LiquidationUpdate: {
|
|
4401
|
+
/** Format: uint32 */
|
|
4402
|
+
makerAccountId: number;
|
|
4403
|
+
/** Format: uint32 */
|
|
4404
|
+
takerAccountId: number;
|
|
4405
|
+
takerBalances: components["schemas"]["LiquidationBalance"][];
|
|
4406
|
+
takerPositions: components["schemas"]["LiquidatedPosition"][];
|
|
4407
|
+
};
|
|
4408
|
+
LiquidationBalance: {
|
|
4409
|
+
/** Format: uint32 */
|
|
4410
|
+
tokenId: number;
|
|
4411
|
+
/** Format: double */
|
|
4412
|
+
amount: number;
|
|
4413
|
+
};
|
|
4414
|
+
LiquidatedPosition: {
|
|
4415
|
+
/** Format: uint32 */
|
|
4416
|
+
marketId: number;
|
|
4417
|
+
/** Format: uint32 */
|
|
4418
|
+
accountId: number;
|
|
4419
|
+
perp?: components["schemas"]["PerpPosition"] | null;
|
|
4420
|
+
};
|
|
4421
|
+
PerpPosition: {
|
|
4422
|
+
/** Format: double */
|
|
4423
|
+
baseSize: number;
|
|
4424
|
+
/** Format: double */
|
|
4425
|
+
price: number;
|
|
4426
|
+
/** Format: double */
|
|
4427
|
+
updatedFundingRateIndex: number;
|
|
4428
|
+
};
|
|
4429
|
+
CandleUpdate: {
|
|
4430
|
+
/** @description TradingView resolution. */
|
|
4431
|
+
res: components["schemas"]["Resolution"];
|
|
4432
|
+
/**
|
|
4433
|
+
* Format: uint32
|
|
4434
|
+
* @description Market id.
|
|
4435
|
+
*/
|
|
4436
|
+
mid: number;
|
|
4437
|
+
/**
|
|
4438
|
+
* Format: int64
|
|
4439
|
+
* @description Timestamp in seconds.
|
|
4440
|
+
*/
|
|
4441
|
+
t: number;
|
|
4442
|
+
/**
|
|
4443
|
+
* Format: double
|
|
4444
|
+
* @description Open price.
|
|
4445
|
+
*/
|
|
4446
|
+
o: number;
|
|
4447
|
+
/**
|
|
4448
|
+
* Format: double
|
|
4449
|
+
* @description High price.
|
|
4450
|
+
*/
|
|
4451
|
+
h: number;
|
|
4452
|
+
/**
|
|
4453
|
+
* Format: double
|
|
4454
|
+
* @description Low price.
|
|
4455
|
+
*/
|
|
4456
|
+
l: number;
|
|
4457
|
+
/**
|
|
4458
|
+
* Format: double
|
|
4459
|
+
* @description Close price.
|
|
4460
|
+
*/
|
|
4461
|
+
c: number;
|
|
4462
|
+
/**
|
|
4463
|
+
* Format: double
|
|
4464
|
+
* @description Volume in the quote currency, i.e. USDC.
|
|
4465
|
+
*/
|
|
4466
|
+
v: number;
|
|
4467
|
+
};
|
|
4067
4468
|
};
|
|
4068
4469
|
responses: never;
|
|
4069
4470
|
parameters: never;
|
package/dist/index.browser.js
CHANGED
|
@@ -76112,6 +76112,18 @@ class Nord {
|
|
|
76112
76112
|
}
|
|
76113
76113
|
});
|
|
76114
76114
|
}
|
|
76115
|
+
async getAccountPnlSummary(accountId, { since, until, marketId } = {}) {
|
|
76116
|
+
return await this.GET("/account/{account_id}/pnl/summary", {
|
|
76117
|
+
params: {
|
|
76118
|
+
path: { account_id: accountId },
|
|
76119
|
+
query: {
|
|
76120
|
+
since,
|
|
76121
|
+
until,
|
|
76122
|
+
marketId
|
|
76123
|
+
}
|
|
76124
|
+
}
|
|
76125
|
+
});
|
|
76126
|
+
}
|
|
76115
76127
|
async getMarketStats({
|
|
76116
76128
|
marketId
|
|
76117
76129
|
}) {
|
|
@@ -76797,7 +76809,7 @@ async function takeAllPositions(client2, signFn, currentTimestamp, nonce, params
|
|
|
76797
76809
|
return { actionId: resp.actionId, ...resp.kind.value };
|
|
76798
76810
|
}
|
|
76799
76811
|
async function atomic(client2, signFn, currentTimestamp, nonce, params) {
|
|
76800
|
-
assert4(params.actions.length > 0 && params.actions.length <=
|
|
76812
|
+
assert4(params.actions.length > 0 && params.actions.length <= 10, "Atomic action must contain between 1 and 10 sub-actions");
|
|
76801
76813
|
const subactions = params.actions.map((a) => {
|
|
76802
76814
|
if (a.kind === "place") {
|
|
76803
76815
|
const price = toScaledU64(a.price ?? 0, a.priceDecimals);
|
|
@@ -77357,9 +77369,11 @@ class NordUser {
|
|
|
77357
77369
|
tokenId,
|
|
77358
77370
|
amount,
|
|
77359
77371
|
fromAccountId,
|
|
77360
|
-
toAccountId
|
|
77361
|
-
|
|
77362
|
-
|
|
77372
|
+
...toAccountId !== undefined && {
|
|
77373
|
+
toAccountId: {
|
|
77374
|
+
type: "Owned",
|
|
77375
|
+
accountId: toAccountId
|
|
77376
|
+
}
|
|
77363
77377
|
}
|
|
77364
77378
|
});
|
|
77365
77379
|
}
|
|
@@ -77393,6 +77407,9 @@ class NordUser {
|
|
|
77393
77407
|
throw new NordError("Transfer amount must be positive");
|
|
77394
77408
|
}
|
|
77395
77409
|
const intoProto = (toAccountId2) => {
|
|
77410
|
+
if (toAccountId2 === undefined) {
|
|
77411
|
+
return;
|
|
77412
|
+
}
|
|
77396
77413
|
switch (toAccountId2.type) {
|
|
77397
77414
|
case "Owned":
|
|
77398
77415
|
return {
|
|
@@ -77419,9 +77436,11 @@ class NordUser {
|
|
|
77419
77436
|
value: create(Action_TransferSchema, {
|
|
77420
77437
|
sessionId: BigInt(optExpect(this.sessionId, "No session")),
|
|
77421
77438
|
fromAccountId: optExpect(fromAccountId, "No source account"),
|
|
77422
|
-
toAccountId: create(Action_RecipientSchema, intoProto(toAccountId)),
|
|
77423
77439
|
tokenId,
|
|
77424
|
-
amount: scaledAmount
|
|
77440
|
+
amount: scaledAmount,
|
|
77441
|
+
...toAccountId !== undefined && {
|
|
77442
|
+
toAccountId: create(Action_RecipientSchema, intoProto(toAccountId))
|
|
77443
|
+
}
|
|
77425
77444
|
})
|
|
77426
77445
|
});
|
|
77427
77446
|
expectReceiptKind(receipt, "transferred", "transfer tokens");
|
|
@@ -77869,6 +77888,9 @@ class NordAdmin {
|
|
|
77869
77888
|
return { actionId: receipt.actionId, ...receipt.kind.value };
|
|
77870
77889
|
}
|
|
77871
77890
|
async updateAccountsTier(accounts, tierId) {
|
|
77891
|
+
if (accounts.length !== new Set(accounts).size) {
|
|
77892
|
+
throw new NordError("duplicate account ids in updateAccountsTier; must be unique");
|
|
77893
|
+
}
|
|
77872
77894
|
const receipt = await this.submitAction({
|
|
77873
77895
|
case: "updateAccountsTier",
|
|
77874
77896
|
value: create(Action_UpdateAccountsTierSchema, {
|
package/dist/index.common.js
CHANGED
|
@@ -360,7 +360,7 @@ var require_fallback = __commonJS((exports, module) => {
|
|
|
360
360
|
|
|
361
361
|
// node_modules/bufferutil/index.js
|
|
362
362
|
var require_bufferutil = __commonJS((exports, module) => {
|
|
363
|
-
var __dirname = "/Users/sheheryar/work/proton/nord/ts/node_modules/bufferutil";
|
|
363
|
+
var __dirname = "/Users/sheheryar/work/proton.wt0/nord/ts/node_modules/bufferutil";
|
|
364
364
|
try {
|
|
365
365
|
module.exports = require_node_gyp_build2()(__dirname);
|
|
366
366
|
} catch (e) {
|
|
@@ -772,7 +772,7 @@ var require_fallback2 = __commonJS((exports, module) => {
|
|
|
772
772
|
|
|
773
773
|
// node_modules/utf-8-validate/index.js
|
|
774
774
|
var require_utf_8_validate = __commonJS((exports, module) => {
|
|
775
|
-
var __dirname = "/Users/sheheryar/work/proton/nord/ts/node_modules/utf-8-validate";
|
|
775
|
+
var __dirname = "/Users/sheheryar/work/proton.wt0/nord/ts/node_modules/utf-8-validate";
|
|
776
776
|
try {
|
|
777
777
|
module.exports = require_node_gyp_build2()(__dirname);
|
|
778
778
|
} catch (e) {
|
|
@@ -47967,7 +47967,7 @@ var require_file_uri_to_path = __commonJS((exports, module) => {
|
|
|
47967
47967
|
|
|
47968
47968
|
// node_modules/bindings/bindings.js
|
|
47969
47969
|
var require_bindings = __commonJS((exports, module) => {
|
|
47970
|
-
var __filename = "/Users/sheheryar/work/proton/nord/ts/node_modules/bindings/bindings.js";
|
|
47970
|
+
var __filename = "/Users/sheheryar/work/proton.wt0/nord/ts/node_modules/bindings/bindings.js";
|
|
47971
47971
|
var fs = __require("fs");
|
|
47972
47972
|
var path = __require("path");
|
|
47973
47973
|
var fileURLToPath = require_file_uri_to_path();
|
|
@@ -86861,6 +86861,18 @@ class Nord {
|
|
|
86861
86861
|
}
|
|
86862
86862
|
});
|
|
86863
86863
|
}
|
|
86864
|
+
async getAccountPnlSummary(accountId, { since, until, marketId } = {}) {
|
|
86865
|
+
return await this.GET("/account/{account_id}/pnl/summary", {
|
|
86866
|
+
params: {
|
|
86867
|
+
path: { account_id: accountId },
|
|
86868
|
+
query: {
|
|
86869
|
+
since,
|
|
86870
|
+
until,
|
|
86871
|
+
marketId
|
|
86872
|
+
}
|
|
86873
|
+
}
|
|
86874
|
+
});
|
|
86875
|
+
}
|
|
86864
86876
|
async getMarketStats({
|
|
86865
86877
|
marketId
|
|
86866
86878
|
}) {
|
|
@@ -87549,7 +87561,7 @@ async function takeAllPositions(client2, signFn, currentTimestamp, nonce, params
|
|
|
87549
87561
|
return { actionId: resp.actionId, ...resp.kind.value };
|
|
87550
87562
|
}
|
|
87551
87563
|
async function atomic(client2, signFn, currentTimestamp, nonce, params) {
|
|
87552
|
-
assert3(params.actions.length > 0 && params.actions.length <=
|
|
87564
|
+
assert3(params.actions.length > 0 && params.actions.length <= 10, "Atomic action must contain between 1 and 10 sub-actions");
|
|
87553
87565
|
const subactions = params.actions.map((a) => {
|
|
87554
87566
|
if (a.kind === "place") {
|
|
87555
87567
|
const price = toScaledU64(a.price ?? 0, a.priceDecimals);
|
|
@@ -88109,9 +88121,11 @@ class NordUser {
|
|
|
88109
88121
|
tokenId,
|
|
88110
88122
|
amount,
|
|
88111
88123
|
fromAccountId,
|
|
88112
|
-
toAccountId
|
|
88113
|
-
|
|
88114
|
-
|
|
88124
|
+
...toAccountId !== undefined && {
|
|
88125
|
+
toAccountId: {
|
|
88126
|
+
type: "Owned",
|
|
88127
|
+
accountId: toAccountId
|
|
88128
|
+
}
|
|
88115
88129
|
}
|
|
88116
88130
|
});
|
|
88117
88131
|
}
|
|
@@ -88145,6 +88159,9 @@ class NordUser {
|
|
|
88145
88159
|
throw new NordError("Transfer amount must be positive");
|
|
88146
88160
|
}
|
|
88147
88161
|
const intoProto = (toAccountId2) => {
|
|
88162
|
+
if (toAccountId2 === undefined) {
|
|
88163
|
+
return;
|
|
88164
|
+
}
|
|
88148
88165
|
switch (toAccountId2.type) {
|
|
88149
88166
|
case "Owned":
|
|
88150
88167
|
return {
|
|
@@ -88171,9 +88188,11 @@ class NordUser {
|
|
|
88171
88188
|
value: create(Action_TransferSchema, {
|
|
88172
88189
|
sessionId: BigInt(optExpect(this.sessionId, "No session")),
|
|
88173
88190
|
fromAccountId: optExpect(fromAccountId, "No source account"),
|
|
88174
|
-
toAccountId: create(Action_RecipientSchema, intoProto(toAccountId)),
|
|
88175
88191
|
tokenId,
|
|
88176
|
-
amount: scaledAmount
|
|
88192
|
+
amount: scaledAmount,
|
|
88193
|
+
...toAccountId !== undefined && {
|
|
88194
|
+
toAccountId: create(Action_RecipientSchema, intoProto(toAccountId))
|
|
88195
|
+
}
|
|
88177
88196
|
})
|
|
88178
88197
|
});
|
|
88179
88198
|
expectReceiptKind(receipt, "transferred", "transfer tokens");
|
|
@@ -88621,6 +88640,9 @@ class NordAdmin {
|
|
|
88621
88640
|
return { actionId: receipt.actionId, ...receipt.kind.value };
|
|
88622
88641
|
}
|
|
88623
88642
|
async updateAccountsTier(accounts, tierId) {
|
|
88643
|
+
if (accounts.length !== new Set(accounts).size) {
|
|
88644
|
+
throw new NordError("duplicate account ids in updateAccountsTier; must be unique");
|
|
88645
|
+
}
|
|
88624
88646
|
const receipt = await this.submitAction({
|
|
88625
88647
|
case: "updateAccountsTier",
|
|
88626
88648
|
value: create(Action_UpdateAccountsTierSchema, {
|
package/dist/types.d.ts
CHANGED
|
@@ -61,6 +61,9 @@ export type FinalizationReason = components["schemas"]["FinalizationReason"];
|
|
|
61
61
|
export type PagedQuery = components["schemas"]["PagedQuery"];
|
|
62
62
|
export type AccountPnlInfo = components["schemas"]["AccountPnlInfo"];
|
|
63
63
|
export type AccountPnlInfoPage = components["schemas"]["PageResult_for_uint64_and_AccountPnlInfo"];
|
|
64
|
+
export type GetAccountPnlQuery = components["schemas"]["GetAccountPnlQuery"];
|
|
65
|
+
export type AccountPnlSummaryInfo = components["schemas"]["AccountPnlSummaryInfo"];
|
|
66
|
+
export type AccountPnlSummaryResult = components["schemas"]["AccountPnlSummaryResult"];
|
|
64
67
|
export type AccountTriggerInfo = components["schemas"]["TriggerInfo"];
|
|
65
68
|
export type TriggerHistoryPage = components["schemas"]["PageResult_for_uint64_and_Trigger"];
|
|
66
69
|
export type WithdrawalHistoryPage = components["schemas"]["PageResult_for_uint64_and_WithdrawalInfo"];
|
|
@@ -196,92 +199,22 @@ export declare enum WebSocketMessageType {
|
|
|
196
199
|
LiquidationUpdate = "liquidation"
|
|
197
200
|
}
|
|
198
201
|
export type CandleResolution = "1" | "5" | "15" | "30" | "60" | "4H" | "1D" | "1W" | "1M";
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
export
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
202
|
+
type UpdatePayload = components["schemas"]["UpdatePayload"];
|
|
203
|
+
type ExtractVariant<T, K extends string> = T extends {
|
|
204
|
+
[P in K]: infer V;
|
|
205
|
+
} ? V : never;
|
|
206
|
+
export type WebSocketTradeUpdate = ExtractVariant<UpdatePayload, "trades">;
|
|
207
|
+
export type WebSocketDeltaUpdate = ExtractVariant<UpdatePayload, "delta">;
|
|
208
|
+
export type WebSocketAccountUpdate = ExtractVariant<UpdatePayload, "account">;
|
|
209
|
+
export type FillUpdate = components["schemas"]["FillUpdate"];
|
|
210
|
+
export type OrderUpdate = components["schemas"]["OrderUpdate"];
|
|
211
|
+
export type TradeUpdate = components["schemas"]["TradeUpdate"];
|
|
212
|
+
export type WebSocketCandleUpdate = components["schemas"]["CandleUpdate"];
|
|
213
|
+
export type WebSocketLiquidationBalance = components["schemas"]["LiquidationBalance"];
|
|
214
|
+
export type WebSocketLiquidatedPosition = components["schemas"]["LiquidatedPosition"];
|
|
215
|
+
export type WebSocketLiquidationEntry = components["schemas"]["LiquidationUpdate"];
|
|
216
|
+
export type WebSocketLiquidationUpdate = ExtractVariant<UpdatePayload, "liquidation">;
|
|
215
217
|
export type OrderId = string;
|
|
216
|
-
export interface WebSocketAccountUpdate {
|
|
217
|
-
last_update_id: number;
|
|
218
|
-
update_id: number;
|
|
219
|
-
account_id: number;
|
|
220
|
-
fills: Record<OrderId, {
|
|
221
|
-
side: "bid" | "ask";
|
|
222
|
-
quantity: number;
|
|
223
|
-
remaining: number;
|
|
224
|
-
price: number;
|
|
225
|
-
order_id: string;
|
|
226
|
-
market_id: number;
|
|
227
|
-
maker_id: number;
|
|
228
|
-
taker_id: number;
|
|
229
|
-
sender_tracking_id: number | null;
|
|
230
|
-
}>;
|
|
231
|
-
places: Record<OrderId, {
|
|
232
|
-
side: "bid" | "ask";
|
|
233
|
-
current_size: number;
|
|
234
|
-
price: number;
|
|
235
|
-
market_id: number;
|
|
236
|
-
}>;
|
|
237
|
-
cancels: Record<OrderId, {
|
|
238
|
-
side: "bid" | "ask";
|
|
239
|
-
current_size: number;
|
|
240
|
-
price: number;
|
|
241
|
-
market_id: number;
|
|
242
|
-
}>;
|
|
243
|
-
reduced_orders: Record<OrderId, {
|
|
244
|
-
side: "bid" | "ask";
|
|
245
|
-
current_size: number;
|
|
246
|
-
price: number;
|
|
247
|
-
market_id: number;
|
|
248
|
-
}>;
|
|
249
|
-
balances: Record<string, number>;
|
|
250
|
-
}
|
|
251
|
-
export interface WebSocketCandleUpdate {
|
|
252
|
-
res: CandleResolution;
|
|
253
|
-
mid: number;
|
|
254
|
-
t: number;
|
|
255
|
-
o: number;
|
|
256
|
-
h: number;
|
|
257
|
-
l: number;
|
|
258
|
-
c: number;
|
|
259
|
-
v: number;
|
|
260
|
-
}
|
|
261
|
-
export interface WebSocketLiquidationBalance {
|
|
262
|
-
tokenId: number;
|
|
263
|
-
amount: number;
|
|
264
|
-
}
|
|
265
|
-
export interface WebSocketLiquidatedPosition {
|
|
266
|
-
marketId: number;
|
|
267
|
-
accountId: number;
|
|
268
|
-
perp: {
|
|
269
|
-
baseSize: number;
|
|
270
|
-
price: number;
|
|
271
|
-
updatedFundingRateIndex: number;
|
|
272
|
-
} | null;
|
|
273
|
-
}
|
|
274
|
-
export interface WebSocketLiquidationEntry {
|
|
275
|
-
makerAccountId: number;
|
|
276
|
-
takerAccountId: number;
|
|
277
|
-
takerBalances: WebSocketLiquidationBalance[];
|
|
278
|
-
takerPositions: WebSocketLiquidatedPosition[];
|
|
279
|
-
}
|
|
280
|
-
export interface WebSocketLiquidationUpdate {
|
|
281
|
-
lastUpdateId: number;
|
|
282
|
-
updateId: number;
|
|
283
|
-
liquidations: WebSocketLiquidationEntry[];
|
|
284
|
-
}
|
|
285
218
|
export type WebSocketMessage = {
|
|
286
219
|
trades: WebSocketTradeUpdate;
|
|
287
220
|
} | {
|
|
@@ -297,3 +230,4 @@ export interface SPLTokenInfo {
|
|
|
297
230
|
tokenId: number;
|
|
298
231
|
name: string;
|
|
299
232
|
}
|
|
233
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n1xyz/nord-ts",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Typescript for Nord",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -14,6 +14,20 @@
|
|
|
14
14
|
"package.json",
|
|
15
15
|
"README.md"
|
|
16
16
|
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"gen:proto": "bunx @bufbuild/buf generate ../engine",
|
|
19
|
+
"gen:api": "nix run ..#openapi | bunx openapi-typescript > src/gen/openapi.ts",
|
|
20
|
+
"gen": "bun run gen:proto && bun run gen:api",
|
|
21
|
+
"build:node": "bun build ./src/index.ts --target=node --format=esm --outfile=dist/index.common.js",
|
|
22
|
+
"build:browser": "bun build ./src/index.ts --target=browser --format=esm --outfile=dist/index.browser.js",
|
|
23
|
+
"build": "bun run gen && bunx tsc && bun run build:node && bun run build:browser && bun run docs",
|
|
24
|
+
"docs": "bunx typedoc --out ./docs ./src",
|
|
25
|
+
"compile": "tsc",
|
|
26
|
+
"clean": "rm -rf ./src/gen ./dist ./docs",
|
|
27
|
+
"fmt": "prettier --write src tests",
|
|
28
|
+
"ci": "bunx eslint && bunx tsc && prettier --check src tests",
|
|
29
|
+
"all": "bun install && bun run build && bun run ci && bun fmt"
|
|
30
|
+
},
|
|
17
31
|
"devDependencies": {
|
|
18
32
|
"@bufbuild/protoc-gen-es": "^2.6.3",
|
|
19
33
|
"@bufbuild/protoplugin": "^2.6.3",
|
|
@@ -46,19 +60,5 @@
|
|
|
46
60
|
"openapi-fetch": "^0.14.0",
|
|
47
61
|
"tweetnacl": "^1.0.3",
|
|
48
62
|
"ws": "^8.18.3"
|
|
49
|
-
},
|
|
50
|
-
"scripts": {
|
|
51
|
-
"gen:proto": "bunx @bufbuild/buf generate ../engine",
|
|
52
|
-
"gen:api": "nix run ..#openapi | bunx openapi-typescript > src/gen/openapi.ts",
|
|
53
|
-
"gen": "bun run gen:proto && bun run gen:api",
|
|
54
|
-
"build:node": "bun build ./src/index.ts --target=node --format=esm --outfile=dist/index.common.js",
|
|
55
|
-
"build:browser": "bun build ./src/index.ts --target=browser --format=esm --outfile=dist/index.browser.js",
|
|
56
|
-
"build": "bun run gen && bunx tsc && bun run build:node && bun run build:browser && bun run docs",
|
|
57
|
-
"docs": "bunx typedoc --out ./docs ./src",
|
|
58
|
-
"compile": "tsc",
|
|
59
|
-
"clean": "rm -rf ./src/gen ./dist ./docs",
|
|
60
|
-
"fmt": "prettier --write src tests",
|
|
61
|
-
"ci": "bunx eslint && bunx tsc && prettier --check src tests",
|
|
62
|
-
"all": "bun install && bun run build && bun run ci && bun fmt"
|
|
63
63
|
}
|
|
64
|
-
}
|
|
64
|
+
}
|