@nightlylabs/dex-sdk 0.3.42 → 1.0.0

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 CHANGED
@@ -30,11 +30,9 @@ __export(index_exports, {
30
30
  ExchangeProxies: () => ExchangeProxies,
31
31
  GLOBAL_DENOMINATOR: () => GLOBAL_DENOMINATOR,
32
32
  MAINNET_CONFIG: () => MAINNET_CONFIG,
33
- Network: () => Network2,
34
33
  OrderSide: () => OrderSide,
35
34
  OrderStatus: () => OrderStatus,
36
35
  OrderType: () => OrderType,
37
- Status: () => Status,
38
36
  TESTNET_CONFIG: () => TESTNET_CONFIG,
39
37
  TestFaucet: () => TestFaucet,
40
38
  TradeRole: () => TradeRole,
@@ -50,6 +48,7 @@ __export(index_exports, {
50
48
  getTopicFromCommand: () => getTopicFromCommand,
51
49
  getTopicFromMessage: () => getTopicFromMessage,
52
50
  nowInMiliseconds: () => nowInMiliseconds,
51
+ nowInMilliseconds: () => nowInMilliseconds,
53
52
  parseEntryFunctionAbi: () => parseEntryFunctionAbi,
54
53
  sleep: () => sleep,
55
54
  toSystemValue: () => toSystemValue
@@ -23390,9 +23389,6 @@ function getNetworkModeFromEnv() {
23390
23389
  }
23391
23390
  function createAptosClient(mode) {
23392
23391
  const config = getNetworkConfig(mode);
23393
- console.log(`Creating Aptos client for ${mode.toUpperCase()}`);
23394
- console.log(`Fullnode URL: ${config.fullnode}`);
23395
- console.log(`Indexer URL: ${config.indexer}`);
23396
23392
  const aptosConfig = new import_ts_sdk.AptosConfig({
23397
23393
  network: import_ts_sdk.Network.CUSTOM,
23398
23394
  fullnode: config.fullnode,
@@ -23616,23 +23612,12 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
23616
23612
  // src/utils.ts
23617
23613
  var import_ts_sdk2 = require("@aptos-labs/ts-sdk");
23618
23614
 
23619
- // src/types.ts
23620
- var Status = /* @__PURE__ */ ((Status2) => {
23621
- Status2[Status2["Halted"] = 0] = "Halted";
23622
- Status2[Status2["ReduceOnly"] = 1] = "ReduceOnly";
23623
- Status2[Status2["PostOnly"] = 2] = "PostOnly";
23624
- Status2[Status2["Live"] = 3] = "Live";
23625
- return Status2;
23626
- })(Status || {});
23627
- var Network2 = /* @__PURE__ */ ((Network3) => {
23628
- Network3["Devnet"] = "Devnet";
23629
- return Network3;
23630
- })(Network2 || {});
23631
-
23632
23615
  // src/static.ts
23633
23616
  var ExchangeProxies = {
23634
- ["Devnet" /* Devnet */]: ["0x1"]
23635
- // TODO define it
23617
+ testnet: ["0x1"],
23618
+ // TODO define actual testnet proxy address(es)
23619
+ mainnet: ["0x1"]
23620
+ // TODO define actual mainnet proxy address(es)
23636
23621
  };
23637
23622
  var GLOBAL_DENOMINATOR = 1e8;
23638
23623
 
@@ -23640,6 +23625,7 @@ var GLOBAL_DENOMINATOR = 1e8;
23640
23625
  var import_decimal = require("decimal.js");
23641
23626
  var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
23642
23627
  var nowInMiliseconds = () => Date.now();
23628
+ var nowInMilliseconds = nowInMiliseconds;
23643
23629
  var toSystemValue = (value) => {
23644
23630
  return new import_decimal.Decimal(value).mul(new import_decimal.Decimal(GLOBAL_DENOMINATOR)).toString();
23645
23631
  };
@@ -23647,6 +23633,7 @@ var generateApiKey = () => {
23647
23633
  return import_ts_sdk2.Account.generate({ scheme: 0 });
23648
23634
  };
23649
23635
  var getTopicFromCommand = (data) => {
23636
+ const commandType = data.type;
23650
23637
  switch (data.type) {
23651
23638
  case "SubscribePerpMarket":
23652
23639
  return data.content.market;
@@ -23677,8 +23664,10 @@ var getTopicFromCommand = (data) => {
23677
23664
  case "UnsubscribeLiquidations":
23678
23665
  return "Liquidations";
23679
23666
  }
23667
+ throw new Error(`Unsupported websocket command type: ${commandType}`);
23680
23668
  };
23681
23669
  var getTopicFromMessage = (data) => {
23670
+ const messageType = data.type;
23682
23671
  switch (data.type) {
23683
23672
  case "Ack":
23684
23673
  return data.content.id;
@@ -23777,6 +23766,7 @@ var getTopicFromMessage = (data) => {
23777
23766
  case "CanceledPerpTriggerOrders":
23778
23767
  return data.content.userId;
23779
23768
  }
23769
+ throw new Error(`Unsupported websocket message type: ${messageType}`);
23780
23770
  };
23781
23771
 
23782
23772
  // src/sequenceNumberManager.ts
@@ -23960,8 +23950,14 @@ var AccountSequenceNumber = class {
23960
23950
  // src/client.ts
23961
23951
  var getRandomId = () => (0, import_uuid.v7)();
23962
23952
  var Client = class _Client {
23953
+ /**
23954
+ * constructor.
23955
+ *
23956
+ * @param connection - Aptos connection instance. See {@link Aptos}.
23957
+ * @param config - Client configuration options. See {@link ClientConfig}.
23958
+ */
23963
23959
  constructor(connection, config = {}) {
23964
- this._apiKeySequenceNumber = 0;
23960
+ this._apiKeySequenceNumber = 0n;
23965
23961
  this._pingIntervalMs = 3e4;
23966
23962
  this._lastPongAt = 0;
23967
23963
  this._subscriptions = /* @__PURE__ */ new Map();
@@ -23972,6 +23968,14 @@ var Client = class _Client {
23972
23968
  // Same as below in init
23973
23969
  this.wsDebug = false;
23974
23970
  /////////////////////////////////// Sponsored transactions
23971
+ /**
23972
+ * submitSponsoredTransaction.
23973
+ *
23974
+ * @param tx - See {@link SimpleTransaction}.
23975
+ * @param signature - See {@link AccountAuthenticator}.
23976
+ *
23977
+ * @returns A promise that resolves to {@link SubmitSponsoredTransactionResponse}.
23978
+ */
23975
23979
  this.submitSponsoredTransaction = async (tx, signature) => {
23976
23980
  const payload = {
23977
23981
  sender: tx.rawTransaction.sender.toString(),
@@ -23991,6 +23995,15 @@ var Client = class _Client {
23991
23995
  );
23992
23996
  return response;
23993
23997
  };
23998
+ /**
23999
+ * submitSponsoredMultiAgentTransaction.
24000
+ *
24001
+ * @param tx - See {@link MultiAgentTransaction}.
24002
+ * @param signature - See {@link AccountAuthenticator}.
24003
+ * @param secondarySignersAuthenticators - See {@link AccountAuthenticator[]}.
24004
+ *
24005
+ * @returns A promise that resolves to {@link SubmitSponsoredTransactionResponse}.
24006
+ */
23994
24007
  this.submitSponsoredMultiAgentTransaction = async (tx, signature, secondarySignersAuthenticators) => {
23995
24008
  const payload = {
23996
24009
  sender: tx.rawTransaction.sender.toString(),
@@ -24012,10 +24025,25 @@ var Client = class _Client {
24012
24025
  );
24013
24026
  return response;
24014
24027
  };
24028
+ /**
24029
+ * setReferralParams.
24030
+ *
24031
+ * @param request - See {@link SetReferralParamsRequest}.
24032
+ *
24033
+ * @returns A promise that resolves to {@link SetReferralParamsResponse}.
24034
+ */
24015
24035
  this.setReferralParams = async (request) => {
24016
24036
  return await this.sendPostJson(request, "/v1/set_user_referral_params" /* SetUserReferralParams */);
24017
24037
  };
24018
24038
  //////////////////////////////////////// GETTERS
24039
+ /**
24040
+ * sendGetJson.
24041
+ *
24042
+ * @param endpoint - See string.
24043
+ * @param message - See { [key: string]: any }.
24044
+ *
24045
+ * @returns A promise that resolves to any.
24046
+ */
24019
24047
  this.sendGetJson = async (endpoint, message) => {
24020
24048
  let URL = this._serverUrl + endpoint;
24021
24049
  if (message) {
@@ -24049,6 +24077,14 @@ var Client = class _Client {
24049
24077
  throw new Error(error);
24050
24078
  }
24051
24079
  };
24080
+ /**
24081
+ * sendPostJson.
24082
+ *
24083
+ * @param message - See object.
24084
+ * @param endpoint - See string.
24085
+ *
24086
+ * @returns A promise that resolves to any.
24087
+ */
24052
24088
  this.sendPostJson = async (message, endpoint) => {
24053
24089
  const URL = this._serverUrl + endpoint;
24054
24090
  const headers = {
@@ -24071,56 +24107,115 @@ var Client = class _Client {
24071
24107
  throw new Error(error);
24072
24108
  }
24073
24109
  };
24110
+ /**
24111
+ * getConfig.
24112
+ *
24113
+ * @returns Current exchange configuration. See {@link ExchangeConfig}.
24114
+ */
24074
24115
  this.getConfig = async () => {
24075
24116
  const response = await this.sendGetJson("/v1/get_config" /* GetConfig */);
24076
24117
  return response;
24077
24118
  };
24119
+ /**
24120
+ * getTokensConfig.
24121
+ *
24122
+ * @returns Token configuration map. See {@link GetTokensConfigResponse}.
24123
+ */
24078
24124
  this.getTokensConfig = async () => {
24079
24125
  const response = await this.sendGetJson(
24080
24126
  "/v1/get_tokens_config" /* GetTokensConfig */
24081
24127
  );
24082
24128
  return response;
24083
24129
  };
24130
+ /**
24131
+ * getPerpMarketsConfig.
24132
+ *
24133
+ * @returns Perpetual markets configuration. See {@link GetPerpMarketsConfigResponse}.
24134
+ */
24084
24135
  this.getPerpMarketsConfig = async () => {
24085
24136
  const response = await this.sendGetJson(
24086
24137
  "/v1/get_perp_markets_config" /* GetPerpMarketsConfig */
24087
24138
  );
24088
24139
  return response;
24089
24140
  };
24141
+ /**
24142
+ * getSpotMarketsConfig.
24143
+ *
24144
+ * @returns Spot markets configuration. See {@link GetSpotMarketsConfigResponse}.
24145
+ */
24090
24146
  this.getSpotMarketsConfig = async () => {
24091
24147
  const response = await this.sendGetJson(
24092
24148
  "/v1/get_spot_markets_config" /* GetSpotMarketsConfig */
24093
24149
  );
24094
24150
  return response;
24095
24151
  };
24152
+ /**
24153
+ * getUserData.
24154
+ *
24155
+ * @param userId - See string.
24156
+ *
24157
+ * @returns A promise that resolves to {@link GetUserDataResponse}.
24158
+ */
24096
24159
  this.getUserData = async (userId) => {
24097
24160
  const response = await this.sendGetJson("/v1/get_user_data" /* GetUserData */, {
24098
24161
  userId
24099
24162
  });
24100
24163
  return response;
24101
24164
  };
24165
+ /**
24166
+ * getOrderBookData.
24167
+ *
24168
+ * @param marketName - See string.
24169
+ *
24170
+ * @returns A promise that resolves to {@link GetOrderBookDataResponse}.
24171
+ */
24102
24172
  this.getOrderBookData = async (marketName) => {
24103
24173
  const response = await this.sendGetJson("/v1/get_orderbook_data" /* GetOrderBookData */, {
24104
24174
  marketName
24105
24175
  });
24106
24176
  return response;
24107
24177
  };
24178
+ /**
24179
+ * getPerpMarketsData.
24180
+ *
24181
+ * @param markets - See string[].
24182
+ *
24183
+ * @returns A promise that resolves to {@link GetPerpMarketsDataResponse}.
24184
+ */
24108
24185
  this.getPerpMarketsData = async (markets) => {
24109
24186
  const response = await this.sendGetJson("/v1/get_perp_markets_data" /* GetPerpMarketsData */, {
24110
24187
  markets
24111
24188
  });
24112
24189
  return response;
24113
24190
  };
24191
+ /**
24192
+ * getSpotMarketsData.
24193
+ *
24194
+ * @param markets - See string[].
24195
+ *
24196
+ * @returns A promise that resolves to {@link GetSpotMarketsDataResponse}.
24197
+ */
24114
24198
  this.getSpotMarketsData = async (markets) => {
24115
24199
  const response = await this.sendGetJson("/v1/get_spot_markets_data" /* GetSpotMarketsData */, {
24116
24200
  markets
24117
24201
  });
24118
24202
  return response;
24119
24203
  };
24204
+ /**
24205
+ * getBorrowLendingData.
24206
+ *
24207
+ * @returns Borrow/lending-related market data. See {@link GetBorrowLendingDataResponse}.
24208
+ */
24120
24209
  this.getBorrowLendingData = async () => {
24121
24210
  const response = await this.sendGetJson("/v1/get_borrow_lending_data" /* GetBorrowLendingData */);
24122
24211
  return response;
24123
24212
  };
24213
+ /**
24214
+ * getChartCandlesInRange.
24215
+ *
24216
+ * @param request - See {@link GetChartCandlesInRangeRequest}.
24217
+ * @returns A promise that resolves to {@link GetChartCandlesInRangeResponse}.
24218
+ */
24124
24219
  this.getChartCandlesInRange = async (request) => {
24125
24220
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24126
24221
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24128,22 +24223,49 @@ var Client = class _Client {
24128
24223
  const response = await this.sendGetJson("/v1/public/chart_candles_in_range" /* GetChartCandlesInRange */, request);
24129
24224
  return response;
24130
24225
  };
24226
+ /**
24227
+ * getPriceIndexes.
24228
+ *
24229
+ * @returns Current price index values. See {@link GetPriceIndexesResponse}.
24230
+ */
24131
24231
  this.getPriceIndexes = async () => {
24132
24232
  const response = await this.sendGetJson("/v1/get_price_indexes" /* GetPriceIndexes */);
24133
24233
  return response;
24134
24234
  };
24235
+ /**
24236
+ * getUsersByAddress.
24237
+ *
24238
+ * @param payload - See {@link GetUsersByAddressRequest}.
24239
+ *
24240
+ * @returns A promise that resolves to {@link GetUsersByAddressResponse}.
24241
+ */
24135
24242
  this.getUsersByAddress = async (payload) => {
24136
24243
  const response = await this.sendGetJson("/v1/get_users_by_address" /* GetUsersByAddress */, payload);
24137
24244
  return response;
24138
24245
  };
24246
+ /**
24247
+ * getPerpRecentTrades.
24248
+ *
24249
+ * @param request - See {@link GetPerpRecentTradesRequest}.
24250
+ */
24139
24251
  this.getPerpRecentTrades = async (request) => {
24140
24252
  const response = await this.sendGetJson("/v1/get_perp_recent_trades" /* GetPerpRecentTrades */, request);
24141
24253
  return response;
24142
24254
  };
24255
+ /**
24256
+ * getSpotRecentTrades.
24257
+ *
24258
+ * @param request - See {@link GetSpotRecentTradesRequest}.
24259
+ */
24143
24260
  this.getSpotRecentTrades = async (request) => {
24144
24261
  const response = await this.sendGetJson("/v1/get_spot_recent_trades" /* GetSpotRecentTrades */, request);
24145
24262
  return response;
24146
24263
  };
24264
+ /**
24265
+ * getUserPerpFills.
24266
+ *
24267
+ * @param request - See {@link GetPerpUserFillsRequest}.
24268
+ */
24147
24269
  this.getUserPerpFills = async (request) => {
24148
24270
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24149
24271
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24151,6 +24273,11 @@ var Client = class _Client {
24151
24273
  const response = await this.sendGetJson("/v1/get_user_perp_fills" /* GetUserPerpFills */, request);
24152
24274
  return response;
24153
24275
  };
24276
+ /**
24277
+ * getUserSpotFills.
24278
+ *
24279
+ * @param request - See {@link GetSpotUserFillsRequest}.
24280
+ */
24154
24281
  this.getUserSpotFills = async (request) => {
24155
24282
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24156
24283
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24158,6 +24285,11 @@ var Client = class _Client {
24158
24285
  const response = await this.sendGetJson("/v1/get_user_spot_fills" /* GetUserSpotFills */, request);
24159
24286
  return response;
24160
24287
  };
24288
+ /**
24289
+ * getUserPerpOrders.
24290
+ *
24291
+ * @param request - See {@link GetPerpUserOrdersRequest}.
24292
+ */
24161
24293
  this.getUserPerpOrders = async (request) => {
24162
24294
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24163
24295
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24165,6 +24297,11 @@ var Client = class _Client {
24165
24297
  const response = await this.sendGetJson("/v1/get_user_perp_orders" /* GetUserPerpOrders */, request);
24166
24298
  return response;
24167
24299
  };
24300
+ /**
24301
+ * getUserSpotOrders.
24302
+ *
24303
+ * @param request - See {@link GetSpotUserOrdersRequest}.
24304
+ */
24168
24305
  this.getUserSpotOrders = async (request) => {
24169
24306
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24170
24307
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24172,6 +24309,11 @@ var Client = class _Client {
24172
24309
  const response = await this.sendGetJson("/v1/get_user_spot_orders" /* GetUserSpotOrders */, request);
24173
24310
  return response;
24174
24311
  };
24312
+ /**
24313
+ * getUserPerpTriggerOrders.
24314
+ *
24315
+ * @param request - See {@link GetPerpUserTriggerOrdersRequest}.
24316
+ */
24175
24317
  this.getUserPerpTriggerOrders = async (request) => {
24176
24318
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24177
24319
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24179,6 +24321,11 @@ var Client = class _Client {
24179
24321
  const response = await this.sendGetJson("/v1/get_user_perp_trigger_orders" /* GetUserPerpTriggerOrders */, request);
24180
24322
  return response;
24181
24323
  };
24324
+ /**
24325
+ * getUserFundingHistory.
24326
+ *
24327
+ * @param request - See {@link GetUserFundingHistoryRequest}.
24328
+ */
24182
24329
  this.getUserFundingHistory = async (request) => {
24183
24330
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24184
24331
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24186,6 +24333,11 @@ var Client = class _Client {
24186
24333
  const response = await this.sendGetJson("/v1/get_user_funding_history" /* GetUserFundingHistory */, request);
24187
24334
  return response;
24188
24335
  };
24336
+ /**
24337
+ * getUserHistoricalDeposits.
24338
+ *
24339
+ * @param request - See {@link GetUserDepositsRequest}.
24340
+ */
24189
24341
  this.getUserHistoricalDeposits = async (request) => {
24190
24342
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24191
24343
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24193,6 +24345,11 @@ var Client = class _Client {
24193
24345
  const response = await this.sendGetJson("/v1/get_user_deposits" /* GetUserDeposits */, request);
24194
24346
  return response;
24195
24347
  };
24348
+ /**
24349
+ * getUserWithdrawalsHistory.
24350
+ *
24351
+ * @param request - See {@link GetUserWithdrawalsRequest}.
24352
+ */
24196
24353
  this.getUserWithdrawalsHistory = async (request) => {
24197
24354
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24198
24355
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24200,6 +24357,11 @@ var Client = class _Client {
24200
24357
  const response = await this.sendGetJson("/v1/get_user_withdrawals" /* GetUserWithdrawals */, request);
24201
24358
  return response;
24202
24359
  };
24360
+ /**
24361
+ * getUserPortfolioValueHistory.
24362
+ *
24363
+ * @param request - See {@link GetUserPortfolioValueRequest}.
24364
+ */
24203
24365
  this.getUserPortfolioValueHistory = async (request) => {
24204
24366
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24205
24367
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24207,6 +24369,11 @@ var Client = class _Client {
24207
24369
  const response = await this.sendGetJson("/v1/get_user_portfolio_value" /* GetUserPortfolioValue */, request);
24208
24370
  return response;
24209
24371
  };
24372
+ /**
24373
+ * getUserRewardsValueHistory.
24374
+ *
24375
+ * @param request - See {@link GetUserRewardsValueRequest}.
24376
+ */
24210
24377
  this.getUserRewardsValueHistory = async (request) => {
24211
24378
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24212
24379
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24214,6 +24381,11 @@ var Client = class _Client {
24214
24381
  const response = await this.sendGetJson("/v1/get_user_rewards_value" /* GetUserRewardsValue */, request);
24215
24382
  return response;
24216
24383
  };
24384
+ /**
24385
+ * getUserTradeStatsHistory.
24386
+ *
24387
+ * @param request - See {@link GetUserTradeStatsHistoryRequest}.
24388
+ */
24217
24389
  this.getUserTradeStatsHistory = async (request) => {
24218
24390
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24219
24391
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24221,10 +24393,20 @@ var Client = class _Client {
24221
24393
  const response = await this.sendGetJson("/v1/get_user_trade_stats" /* GetUserTradeStats */, request);
24222
24394
  return response;
24223
24395
  };
24396
+ /**
24397
+ * getUserAggregatedStats.
24398
+ *
24399
+ * @param request - See {@link GetUserAggregatedStatsRequest}.
24400
+ */
24224
24401
  this.getUserAggregatedStats = async (request) => {
24225
24402
  const response = await this.sendGetJson("/v1/get_user_aggregated_stats" /* GetUserAggregatedStats */, request);
24226
24403
  return response;
24227
24404
  };
24405
+ /**
24406
+ * getUserBoxRewardsStatsHistory.
24407
+ *
24408
+ * @param request - See {@link GetUserBoxRewardsStatsHistoryRequest}.
24409
+ */
24228
24410
  this.getUserBoxRewardsStatsHistory = async (request) => {
24229
24411
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24230
24412
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24232,6 +24414,11 @@ var Client = class _Client {
24232
24414
  const response = await this.sendGetJson("/v1/get_user_box_rewards_stats" /* GetUserBoxRewardsStats */, request);
24233
24415
  return response;
24234
24416
  };
24417
+ /**
24418
+ * getUserAggregatedBoxRewardsStats.
24419
+ *
24420
+ * @param request - See {@link GetUserAggregatedBoxRewardsStatsRequest}.
24421
+ */
24235
24422
  this.getUserAggregatedBoxRewardsStats = async (request) => {
24236
24423
  const response = await this.sendGetJson(
24237
24424
  "/v1/get_user_aggregated_box_rewards_stats" /* GetUserAggregatedBoxRewardsStats */,
@@ -24239,6 +24426,11 @@ var Client = class _Client {
24239
24426
  );
24240
24427
  return response;
24241
24428
  };
24429
+ /**
24430
+ * getUserReferralStatsHistory.
24431
+ *
24432
+ * @param request - See {@link GetUserReferralStatsHistoryRequest}.
24433
+ */
24242
24434
  this.getUserReferralStatsHistory = async (request) => {
24243
24435
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24244
24436
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24246,10 +24438,20 @@ var Client = class _Client {
24246
24438
  const response = await this.sendGetJson("/v1/get_user_referral_stats" /* GetUserReferralStats */, request);
24247
24439
  return response;
24248
24440
  };
24441
+ /**
24442
+ * getUserAggregatedReferralStats.
24443
+ *
24444
+ * @param request - See {@link GetUserAggregatedReferralStatsRequest}.
24445
+ */
24249
24446
  this.getUserAggregatedReferralStats = async (request) => {
24250
24447
  const response = await this.sendGetJson("/v1/get_user_aggregated_referral" /* GetUserAggregatedReferral */, request);
24251
24448
  return response;
24252
24449
  };
24450
+ /**
24451
+ * getUserClaimedKickbackHistory.
24452
+ *
24453
+ * @param request - See {@link GetUserClaimedKickbackHistoryRequest}.
24454
+ */
24253
24455
  this.getUserClaimedKickbackHistory = async (request) => {
24254
24456
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24255
24457
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24257,6 +24459,11 @@ var Client = class _Client {
24257
24459
  const response = await this.sendGetJson("/v1/get_user_claimed_kickback" /* GetUserClaimedKickback */, request);
24258
24460
  return response;
24259
24461
  };
24462
+ /**
24463
+ * getUserClaimedReferralKickbackHistory.
24464
+ *
24465
+ * @param request - See {@link GetUserClaimedReferralKickbackHistoryRequest}.
24466
+ */
24260
24467
  this.getUserClaimedReferralKickbackHistory = async (request) => {
24261
24468
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24262
24469
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24264,6 +24471,11 @@ var Client = class _Client {
24264
24471
  const response = await this.sendGetJson("/v1/get_user_claimed_referral" /* GetUserClaimedReferral */, request);
24265
24472
  return response;
24266
24473
  };
24474
+ /**
24475
+ * getUserTransfersHistory.
24476
+ *
24477
+ * @param request - See {@link GetUserTransferHistoryRequest}.
24478
+ */
24267
24479
  this.getUserTransfersHistory = async (request) => {
24268
24480
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24269
24481
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24271,6 +24483,11 @@ var Client = class _Client {
24271
24483
  const response = await this.sendGetJson("/v1/get_user_transfers" /* GetUserTransfers */, request);
24272
24484
  return response;
24273
24485
  };
24486
+ /**
24487
+ * getUserLiquidations.
24488
+ *
24489
+ * @param request - See {@link GetUserFullLiquidationsHistoryRequest}.
24490
+ */
24274
24491
  this.getUserLiquidations = async (request) => {
24275
24492
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24276
24493
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24278,6 +24495,11 @@ var Client = class _Client {
24278
24495
  const response = await this.sendGetJson("/v1/get_user_full_liquidations" /* GetUserFullLiquidations */, request);
24279
24496
  return response;
24280
24497
  };
24498
+ /**
24499
+ * getUserPartialLiquidations.
24500
+ *
24501
+ * @param request - See {@link GetUserPartialLiquidationsHistoryRequest}.
24502
+ */
24281
24503
  this.getUserPartialLiquidations = async (request) => {
24282
24504
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24283
24505
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24285,6 +24507,11 @@ var Client = class _Client {
24285
24507
  const response = await this.sendGetJson("/v1/get_user_partial_liquidations" /* GetUserPartialLiquidations */, request);
24286
24508
  return response;
24287
24509
  };
24510
+ /**
24511
+ * getBorrowLendHistoricalState.
24512
+ *
24513
+ * @param request - See {@link GetBorrowLendingHistoricalDataRequest}.
24514
+ */
24288
24515
  this.getBorrowLendHistoricalState = async (request) => {
24289
24516
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24290
24517
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24292,10 +24519,22 @@ var Client = class _Client {
24292
24519
  const response = await this.sendGetJson("/v1/get_borrow_lend_historical_data" /* GetBorrowLendHistoricalData */, request);
24293
24520
  return response;
24294
24521
  };
24522
+ /**
24523
+ * getBorrowLendAggregatedStats.
24524
+ *
24525
+ * @param request - See {@link GetBorrowLendingAggregatedStatsRequest}.
24526
+ */
24295
24527
  this.getBorrowLendAggregatedStats = async (request) => {
24296
24528
  const response = await this.sendGetJson("/v1/get_borrow_lend_aggregated_data" /* GetBorrowLendAggregatedData */, request);
24297
24529
  return response;
24298
24530
  };
24531
+ /**
24532
+ * getTokenStats.
24533
+ *
24534
+ * @param request - See {@link GetTokenStatsHistoryRequest}.
24535
+ *
24536
+ * @returns A promise that resolves to {@link GetTokenStatsHistoryResponse}.
24537
+ */
24299
24538
  this.getTokenStats = async (request) => {
24300
24539
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24301
24540
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24303,28 +24542,64 @@ var Client = class _Client {
24303
24542
  const response = await this.sendGetJson("/v1/get_tokens_stats" /* GetTokensStats */, request);
24304
24543
  return response;
24305
24544
  };
24545
+ /**
24546
+ * getTokenAggregatedStats.
24547
+ *
24548
+ * @param request - See {@link GetTokenAggregatedStatsRequest}.
24549
+ *
24550
+ * @returns A promise that resolves to {@link GetTokenAggregatedStatsResponse}.
24551
+ */
24306
24552
  this.getTokenAggregatedStats = async (request) => {
24307
24553
  const response = await this.sendGetJson("/v1/get_tokens_aggregated_stats" /* GetTokensAggregatedStats */, request);
24308
24554
  return response;
24309
24555
  };
24556
+ /**
24557
+ * checkReferralCode.
24558
+ *
24559
+ * @param request - See {@link CheckReferralCodeRequest}.
24560
+ *
24561
+ * @returns A promise that resolves to {@link CheckReferralCodeResponse}.
24562
+ */
24310
24563
  this.checkReferralCode = async (request) => {
24311
24564
  const response = await this.sendGetJson("/v1/check_referral_code" /* CheckReferralCode */, request);
24312
24565
  return response;
24313
24566
  };
24567
+ /**
24568
+ * getServicesStatus.
24569
+ *
24570
+ * @returns Service health status data. See {@link GetServicesStatusResponse}.
24571
+ */
24314
24572
  this.getServicesStatus = async () => {
24315
24573
  const response = await this.sendGetJson(
24316
24574
  "/v1/services_status" /* ServicesStatus */
24317
24575
  );
24318
24576
  return response;
24319
24577
  };
24578
+ /**
24579
+ * getUserVaultDeposits.
24580
+ *
24581
+ * @param request - See {@link GetUserDepositsRequest}.
24582
+ */
24320
24583
  this.getUserVaultDeposits = async (request) => {
24321
24584
  const response = await this.sendGetJson("/v1/get_user_vault_deposits" /* GetUserVaultDeposits */, request);
24322
24585
  return response;
24323
24586
  };
24587
+ /**
24588
+ * getUserVaultWithdraws.
24589
+ *
24590
+ * @param request - See {@link GetUserWithdrawalsRequest}.
24591
+ */
24324
24592
  this.getUserVaultWithdraws = async (request) => {
24325
24593
  const response = await this.sendGetJson("/v1/get_user_vault_withdrawals" /* GetUserVaultWithdrawals */, request);
24326
24594
  return response;
24327
24595
  };
24596
+ /**
24597
+ * getVaultHistoricalData.
24598
+ *
24599
+ * @param request - See {@link GetVaultHistoricalDataRequest}.
24600
+ *
24601
+ * @returns A promise that resolves to {@link GetVaultHistoricalDataResponse}.
24602
+ */
24328
24603
  this.getVaultHistoricalData = async (request) => {
24329
24604
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24330
24605
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24332,6 +24607,13 @@ var Client = class _Client {
24332
24607
  const response = await this.sendGetJson("/v1/get_vault_historical_data" /* GetVaultHistoricalData */, request);
24333
24608
  return response;
24334
24609
  };
24610
+ /**
24611
+ * getHistoricalIndexPrices.
24612
+ *
24613
+ * @param request - See {@link GetIndexPriceHistoryRequest}.
24614
+ *
24615
+ * @returns A promise that resolves to {@link GetIndexPriceHistoryResponse}.
24616
+ */
24335
24617
  this.getHistoricalIndexPrices = async (request) => {
24336
24618
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24337
24619
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24339,16 +24621,35 @@ var Client = class _Client {
24339
24621
  const response = await this.sendGetJson("/v1/get_index_price_history" /* GetIndexPriceHistory */, request);
24340
24622
  return response;
24341
24623
  };
24624
+ /**
24625
+ * getUserAggregatedVaultStats.
24626
+ *
24627
+ * @param request - See {@link GetUserAggregatedVaultStatsRequest}.
24628
+ *
24629
+ * @returns A promise that resolves to {@link GetUserAggregatedVaultStatsResponse}.
24630
+ */
24342
24631
  this.getUserAggregatedVaultStats = async (request) => {
24343
24632
  const response = await this.sendGetJson("/v1/get_user_aggregated_vault_stats" /* GetUserAggregatedVaultStats */, request);
24344
24633
  return response;
24345
24634
  };
24635
+ /**
24636
+ * getIndexerStatus.
24637
+ *
24638
+ * @returns Indexer status payload. See {@link GetIndexerStatusResponse}.
24639
+ */
24346
24640
  this.getIndexerStatus = async () => {
24347
24641
  const response = await this.sendGetJson(
24348
24642
  "/v1/get_indexer_status" /* GetIndexerStatus */
24349
24643
  );
24350
24644
  return response;
24351
24645
  };
24646
+ /**
24647
+ * getVaultHistoricalDeposits.
24648
+ *
24649
+ * @param request - See {@link GetVaultDepositsRequest}.
24650
+ *
24651
+ * @returns A promise that resolves to {@link GetVaultDepositsResponse}.
24652
+ */
24352
24653
  this.getVaultHistoricalDeposits = async (request) => {
24353
24654
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24354
24655
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24356,6 +24657,13 @@ var Client = class _Client {
24356
24657
  const response = await this.sendGetJson("/v1/get_vault_deposits" /* GetVaultDeposits */, request);
24357
24658
  return response;
24358
24659
  };
24660
+ /**
24661
+ * getVaultWithdrawals.
24662
+ *
24663
+ * @param request - See {@link GetVaultWithdrawalsRequest}.
24664
+ *
24665
+ * @returns A promise that resolves to {@link GetVaultWithdrawalsResponse}.
24666
+ */
24359
24667
  this.getVaultWithdrawals = async (request) => {
24360
24668
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24361
24669
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24363,6 +24671,13 @@ var Client = class _Client {
24363
24671
  const response = await this.sendGetJson("/v1/get_vault_withdrawals" /* GetVaultWithdrawals */, request);
24364
24672
  return response;
24365
24673
  };
24674
+ /**
24675
+ * getUserBoxesHistory.
24676
+ *
24677
+ * @param request - See {@link GetUserBoxesHistoryRequest}.
24678
+ *
24679
+ * @returns A promise that resolves to {@link GetUserBoxesHistoryResponse}.
24680
+ */
24366
24681
  this.getUserBoxesHistory = async (request) => {
24367
24682
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24368
24683
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24370,10 +24685,24 @@ var Client = class _Client {
24370
24685
  const response = await this.sendGetJson("/v1/get_user_boxes_history" /* GetUserBoxesHistory */, request);
24371
24686
  return response;
24372
24687
  };
24688
+ /**
24689
+ * getUserRequiredVolumeForReferral.
24690
+ *
24691
+ * @param request - See {@link GetUserVolumeForReferralRequest}.
24692
+ *
24693
+ * @returns A promise that resolves to {@link GetUserVolumeForReferralResponse}.
24694
+ */
24373
24695
  this.getUserRequiredVolumeForReferral = async (request) => {
24374
24696
  const response = await this.sendGetJson("/v1/get_required_volume_for_referral" /* GetUserVolumeForReferral */, request);
24375
24697
  return response;
24376
24698
  };
24699
+ /**
24700
+ * getUserPointsHistory.
24701
+ *
24702
+ * @param request - See {@link GetUserPointsHistoryRequest}.
24703
+ *
24704
+ * @returns A promise that resolves to {@link GetUserPointsHistoryResponse}.
24705
+ */
24377
24706
  this.getUserPointsHistory = async (request) => {
24378
24707
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24379
24708
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24381,29 +24710,65 @@ var Client = class _Client {
24381
24710
  const response = await this.sendGetJson("/v1/get_user_points_history" /* GetUserPointsHistory */, request);
24382
24711
  return response;
24383
24712
  };
24713
+ /**
24714
+ * getAllVaultsIds.
24715
+ *
24716
+ * @returns All vault identifiers available from the API. See {@link GetAllVaultsIdsResponse}.
24717
+ */
24384
24718
  this.getAllVaultsIds = async () => {
24385
24719
  const response = await this.sendGetJson(
24386
24720
  "/v1/get_all_vaults_ids" /* GetAllVaultsIds */
24387
24721
  );
24388
24722
  return response;
24389
24723
  };
24724
+ /**
24725
+ * getUserPersonalPointsRanking.
24726
+ *
24727
+ * @param request - See {@link GetUserPersonalPointsRankingRequest}.
24728
+ *
24729
+ * @returns A promise that resolves to {@link GetUserPersonalPointsRankingResponse}.
24730
+ */
24390
24731
  this.getUserPersonalPointsRanking = async (request) => {
24391
24732
  const response = await this.sendGetJson("/v1/get_user_personal_points_ranking" /* GetUserPersonalPointsRanking */, request);
24392
24733
  return response;
24393
24734
  };
24735
+ /**
24736
+ * getTopPointsRanking.
24737
+ *
24738
+ * @returns Leaderboard data ordered by points. See {@link GetTopPointsRankingResponse}.
24739
+ */
24394
24740
  this.getTopPointsRanking = async () => {
24395
24741
  const response = await this.sendGetJson("/v1/get_top_points_ranking" /* GetTopPointsRanking */);
24396
24742
  return response;
24397
24743
  };
24744
+ /**
24745
+ * getAccountValueRanking.
24746
+ *
24747
+ * @param request - See {@link GetAccountValueRankingRequest}.
24748
+ *
24749
+ * @returns A promise that resolves to {@link GetAccountValueRankingResponse}.
24750
+ */
24398
24751
  this.getAccountValueRanking = async (request) => {
24399
24752
  const response = await this.sendGetJson("/v1/get_account_value_ranking" /* GetAccountValueRanking */, request);
24400
24753
  return response;
24401
24754
  };
24755
+ /**
24756
+ * getUserAccountValueRanking.
24757
+ *
24758
+ * @param request - See {@link GetUserAccountValueRankingRequest}.
24759
+ *
24760
+ * @returns A promise that resolves to {@link GetUserAccountValueRankingResponse}.
24761
+ */
24402
24762
  this.getUserAccountValueRanking = async (request) => {
24403
24763
  const response = await this.sendGetJson("/v1/get_user_account_value_ranking" /* GetUserAccountValueRanking */, request);
24404
24764
  return response;
24405
24765
  };
24406
24766
  // Meta
24767
+ /**
24768
+ * getTime.
24769
+ *
24770
+ * @returns Current server time string.
24771
+ */
24407
24772
  this.getTime = async () => {
24408
24773
  const response = await this.sendGetJson("/time" /* Time */);
24409
24774
  return response.time;
@@ -24425,6 +24790,14 @@ var Client = class _Client {
24425
24790
  this.timeout = config.timeout || 5e3;
24426
24791
  this._pingIntervalMs = config.pingIntervalMs || 3e4;
24427
24792
  }
24793
+ /**
24794
+ * init.
24795
+ *
24796
+ * @param connection - Aptos connection instance. See {@link Aptos}.
24797
+ * @param config - Client configuration options. See {@link ClientConfig}.
24798
+
24799
+ * @returns A promise that resolves to {@link Client}.
24800
+ */
24428
24801
  static async init(connection, config = {}) {
24429
24802
  const id = config.chainId || await connection.getChainId();
24430
24803
  const client = new _Client(connection, { ...config, chainId: id });
@@ -24436,9 +24809,10 @@ var Client = class _Client {
24436
24809
  /**
24437
24810
  * Create a new Client instance
24438
24811
  *
24439
- * @param connection - Aptos connection instance
24440
- * @param config - Client configuration options
24441
- * @returns Promise<Client>
24812
+ * @param connection - Aptos connection instance. See {@link Aptos}.
24813
+ * @param config - Optional client config object. See {@link ClientConfig}.
24814
+ *
24815
+ * @returns A promise that resolves to {@link Client}.
24442
24816
  *
24443
24817
  * @example
24444
24818
  * // Create a testnet client (default)
@@ -24465,36 +24839,76 @@ var Client = class _Client {
24465
24839
  static async create(connection, config = {}) {
24466
24840
  return _Client.init(connection, config);
24467
24841
  }
24842
+ /**
24843
+ * setApiKey.
24844
+ *
24845
+ * @param apiKey - See {@link Account}.
24846
+ */
24468
24847
  async setApiKey(apiKey) {
24469
24848
  this._apiKey = apiKey;
24470
24849
  this._apiKeySequenceNumber = await this.fetchApiKeySequenceNumber();
24471
24850
  this._sequenceNumberManager = new AccountSequenceNumber(this._aptos, this._apiKey);
24472
24851
  await this._sequenceNumberManager.initialize();
24473
24852
  }
24853
+ /**
24854
+ * getContractAddress.
24855
+ *
24856
+ * @returns The configured contract address.
24857
+ */
24474
24858
  getContractAddress() {
24475
24859
  return this._contractAddress;
24476
24860
  }
24861
+ /**
24862
+ * getApiKeySequenceNumber.
24863
+ *
24864
+ * @returns The next API key sequence number or null when unavailable.
24865
+ */
24477
24866
  getApiKeySequenceNumber() {
24478
24867
  return this._sequenceNumberManager.nextSequenceNumber();
24479
24868
  }
24869
+ /**
24870
+ * fetchApiKeySequenceNumber.
24871
+ *
24872
+ * @returns The on-chain API key sequence number.
24873
+ */
24480
24874
  async fetchApiKeySequenceNumber() {
24481
24875
  const accInfo = await this._aptos.getAccountInfo({
24482
24876
  accountAddress: this._apiKey.accountAddress
24483
24877
  });
24484
- return Number(await accInfo.sequence_number);
24878
+ return BigInt(accInfo.sequence_number);
24485
24879
  }
24880
+ /**
24881
+ * setTxParams.
24882
+ *
24883
+ * @param params - See {@link TxParams}.
24884
+ */
24486
24885
  setTxParams(params) {
24487
24886
  this._maxGas = params.maxGas;
24488
24887
  this._gasUnitPrice = params.gasUnitPrice;
24489
24888
  this._expirationTimestampDelay = params.expirationTimestampSecs;
24490
24889
  }
24491
24890
  //////////////////////////////////////// Websocket functions
24891
+ /**
24892
+ * _wsLog.
24893
+ *
24894
+ * @param args -
24895
+ */
24492
24896
  _wsLog(...args) {
24493
24897
  if (this.wsDebug) console.log("[WS]", ...args);
24494
24898
  }
24899
+ /**
24900
+ * setWsDebugActive.
24901
+ *
24902
+ * @param active - See boolean.
24903
+ */
24495
24904
  setWsDebugActive(active) {
24496
24905
  this.wsDebug = active;
24497
24906
  }
24907
+ /**
24908
+ * connectWebSocket.
24909
+ *
24910
+ * @returns A promise that resolves when WebSocket initialization is complete.
24911
+ */
24498
24912
  async connectWebSocket() {
24499
24913
  if (this._ws) {
24500
24914
  console.warn("WebSocket is already connected");
@@ -24510,6 +24924,12 @@ var Client = class _Client {
24510
24924
  throw new Error(`Failed to connect WebSocket: ${error}`);
24511
24925
  }
24512
24926
  }
24927
+ /**
24928
+ * _initWebSocket.
24929
+ *
24930
+ * @param url -
24931
+ * @param timeout -
24932
+ */
24513
24933
  _initWebSocket(url, timeout) {
24514
24934
  return new Promise((resolve, reject) => {
24515
24935
  const wsUrl = `${url.replace("http", "ws").replace("https", "wss")}` + "/v1/ws" /* Ws */;
@@ -24578,6 +24998,11 @@ var Client = class _Client {
24578
24998
  this._wsLog("Error:", error);
24579
24999
  };
24580
25000
  }
25001
+ /**
25002
+ * disconnectWebSocket.
25003
+ *
25004
+ * @returns A promise that resolves when cleanup and close actions are finished.
25005
+ */
24581
25006
  async disconnectWebSocket() {
24582
25007
  if (!this._ws) {
24583
25008
  console.warn("WebSocket is not connected");
@@ -24603,6 +25028,13 @@ var Client = class _Client {
24603
25028
  this._wsLog("isWebSocketConnected:", alive, "lastPong:", Date.now() - this._lastPongAt, "ms ago");
24604
25029
  return alive;
24605
25030
  }
25031
+ /**
25032
+ * sendWsMessage.
25033
+ *
25034
+ * @param message - See {@link WsCommand}.
25035
+
25036
+ * @returns A promise that resolves to {@link WsMessage}.
25037
+ */
24606
25038
  sendWsMessage(message) {
24607
25039
  if (!this._ws) throw new Error("WebSocket is not connected");
24608
25040
  return new Promise((resolve, reject) => {
@@ -24630,6 +25062,13 @@ var Client = class _Client {
24630
25062
  this._ws?.send(JSON.stringify(message));
24631
25063
  });
24632
25064
  }
25065
+ /**
25066
+ * subscribeIndexPricesUpdates.
25067
+ *
25068
+ * @param callback - Callback invoked for oracle updates. See {@link WsOracleUpdates}.
25069
+
25070
+ * @returns A promise that resolves to an unsubscribe function.
25071
+ */
24633
25072
  async subscribeIndexPricesUpdates(callback) {
24634
25073
  const command = {
24635
25074
  type: "SubscribeOracle",
@@ -24640,6 +25079,11 @@ var Client = class _Client {
24640
25079
  await this.sendWsMessage(command);
24641
25080
  return this.unsubscribeIndexPricesUpdates;
24642
25081
  }
25082
+ /**
25083
+ * unsubscribeIndexPricesUpdates.
25084
+ *
25085
+ * @returns A promise that resolves to a completed unsubscribe flow.
25086
+ */
24643
25087
  async unsubscribeIndexPricesUpdates() {
24644
25088
  const command = {
24645
25089
  type: "UnsubscribeOracle",
@@ -24649,6 +25093,13 @@ var Client = class _Client {
24649
25093
  const topic = getTopicFromCommand(command);
24650
25094
  this._subscriptions.delete(topic);
24651
25095
  }
25096
+ /**
25097
+ * subscribeBorrowLendingUpdates.
25098
+ *
25099
+ * @param callback - Callback invoked for borrow-lending updates. See {@link WsBorrowLendUpdate}.
25100
+
25101
+ * @returns A promise that resolves to an unsubscribe function.
25102
+ */
24652
25103
  async subscribeBorrowLendingUpdates(callback) {
24653
25104
  const command = {
24654
25105
  type: "SubscribeBorrowLend",
@@ -24659,6 +25110,11 @@ var Client = class _Client {
24659
25110
  await this.sendWsMessage(command);
24660
25111
  return this.unsubscribeIndexPricesUpdates;
24661
25112
  }
25113
+ /**
25114
+ * unsubscribeBorrowLendingUpdates.
25115
+ *
25116
+ * @returns A promise that resolves to a completed unsubscribe flow.
25117
+ */
24662
25118
  async unsubscribeBorrowLendingUpdates() {
24663
25119
  const command = {
24664
25120
  type: "UnsubscribeBorrowLend",
@@ -24668,6 +25124,13 @@ var Client = class _Client {
24668
25124
  const topic = getTopicFromCommand(command);
24669
25125
  this._subscriptions.delete(topic);
24670
25126
  }
25127
+ /**
25128
+ * subscribeBoxOpeningUpdates.
25129
+ *
25130
+ * @param callback - Callback invoked for box-opening updates. See {@link WsBoxOpeningUpdate}.
25131
+
25132
+ * @returns A promise that resolves to an unsubscribe function.
25133
+ */
24671
25134
  async subscribeBoxOpeningUpdates(callback) {
24672
25135
  const command = {
24673
25136
  type: "SubscribeBoxes",
@@ -24678,6 +25141,11 @@ var Client = class _Client {
24678
25141
  await this.sendWsMessage(command);
24679
25142
  return this.unsubscribeBoxOpeningUpdates;
24680
25143
  }
25144
+ /**
25145
+ * unsubscribeBoxOpeningUpdates.
25146
+ *
25147
+ * @returns A promise that resolves to a completed unsubscribe flow.
25148
+ */
24681
25149
  async unsubscribeBoxOpeningUpdates() {
24682
25150
  const command = {
24683
25151
  type: "UnsubscribeBoxes",
@@ -24687,6 +25155,13 @@ var Client = class _Client {
24687
25155
  const topic = getTopicFromCommand(command);
24688
25156
  this._subscriptions.delete(topic);
24689
25157
  }
25158
+ /**
25159
+ * subscribeLiquidationUpdates.
25160
+ *
25161
+ * @param callback - Callback invoked for liquidation updates. See {@link WsLiquidationUpdate}.
25162
+
25163
+ * @returns A promise that resolves to an unsubscribe function.
25164
+ */
24690
25165
  async subscribeLiquidationUpdates(callback) {
24691
25166
  const command = {
24692
25167
  type: "SubscribeLiquidations",
@@ -24697,6 +25172,11 @@ var Client = class _Client {
24697
25172
  await this.sendWsMessage(command);
24698
25173
  return this.unsubscribeLiquidationUpdates;
24699
25174
  }
25175
+ /**
25176
+ * unsubscribeLiquidationUpdates.
25177
+ *
25178
+ * @returns A promise that resolves to a completed unsubscribe flow.
25179
+ */
24700
25180
  async unsubscribeLiquidationUpdates() {
24701
25181
  const command = {
24702
25182
  type: "UnsubscribeLiquidations",
@@ -24706,6 +25186,14 @@ var Client = class _Client {
24706
25186
  const topic = getTopicFromCommand(command);
24707
25187
  this._subscriptions.delete(topic);
24708
25188
  }
25189
+ /**
25190
+ * subscribeUserUpdates.
25191
+ *
25192
+ * @param userId - See string.
25193
+ * @param callback - Callback invoked for user updates. See {@link WsUserUpdates}.
25194
+
25195
+ * @returns A promise that resolves to an unsubscribe function.
25196
+ */
24709
25197
  async subscribeUserUpdates(userId, callback) {
24710
25198
  const command = {
24711
25199
  type: "SubscribeUser",
@@ -24716,6 +25204,11 @@ var Client = class _Client {
24716
25204
  await this.sendWsMessage(command);
24717
25205
  return () => this.unsubscribeUserUpdates(userId);
24718
25206
  }
25207
+ /**
25208
+ * unsubscribeUserUpdates.
25209
+ *
25210
+ * @param userId - See string.
25211
+ */
24719
25212
  async unsubscribeUserUpdates(userId) {
24720
25213
  const command = {
24721
25214
  type: "UnsubscribeUser",
@@ -24725,6 +25218,14 @@ var Client = class _Client {
24725
25218
  const topic = getTopicFromCommand(command);
24726
25219
  this._subscriptions.delete(topic);
24727
25220
  }
25221
+ /**
25222
+ * subscribePerpMarketUpdates.
25223
+ *
25224
+ * @param market - See string.
25225
+ * @param callback - Callback invoked for perpetual market updates. See {@link WsPerpMarketUpdates}.
25226
+
25227
+ * @returns A promise that resolves to an unsubscribe function.
25228
+ */
24728
25229
  async subscribePerpMarketUpdates(market, callback) {
24729
25230
  const command = {
24730
25231
  type: "SubscribePerpMarket",
@@ -24735,6 +25236,11 @@ var Client = class _Client {
24735
25236
  await this.sendWsMessage(command);
24736
25237
  return () => this.unsubscribePerpMarketUpdates(market);
24737
25238
  }
25239
+ /**
25240
+ * unsubscribePerpMarketUpdates.
25241
+ *
25242
+ * @param market - See string.
25243
+ */
24738
25244
  async unsubscribePerpMarketUpdates(market) {
24739
25245
  const command = {
24740
25246
  type: "UnsubscribePerpMarket",
@@ -24744,6 +25250,14 @@ var Client = class _Client {
24744
25250
  const topic = getTopicFromCommand(command);
24745
25251
  this._subscriptions.delete(topic);
24746
25252
  }
25253
+ /**
25254
+ * subscribeSpotMarketUpdates.
25255
+ *
25256
+ * @param market - See string.
25257
+ * @param callback - Callback invoked for spot market updates. See {@link WsSpotMarketUpdates}.
25258
+
25259
+ * @returns A promise that resolves to an unsubscribe function.
25260
+ */
24747
25261
  async subscribeSpotMarketUpdates(market, callback) {
24748
25262
  const command = {
24749
25263
  type: "SubscribeSpotMarket",
@@ -24754,6 +25268,11 @@ var Client = class _Client {
24754
25268
  await this.sendWsMessage(command);
24755
25269
  return () => this.unsubscribeSpotMarketUpdates(market);
24756
25270
  }
25271
+ /**
25272
+ * unsubscribeSpotMarketUpdates.
25273
+ *
25274
+ * @param market - See string.
25275
+ */
24757
25276
  async unsubscribeSpotMarketUpdates(market) {
24758
25277
  const command = {
24759
25278
  type: "UnsubscribeSpotMarket",
@@ -24764,6 +25283,12 @@ var Client = class _Client {
24764
25283
  this._subscriptions.delete(topic);
24765
25284
  }
24766
25285
  /////////////////////////////////// Functions which needs to be signed by user and sent to blockchain
25286
+ /**
25287
+ * createUser.
25288
+ *
25289
+ * @param params - See {@link CreateUserParams}.
25290
+ * @returns A promise that resolves to the user creation payload bundle.
25291
+ */
24767
25292
  async createUser(params) {
24768
25293
  const apiKey = generateApiKey();
24769
25294
  const abi = this._abis.CreateUserABI;
@@ -24797,6 +25322,12 @@ var Client = class _Client {
24797
25322
  apiKey
24798
25323
  };
24799
25324
  }
25325
+ /**
25326
+ * createUserPayload.
25327
+ *
25328
+ * @param params - See {@link CreateUserParams}.
25329
+ * @returns A promise that resolves to an object with the unsigned payload and generated API key. See {@link AnyTransactionPayloadInstance}.
25330
+ */
24800
25331
  async createUserPayload(params) {
24801
25332
  const apiKey = generateApiKey();
24802
25333
  const abi = this._abis.CreateUserABI;
@@ -24817,6 +25348,11 @@ var Client = class _Client {
24817
25348
  apiKey
24818
25349
  };
24819
25350
  }
25351
+ /**
25352
+ * addApiKey.
25353
+ *
25354
+ * @param params - See {@link AddApiKeyParams}.
25355
+ */
24820
25356
  async addApiKey(params) {
24821
25357
  const abi = this._abis.AddApiKeyABI;
24822
25358
  return await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -24832,6 +25368,11 @@ var Client = class _Client {
24832
25368
  functionArguments: [params.userId, params.expiration]
24833
25369
  });
24834
25370
  }
25371
+ /**
25372
+ * depositTokenPayload.
25373
+ *
25374
+ * @param params - See {@link DepositTokenParams}.
25375
+ */
24835
25376
  async depositTokenPayload(params) {
24836
25377
  const abi = this._abis.DepositTokenABI;
24837
25378
  return await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -24847,6 +25388,14 @@ var Client = class _Client {
24847
25388
  functionArguments: [params.userId, params.amount, params.tokenAddress]
24848
25389
  });
24849
25390
  }
25391
+ /**
25392
+ * Creates the transaction payload for withdrawing a token.
25393
+ *
25394
+ * @param params - Withdraw request parameters.
25395
+ * See {@link WithdrawTokenParams}.
25396
+ * @returns The generated transaction payload. See
25397
+ * {@link AnyTransactionPayloadInstance}.
25398
+ */
24850
25399
  async withdrawTokenPayload(params) {
24851
25400
  const abi = this._abis.WithdrawTokenABI;
24852
25401
  return await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -24869,6 +25418,11 @@ var Client = class _Client {
24869
25418
  ]
24870
25419
  });
24871
25420
  }
25421
+ /**
25422
+ * removeApiKeySigner.
25423
+ *
25424
+ * @param params - See {@link RemoveApiKeySignerParams}.
25425
+ */
24872
25426
  async removeApiKeySigner(params) {
24873
25427
  const abi = this._abis.RemoveApiKeySignerABI;
24874
25428
  return await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -24884,6 +25438,11 @@ var Client = class _Client {
24884
25438
  functionArguments: [params.apiKeys, params.userId]
24885
25439
  });
24886
25440
  }
25441
+ /**
25442
+ * addApiCredits.
25443
+ *
25444
+ * @param params - See {@link AddApiCreditsParams}.
25445
+ */
24887
25446
  async addApiCredits(params) {
24888
25447
  const abi = this._abis.AddCreditsABI;
24889
25448
  return await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -24900,8 +25459,18 @@ var Client = class _Client {
24900
25459
  });
24901
25460
  }
24902
25461
  // Helper function to submit sponsored transaction
25462
+ /**
25463
+ * createAndSubmitTransaction.
25464
+ *
25465
+ * @param aptosPayload - See {@link AnyTransactionPayloadInstance}.
25466
+
25467
+ * @returns A promise that resolves to {@link SubmitSponsoredTransactionResponse}.
25468
+ */
24903
25469
  async createAndSubmitTransaction(aptosPayload) {
24904
25470
  const sequenceNumber = await this.getApiKeySequenceNumber();
25471
+ if (sequenceNumber === null) {
25472
+ throw new Error("Unable to determine a valid API key sequence number");
25473
+ }
24905
25474
  const rawTx = new import_ts_sdk3.RawTransaction(
24906
25475
  import_ts_sdk3.AccountAddress.from(this._apiKey.accountAddress),
24907
25476
  BigInt(sequenceNumber),
@@ -24921,13 +25490,37 @@ var Client = class _Client {
24921
25490
  });
24922
25491
  return await this.submitSponsoredTransaction(tx, signature);
24923
25492
  }
25493
+ /**
25494
+ * createOpenBoxesMessage.
25495
+ *
25496
+ * @param boxId - See string.
25497
+ * @param amount - See string.
25498
+ * @param userId - See string.
25499
+ * @param apiKey - See string.
25500
+
25501
+ * @returns The generated box-open message.
25502
+ */
24924
25503
  createOpenBoxesMessage(boxId, amount, userId, apiKey) {
24925
25504
  return `[Neony Exchange]: Open box, id:${boxId}, amount:${amount}, user_id:${userId}, api_key:${apiKey}`;
24926
25505
  }
25506
+ /**
25507
+ * openBoxes.
25508
+ *
25509
+ * @param params - See {@link OpenBoxesRequest}.
25510
+
25511
+ * @returns A promise that resolves to {@link OpenBoxesResponse}.
25512
+ */
24927
25513
  async openBoxes(params) {
24928
25514
  const response = await this.sendPostJson(params, "/v1/open_boxes" /* OpenBoxes */);
24929
25515
  return response;
24930
25516
  }
25517
+ /**
25518
+ * removeApiKey.
25519
+ *
25520
+ * @param params - See {@link RemoveApiKeyParams}.
25521
+
25522
+ * @returns A promise that resolves to {@link SubmitSponsoredTransactionResponse}.
25523
+ */
24931
25524
  async removeApiKey(params) {
24932
25525
  const abi = this._abis.RemoveApiKeyABI;
24933
25526
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -24944,6 +25537,11 @@ var Client = class _Client {
24944
25537
  });
24945
25538
  return await this.createAndSubmitTransaction(aptosPayload);
24946
25539
  }
25540
+ /**
25541
+ * setAliasName.
25542
+ *
25543
+ * @param params - See {@link SetAliasNameParams}.
25544
+ */
24947
25545
  async setAliasName(params) {
24948
25546
  const abi = this._abis.SetAliasNameABI;
24949
25547
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -24960,6 +25558,11 @@ var Client = class _Client {
24960
25558
  });
24961
25559
  return await this.createAndSubmitTransaction(aptosPayload);
24962
25560
  }
25561
+ /**
25562
+ * placePerpLimitOrder.
25563
+ *
25564
+ * @param params - See {@link PlacePerpOrderParams}.
25565
+ */
24963
25566
  async placePerpLimitOrder(params) {
24964
25567
  const abi = this._abis.PlacePerpLimitOrderABI;
24965
25568
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -24984,6 +25587,11 @@ var Client = class _Client {
24984
25587
  });
24985
25588
  return await this.createAndSubmitTransaction(aptosPayload);
24986
25589
  }
25590
+ /**
25591
+ * placePerpMarketOrder.
25592
+ *
25593
+ * @param params - See {@link PlacePerpOrderParams}.
25594
+ */
24987
25595
  async placePerpMarketOrder(params) {
24988
25596
  const abi = this._abis.PlacePerpMarketOrderABI;
24989
25597
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25008,6 +25616,11 @@ var Client = class _Client {
25008
25616
  return await this.createAndSubmitTransaction(aptosPayload);
25009
25617
  }
25010
25618
  ////////// Spot orders (ABI-based)
25619
+ /**
25620
+ * placeSpotLimitOrder.
25621
+ *
25622
+ * @param params - See {@link PlaceSpotOrderParams}.
25623
+ */
25011
25624
  async placeSpotLimitOrder(params) {
25012
25625
  const abi = this._abis.PlaceSpotLimitOrderABI;
25013
25626
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25031,6 +25644,11 @@ var Client = class _Client {
25031
25644
  });
25032
25645
  return await this.createAndSubmitTransaction(aptosPayload);
25033
25646
  }
25647
+ /**
25648
+ * placeSpotMarketOrder.
25649
+ *
25650
+ * @param params - See {@link PlaceSpotOrderParams}.
25651
+ */
25034
25652
  async placeSpotMarketOrder(params) {
25035
25653
  const abi = this._abis.PlaceSpotMarketOrderABI;
25036
25654
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25054,6 +25672,11 @@ var Client = class _Client {
25054
25672
  });
25055
25673
  return await this.createAndSubmitTransaction(aptosPayload);
25056
25674
  }
25675
+ /**
25676
+ * changeSpotOrderPrice.
25677
+ *
25678
+ * @param params - See {@link ChangeSpotOrderParams}.
25679
+ */
25057
25680
  async changeSpotOrderPrice(params) {
25058
25681
  const abi = this._abis.ChangeSpotOrderABI;
25059
25682
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25077,6 +25700,11 @@ var Client = class _Client {
25077
25700
  });
25078
25701
  return await this.createAndSubmitTransaction(aptosPayload);
25079
25702
  }
25703
+ /**
25704
+ * cancelSpotOrders.
25705
+ *
25706
+ * @param params - See {@link CancelSpotOrdersParams}.
25707
+ */
25080
25708
  async cancelSpotOrders(params) {
25081
25709
  const abi = this._abis.CancelSpotOrdersABI;
25082
25710
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25093,6 +25721,11 @@ var Client = class _Client {
25093
25721
  });
25094
25722
  return await this.createAndSubmitTransaction(aptosPayload);
25095
25723
  }
25724
+ /**
25725
+ * placeTriggerOrder.
25726
+ *
25727
+ * @param params - See {@link PlacePerpTriggerOrderParams}.
25728
+ */
25096
25729
  async placeTriggerOrder(params) {
25097
25730
  const abi = this._abis.PlacePerpTriggerOrderABI;
25098
25731
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25121,6 +25754,11 @@ var Client = class _Client {
25121
25754
  });
25122
25755
  return await this.createAndSubmitTransaction(aptosPayload);
25123
25756
  }
25757
+ /**
25758
+ * changePerpOrderPrice.
25759
+ *
25760
+ * @param params - See {@link ChangePerpOrderParams}.
25761
+ */
25124
25762
  async changePerpOrderPrice(params) {
25125
25763
  const abi = this._abis.ChangePerpOrderABI;
25126
25764
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25145,6 +25783,11 @@ var Client = class _Client {
25145
25783
  });
25146
25784
  return await this.createAndSubmitTransaction(aptosPayload);
25147
25785
  }
25786
+ /**
25787
+ * cancelPerpOrders.
25788
+ *
25789
+ * @param params - See {@link CancelPerpOrdersParams}.
25790
+ */
25148
25791
  async cancelPerpOrders(params) {
25149
25792
  const abi = this._abis.CancelPerpOrdersABI;
25150
25793
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25161,6 +25804,11 @@ var Client = class _Client {
25161
25804
  });
25162
25805
  return await this.createAndSubmitTransaction(aptosPayload);
25163
25806
  }
25807
+ /**
25808
+ * cancelAllPerpOrders.
25809
+ *
25810
+ * @param params - See {@link CancelAllPerpOrdersParams}.
25811
+ */
25164
25812
  async cancelAllPerpOrders(params) {
25165
25813
  const abi = this._abis.CancelAllPerpOrdersABI;
25166
25814
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25177,6 +25825,11 @@ var Client = class _Client {
25177
25825
  });
25178
25826
  return await this.createAndSubmitTransaction(aptosPayload);
25179
25827
  }
25828
+ /**
25829
+ * cancelAllSpotOrders.
25830
+ *
25831
+ * @param params - See {@link CancelAllSpotOrdersParams}.
25832
+ */
25180
25833
  async cancelAllSpotOrders(params) {
25181
25834
  const abi = this._abis.CancelAllSpotOrdersABI;
25182
25835
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25193,6 +25846,11 @@ var Client = class _Client {
25193
25846
  });
25194
25847
  return await this.createAndSubmitTransaction(aptosPayload);
25195
25848
  }
25849
+ /**
25850
+ * setAutolend.
25851
+ *
25852
+ * @param params - See {@link SetAutolendParams}.
25853
+ */
25196
25854
  async setAutolend(params) {
25197
25855
  const abi = this._abis.SetAutolendABI;
25198
25856
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25209,6 +25867,11 @@ var Client = class _Client {
25209
25867
  });
25210
25868
  return await this.createAndSubmitTransaction(aptosPayload);
25211
25869
  }
25870
+ /**
25871
+ * depositToVault.
25872
+ *
25873
+ * @param params - See {@link DepositToVaultParams}.
25874
+ */
25212
25875
  async depositToVault(params) {
25213
25876
  const abi = this._abis.DepositToVaultABI;
25214
25877
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25225,6 +25888,11 @@ var Client = class _Client {
25225
25888
  });
25226
25889
  return await this.createAndSubmitTransaction(aptosPayload);
25227
25890
  }
25891
+ /**
25892
+ * withdrawFromVault.
25893
+ *
25894
+ * @param params - See {@link WithdrawFromVaultParams}.
25895
+ */
25228
25896
  async withdrawFromVault(params) {
25229
25897
  const abi = this._abis.WithdrawFromVaultABI;
25230
25898
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25246,6 +25914,11 @@ var Client = class _Client {
25246
25914
  });
25247
25915
  return await this.createAndSubmitTransaction(aptosPayload);
25248
25916
  }
25917
+ /**
25918
+ * redeemToken.
25919
+ *
25920
+ * @param params - See {@link RedeemTokenParams}.
25921
+ */
25249
25922
  async redeemToken(params) {
25250
25923
  const abi = this._abis.RedeemTokenABI;
25251
25924
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25267,6 +25940,11 @@ var Client = class _Client {
25267
25940
  });
25268
25941
  return await this.createAndSubmitTransaction(aptosPayload);
25269
25942
  }
25943
+ /**
25944
+ * lendToken.
25945
+ *
25946
+ * @param params - See {@link LendTokenParams}.
25947
+ */
25270
25948
  async lendToken(params) {
25271
25949
  const abi = this._abis.LendTokenABI;
25272
25950
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25288,6 +25966,11 @@ var Client = class _Client {
25288
25966
  });
25289
25967
  return await this.createAndSubmitTransaction(aptosPayload);
25290
25968
  }
25969
+ /**
25970
+ * claimReferralFees.
25971
+ *
25972
+ * @param params - See {@link ClaimReferralFeesParams}.
25973
+ */
25291
25974
  async claimReferralFees(params) {
25292
25975
  const abi = this._abis.ClaimReferralFeesABI;
25293
25976
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25304,6 +25987,11 @@ var Client = class _Client {
25304
25987
  });
25305
25988
  return await this.createAndSubmitTransaction(aptosPayload);
25306
25989
  }
25990
+ /**
25991
+ * claimKickbackFee.
25992
+ *
25993
+ * @param params - See {@link ClaimKickbackFeeParams}.
25994
+ */
25307
25995
  async claimKickbackFee(params) {
25308
25996
  const abi = this._abis.ClaimKickbackFeeABI;
25309
25997
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25320,6 +26008,11 @@ var Client = class _Client {
25320
26008
  });
25321
26009
  return await this.createAndSubmitTransaction(aptosPayload);
25322
26010
  }
26011
+ /**
26012
+ * transferToUser.
26013
+ *
26014
+ * @param params - See {@link TransferToUserParams}.
26015
+ */
25323
26016
  async transferToUser(params) {
25324
26017
  const abi = this._abis.TransferToUserABI;
25325
26018
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25343,6 +26036,11 @@ var Client = class _Client {
25343
26036
  });
25344
26037
  return await this.createAndSubmitTransaction(aptosPayload);
25345
26038
  }
26039
+ /**
26040
+ * withdrawToken.
26041
+ *
26042
+ * @param params - See {@link WithdrawTokenParams}.
26043
+ */
25346
26044
  async withdrawToken(params) {
25347
26045
  const abi = this._abis.WithdrawTokenABI;
25348
26046
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25366,6 +26064,11 @@ var Client = class _Client {
25366
26064
  });
25367
26065
  return await this.createAndSubmitTransaction(aptosPayload);
25368
26066
  }
26067
+ /**
26068
+ * replaceMultipleOrders.
26069
+ *
26070
+ * @param params - See {@link ReplaceMultipleOrdersParams}.
26071
+ */
25369
26072
  async replaceMultipleOrders(params) {
25370
26073
  const isBids = params.orders.map((order) => order.isBid);
25371
26074
  const prices = params.orders.map((order) => order.price);
@@ -25386,6 +26089,11 @@ var Client = class _Client {
25386
26089
  });
25387
26090
  return await this.createAndSubmitTransaction(aptosPayload);
25388
26091
  }
26092
+ /**
26093
+ * replaceMultipleSpotOrders.
26094
+ *
26095
+ * @param params - See {@link ReplaceMultipleSpotOrdersParams}.
26096
+ */
25389
26097
  async replaceMultipleSpotOrders(params) {
25390
26098
  const isBids = params.orders.map((order) => order.isBid);
25391
26099
  const prices = params.orders.map((order) => order.price);
@@ -25406,6 +26114,11 @@ var Client = class _Client {
25406
26114
  });
25407
26115
  return await this.createAndSubmitTransaction(aptosPayload);
25408
26116
  }
26117
+ /**
26118
+ * placeMultiplePerpOrders.
26119
+ *
26120
+ * @param params - See {@link PlaceMultiplePerpOrdersParams}.
26121
+ */
25409
26122
  async placeMultiplePerpOrders(params) {
25410
26123
  const markets = params.perpOrders.map((order) => order.market);
25411
26124
  const isBids = params.perpOrders.map((order) => order.isBid);
@@ -25436,6 +26149,11 @@ var Client = class _Client {
25436
26149
  });
25437
26150
  return await this.createAndSubmitTransaction(aptosPayload);
25438
26151
  }
26152
+ /**
26153
+ * placeMultipleSpotOrders.
26154
+ *
26155
+ * @param params - See {@link PlaceMultipleSpotOrdersParams}.
26156
+ */
25439
26157
  async placeMultipleSpotOrders(params) {
25440
26158
  const markets = params.spotOrders.map((order) => order.marketName);
25441
26159
  const uniqueMarkets = new Set(markets);
@@ -25462,6 +26180,11 @@ var Client = class _Client {
25462
26180
  });
25463
26181
  return await this.createAndSubmitTransaction(aptosPayload);
25464
26182
  }
26183
+ /**
26184
+ * claimDeposit.
26185
+ *
26186
+ * @param params - See {@link ClaimDepositParams}.
26187
+ */
25465
26188
  async claimDeposit(params) {
25466
26189
  const abi = this._abis.ClaimDepositABI;
25467
26190
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25478,6 +26201,11 @@ var Client = class _Client {
25478
26201
  });
25479
26202
  return await this.createAndSubmitTransaction(aptosPayload);
25480
26203
  }
26204
+ /**
26205
+ * setReferralCode.
26206
+ *
26207
+ * @param params - See {@link SetReferralCodeParams}.
26208
+ */
25481
26209
  async setReferralCode(params) {
25482
26210
  const abi = this._abis.SetReferralCodeABI;
25483
26211
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25494,6 +26222,11 @@ var Client = class _Client {
25494
26222
  });
25495
26223
  return await this.createAndSubmitTransaction(aptosPayload);
25496
26224
  }
26225
+ /**
26226
+ * tokenizeUserVaultInvestment.
26227
+ *
26228
+ * @param params - See {@link TokenizeUserVaultInvestmentParams}.
26229
+ */
25497
26230
  async tokenizeUserVaultInvestment(params) {
25498
26231
  const abi = this._abis.TokenizeUserVaultInvestmentABI;
25499
26232
  const aptosPayload = await (0, import_ts_sdk3.generateTransactionPayload)({
@@ -25540,12 +26273,26 @@ function parseEntryFunctionAbi(args) {
25540
26273
  // src/testFaucet.ts
25541
26274
  var import_ts_sdk4 = require("@aptos-labs/ts-sdk");
25542
26275
  var TestFaucet = class _TestFaucet extends client_default {
26276
+ /** Creates a `TestFaucet` instance.
26277
+ * @param connection -
26278
+ * @param config -
26279
+ */
25543
26280
  constructor(connection, config = {}) {
25544
26281
  super(connection, config);
25545
26282
  }
26283
+ /**
26284
+ * Creates and initializes a faucet helper with websocket disabled by default.
26285
+ *
26286
+ * @param connection - Aptos client connected to the target network.
26287
+ * @param config - Optional client config.
26288
+
26289
+ * @param configOrNetworkMode -
26290
+ * @param enableWs -
26291
+ */
25546
26292
  static async create(connection, config = {}) {
25547
- return new _TestFaucet(connection, { enableWs: false, ...config });
26293
+ return new _TestFaucet(connection, { ...config, enableWs: false });
25548
26294
  }
26295
+ /** Builds the initialize-faucet payload (testnet only). */
25549
26296
  async initFaucetPayload() {
25550
26297
  const abi = this._abis.FaucetEntrypointsABI;
25551
26298
  if (!abi) {
@@ -25564,6 +26311,7 @@ var TestFaucet = class _TestFaucet extends client_default {
25564
26311
  functionArguments: []
25565
26312
  });
25566
26313
  }
26314
+ /** Submits the faucet initialization transaction. */
25567
26315
  async initFaucet() {
25568
26316
  const payload = await this.initFaucetPayload();
25569
26317
  const tx = new import_ts_sdk4.SimpleTransaction(
@@ -25579,6 +26327,11 @@ var TestFaucet = class _TestFaucet extends client_default {
25579
26327
  });
25580
26328
  return await this.submitSponsoredTransaction(tx, signature);
25581
26329
  }
26330
+ /** Builds the mint payload for test tokens (testnet only).
26331
+ * @param receiver -
26332
+ * @param token -
26333
+ * @param amount -
26334
+ */
25582
26335
  async mintTokenPayload(receiver, token, amount) {
25583
26336
  const abi = this._abis.FaucetEntrypointsABI;
25584
26337
  if (!abi) {
@@ -25597,6 +26350,13 @@ var TestFaucet = class _TestFaucet extends client_default {
25597
26350
  functionArguments: [receiver, token, amount]
25598
26351
  });
25599
26352
  }
26353
+ /**
26354
+ * Mints testnet tokens to an on-chain recipient.
26355
+ *
26356
+ * @param receiver - Recipient address.
26357
+ * @param token - Token symbol.
26358
+ * @param amount - Mint amount.
26359
+ */
25600
26360
  async mintToken(receiver, token, amount) {
25601
26361
  const payload = await this.mintTokenPayload(receiver, token, amount);
25602
26362
  const tx = new import_ts_sdk4.SimpleTransaction(
@@ -25627,11 +26387,9 @@ var TestFaucet = class _TestFaucet extends client_default {
25627
26387
  ExchangeProxies,
25628
26388
  GLOBAL_DENOMINATOR,
25629
26389
  MAINNET_CONFIG,
25630
- Network,
25631
26390
  OrderSide,
25632
26391
  OrderStatus,
25633
26392
  OrderType,
25634
- Status,
25635
26393
  TESTNET_CONFIG,
25636
26394
  TestFaucet,
25637
26395
  TradeRole,
@@ -25647,6 +26405,7 @@ var TestFaucet = class _TestFaucet extends client_default {
25647
26405
  getTopicFromCommand,
25648
26406
  getTopicFromMessage,
25649
26407
  nowInMiliseconds,
26408
+ nowInMilliseconds,
25650
26409
  parseEntryFunctionAbi,
25651
26410
  sleep,
25652
26411
  toSystemValue