@nightlylabs/dex-sdk 0.3.36 → 0.3.37
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 +97 -42
- package/dist/index.d.cts +10 -13
- package/dist/index.d.ts +10 -13
- package/dist/index.js +97 -42
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23934,13 +23934,15 @@ var AccountSequenceNumber = class {
|
|
|
23934
23934
|
// src/client.ts
|
|
23935
23935
|
var getRandomId = () => (0, import_uuid.v7)();
|
|
23936
23936
|
var Client = class _Client {
|
|
23937
|
-
constructor(connection, enableWs, url, apiKey, chainId, params, networkMode = "testnet") {
|
|
23937
|
+
constructor(connection, enableWs, url, apiKey, chainId, params, networkMode = "testnet", wsDebug = false, timeout = 5e3) {
|
|
23938
23938
|
this._apiKeySequenceNumber = 0;
|
|
23939
23939
|
this._subscriptions = /* @__PURE__ */ new Map();
|
|
23940
23940
|
this._gasUnitPrice = 100;
|
|
23941
23941
|
this._expirationTimestampDelay = 20;
|
|
23942
23942
|
// 20 seconds
|
|
23943
23943
|
this.timeout = 5e3;
|
|
23944
|
+
// Same as below in init
|
|
23945
|
+
this.wsDebug = false;
|
|
23944
23946
|
/////////////////////////////////// Sponsored transactions
|
|
23945
23947
|
this.submitSponsoredTransaction = async (tx, signature) => {
|
|
23946
23948
|
const payload = {
|
|
@@ -24091,24 +24093,11 @@ var Client = class _Client {
|
|
|
24091
24093
|
const response = await this.sendGetJson("/v1/get_borrow_lending_data" /* GetBorrowLendingData */);
|
|
24092
24094
|
return response;
|
|
24093
24095
|
};
|
|
24094
|
-
this.getChartCandlesInRange = async ({
|
|
24095
|
-
|
|
24096
|
-
|
|
24097
|
-
timestampStartMs = Math.round((/* @__PURE__ */ new Date()).getTime()),
|
|
24098
|
-
timestampEndMs = Math.round((/* @__PURE__ */ new Date()).getTime() - 24 * 60 * 60 * 1e3),
|
|
24099
|
-
// default 24 back
|
|
24100
|
-
cursor
|
|
24101
|
-
}) => {
|
|
24102
|
-
if (timestampEndMs && timestampStartMs && timestampEndMs > timestampStartMs) {
|
|
24103
|
-
throw new Error("timestampEndMs must be lower than timestampStartMs");
|
|
24096
|
+
this.getChartCandlesInRange = async (request) => {
|
|
24097
|
+
if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
|
|
24098
|
+
throw new Error("olderTimestampMs must be lower than newerTimestampMs");
|
|
24104
24099
|
}
|
|
24105
|
-
const response = await this.sendGetJson("/v1/public/chart_candles_in_range" /* GetChartCandlesInRange */,
|
|
24106
|
-
marketName,
|
|
24107
|
-
interval,
|
|
24108
|
-
startTimestamp: timestampStartMs.toString(),
|
|
24109
|
-
endTimestamp: timestampEndMs.toString(),
|
|
24110
|
-
paginationCursor: cursor
|
|
24111
|
-
});
|
|
24100
|
+
const response = await this.sendGetJson("/v1/public/chart_candles_in_range" /* GetChartCandlesInRange */, request);
|
|
24112
24101
|
return response;
|
|
24113
24102
|
};
|
|
24114
24103
|
this.getPriceIndexes = async () => {
|
|
@@ -24403,13 +24392,25 @@ var Client = class _Client {
|
|
|
24403
24392
|
this._maxGas = params?.maxGas || 2e4;
|
|
24404
24393
|
this._gasUnitPrice = params?.gasUnitPrice || 100;
|
|
24405
24394
|
this._expirationTimestampDelay = params?.expirationTimestampSecs || 20;
|
|
24395
|
+
this.wsDebug = wsDebug;
|
|
24396
|
+
this.timeout = timeout;
|
|
24406
24397
|
if (enableWs) {
|
|
24407
24398
|
this.connectWebSocket();
|
|
24408
24399
|
}
|
|
24409
24400
|
}
|
|
24410
|
-
static async init(connection, enableWs = true, url, apiKey, chainId, params, networkMode = "testnet") {
|
|
24401
|
+
static async init(connection, enableWs = true, url, apiKey, chainId, params, networkMode = "testnet", wsDebug = false, timeout = 5e3) {
|
|
24411
24402
|
const id = chainId || await connection.getChainId();
|
|
24412
|
-
const client = new _Client(
|
|
24403
|
+
const client = new _Client(
|
|
24404
|
+
connection,
|
|
24405
|
+
enableWs,
|
|
24406
|
+
url,
|
|
24407
|
+
apiKey,
|
|
24408
|
+
id,
|
|
24409
|
+
params,
|
|
24410
|
+
networkMode,
|
|
24411
|
+
wsDebug,
|
|
24412
|
+
timeout
|
|
24413
|
+
);
|
|
24413
24414
|
if (enableWs) {
|
|
24414
24415
|
client.connectWebSocket();
|
|
24415
24416
|
}
|
|
@@ -24443,11 +24444,21 @@ var Client = class _Client {
|
|
|
24443
24444
|
* myApiKeyAccount // custom API key
|
|
24444
24445
|
* )
|
|
24445
24446
|
*/
|
|
24446
|
-
static async create(connection, networkMode = "testnet", enableWs = true, url, apiKey) {
|
|
24447
|
+
static async create(connection, networkMode = "testnet", enableWs = true, url, apiKey, wsDebug = false, timeout = 5e3) {
|
|
24447
24448
|
const networkConfig = getNetworkConfig(networkMode);
|
|
24448
24449
|
const apiUrl = url || networkConfig.apiUrl;
|
|
24449
24450
|
const chainId = networkConfig.chainId;
|
|
24450
|
-
return _Client.init(
|
|
24451
|
+
return _Client.init(
|
|
24452
|
+
connection,
|
|
24453
|
+
enableWs,
|
|
24454
|
+
apiUrl,
|
|
24455
|
+
apiKey,
|
|
24456
|
+
chainId,
|
|
24457
|
+
void 0,
|
|
24458
|
+
networkMode,
|
|
24459
|
+
wsDebug,
|
|
24460
|
+
timeout
|
|
24461
|
+
);
|
|
24451
24462
|
}
|
|
24452
24463
|
async setApiKey(apiKey) {
|
|
24453
24464
|
this._apiKey = apiKey;
|
|
@@ -24473,21 +24484,60 @@ var Client = class _Client {
|
|
|
24473
24484
|
this._expirationTimestampDelay = params.expirationTimestampSecs;
|
|
24474
24485
|
}
|
|
24475
24486
|
//////////////////////////////////////// Websocket functions
|
|
24487
|
+
_wsLog(...args) {
|
|
24488
|
+
if (this.wsDebug) console.log("[WS]", ...args);
|
|
24489
|
+
}
|
|
24490
|
+
setWsDebugActive(active) {
|
|
24491
|
+
this.wsDebug = active;
|
|
24492
|
+
}
|
|
24476
24493
|
async connectWebSocket() {
|
|
24477
24494
|
if (this._ws) {
|
|
24478
24495
|
console.warn("WebSocket is already connected");
|
|
24479
24496
|
return;
|
|
24480
24497
|
}
|
|
24481
24498
|
try {
|
|
24482
|
-
|
|
24499
|
+
const wsUrl = `${this._serverUrl.replace("http", "ws").replace("https", "wss")}` + "/v1/ws" /* Ws */;
|
|
24500
|
+
this._wsLog("Connecting to", wsUrl);
|
|
24501
|
+
this._ws = new WebSocket(wsUrl);
|
|
24483
24502
|
this._setupWebSocketHandlers();
|
|
24484
|
-
|
|
24503
|
+
await this._waitForOpen(this.timeout);
|
|
24504
|
+
this._wsLog("Connected");
|
|
24485
24505
|
} catch (error) {
|
|
24506
|
+
this._wsLog("Connection failed:", error);
|
|
24507
|
+
this._ws = void 0;
|
|
24486
24508
|
throw new Error(`Failed to connect WebSocket: ${error}`);
|
|
24487
24509
|
}
|
|
24488
24510
|
}
|
|
24511
|
+
_waitForOpen(timeout) {
|
|
24512
|
+
return new Promise((resolve, reject) => {
|
|
24513
|
+
if (!this._ws) return reject(new Error("No WebSocket"));
|
|
24514
|
+
if (this._ws.readyState === WebSocket.OPEN) {
|
|
24515
|
+
return resolve();
|
|
24516
|
+
}
|
|
24517
|
+
const timer = setTimeout(() => {
|
|
24518
|
+
this._wsLog("Connection timeout after", timeout, "ms");
|
|
24519
|
+
reject(new Error("WebSocket connection timeout"));
|
|
24520
|
+
}, timeout);
|
|
24521
|
+
const ws = this._ws;
|
|
24522
|
+
const origOnOpen = ws.onopen;
|
|
24523
|
+
ws.onopen = (event) => {
|
|
24524
|
+
clearTimeout(timer);
|
|
24525
|
+
origOnOpen?.call(ws, event);
|
|
24526
|
+
resolve();
|
|
24527
|
+
};
|
|
24528
|
+
const origOnError = ws.onerror;
|
|
24529
|
+
ws.onerror = (error) => {
|
|
24530
|
+
clearTimeout(timer);
|
|
24531
|
+
origOnError?.call(ws, error);
|
|
24532
|
+
reject(error);
|
|
24533
|
+
};
|
|
24534
|
+
});
|
|
24535
|
+
}
|
|
24489
24536
|
_setupWebSocketHandlers() {
|
|
24490
24537
|
if (!this._ws) return;
|
|
24538
|
+
this._ws.onopen = () => {
|
|
24539
|
+
this._wsLog("Opened");
|
|
24540
|
+
};
|
|
24491
24541
|
this._ws.onmessage = async (msg) => {
|
|
24492
24542
|
let data;
|
|
24493
24543
|
if (msg.data.arrayBuffer) {
|
|
@@ -24496,49 +24546,52 @@ var Client = class _Client {
|
|
|
24496
24546
|
data = msg.data;
|
|
24497
24547
|
}
|
|
24498
24548
|
const decodedMsg = JSON.parse(data);
|
|
24549
|
+
this._wsLog("Received:", decodedMsg.type, decodedMsg.content);
|
|
24499
24550
|
const topic = getTopicFromMessage(decodedMsg);
|
|
24500
24551
|
const callback = this._subscriptions.get(topic);
|
|
24501
24552
|
if (callback) {
|
|
24502
24553
|
callback(decodedMsg);
|
|
24554
|
+
} else {
|
|
24555
|
+
this._wsLog("No handler for topic:", topic);
|
|
24503
24556
|
}
|
|
24504
24557
|
};
|
|
24505
|
-
|
|
24506
|
-
|
|
24507
|
-
|
|
24508
|
-
|
|
24509
|
-
|
|
24558
|
+
this._ws.onclose = (event) => {
|
|
24559
|
+
this._wsLog(
|
|
24560
|
+
"Closed: code=" + event.code,
|
|
24561
|
+
"reason=" + event.reason,
|
|
24562
|
+
"clean=" + event.wasClean
|
|
24510
24563
|
);
|
|
24511
|
-
|
|
24512
|
-
|
|
24513
|
-
|
|
24514
|
-
|
|
24515
|
-
|
|
24516
|
-
|
|
24517
|
-
|
|
24518
|
-
ws.onerror = (error) => {
|
|
24519
|
-
clearTimeout(timer);
|
|
24520
|
-
reject(error);
|
|
24521
|
-
};
|
|
24522
|
-
});
|
|
24564
|
+
this._ws = void 0;
|
|
24565
|
+
this._subscriptions.clear();
|
|
24566
|
+
this.onWsClose?.(event);
|
|
24567
|
+
};
|
|
24568
|
+
this._ws.onerror = (error) => {
|
|
24569
|
+
this._wsLog("Error:", error);
|
|
24570
|
+
};
|
|
24523
24571
|
}
|
|
24524
24572
|
async disconnectWebSocket() {
|
|
24525
24573
|
if (!this._ws) {
|
|
24526
24574
|
console.warn("WebSocket is not connected");
|
|
24527
24575
|
return;
|
|
24528
24576
|
}
|
|
24577
|
+
this._wsLog("Disconnecting, clearing", this._subscriptions.size, "subscriptions");
|
|
24529
24578
|
this._subscriptions.clear();
|
|
24530
24579
|
this._ws.close();
|
|
24531
24580
|
this._ws = void 0;
|
|
24532
24581
|
}
|
|
24533
24582
|
// Method to check if WebSocket is connected
|
|
24534
24583
|
isWebSocketConnected() {
|
|
24535
|
-
|
|
24584
|
+
const connected = this._ws !== void 0 && this._ws.readyState === WebSocket.OPEN;
|
|
24585
|
+
this._wsLog("isWebSocketConnected:", connected);
|
|
24586
|
+
return connected;
|
|
24536
24587
|
}
|
|
24537
24588
|
sendWsMessage(message) {
|
|
24538
24589
|
if (!this._ws) throw new Error("WebSocket is not connected");
|
|
24539
24590
|
return new Promise((resolve, reject) => {
|
|
24540
24591
|
const topic = message.content.id;
|
|
24592
|
+
this._wsLog("Sending:", message.type, "id=" + topic);
|
|
24541
24593
|
const timer = setTimeout(() => {
|
|
24594
|
+
this._wsLog("Timeout waiting for response:", message.type, "id=" + topic);
|
|
24542
24595
|
reject(new Error(`Connection timed out after ${this.timeout} ms`));
|
|
24543
24596
|
}, this.timeout);
|
|
24544
24597
|
let handler = (response) => {
|
|
@@ -24546,11 +24599,13 @@ var Client = class _Client {
|
|
|
24546
24599
|
this._subscriptions.delete(topic);
|
|
24547
24600
|
if (response.type === "Error") {
|
|
24548
24601
|
const errorMessage = response.content.message || "Unknown websocket error without message";
|
|
24602
|
+
this._wsLog("Error response:", errorMessage, "id=" + topic);
|
|
24549
24603
|
reject(
|
|
24550
24604
|
new Error(`WebSocket error (id: ${response.content.id}): ${errorMessage}`)
|
|
24551
24605
|
);
|
|
24552
24606
|
return;
|
|
24553
24607
|
}
|
|
24608
|
+
this._wsLog("Ack received for:", message.type, "id=" + topic);
|
|
24554
24609
|
resolve(response);
|
|
24555
24610
|
};
|
|
24556
24611
|
this._subscriptions.set(topic, handler);
|
package/dist/index.d.cts
CHANGED
|
@@ -5597,13 +5597,6 @@ interface WithdrawTokenParams {
|
|
|
5597
5597
|
max: boolean;
|
|
5598
5598
|
recipient: Address;
|
|
5599
5599
|
}
|
|
5600
|
-
interface IGetChartCandlesInRange {
|
|
5601
|
-
marketName: string;
|
|
5602
|
-
interval: ChartInterval;
|
|
5603
|
-
timestampStartMs?: number;
|
|
5604
|
-
timestampEndMs?: number;
|
|
5605
|
-
cursor?: PaginationCursor;
|
|
5606
|
-
}
|
|
5607
5600
|
interface PlaceMultiplePerpOrdersParams {
|
|
5608
5601
|
userId: string;
|
|
5609
5602
|
perpOrders: PerpOrderData[];
|
|
@@ -5781,10 +5774,12 @@ declare class Client {
|
|
|
5781
5774
|
_gasUnitPrice: number;
|
|
5782
5775
|
_expirationTimestampDelay: number;
|
|
5783
5776
|
timeout: number;
|
|
5777
|
+
wsDebug: boolean;
|
|
5778
|
+
onWsClose: ((event: CloseEvent) => void) | undefined;
|
|
5784
5779
|
_abis: ReturnType<typeof getABIsForNetwork>;
|
|
5785
5780
|
_contractAddress: string;
|
|
5786
|
-
static init(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams, networkMode?: NetworkMode): Promise<Client>;
|
|
5787
|
-
constructor(connection: Aptos, enableWs: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams, networkMode?: NetworkMode);
|
|
5781
|
+
static init(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams, networkMode?: NetworkMode, wsDebug?: boolean, timeout?: number): Promise<Client>;
|
|
5782
|
+
constructor(connection: Aptos, enableWs: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams, networkMode?: NetworkMode, wsDebug?: boolean, timeout?: number);
|
|
5788
5783
|
/**
|
|
5789
5784
|
* Create a new Client instance
|
|
5790
5785
|
*
|
|
@@ -5813,15 +5808,17 @@ declare class Client {
|
|
|
5813
5808
|
* myApiKeyAccount // custom API key
|
|
5814
5809
|
* )
|
|
5815
5810
|
*/
|
|
5816
|
-
static create(connection: Aptos, networkMode?: NetworkMode, enableWs?: boolean, url?: string, apiKey?: Account): Promise<Client>;
|
|
5811
|
+
static create(connection: Aptos, networkMode?: NetworkMode, enableWs?: boolean, url?: string, apiKey?: Account, wsDebug?: boolean, timeout?: number): Promise<Client>;
|
|
5817
5812
|
setApiKey(apiKey: Account): Promise<void>;
|
|
5818
5813
|
getContractAddress(): string;
|
|
5819
5814
|
getApiKeySequenceNumber(): Promise<bigint | null>;
|
|
5820
5815
|
fetchApiKeySequenceNumber(): Promise<number>;
|
|
5821
5816
|
setTxParams(params: TxParams): void;
|
|
5817
|
+
private _wsLog;
|
|
5818
|
+
setWsDebugActive(active: boolean): void;
|
|
5822
5819
|
connectWebSocket(): Promise<void>;
|
|
5820
|
+
private _waitForOpen;
|
|
5823
5821
|
private _setupWebSocketHandlers;
|
|
5824
|
-
static initWebSocket(url: string, timeout?: number): Promise<WebSocket>;
|
|
5825
5822
|
disconnectWebSocket(): Promise<void>;
|
|
5826
5823
|
isWebSocketConnected(): boolean;
|
|
5827
5824
|
sendWsMessage(message: WsCommand): Promise<WsMessage>;
|
|
@@ -5901,7 +5898,7 @@ declare class Client {
|
|
|
5901
5898
|
getPerpMarketsData: (markets: string[]) => Promise<GetPerpMarketsDataResponse>;
|
|
5902
5899
|
getSpotMarketsData: (markets: string[]) => Promise<GetSpotMarketsDataResponse>;
|
|
5903
5900
|
getBorrowLendingData: () => Promise<GetBorrowLendingDataResponse>;
|
|
5904
|
-
getChartCandlesInRange: (
|
|
5901
|
+
getChartCandlesInRange: (request: GetChartCandlesInRangeRequest) => Promise<GetChartCandlesInRangeResponse>;
|
|
5905
5902
|
getPriceIndexes: () => Promise<GetPriceIndexesResponse>;
|
|
5906
5903
|
getUsersByAddress: (payload: GetUsersByAddressRequest) => Promise<GetUsersByAddressResponse>;
|
|
5907
5904
|
getPerpRecentTrades: (request: GetPerpRecentTradesRequest) => Promise<GetPerpRecentTradesResponse>;
|
|
@@ -5980,4 +5977,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
5980
5977
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
5981
5978
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
5982
5979
|
|
|
5983
|
-
export { ABIs, type AccountValueRankingEntry, type AddApiCreditsParams, type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiCreditsChange, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type BorrowLendingAggregatedData, type BorrowLendingHistoricalData, type BoxOpeningEvent, type BoxReward, BoxRewardTier, type CancelAllPerpOrdersParams, type CancelAllSpotOrdersParams, type CancelPerpOrdersParams, type CancelSpotOrdersParams, type CanceledPerpOrderData, type CanceledPerpOrders, type CanceledPerpTriggerOrderData, type CanceledPerpTriggerOrders, type CanceledSpotOrderData, type CanceledSpotOrders, type ChangePerpOrderParams, type ChangeSpotOrderParams, type ChartCandle, ChartInterval, type CheckReferralCodeRequest, type CheckReferralCodeResponse, type ClaimDepositParams, type ClaimKickbackFeeParams, type ClaimReferralFee, type ClaimReferralFeesParams, type ClaimUserKickbackFee, type ClaimedKickback, type ClaimedReferralKickback, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type ExchangeStatsEntry, type FeeData, type FeeTier, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetAccountValueRankingRequest, type GetAccountValueRankingResponse, type GetAllVaultsIdsResponse, type GetBorrowLendingAggregatedStatsRequest, type GetBorrowLendingAggregatedStatsResponse, type GetBorrowLendingDataResponse, type GetBorrowLendingHistoricalDataRequest, type GetBorrowLendingHistoricalDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetExchangeStatsHistoryRequest, type GetExchangeStatsHistoryResponse, type GetIndexPriceHistoryRequest, type GetIndexPriceHistoryResponse, type GetIndexPricesResponse, type GetIndexerStatusResponse, type GetOrderBookDataRequest, type GetOrderBookDataResponse, type GetPerpMarketsConfigResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpUserTriggerOrdersRequest, type GetPerpUserTriggerOrdersResponse, type GetPriceIndexesResponse, type GetServicesStatusResponse, type GetSpotMarketsConfigResponse, type GetSpotMarketsDataRequest, type GetSpotMarketsDataResponse, type GetSpotRecentTradesRequest, type GetSpotRecentTradesResponse, type GetSpotUserFillsRequest, type GetSpotUserFillsResponse, type GetSpotUserOrdersRequest, type GetSpotUserOrdersResponse, type GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetTopPointsRankingResponse, type GetUserAccountValueRankingRequest, type GetUserAccountValueRankingResponse, type GetUserAggregatedBoxRewardsStatsRequest, type GetUserAggregatedBoxRewardsStatsResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserAggregatedVaultStatsRequest, type GetUserAggregatedVaultStatsResponse, type GetUserBoxRewardsStatsHistoryRequest, type GetUserBoxRewardsStatsHistoryResponse, type GetUserBoxesHistoryRequest, type GetUserBoxesHistoryResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFullLiquidationsHistoryRequest, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserLiquidationsCancelHistoryResponse, type GetUserLiquidationsCancelOrdersHistoryRequest, type GetUserLiquidationsHistoryResponse, type GetUserPartialLiquidationsHistoryRequest, type GetUserPartialLiquidationsHistoryResponse, type GetUserPersonalPointsRankingRequest, type GetUserPersonalPointsRankingResponse, type GetUserPointsHistoryRequest, type GetUserPointsHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserReferralStatsHistoryRequest, type GetUserReferralStatsHistoryResponse, type GetUserRewardsValueRequest, type GetUserRewardsValueResponse, type GetUserTradeStatsHistoryRequest, type GetUserTradeStatsHistoryResponse, type GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserVaultDepositsRequest, type GetUserVaultDepositsResponse, type GetUserVaultWithdrawsRequest, type GetUserVaultWithdrawsResponse, type GetUserVolumeForReferralRequest, type GetUserVolumeForReferralResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type GetVaultDepositsRequest, type GetVaultDepositsResponse, type GetVaultHistoricalDataRequest, type GetVaultHistoricalDataResponse, type GetVaultWithdrawalsRequest, type GetVaultWithdrawalsResponse, type GlobalLiquidation, type GlobalPartialLiquidation, type HistoricBoxReward, type HistoricalBoxRewardsStats, type HistoricalDeposit, type HistoricalFullLiquidation, type HistoricalFunding, type HistoricalLiquidatedBorrow, type HistoricalLiquidatedCollateral, type HistoricalLiquidatedLend, type HistoricalLiquidatedPosition, type HistoricalLiquidationCancelOrders, type HistoricalPartialLiquidatedPosition, type HistoricalPartialLiquidation, type HistoricalPerpOrder, type HistoricalPoints, type HistoricalReferralStats, type HistoricalSpotOrder, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalVaultDeposit, type HistoricalVaultWithdraw, type HistoricalWithdraw, type
|
|
5980
|
+
export { ABIs, type AccountValueRankingEntry, type AddApiCreditsParams, type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiCreditsChange, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type BorrowLendingAggregatedData, type BorrowLendingHistoricalData, type BoxOpeningEvent, type BoxReward, BoxRewardTier, type CancelAllPerpOrdersParams, type CancelAllSpotOrdersParams, type CancelPerpOrdersParams, type CancelSpotOrdersParams, type CanceledPerpOrderData, type CanceledPerpOrders, type CanceledPerpTriggerOrderData, type CanceledPerpTriggerOrders, type CanceledSpotOrderData, type CanceledSpotOrders, type ChangePerpOrderParams, type ChangeSpotOrderParams, type ChartCandle, ChartInterval, type CheckReferralCodeRequest, type CheckReferralCodeResponse, type ClaimDepositParams, type ClaimKickbackFeeParams, type ClaimReferralFee, type ClaimReferralFeesParams, type ClaimUserKickbackFee, type ClaimedKickback, type ClaimedReferralKickback, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type ExchangeStatsEntry, type FeeData, type FeeTier, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetAccountValueRankingRequest, type GetAccountValueRankingResponse, type GetAllVaultsIdsResponse, type GetBorrowLendingAggregatedStatsRequest, type GetBorrowLendingAggregatedStatsResponse, type GetBorrowLendingDataResponse, type GetBorrowLendingHistoricalDataRequest, type GetBorrowLendingHistoricalDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetExchangeStatsHistoryRequest, type GetExchangeStatsHistoryResponse, type GetIndexPriceHistoryRequest, type GetIndexPriceHistoryResponse, type GetIndexPricesResponse, type GetIndexerStatusResponse, type GetOrderBookDataRequest, type GetOrderBookDataResponse, type GetPerpMarketsConfigResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpUserTriggerOrdersRequest, type GetPerpUserTriggerOrdersResponse, type GetPriceIndexesResponse, type GetServicesStatusResponse, type GetSpotMarketsConfigResponse, type GetSpotMarketsDataRequest, type GetSpotMarketsDataResponse, type GetSpotRecentTradesRequest, type GetSpotRecentTradesResponse, type GetSpotUserFillsRequest, type GetSpotUserFillsResponse, type GetSpotUserOrdersRequest, type GetSpotUserOrdersResponse, type GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetTopPointsRankingResponse, type GetUserAccountValueRankingRequest, type GetUserAccountValueRankingResponse, type GetUserAggregatedBoxRewardsStatsRequest, type GetUserAggregatedBoxRewardsStatsResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserAggregatedVaultStatsRequest, type GetUserAggregatedVaultStatsResponse, type GetUserBoxRewardsStatsHistoryRequest, type GetUserBoxRewardsStatsHistoryResponse, type GetUserBoxesHistoryRequest, type GetUserBoxesHistoryResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFullLiquidationsHistoryRequest, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserLiquidationsCancelHistoryResponse, type GetUserLiquidationsCancelOrdersHistoryRequest, type GetUserLiquidationsHistoryResponse, type GetUserPartialLiquidationsHistoryRequest, type GetUserPartialLiquidationsHistoryResponse, type GetUserPersonalPointsRankingRequest, type GetUserPersonalPointsRankingResponse, type GetUserPointsHistoryRequest, type GetUserPointsHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserReferralStatsHistoryRequest, type GetUserReferralStatsHistoryResponse, type GetUserRewardsValueRequest, type GetUserRewardsValueResponse, type GetUserTradeStatsHistoryRequest, type GetUserTradeStatsHistoryResponse, type GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserVaultDepositsRequest, type GetUserVaultDepositsResponse, type GetUserVaultWithdrawsRequest, type GetUserVaultWithdrawsResponse, type GetUserVolumeForReferralRequest, type GetUserVolumeForReferralResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type GetVaultDepositsRequest, type GetVaultDepositsResponse, type GetVaultHistoricalDataRequest, type GetVaultHistoricalDataResponse, type GetVaultWithdrawalsRequest, type GetVaultWithdrawalsResponse, type GlobalLiquidation, type GlobalPartialLiquidation, type HistoricBoxReward, type HistoricalBoxRewardsStats, type HistoricalDeposit, type HistoricalFullLiquidation, type HistoricalFunding, type HistoricalLiquidatedBorrow, type HistoricalLiquidatedCollateral, type HistoricalLiquidatedLend, type HistoricalLiquidatedPosition, type HistoricalLiquidationCancelOrders, type HistoricalPartialLiquidatedPosition, type HistoricalPartialLiquidation, type HistoricalPerpOrder, type HistoricalPoints, type HistoricalReferralStats, type HistoricalSpotOrder, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalVaultDeposit, type HistoricalVaultWithdraw, type HistoricalWithdraw, type IndexPriceHistory, type IndexPriceLive, type Lend, type LendTokenParams, type Liquidation, type LiquidationCancelledOrderData, type LiquidationCancelledTriggerOrderData, MAINNET_CONFIG, type MarginStep, Network, type NetworkConfig, type NetworkMode, type NodeStatus, type OpenBoxesRequest, type OpenBoxesResponse, type OpenBoxesSignRequest, type OracleUpdate, type OracleUpdates, type OrderBookData, OrderSide, OrderStatus, OrderType, type PaginationCursor, type PartialLiquidation, type PerpFill, type PerpMarketConfigEntry, type PerpMarketData, type PerpOrder, type PerpOrderData, type PerpOrderDataForMarket, type PerpOrderFills, type PerpOrderbookState, type PerpOrderbookUpdate, type PerpPosition, type PerpTrade, type PerpTradesUpdate, type PerpTriggerOrder, type PerpTriggerOrderTriggered, type PlaceMultiplePerpOrdersParams, type PlaceMultipleSpotOrdersParams, type PlacePerpLimitOrder, type PlacePerpMarketOrder, type PlacePerpOrderParams, type PlacePerpTriggerOrder, type PlacePerpTriggerOrderParams, type PlaceSpotLimitOrder, type PlaceSpotMarketOrder, type PlaceSpotOrderParams, type PointsRankingEntry, type PriceIndex, type RedeemTokenParams, type Referral, type ReferralUpdate, type RemoveApiKey, type RemoveApiKeyParams, type RemoveApiKeySignerParams, type RepayBorrow, type ReplaceMultipleOrdersParams, type ReplaceMultipleSpotOrdersParams, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, type SetReferralCodeParams, type SetReferralParamsRequest, type SetReferralParamsResponse, type SpotFill, type SpotMarketConfigEntry, type SpotMarketData, type SpotOrder, type SpotOrderData, type SpotOrderDataForMarket, type SpotOrderFills, type SpotOrderbookState, type SpotOrderbookUpdate, type SpotTrade, type SpotTradesUpdate, Status, type StatusResponse, type SubServiceStatus, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TESTNET_CONFIG, TestFaucet, type TimeResponse, type TokenAggregatedStats, type TokenConfigEntry, type TokenizeUserVaultInvestmentParams, type Topic, type Trade, TradeRole, TransferAction, type TransferToUserParams, type TriggerOrder, type TvlTokenEntry, type TxParams, type UpdateUserFeeTier, type User, type UserAggregatedBoxRewardsStats, type UserAggregatedReferralStats, type UserAggregatedStats, type UserAggregatedVaultStats, type UserBoxOpeningEvent, type UserPointsBreakdown, type UserPortfolioValue, type UserRewardsValue, UserStatus, type UserTransfer, type UtilizationCurve, type Vault, type VaultDeposit, type VaultHistoricalData, type VaultInvestment, type VaultWithdraw, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WithdrawTokenParams, type WsBorrowLendUpdate, type WsBoxOpeningUpdate, type WsCommand, type WsFill, type WsLiquidatedBorrow, type WsLiquidatedCollateral, type WsLiquidatedLend, type WsLiquidatedPosition, type WsLiquidationUpdate, type WsMessage, type WsOracleUpdates, type WsPartialLiquidatedPosition, type WsPerpMarketUpdates, type WsSpotMarketUpdates, type WsUserUpdates, createAptosClient, createAptosClientFromEnv, generateApiKey, getABIsForNetwork, getNetworkConfig, getNetworkModeFromEnv, getRandomId, getTopicFromCommand, getTopicFromMessage, nowInMiliseconds, parseEntryFunctionAbi, sleep, toSystemValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -5597,13 +5597,6 @@ interface WithdrawTokenParams {
|
|
|
5597
5597
|
max: boolean;
|
|
5598
5598
|
recipient: Address;
|
|
5599
5599
|
}
|
|
5600
|
-
interface IGetChartCandlesInRange {
|
|
5601
|
-
marketName: string;
|
|
5602
|
-
interval: ChartInterval;
|
|
5603
|
-
timestampStartMs?: number;
|
|
5604
|
-
timestampEndMs?: number;
|
|
5605
|
-
cursor?: PaginationCursor;
|
|
5606
|
-
}
|
|
5607
5600
|
interface PlaceMultiplePerpOrdersParams {
|
|
5608
5601
|
userId: string;
|
|
5609
5602
|
perpOrders: PerpOrderData[];
|
|
@@ -5781,10 +5774,12 @@ declare class Client {
|
|
|
5781
5774
|
_gasUnitPrice: number;
|
|
5782
5775
|
_expirationTimestampDelay: number;
|
|
5783
5776
|
timeout: number;
|
|
5777
|
+
wsDebug: boolean;
|
|
5778
|
+
onWsClose: ((event: CloseEvent) => void) | undefined;
|
|
5784
5779
|
_abis: ReturnType<typeof getABIsForNetwork>;
|
|
5785
5780
|
_contractAddress: string;
|
|
5786
|
-
static init(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams, networkMode?: NetworkMode): Promise<Client>;
|
|
5787
|
-
constructor(connection: Aptos, enableWs: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams, networkMode?: NetworkMode);
|
|
5781
|
+
static init(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams, networkMode?: NetworkMode, wsDebug?: boolean, timeout?: number): Promise<Client>;
|
|
5782
|
+
constructor(connection: Aptos, enableWs: boolean, url?: string, apiKey?: Account, chainId?: number, params?: TxParams, networkMode?: NetworkMode, wsDebug?: boolean, timeout?: number);
|
|
5788
5783
|
/**
|
|
5789
5784
|
* Create a new Client instance
|
|
5790
5785
|
*
|
|
@@ -5813,15 +5808,17 @@ declare class Client {
|
|
|
5813
5808
|
* myApiKeyAccount // custom API key
|
|
5814
5809
|
* )
|
|
5815
5810
|
*/
|
|
5816
|
-
static create(connection: Aptos, networkMode?: NetworkMode, enableWs?: boolean, url?: string, apiKey?: Account): Promise<Client>;
|
|
5811
|
+
static create(connection: Aptos, networkMode?: NetworkMode, enableWs?: boolean, url?: string, apiKey?: Account, wsDebug?: boolean, timeout?: number): Promise<Client>;
|
|
5817
5812
|
setApiKey(apiKey: Account): Promise<void>;
|
|
5818
5813
|
getContractAddress(): string;
|
|
5819
5814
|
getApiKeySequenceNumber(): Promise<bigint | null>;
|
|
5820
5815
|
fetchApiKeySequenceNumber(): Promise<number>;
|
|
5821
5816
|
setTxParams(params: TxParams): void;
|
|
5817
|
+
private _wsLog;
|
|
5818
|
+
setWsDebugActive(active: boolean): void;
|
|
5822
5819
|
connectWebSocket(): Promise<void>;
|
|
5820
|
+
private _waitForOpen;
|
|
5823
5821
|
private _setupWebSocketHandlers;
|
|
5824
|
-
static initWebSocket(url: string, timeout?: number): Promise<WebSocket>;
|
|
5825
5822
|
disconnectWebSocket(): Promise<void>;
|
|
5826
5823
|
isWebSocketConnected(): boolean;
|
|
5827
5824
|
sendWsMessage(message: WsCommand): Promise<WsMessage>;
|
|
@@ -5901,7 +5898,7 @@ declare class Client {
|
|
|
5901
5898
|
getPerpMarketsData: (markets: string[]) => Promise<GetPerpMarketsDataResponse>;
|
|
5902
5899
|
getSpotMarketsData: (markets: string[]) => Promise<GetSpotMarketsDataResponse>;
|
|
5903
5900
|
getBorrowLendingData: () => Promise<GetBorrowLendingDataResponse>;
|
|
5904
|
-
getChartCandlesInRange: (
|
|
5901
|
+
getChartCandlesInRange: (request: GetChartCandlesInRangeRequest) => Promise<GetChartCandlesInRangeResponse>;
|
|
5905
5902
|
getPriceIndexes: () => Promise<GetPriceIndexesResponse>;
|
|
5906
5903
|
getUsersByAddress: (payload: GetUsersByAddressRequest) => Promise<GetUsersByAddressResponse>;
|
|
5907
5904
|
getPerpRecentTrades: (request: GetPerpRecentTradesRequest) => Promise<GetPerpRecentTradesResponse>;
|
|
@@ -5980,4 +5977,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
5980
5977
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
5981
5978
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
5982
5979
|
|
|
5983
|
-
export { ABIs, type AccountValueRankingEntry, type AddApiCreditsParams, type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiCreditsChange, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type BorrowLendingAggregatedData, type BorrowLendingHistoricalData, type BoxOpeningEvent, type BoxReward, BoxRewardTier, type CancelAllPerpOrdersParams, type CancelAllSpotOrdersParams, type CancelPerpOrdersParams, type CancelSpotOrdersParams, type CanceledPerpOrderData, type CanceledPerpOrders, type CanceledPerpTriggerOrderData, type CanceledPerpTriggerOrders, type CanceledSpotOrderData, type CanceledSpotOrders, type ChangePerpOrderParams, type ChangeSpotOrderParams, type ChartCandle, ChartInterval, type CheckReferralCodeRequest, type CheckReferralCodeResponse, type ClaimDepositParams, type ClaimKickbackFeeParams, type ClaimReferralFee, type ClaimReferralFeesParams, type ClaimUserKickbackFee, type ClaimedKickback, type ClaimedReferralKickback, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type ExchangeStatsEntry, type FeeData, type FeeTier, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetAccountValueRankingRequest, type GetAccountValueRankingResponse, type GetAllVaultsIdsResponse, type GetBorrowLendingAggregatedStatsRequest, type GetBorrowLendingAggregatedStatsResponse, type GetBorrowLendingDataResponse, type GetBorrowLendingHistoricalDataRequest, type GetBorrowLendingHistoricalDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetExchangeStatsHistoryRequest, type GetExchangeStatsHistoryResponse, type GetIndexPriceHistoryRequest, type GetIndexPriceHistoryResponse, type GetIndexPricesResponse, type GetIndexerStatusResponse, type GetOrderBookDataRequest, type GetOrderBookDataResponse, type GetPerpMarketsConfigResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpUserTriggerOrdersRequest, type GetPerpUserTriggerOrdersResponse, type GetPriceIndexesResponse, type GetServicesStatusResponse, type GetSpotMarketsConfigResponse, type GetSpotMarketsDataRequest, type GetSpotMarketsDataResponse, type GetSpotRecentTradesRequest, type GetSpotRecentTradesResponse, type GetSpotUserFillsRequest, type GetSpotUserFillsResponse, type GetSpotUserOrdersRequest, type GetSpotUserOrdersResponse, type GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetTopPointsRankingResponse, type GetUserAccountValueRankingRequest, type GetUserAccountValueRankingResponse, type GetUserAggregatedBoxRewardsStatsRequest, type GetUserAggregatedBoxRewardsStatsResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserAggregatedVaultStatsRequest, type GetUserAggregatedVaultStatsResponse, type GetUserBoxRewardsStatsHistoryRequest, type GetUserBoxRewardsStatsHistoryResponse, type GetUserBoxesHistoryRequest, type GetUserBoxesHistoryResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFullLiquidationsHistoryRequest, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserLiquidationsCancelHistoryResponse, type GetUserLiquidationsCancelOrdersHistoryRequest, type GetUserLiquidationsHistoryResponse, type GetUserPartialLiquidationsHistoryRequest, type GetUserPartialLiquidationsHistoryResponse, type GetUserPersonalPointsRankingRequest, type GetUserPersonalPointsRankingResponse, type GetUserPointsHistoryRequest, type GetUserPointsHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserReferralStatsHistoryRequest, type GetUserReferralStatsHistoryResponse, type GetUserRewardsValueRequest, type GetUserRewardsValueResponse, type GetUserTradeStatsHistoryRequest, type GetUserTradeStatsHistoryResponse, type GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserVaultDepositsRequest, type GetUserVaultDepositsResponse, type GetUserVaultWithdrawsRequest, type GetUserVaultWithdrawsResponse, type GetUserVolumeForReferralRequest, type GetUserVolumeForReferralResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type GetVaultDepositsRequest, type GetVaultDepositsResponse, type GetVaultHistoricalDataRequest, type GetVaultHistoricalDataResponse, type GetVaultWithdrawalsRequest, type GetVaultWithdrawalsResponse, type GlobalLiquidation, type GlobalPartialLiquidation, type HistoricBoxReward, type HistoricalBoxRewardsStats, type HistoricalDeposit, type HistoricalFullLiquidation, type HistoricalFunding, type HistoricalLiquidatedBorrow, type HistoricalLiquidatedCollateral, type HistoricalLiquidatedLend, type HistoricalLiquidatedPosition, type HistoricalLiquidationCancelOrders, type HistoricalPartialLiquidatedPosition, type HistoricalPartialLiquidation, type HistoricalPerpOrder, type HistoricalPoints, type HistoricalReferralStats, type HistoricalSpotOrder, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalVaultDeposit, type HistoricalVaultWithdraw, type HistoricalWithdraw, type
|
|
5980
|
+
export { ABIs, type AccountValueRankingEntry, type AddApiCreditsParams, type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type ApiCreditsChange, type ApiStatus, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLendUpdate, type BorrowLending, type BorrowLendingAggregatedData, type BorrowLendingHistoricalData, type BoxOpeningEvent, type BoxReward, BoxRewardTier, type CancelAllPerpOrdersParams, type CancelAllSpotOrdersParams, type CancelPerpOrdersParams, type CancelSpotOrdersParams, type CanceledPerpOrderData, type CanceledPerpOrders, type CanceledPerpTriggerOrderData, type CanceledPerpTriggerOrders, type CanceledSpotOrderData, type CanceledSpotOrders, type ChangePerpOrderParams, type ChangeSpotOrderParams, type ChartCandle, ChartInterval, type CheckReferralCodeRequest, type CheckReferralCodeResponse, type ClaimDepositParams, type ClaimKickbackFeeParams, type ClaimReferralFee, type ClaimReferralFeesParams, type ClaimUserKickbackFee, type ClaimedKickback, type ClaimedReferralKickback, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type ExchangeStatsEntry, type FeeData, type FeeTier, type Fees, type FundingCheckpoint, type FundingPayment, type FundingRate, GLOBAL_DENOMINATOR, type GetAccountValueRankingRequest, type GetAccountValueRankingResponse, type GetAllVaultsIdsResponse, type GetBorrowLendingAggregatedStatsRequest, type GetBorrowLendingAggregatedStatsResponse, type GetBorrowLendingDataResponse, type GetBorrowLendingHistoricalDataRequest, type GetBorrowLendingHistoricalDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetExchangeStatsHistoryRequest, type GetExchangeStatsHistoryResponse, type GetIndexPriceHistoryRequest, type GetIndexPriceHistoryResponse, type GetIndexPricesResponse, type GetIndexerStatusResponse, type GetOrderBookDataRequest, type GetOrderBookDataResponse, type GetPerpMarketsConfigResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, type GetPerpUserTriggerOrdersRequest, type GetPerpUserTriggerOrdersResponse, type GetPriceIndexesResponse, type GetServicesStatusResponse, type GetSpotMarketsConfigResponse, type GetSpotMarketsDataRequest, type GetSpotMarketsDataResponse, type GetSpotRecentTradesRequest, type GetSpotRecentTradesResponse, type GetSpotUserFillsRequest, type GetSpotUserFillsResponse, type GetSpotUserOrdersRequest, type GetSpotUserOrdersResponse, type GetTokenAggregatedStatsRequest, type GetTokenAggregatedStatsResponse, type GetTokenStatsHistoryRequest, type GetTokenStatsHistoryResponse, type GetTokensConfigResponse, type GetTopPointsRankingResponse, type GetUserAccountValueRankingRequest, type GetUserAccountValueRankingResponse, type GetUserAggregatedBoxRewardsStatsRequest, type GetUserAggregatedBoxRewardsStatsResponse, type GetUserAggregatedReferralStatsRequest, type GetUserAggregatedReferralStatsResponse, type GetUserAggregatedStatsRequest, type GetUserAggregatedStatsResponse, type GetUserAggregatedVaultStatsRequest, type GetUserAggregatedVaultStatsResponse, type GetUserBoxRewardsStatsHistoryRequest, type GetUserBoxRewardsStatsHistoryResponse, type GetUserBoxesHistoryRequest, type GetUserBoxesHistoryResponse, type GetUserClaimedKickbackHistoryRequest, type GetUserClaimedKickbackHistoryResponse, type GetUserClaimedReferralKickbackHistoryRequest, type GetUserClaimedReferralKickbackHistoryResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUserDepositsRequest, type GetUserDepositsResponse, type GetUserFullLiquidationsHistoryRequest, type GetUserFundingHistoryRequest, type GetUserFundingHistoryResponse, type GetUserLiquidationsCancelHistoryResponse, type GetUserLiquidationsCancelOrdersHistoryRequest, type GetUserLiquidationsHistoryResponse, type GetUserPartialLiquidationsHistoryRequest, type GetUserPartialLiquidationsHistoryResponse, type GetUserPersonalPointsRankingRequest, type GetUserPersonalPointsRankingResponse, type GetUserPointsHistoryRequest, type GetUserPointsHistoryResponse, type GetUserPortfolioValueRequest, type GetUserPortfolioValueResponse, type GetUserReferralStatsHistoryRequest, type GetUserReferralStatsHistoryResponse, type GetUserRewardsValueRequest, type GetUserRewardsValueResponse, type GetUserTradeStatsHistoryRequest, type GetUserTradeStatsHistoryResponse, type GetUserTransferHistoryRequest, type GetUserTransferHistoryResponse, type GetUserVaultDepositsRequest, type GetUserVaultDepositsResponse, type GetUserVaultWithdrawsRequest, type GetUserVaultWithdrawsResponse, type GetUserVolumeForReferralRequest, type GetUserVolumeForReferralResponse, type GetUserWithdrawalsRequest, type GetUserWithdrawalsResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type GetVaultDepositsRequest, type GetVaultDepositsResponse, type GetVaultHistoricalDataRequest, type GetVaultHistoricalDataResponse, type GetVaultWithdrawalsRequest, type GetVaultWithdrawalsResponse, type GlobalLiquidation, type GlobalPartialLiquidation, type HistoricBoxReward, type HistoricalBoxRewardsStats, type HistoricalDeposit, type HistoricalFullLiquidation, type HistoricalFunding, type HistoricalLiquidatedBorrow, type HistoricalLiquidatedCollateral, type HistoricalLiquidatedLend, type HistoricalLiquidatedPosition, type HistoricalLiquidationCancelOrders, type HistoricalPartialLiquidatedPosition, type HistoricalPartialLiquidation, type HistoricalPerpOrder, type HistoricalPoints, type HistoricalReferralStats, type HistoricalSpotOrder, type HistoricalTokenStats, type HistoricalTradeStats, type HistoricalUserTransfer, type HistoricalVaultDeposit, type HistoricalVaultWithdraw, type HistoricalWithdraw, type IndexPriceHistory, type IndexPriceLive, type Lend, type LendTokenParams, type Liquidation, type LiquidationCancelledOrderData, type LiquidationCancelledTriggerOrderData, MAINNET_CONFIG, type MarginStep, Network, type NetworkConfig, type NetworkMode, type NodeStatus, type OpenBoxesRequest, type OpenBoxesResponse, type OpenBoxesSignRequest, type OracleUpdate, type OracleUpdates, type OrderBookData, OrderSide, OrderStatus, OrderType, type PaginationCursor, type PartialLiquidation, type PerpFill, type PerpMarketConfigEntry, type PerpMarketData, type PerpOrder, type PerpOrderData, type PerpOrderDataForMarket, type PerpOrderFills, type PerpOrderbookState, type PerpOrderbookUpdate, type PerpPosition, type PerpTrade, type PerpTradesUpdate, type PerpTriggerOrder, type PerpTriggerOrderTriggered, type PlaceMultiplePerpOrdersParams, type PlaceMultipleSpotOrdersParams, type PlacePerpLimitOrder, type PlacePerpMarketOrder, type PlacePerpOrderParams, type PlacePerpTriggerOrder, type PlacePerpTriggerOrderParams, type PlaceSpotLimitOrder, type PlaceSpotMarketOrder, type PlaceSpotOrderParams, type PointsRankingEntry, type PriceIndex, type RedeemTokenParams, type Referral, type ReferralUpdate, type RemoveApiKey, type RemoveApiKeyParams, type RemoveApiKeySignerParams, type RepayBorrow, type ReplaceMultipleOrdersParams, type ReplaceMultipleSpotOrdersParams, type SetAlias, type SetAliasNameParams, type SetAutoLend, type SetAutolendParams, type SetReferralCodeParams, type SetReferralParamsRequest, type SetReferralParamsResponse, type SpotFill, type SpotMarketConfigEntry, type SpotMarketData, type SpotOrder, type SpotOrderData, type SpotOrderDataForMarket, type SpotOrderFills, type SpotOrderbookState, type SpotOrderbookUpdate, type SpotTrade, type SpotTradesUpdate, Status, type StatusResponse, type SubServiceStatus, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TESTNET_CONFIG, TestFaucet, type TimeResponse, type TokenAggregatedStats, type TokenConfigEntry, type TokenizeUserVaultInvestmentParams, type Topic, type Trade, TradeRole, TransferAction, type TransferToUserParams, type TriggerOrder, type TvlTokenEntry, type TxParams, type UpdateUserFeeTier, type User, type UserAggregatedBoxRewardsStats, type UserAggregatedReferralStats, type UserAggregatedStats, type UserAggregatedVaultStats, type UserBoxOpeningEvent, type UserPointsBreakdown, type UserPortfolioValue, type UserRewardsValue, UserStatus, type UserTransfer, type UtilizationCurve, type Vault, type VaultDeposit, type VaultHistoricalData, type VaultInvestment, type VaultWithdraw, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WithdrawTokenParams, type WsBorrowLendUpdate, type WsBoxOpeningUpdate, type WsCommand, type WsFill, type WsLiquidatedBorrow, type WsLiquidatedCollateral, type WsLiquidatedLend, type WsLiquidatedPosition, type WsLiquidationUpdate, type WsMessage, type WsOracleUpdates, type WsPartialLiquidatedPosition, type WsPerpMarketUpdates, type WsSpotMarketUpdates, type WsUserUpdates, createAptosClient, createAptosClientFromEnv, generateApiKey, getABIsForNetwork, getNetworkConfig, getNetworkModeFromEnv, getRandomId, getTopicFromCommand, getTopicFromMessage, nowInMiliseconds, parseEntryFunctionAbi, sleep, toSystemValue };
|
package/dist/index.js
CHANGED
|
@@ -23892,13 +23892,15 @@ var AccountSequenceNumber = class {
|
|
|
23892
23892
|
// src/client.ts
|
|
23893
23893
|
var getRandomId = () => uuidv7();
|
|
23894
23894
|
var Client = class _Client {
|
|
23895
|
-
constructor(connection, enableWs, url, apiKey, chainId, params, networkMode = "testnet") {
|
|
23895
|
+
constructor(connection, enableWs, url, apiKey, chainId, params, networkMode = "testnet", wsDebug = false, timeout = 5e3) {
|
|
23896
23896
|
this._apiKeySequenceNumber = 0;
|
|
23897
23897
|
this._subscriptions = /* @__PURE__ */ new Map();
|
|
23898
23898
|
this._gasUnitPrice = 100;
|
|
23899
23899
|
this._expirationTimestampDelay = 20;
|
|
23900
23900
|
// 20 seconds
|
|
23901
23901
|
this.timeout = 5e3;
|
|
23902
|
+
// Same as below in init
|
|
23903
|
+
this.wsDebug = false;
|
|
23902
23904
|
/////////////////////////////////// Sponsored transactions
|
|
23903
23905
|
this.submitSponsoredTransaction = async (tx, signature) => {
|
|
23904
23906
|
const payload = {
|
|
@@ -24049,24 +24051,11 @@ var Client = class _Client {
|
|
|
24049
24051
|
const response = await this.sendGetJson("/v1/get_borrow_lending_data" /* GetBorrowLendingData */);
|
|
24050
24052
|
return response;
|
|
24051
24053
|
};
|
|
24052
|
-
this.getChartCandlesInRange = async ({
|
|
24053
|
-
|
|
24054
|
-
|
|
24055
|
-
timestampStartMs = Math.round((/* @__PURE__ */ new Date()).getTime()),
|
|
24056
|
-
timestampEndMs = Math.round((/* @__PURE__ */ new Date()).getTime() - 24 * 60 * 60 * 1e3),
|
|
24057
|
-
// default 24 back
|
|
24058
|
-
cursor
|
|
24059
|
-
}) => {
|
|
24060
|
-
if (timestampEndMs && timestampStartMs && timestampEndMs > timestampStartMs) {
|
|
24061
|
-
throw new Error("timestampEndMs must be lower than timestampStartMs");
|
|
24054
|
+
this.getChartCandlesInRange = async (request) => {
|
|
24055
|
+
if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
|
|
24056
|
+
throw new Error("olderTimestampMs must be lower than newerTimestampMs");
|
|
24062
24057
|
}
|
|
24063
|
-
const response = await this.sendGetJson("/v1/public/chart_candles_in_range" /* GetChartCandlesInRange */,
|
|
24064
|
-
marketName,
|
|
24065
|
-
interval,
|
|
24066
|
-
startTimestamp: timestampStartMs.toString(),
|
|
24067
|
-
endTimestamp: timestampEndMs.toString(),
|
|
24068
|
-
paginationCursor: cursor
|
|
24069
|
-
});
|
|
24058
|
+
const response = await this.sendGetJson("/v1/public/chart_candles_in_range" /* GetChartCandlesInRange */, request);
|
|
24070
24059
|
return response;
|
|
24071
24060
|
};
|
|
24072
24061
|
this.getPriceIndexes = async () => {
|
|
@@ -24361,13 +24350,25 @@ var Client = class _Client {
|
|
|
24361
24350
|
this._maxGas = params?.maxGas || 2e4;
|
|
24362
24351
|
this._gasUnitPrice = params?.gasUnitPrice || 100;
|
|
24363
24352
|
this._expirationTimestampDelay = params?.expirationTimestampSecs || 20;
|
|
24353
|
+
this.wsDebug = wsDebug;
|
|
24354
|
+
this.timeout = timeout;
|
|
24364
24355
|
if (enableWs) {
|
|
24365
24356
|
this.connectWebSocket();
|
|
24366
24357
|
}
|
|
24367
24358
|
}
|
|
24368
|
-
static async init(connection, enableWs = true, url, apiKey, chainId, params, networkMode = "testnet") {
|
|
24359
|
+
static async init(connection, enableWs = true, url, apiKey, chainId, params, networkMode = "testnet", wsDebug = false, timeout = 5e3) {
|
|
24369
24360
|
const id = chainId || await connection.getChainId();
|
|
24370
|
-
const client = new _Client(
|
|
24361
|
+
const client = new _Client(
|
|
24362
|
+
connection,
|
|
24363
|
+
enableWs,
|
|
24364
|
+
url,
|
|
24365
|
+
apiKey,
|
|
24366
|
+
id,
|
|
24367
|
+
params,
|
|
24368
|
+
networkMode,
|
|
24369
|
+
wsDebug,
|
|
24370
|
+
timeout
|
|
24371
|
+
);
|
|
24371
24372
|
if (enableWs) {
|
|
24372
24373
|
client.connectWebSocket();
|
|
24373
24374
|
}
|
|
@@ -24401,11 +24402,21 @@ var Client = class _Client {
|
|
|
24401
24402
|
* myApiKeyAccount // custom API key
|
|
24402
24403
|
* )
|
|
24403
24404
|
*/
|
|
24404
|
-
static async create(connection, networkMode = "testnet", enableWs = true, url, apiKey) {
|
|
24405
|
+
static async create(connection, networkMode = "testnet", enableWs = true, url, apiKey, wsDebug = false, timeout = 5e3) {
|
|
24405
24406
|
const networkConfig = getNetworkConfig(networkMode);
|
|
24406
24407
|
const apiUrl = url || networkConfig.apiUrl;
|
|
24407
24408
|
const chainId = networkConfig.chainId;
|
|
24408
|
-
return _Client.init(
|
|
24409
|
+
return _Client.init(
|
|
24410
|
+
connection,
|
|
24411
|
+
enableWs,
|
|
24412
|
+
apiUrl,
|
|
24413
|
+
apiKey,
|
|
24414
|
+
chainId,
|
|
24415
|
+
void 0,
|
|
24416
|
+
networkMode,
|
|
24417
|
+
wsDebug,
|
|
24418
|
+
timeout
|
|
24419
|
+
);
|
|
24409
24420
|
}
|
|
24410
24421
|
async setApiKey(apiKey) {
|
|
24411
24422
|
this._apiKey = apiKey;
|
|
@@ -24431,21 +24442,60 @@ var Client = class _Client {
|
|
|
24431
24442
|
this._expirationTimestampDelay = params.expirationTimestampSecs;
|
|
24432
24443
|
}
|
|
24433
24444
|
//////////////////////////////////////// Websocket functions
|
|
24445
|
+
_wsLog(...args) {
|
|
24446
|
+
if (this.wsDebug) console.log("[WS]", ...args);
|
|
24447
|
+
}
|
|
24448
|
+
setWsDebugActive(active) {
|
|
24449
|
+
this.wsDebug = active;
|
|
24450
|
+
}
|
|
24434
24451
|
async connectWebSocket() {
|
|
24435
24452
|
if (this._ws) {
|
|
24436
24453
|
console.warn("WebSocket is already connected");
|
|
24437
24454
|
return;
|
|
24438
24455
|
}
|
|
24439
24456
|
try {
|
|
24440
|
-
|
|
24457
|
+
const wsUrl = `${this._serverUrl.replace("http", "ws").replace("https", "wss")}` + "/v1/ws" /* Ws */;
|
|
24458
|
+
this._wsLog("Connecting to", wsUrl);
|
|
24459
|
+
this._ws = new WebSocket(wsUrl);
|
|
24441
24460
|
this._setupWebSocketHandlers();
|
|
24442
|
-
|
|
24461
|
+
await this._waitForOpen(this.timeout);
|
|
24462
|
+
this._wsLog("Connected");
|
|
24443
24463
|
} catch (error) {
|
|
24464
|
+
this._wsLog("Connection failed:", error);
|
|
24465
|
+
this._ws = void 0;
|
|
24444
24466
|
throw new Error(`Failed to connect WebSocket: ${error}`);
|
|
24445
24467
|
}
|
|
24446
24468
|
}
|
|
24469
|
+
_waitForOpen(timeout) {
|
|
24470
|
+
return new Promise((resolve, reject) => {
|
|
24471
|
+
if (!this._ws) return reject(new Error("No WebSocket"));
|
|
24472
|
+
if (this._ws.readyState === WebSocket.OPEN) {
|
|
24473
|
+
return resolve();
|
|
24474
|
+
}
|
|
24475
|
+
const timer = setTimeout(() => {
|
|
24476
|
+
this._wsLog("Connection timeout after", timeout, "ms");
|
|
24477
|
+
reject(new Error("WebSocket connection timeout"));
|
|
24478
|
+
}, timeout);
|
|
24479
|
+
const ws = this._ws;
|
|
24480
|
+
const origOnOpen = ws.onopen;
|
|
24481
|
+
ws.onopen = (event) => {
|
|
24482
|
+
clearTimeout(timer);
|
|
24483
|
+
origOnOpen?.call(ws, event);
|
|
24484
|
+
resolve();
|
|
24485
|
+
};
|
|
24486
|
+
const origOnError = ws.onerror;
|
|
24487
|
+
ws.onerror = (error) => {
|
|
24488
|
+
clearTimeout(timer);
|
|
24489
|
+
origOnError?.call(ws, error);
|
|
24490
|
+
reject(error);
|
|
24491
|
+
};
|
|
24492
|
+
});
|
|
24493
|
+
}
|
|
24447
24494
|
_setupWebSocketHandlers() {
|
|
24448
24495
|
if (!this._ws) return;
|
|
24496
|
+
this._ws.onopen = () => {
|
|
24497
|
+
this._wsLog("Opened");
|
|
24498
|
+
};
|
|
24449
24499
|
this._ws.onmessage = async (msg) => {
|
|
24450
24500
|
let data;
|
|
24451
24501
|
if (msg.data.arrayBuffer) {
|
|
@@ -24454,49 +24504,52 @@ var Client = class _Client {
|
|
|
24454
24504
|
data = msg.data;
|
|
24455
24505
|
}
|
|
24456
24506
|
const decodedMsg = JSON.parse(data);
|
|
24507
|
+
this._wsLog("Received:", decodedMsg.type, decodedMsg.content);
|
|
24457
24508
|
const topic = getTopicFromMessage(decodedMsg);
|
|
24458
24509
|
const callback = this._subscriptions.get(topic);
|
|
24459
24510
|
if (callback) {
|
|
24460
24511
|
callback(decodedMsg);
|
|
24512
|
+
} else {
|
|
24513
|
+
this._wsLog("No handler for topic:", topic);
|
|
24461
24514
|
}
|
|
24462
24515
|
};
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
|
|
24466
|
-
|
|
24467
|
-
|
|
24516
|
+
this._ws.onclose = (event) => {
|
|
24517
|
+
this._wsLog(
|
|
24518
|
+
"Closed: code=" + event.code,
|
|
24519
|
+
"reason=" + event.reason,
|
|
24520
|
+
"clean=" + event.wasClean
|
|
24468
24521
|
);
|
|
24469
|
-
|
|
24470
|
-
|
|
24471
|
-
|
|
24472
|
-
|
|
24473
|
-
|
|
24474
|
-
|
|
24475
|
-
|
|
24476
|
-
ws.onerror = (error) => {
|
|
24477
|
-
clearTimeout(timer);
|
|
24478
|
-
reject(error);
|
|
24479
|
-
};
|
|
24480
|
-
});
|
|
24522
|
+
this._ws = void 0;
|
|
24523
|
+
this._subscriptions.clear();
|
|
24524
|
+
this.onWsClose?.(event);
|
|
24525
|
+
};
|
|
24526
|
+
this._ws.onerror = (error) => {
|
|
24527
|
+
this._wsLog("Error:", error);
|
|
24528
|
+
};
|
|
24481
24529
|
}
|
|
24482
24530
|
async disconnectWebSocket() {
|
|
24483
24531
|
if (!this._ws) {
|
|
24484
24532
|
console.warn("WebSocket is not connected");
|
|
24485
24533
|
return;
|
|
24486
24534
|
}
|
|
24535
|
+
this._wsLog("Disconnecting, clearing", this._subscriptions.size, "subscriptions");
|
|
24487
24536
|
this._subscriptions.clear();
|
|
24488
24537
|
this._ws.close();
|
|
24489
24538
|
this._ws = void 0;
|
|
24490
24539
|
}
|
|
24491
24540
|
// Method to check if WebSocket is connected
|
|
24492
24541
|
isWebSocketConnected() {
|
|
24493
|
-
|
|
24542
|
+
const connected = this._ws !== void 0 && this._ws.readyState === WebSocket.OPEN;
|
|
24543
|
+
this._wsLog("isWebSocketConnected:", connected);
|
|
24544
|
+
return connected;
|
|
24494
24545
|
}
|
|
24495
24546
|
sendWsMessage(message) {
|
|
24496
24547
|
if (!this._ws) throw new Error("WebSocket is not connected");
|
|
24497
24548
|
return new Promise((resolve, reject) => {
|
|
24498
24549
|
const topic = message.content.id;
|
|
24550
|
+
this._wsLog("Sending:", message.type, "id=" + topic);
|
|
24499
24551
|
const timer = setTimeout(() => {
|
|
24552
|
+
this._wsLog("Timeout waiting for response:", message.type, "id=" + topic);
|
|
24500
24553
|
reject(new Error(`Connection timed out after ${this.timeout} ms`));
|
|
24501
24554
|
}, this.timeout);
|
|
24502
24555
|
let handler = (response) => {
|
|
@@ -24504,11 +24557,13 @@ var Client = class _Client {
|
|
|
24504
24557
|
this._subscriptions.delete(topic);
|
|
24505
24558
|
if (response.type === "Error") {
|
|
24506
24559
|
const errorMessage = response.content.message || "Unknown websocket error without message";
|
|
24560
|
+
this._wsLog("Error response:", errorMessage, "id=" + topic);
|
|
24507
24561
|
reject(
|
|
24508
24562
|
new Error(`WebSocket error (id: ${response.content.id}): ${errorMessage}`)
|
|
24509
24563
|
);
|
|
24510
24564
|
return;
|
|
24511
24565
|
}
|
|
24566
|
+
this._wsLog("Ack received for:", message.type, "id=" + topic);
|
|
24512
24567
|
resolve(response);
|
|
24513
24568
|
};
|
|
24514
24569
|
this._subscriptions.set(topic, handler);
|