@nightlylabs/dex-sdk 0.0.45 → 0.0.47
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/index.cjs +14 -14
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +14 -14
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -888,19 +888,19 @@ var Client = class _Client {
|
|
|
888
888
|
this.getChartCandlesInRange = async ({
|
|
889
889
|
interval,
|
|
890
890
|
marketName,
|
|
891
|
-
|
|
892
|
-
|
|
891
|
+
timestampStartMs = Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3),
|
|
892
|
+
timestampEndMs = Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3 - 24 * 60 * 60 * 1e3),
|
|
893
893
|
// default 24 back
|
|
894
894
|
cursor
|
|
895
895
|
}) => {
|
|
896
|
-
if (
|
|
897
|
-
throw new Error("
|
|
896
|
+
if (timestampEndMs && timestampStartMs && timestampEndMs > timestampStartMs) {
|
|
897
|
+
throw new Error("timestampEndMs must be lower than timestampStartMs");
|
|
898
898
|
}
|
|
899
899
|
const response = await this.sendGetJson("/v1/public/chart_candles_in_range" /* GetChartCandlesInRange */, {
|
|
900
900
|
marketName,
|
|
901
901
|
interval,
|
|
902
|
-
startTimestamp:
|
|
903
|
-
endTimestamp:
|
|
902
|
+
startTimestamp: timestampStartMs.toString(),
|
|
903
|
+
endTimestamp: timestampEndMs.toString(),
|
|
904
904
|
paginationCursor: cursor
|
|
905
905
|
});
|
|
906
906
|
return response;
|
|
@@ -918,22 +918,22 @@ var Client = class _Client {
|
|
|
918
918
|
return response;
|
|
919
919
|
};
|
|
920
920
|
this.getUserPerpFills = async (request) => {
|
|
921
|
-
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs
|
|
922
|
-
throw new Error("timestampEndMs must be
|
|
921
|
+
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs > request.timestampStartMs) {
|
|
922
|
+
throw new Error("timestampEndMs must be lower than timestampStartMs");
|
|
923
923
|
}
|
|
924
924
|
const response = await this.sendGetJson("/v1/get_user_perp_fills" /* GetUserPerpFills */, request);
|
|
925
925
|
return response;
|
|
926
926
|
};
|
|
927
927
|
this.getUserPerpOrders = async (request) => {
|
|
928
|
-
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs
|
|
929
|
-
throw new Error("timestampEndMs must be
|
|
928
|
+
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs > request.timestampStartMs) {
|
|
929
|
+
throw new Error("timestampEndMs must be lower than timestampStartMs");
|
|
930
930
|
}
|
|
931
931
|
const response = await this.sendGetJson("/v1/get_user_perp_orders" /* GetUserPerpOrders */, request);
|
|
932
932
|
return response;
|
|
933
933
|
};
|
|
934
934
|
this.getUserFundingHistory = async (request) => {
|
|
935
|
-
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs
|
|
936
|
-
throw new Error("timestampEndMs must be
|
|
935
|
+
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs > request.timestampStartMs) {
|
|
936
|
+
throw new Error("timestampEndMs must be lower than timestampStartMs");
|
|
937
937
|
}
|
|
938
938
|
const response = await this.sendGetJson("/v1/get_user_funding_history" /* GetUserFundingHistory */, request);
|
|
939
939
|
return response;
|
|
@@ -947,8 +947,8 @@ var Client = class _Client {
|
|
|
947
947
|
return response;
|
|
948
948
|
};
|
|
949
949
|
this.getUserPortfolioValueHistory = async (request) => {
|
|
950
|
-
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs
|
|
951
|
-
throw new Error("timestampEndMs must be
|
|
950
|
+
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs > request.timestampStartMs) {
|
|
951
|
+
throw new Error("timestampEndMs must be lower than timestampStartMs");
|
|
952
952
|
}
|
|
953
953
|
const response = await this.sendGetJson("/v1/get_user_portfolio_value" /* GetUserPortfolioValue */, request);
|
|
954
954
|
return response;
|
package/dist/index.d.cts
CHANGED
|
@@ -148,8 +148,8 @@ declare enum ChartInterval {
|
|
|
148
148
|
interface GetChartCandlesInRangeRequest {
|
|
149
149
|
marketName: string;
|
|
150
150
|
interval: ChartInterval;
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
timestampStartMs?: string;
|
|
152
|
+
timestampEndMs?: string;
|
|
153
153
|
paginationCursor?: PaginationCursor;
|
|
154
154
|
}
|
|
155
155
|
interface GetChartCandlesInRangeResponse {
|
|
@@ -809,7 +809,7 @@ declare class Client {
|
|
|
809
809
|
getPerpOrderBookData: (marketName: string) => Promise<GetPerpOrderBookDataResponse>;
|
|
810
810
|
getPerpMarketsData: (markets: string[]) => Promise<GetPerpMarketsDataResponse>;
|
|
811
811
|
getBorrowLendingData: () => Promise<GetBorrowLendingDataResponse>;
|
|
812
|
-
getChartCandlesInRange: ({ interval, marketName,
|
|
812
|
+
getChartCandlesInRange: ({ interval, marketName, timestampStartMs, timestampEndMs, cursor, }: IGetChartCandlesInRange) => Promise<GetChartCandlesInRangeResponse>;
|
|
813
813
|
getPriceIndexes: () => Promise<GetPriceIndexesResponse>;
|
|
814
814
|
getUsersByAddress: (payload: GetUsersByAddressRequest) => Promise<GetUsersByAddressResponse>;
|
|
815
815
|
getPerpRecentTrades: (request: GetPerpRecentTradesRequest) => Promise<any>;
|
|
@@ -897,8 +897,8 @@ interface LendTokenParams {
|
|
|
897
897
|
interface IGetChartCandlesInRange {
|
|
898
898
|
marketName: string;
|
|
899
899
|
interval: ChartInterval;
|
|
900
|
-
|
|
901
|
-
|
|
900
|
+
timestampStartMs?: number;
|
|
901
|
+
timestampEndMs?: number;
|
|
902
902
|
cursor?: PaginationCursor;
|
|
903
903
|
}
|
|
904
904
|
type WsOracleUpdates = Extract<WsMessage, {
|
package/dist/index.d.ts
CHANGED
|
@@ -148,8 +148,8 @@ declare enum ChartInterval {
|
|
|
148
148
|
interface GetChartCandlesInRangeRequest {
|
|
149
149
|
marketName: string;
|
|
150
150
|
interval: ChartInterval;
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
timestampStartMs?: string;
|
|
152
|
+
timestampEndMs?: string;
|
|
153
153
|
paginationCursor?: PaginationCursor;
|
|
154
154
|
}
|
|
155
155
|
interface GetChartCandlesInRangeResponse {
|
|
@@ -809,7 +809,7 @@ declare class Client {
|
|
|
809
809
|
getPerpOrderBookData: (marketName: string) => Promise<GetPerpOrderBookDataResponse>;
|
|
810
810
|
getPerpMarketsData: (markets: string[]) => Promise<GetPerpMarketsDataResponse>;
|
|
811
811
|
getBorrowLendingData: () => Promise<GetBorrowLendingDataResponse>;
|
|
812
|
-
getChartCandlesInRange: ({ interval, marketName,
|
|
812
|
+
getChartCandlesInRange: ({ interval, marketName, timestampStartMs, timestampEndMs, cursor, }: IGetChartCandlesInRange) => Promise<GetChartCandlesInRangeResponse>;
|
|
813
813
|
getPriceIndexes: () => Promise<GetPriceIndexesResponse>;
|
|
814
814
|
getUsersByAddress: (payload: GetUsersByAddressRequest) => Promise<GetUsersByAddressResponse>;
|
|
815
815
|
getPerpRecentTrades: (request: GetPerpRecentTradesRequest) => Promise<any>;
|
|
@@ -897,8 +897,8 @@ interface LendTokenParams {
|
|
|
897
897
|
interface IGetChartCandlesInRange {
|
|
898
898
|
marketName: string;
|
|
899
899
|
interval: ChartInterval;
|
|
900
|
-
|
|
901
|
-
|
|
900
|
+
timestampStartMs?: number;
|
|
901
|
+
timestampEndMs?: number;
|
|
902
902
|
cursor?: PaginationCursor;
|
|
903
903
|
}
|
|
904
904
|
type WsOracleUpdates = Extract<WsMessage, {
|
package/dist/index.js
CHANGED
|
@@ -837,19 +837,19 @@ var Client = class _Client {
|
|
|
837
837
|
this.getChartCandlesInRange = async ({
|
|
838
838
|
interval,
|
|
839
839
|
marketName,
|
|
840
|
-
|
|
841
|
-
|
|
840
|
+
timestampStartMs = Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3),
|
|
841
|
+
timestampEndMs = Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3 - 24 * 60 * 60 * 1e3),
|
|
842
842
|
// default 24 back
|
|
843
843
|
cursor
|
|
844
844
|
}) => {
|
|
845
|
-
if (
|
|
846
|
-
throw new Error("
|
|
845
|
+
if (timestampEndMs && timestampStartMs && timestampEndMs > timestampStartMs) {
|
|
846
|
+
throw new Error("timestampEndMs must be lower than timestampStartMs");
|
|
847
847
|
}
|
|
848
848
|
const response = await this.sendGetJson("/v1/public/chart_candles_in_range" /* GetChartCandlesInRange */, {
|
|
849
849
|
marketName,
|
|
850
850
|
interval,
|
|
851
|
-
startTimestamp:
|
|
852
|
-
endTimestamp:
|
|
851
|
+
startTimestamp: timestampStartMs.toString(),
|
|
852
|
+
endTimestamp: timestampEndMs.toString(),
|
|
853
853
|
paginationCursor: cursor
|
|
854
854
|
});
|
|
855
855
|
return response;
|
|
@@ -867,22 +867,22 @@ var Client = class _Client {
|
|
|
867
867
|
return response;
|
|
868
868
|
};
|
|
869
869
|
this.getUserPerpFills = async (request) => {
|
|
870
|
-
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs
|
|
871
|
-
throw new Error("timestampEndMs must be
|
|
870
|
+
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs > request.timestampStartMs) {
|
|
871
|
+
throw new Error("timestampEndMs must be lower than timestampStartMs");
|
|
872
872
|
}
|
|
873
873
|
const response = await this.sendGetJson("/v1/get_user_perp_fills" /* GetUserPerpFills */, request);
|
|
874
874
|
return response;
|
|
875
875
|
};
|
|
876
876
|
this.getUserPerpOrders = async (request) => {
|
|
877
|
-
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs
|
|
878
|
-
throw new Error("timestampEndMs must be
|
|
877
|
+
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs > request.timestampStartMs) {
|
|
878
|
+
throw new Error("timestampEndMs must be lower than timestampStartMs");
|
|
879
879
|
}
|
|
880
880
|
const response = await this.sendGetJson("/v1/get_user_perp_orders" /* GetUserPerpOrders */, request);
|
|
881
881
|
return response;
|
|
882
882
|
};
|
|
883
883
|
this.getUserFundingHistory = async (request) => {
|
|
884
|
-
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs
|
|
885
|
-
throw new Error("timestampEndMs must be
|
|
884
|
+
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs > request.timestampStartMs) {
|
|
885
|
+
throw new Error("timestampEndMs must be lower than timestampStartMs");
|
|
886
886
|
}
|
|
887
887
|
const response = await this.sendGetJson("/v1/get_user_funding_history" /* GetUserFundingHistory */, request);
|
|
888
888
|
return response;
|
|
@@ -896,8 +896,8 @@ var Client = class _Client {
|
|
|
896
896
|
return response;
|
|
897
897
|
};
|
|
898
898
|
this.getUserPortfolioValueHistory = async (request) => {
|
|
899
|
-
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs
|
|
900
|
-
throw new Error("timestampEndMs must be
|
|
899
|
+
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs > request.timestampStartMs) {
|
|
900
|
+
throw new Error("timestampEndMs must be lower than timestampStartMs");
|
|
901
901
|
}
|
|
902
902
|
const response = await this.sendGetJson("/v1/get_user_portfolio_value" /* GetUserPortfolioValue */, request);
|
|
903
903
|
return response;
|