@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.js CHANGED
@@ -23348,9 +23348,6 @@ function getNetworkModeFromEnv() {
23348
23348
  }
23349
23349
  function createAptosClient(mode) {
23350
23350
  const config = getNetworkConfig(mode);
23351
- console.log(`Creating Aptos client for ${mode.toUpperCase()}`);
23352
- console.log(`Fullnode URL: ${config.fullnode}`);
23353
- console.log(`Indexer URL: ${config.indexer}`);
23354
23351
  const aptosConfig = new AptosConfig({
23355
23352
  network: Network.CUSTOM,
23356
23353
  fullnode: config.fullnode,
@@ -23574,23 +23571,12 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
23574
23571
  // src/utils.ts
23575
23572
  import { Account } from "@aptos-labs/ts-sdk";
23576
23573
 
23577
- // src/types.ts
23578
- var Status = /* @__PURE__ */ ((Status2) => {
23579
- Status2[Status2["Halted"] = 0] = "Halted";
23580
- Status2[Status2["ReduceOnly"] = 1] = "ReduceOnly";
23581
- Status2[Status2["PostOnly"] = 2] = "PostOnly";
23582
- Status2[Status2["Live"] = 3] = "Live";
23583
- return Status2;
23584
- })(Status || {});
23585
- var Network2 = /* @__PURE__ */ ((Network3) => {
23586
- Network3["Devnet"] = "Devnet";
23587
- return Network3;
23588
- })(Network2 || {});
23589
-
23590
23574
  // src/static.ts
23591
23575
  var ExchangeProxies = {
23592
- ["Devnet" /* Devnet */]: ["0x1"]
23593
- // TODO define it
23576
+ testnet: ["0x1"],
23577
+ // TODO define actual testnet proxy address(es)
23578
+ mainnet: ["0x1"]
23579
+ // TODO define actual mainnet proxy address(es)
23594
23580
  };
23595
23581
  var GLOBAL_DENOMINATOR = 1e8;
23596
23582
 
@@ -23598,6 +23584,7 @@ var GLOBAL_DENOMINATOR = 1e8;
23598
23584
  import { Decimal } from "decimal.js";
23599
23585
  var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
23600
23586
  var nowInMiliseconds = () => Date.now();
23587
+ var nowInMilliseconds = nowInMiliseconds;
23601
23588
  var toSystemValue = (value) => {
23602
23589
  return new Decimal(value).mul(new Decimal(GLOBAL_DENOMINATOR)).toString();
23603
23590
  };
@@ -23605,6 +23592,7 @@ var generateApiKey = () => {
23605
23592
  return Account.generate({ scheme: 0 });
23606
23593
  };
23607
23594
  var getTopicFromCommand = (data) => {
23595
+ const commandType = data.type;
23608
23596
  switch (data.type) {
23609
23597
  case "SubscribePerpMarket":
23610
23598
  return data.content.market;
@@ -23635,8 +23623,10 @@ var getTopicFromCommand = (data) => {
23635
23623
  case "UnsubscribeLiquidations":
23636
23624
  return "Liquidations";
23637
23625
  }
23626
+ throw new Error(`Unsupported websocket command type: ${commandType}`);
23638
23627
  };
23639
23628
  var getTopicFromMessage = (data) => {
23629
+ const messageType = data.type;
23640
23630
  switch (data.type) {
23641
23631
  case "Ack":
23642
23632
  return data.content.id;
@@ -23735,6 +23725,7 @@ var getTopicFromMessage = (data) => {
23735
23725
  case "CanceledPerpTriggerOrders":
23736
23726
  return data.content.userId;
23737
23727
  }
23728
+ throw new Error(`Unsupported websocket message type: ${messageType}`);
23738
23729
  };
23739
23730
 
23740
23731
  // src/sequenceNumberManager.ts
@@ -23918,8 +23909,14 @@ var AccountSequenceNumber = class {
23918
23909
  // src/client.ts
23919
23910
  var getRandomId = () => uuidv7();
23920
23911
  var Client = class _Client {
23912
+ /**
23913
+ * constructor.
23914
+ *
23915
+ * @param connection - Aptos connection instance. See {@link Aptos}.
23916
+ * @param config - Client configuration options. See {@link ClientConfig}.
23917
+ */
23921
23918
  constructor(connection, config = {}) {
23922
- this._apiKeySequenceNumber = 0;
23919
+ this._apiKeySequenceNumber = 0n;
23923
23920
  this._pingIntervalMs = 3e4;
23924
23921
  this._lastPongAt = 0;
23925
23922
  this._subscriptions = /* @__PURE__ */ new Map();
@@ -23930,6 +23927,14 @@ var Client = class _Client {
23930
23927
  // Same as below in init
23931
23928
  this.wsDebug = false;
23932
23929
  /////////////////////////////////// Sponsored transactions
23930
+ /**
23931
+ * submitSponsoredTransaction.
23932
+ *
23933
+ * @param tx - See {@link SimpleTransaction}.
23934
+ * @param signature - See {@link AccountAuthenticator}.
23935
+ *
23936
+ * @returns A promise that resolves to {@link SubmitSponsoredTransactionResponse}.
23937
+ */
23933
23938
  this.submitSponsoredTransaction = async (tx, signature) => {
23934
23939
  const payload = {
23935
23940
  sender: tx.rawTransaction.sender.toString(),
@@ -23949,6 +23954,15 @@ var Client = class _Client {
23949
23954
  );
23950
23955
  return response;
23951
23956
  };
23957
+ /**
23958
+ * submitSponsoredMultiAgentTransaction.
23959
+ *
23960
+ * @param tx - See {@link MultiAgentTransaction}.
23961
+ * @param signature - See {@link AccountAuthenticator}.
23962
+ * @param secondarySignersAuthenticators - See {@link AccountAuthenticator[]}.
23963
+ *
23964
+ * @returns A promise that resolves to {@link SubmitSponsoredTransactionResponse}.
23965
+ */
23952
23966
  this.submitSponsoredMultiAgentTransaction = async (tx, signature, secondarySignersAuthenticators) => {
23953
23967
  const payload = {
23954
23968
  sender: tx.rawTransaction.sender.toString(),
@@ -23970,10 +23984,25 @@ var Client = class _Client {
23970
23984
  );
23971
23985
  return response;
23972
23986
  };
23987
+ /**
23988
+ * setReferralParams.
23989
+ *
23990
+ * @param request - See {@link SetReferralParamsRequest}.
23991
+ *
23992
+ * @returns A promise that resolves to {@link SetReferralParamsResponse}.
23993
+ */
23973
23994
  this.setReferralParams = async (request) => {
23974
23995
  return await this.sendPostJson(request, "/v1/set_user_referral_params" /* SetUserReferralParams */);
23975
23996
  };
23976
23997
  //////////////////////////////////////// GETTERS
23998
+ /**
23999
+ * sendGetJson.
24000
+ *
24001
+ * @param endpoint - See string.
24002
+ * @param message - See { [key: string]: any }.
24003
+ *
24004
+ * @returns A promise that resolves to any.
24005
+ */
23977
24006
  this.sendGetJson = async (endpoint, message) => {
23978
24007
  let URL = this._serverUrl + endpoint;
23979
24008
  if (message) {
@@ -24007,6 +24036,14 @@ var Client = class _Client {
24007
24036
  throw new Error(error);
24008
24037
  }
24009
24038
  };
24039
+ /**
24040
+ * sendPostJson.
24041
+ *
24042
+ * @param message - See object.
24043
+ * @param endpoint - See string.
24044
+ *
24045
+ * @returns A promise that resolves to any.
24046
+ */
24010
24047
  this.sendPostJson = async (message, endpoint) => {
24011
24048
  const URL = this._serverUrl + endpoint;
24012
24049
  const headers = {
@@ -24029,56 +24066,115 @@ var Client = class _Client {
24029
24066
  throw new Error(error);
24030
24067
  }
24031
24068
  };
24069
+ /**
24070
+ * getConfig.
24071
+ *
24072
+ * @returns Current exchange configuration. See {@link ExchangeConfig}.
24073
+ */
24032
24074
  this.getConfig = async () => {
24033
24075
  const response = await this.sendGetJson("/v1/get_config" /* GetConfig */);
24034
24076
  return response;
24035
24077
  };
24078
+ /**
24079
+ * getTokensConfig.
24080
+ *
24081
+ * @returns Token configuration map. See {@link GetTokensConfigResponse}.
24082
+ */
24036
24083
  this.getTokensConfig = async () => {
24037
24084
  const response = await this.sendGetJson(
24038
24085
  "/v1/get_tokens_config" /* GetTokensConfig */
24039
24086
  );
24040
24087
  return response;
24041
24088
  };
24089
+ /**
24090
+ * getPerpMarketsConfig.
24091
+ *
24092
+ * @returns Perpetual markets configuration. See {@link GetPerpMarketsConfigResponse}.
24093
+ */
24042
24094
  this.getPerpMarketsConfig = async () => {
24043
24095
  const response = await this.sendGetJson(
24044
24096
  "/v1/get_perp_markets_config" /* GetPerpMarketsConfig */
24045
24097
  );
24046
24098
  return response;
24047
24099
  };
24100
+ /**
24101
+ * getSpotMarketsConfig.
24102
+ *
24103
+ * @returns Spot markets configuration. See {@link GetSpotMarketsConfigResponse}.
24104
+ */
24048
24105
  this.getSpotMarketsConfig = async () => {
24049
24106
  const response = await this.sendGetJson(
24050
24107
  "/v1/get_spot_markets_config" /* GetSpotMarketsConfig */
24051
24108
  );
24052
24109
  return response;
24053
24110
  };
24111
+ /**
24112
+ * getUserData.
24113
+ *
24114
+ * @param userId - See string.
24115
+ *
24116
+ * @returns A promise that resolves to {@link GetUserDataResponse}.
24117
+ */
24054
24118
  this.getUserData = async (userId) => {
24055
24119
  const response = await this.sendGetJson("/v1/get_user_data" /* GetUserData */, {
24056
24120
  userId
24057
24121
  });
24058
24122
  return response;
24059
24123
  };
24124
+ /**
24125
+ * getOrderBookData.
24126
+ *
24127
+ * @param marketName - See string.
24128
+ *
24129
+ * @returns A promise that resolves to {@link GetOrderBookDataResponse}.
24130
+ */
24060
24131
  this.getOrderBookData = async (marketName) => {
24061
24132
  const response = await this.sendGetJson("/v1/get_orderbook_data" /* GetOrderBookData */, {
24062
24133
  marketName
24063
24134
  });
24064
24135
  return response;
24065
24136
  };
24137
+ /**
24138
+ * getPerpMarketsData.
24139
+ *
24140
+ * @param markets - See string[].
24141
+ *
24142
+ * @returns A promise that resolves to {@link GetPerpMarketsDataResponse}.
24143
+ */
24066
24144
  this.getPerpMarketsData = async (markets) => {
24067
24145
  const response = await this.sendGetJson("/v1/get_perp_markets_data" /* GetPerpMarketsData */, {
24068
24146
  markets
24069
24147
  });
24070
24148
  return response;
24071
24149
  };
24150
+ /**
24151
+ * getSpotMarketsData.
24152
+ *
24153
+ * @param markets - See string[].
24154
+ *
24155
+ * @returns A promise that resolves to {@link GetSpotMarketsDataResponse}.
24156
+ */
24072
24157
  this.getSpotMarketsData = async (markets) => {
24073
24158
  const response = await this.sendGetJson("/v1/get_spot_markets_data" /* GetSpotMarketsData */, {
24074
24159
  markets
24075
24160
  });
24076
24161
  return response;
24077
24162
  };
24163
+ /**
24164
+ * getBorrowLendingData.
24165
+ *
24166
+ * @returns Borrow/lending-related market data. See {@link GetBorrowLendingDataResponse}.
24167
+ */
24078
24168
  this.getBorrowLendingData = async () => {
24079
24169
  const response = await this.sendGetJson("/v1/get_borrow_lending_data" /* GetBorrowLendingData */);
24080
24170
  return response;
24081
24171
  };
24172
+ /**
24173
+ * getChartCandlesInRange.
24174
+ *
24175
+ * @param request - See {@link GetChartCandlesInRangeRequest}.
24176
+ * @returns A promise that resolves to {@link GetChartCandlesInRangeResponse}.
24177
+ */
24082
24178
  this.getChartCandlesInRange = async (request) => {
24083
24179
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24084
24180
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24086,22 +24182,49 @@ var Client = class _Client {
24086
24182
  const response = await this.sendGetJson("/v1/public/chart_candles_in_range" /* GetChartCandlesInRange */, request);
24087
24183
  return response;
24088
24184
  };
24185
+ /**
24186
+ * getPriceIndexes.
24187
+ *
24188
+ * @returns Current price index values. See {@link GetPriceIndexesResponse}.
24189
+ */
24089
24190
  this.getPriceIndexes = async () => {
24090
24191
  const response = await this.sendGetJson("/v1/get_price_indexes" /* GetPriceIndexes */);
24091
24192
  return response;
24092
24193
  };
24194
+ /**
24195
+ * getUsersByAddress.
24196
+ *
24197
+ * @param payload - See {@link GetUsersByAddressRequest}.
24198
+ *
24199
+ * @returns A promise that resolves to {@link GetUsersByAddressResponse}.
24200
+ */
24093
24201
  this.getUsersByAddress = async (payload) => {
24094
24202
  const response = await this.sendGetJson("/v1/get_users_by_address" /* GetUsersByAddress */, payload);
24095
24203
  return response;
24096
24204
  };
24205
+ /**
24206
+ * getPerpRecentTrades.
24207
+ *
24208
+ * @param request - See {@link GetPerpRecentTradesRequest}.
24209
+ */
24097
24210
  this.getPerpRecentTrades = async (request) => {
24098
24211
  const response = await this.sendGetJson("/v1/get_perp_recent_trades" /* GetPerpRecentTrades */, request);
24099
24212
  return response;
24100
24213
  };
24214
+ /**
24215
+ * getSpotRecentTrades.
24216
+ *
24217
+ * @param request - See {@link GetSpotRecentTradesRequest}.
24218
+ */
24101
24219
  this.getSpotRecentTrades = async (request) => {
24102
24220
  const response = await this.sendGetJson("/v1/get_spot_recent_trades" /* GetSpotRecentTrades */, request);
24103
24221
  return response;
24104
24222
  };
24223
+ /**
24224
+ * getUserPerpFills.
24225
+ *
24226
+ * @param request - See {@link GetPerpUserFillsRequest}.
24227
+ */
24105
24228
  this.getUserPerpFills = async (request) => {
24106
24229
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24107
24230
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24109,6 +24232,11 @@ var Client = class _Client {
24109
24232
  const response = await this.sendGetJson("/v1/get_user_perp_fills" /* GetUserPerpFills */, request);
24110
24233
  return response;
24111
24234
  };
24235
+ /**
24236
+ * getUserSpotFills.
24237
+ *
24238
+ * @param request - See {@link GetSpotUserFillsRequest}.
24239
+ */
24112
24240
  this.getUserSpotFills = async (request) => {
24113
24241
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24114
24242
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24116,6 +24244,11 @@ var Client = class _Client {
24116
24244
  const response = await this.sendGetJson("/v1/get_user_spot_fills" /* GetUserSpotFills */, request);
24117
24245
  return response;
24118
24246
  };
24247
+ /**
24248
+ * getUserPerpOrders.
24249
+ *
24250
+ * @param request - See {@link GetPerpUserOrdersRequest}.
24251
+ */
24119
24252
  this.getUserPerpOrders = async (request) => {
24120
24253
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24121
24254
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24123,6 +24256,11 @@ var Client = class _Client {
24123
24256
  const response = await this.sendGetJson("/v1/get_user_perp_orders" /* GetUserPerpOrders */, request);
24124
24257
  return response;
24125
24258
  };
24259
+ /**
24260
+ * getUserSpotOrders.
24261
+ *
24262
+ * @param request - See {@link GetSpotUserOrdersRequest}.
24263
+ */
24126
24264
  this.getUserSpotOrders = async (request) => {
24127
24265
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24128
24266
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24130,6 +24268,11 @@ var Client = class _Client {
24130
24268
  const response = await this.sendGetJson("/v1/get_user_spot_orders" /* GetUserSpotOrders */, request);
24131
24269
  return response;
24132
24270
  };
24271
+ /**
24272
+ * getUserPerpTriggerOrders.
24273
+ *
24274
+ * @param request - See {@link GetPerpUserTriggerOrdersRequest}.
24275
+ */
24133
24276
  this.getUserPerpTriggerOrders = async (request) => {
24134
24277
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24135
24278
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24137,6 +24280,11 @@ var Client = class _Client {
24137
24280
  const response = await this.sendGetJson("/v1/get_user_perp_trigger_orders" /* GetUserPerpTriggerOrders */, request);
24138
24281
  return response;
24139
24282
  };
24283
+ /**
24284
+ * getUserFundingHistory.
24285
+ *
24286
+ * @param request - See {@link GetUserFundingHistoryRequest}.
24287
+ */
24140
24288
  this.getUserFundingHistory = async (request) => {
24141
24289
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24142
24290
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24144,6 +24292,11 @@ var Client = class _Client {
24144
24292
  const response = await this.sendGetJson("/v1/get_user_funding_history" /* GetUserFundingHistory */, request);
24145
24293
  return response;
24146
24294
  };
24295
+ /**
24296
+ * getUserHistoricalDeposits.
24297
+ *
24298
+ * @param request - See {@link GetUserDepositsRequest}.
24299
+ */
24147
24300
  this.getUserHistoricalDeposits = async (request) => {
24148
24301
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24149
24302
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24151,6 +24304,11 @@ var Client = class _Client {
24151
24304
  const response = await this.sendGetJson("/v1/get_user_deposits" /* GetUserDeposits */, request);
24152
24305
  return response;
24153
24306
  };
24307
+ /**
24308
+ * getUserWithdrawalsHistory.
24309
+ *
24310
+ * @param request - See {@link GetUserWithdrawalsRequest}.
24311
+ */
24154
24312
  this.getUserWithdrawalsHistory = async (request) => {
24155
24313
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24156
24314
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24158,6 +24316,11 @@ var Client = class _Client {
24158
24316
  const response = await this.sendGetJson("/v1/get_user_withdrawals" /* GetUserWithdrawals */, request);
24159
24317
  return response;
24160
24318
  };
24319
+ /**
24320
+ * getUserPortfolioValueHistory.
24321
+ *
24322
+ * @param request - See {@link GetUserPortfolioValueRequest}.
24323
+ */
24161
24324
  this.getUserPortfolioValueHistory = async (request) => {
24162
24325
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24163
24326
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24165,6 +24328,11 @@ var Client = class _Client {
24165
24328
  const response = await this.sendGetJson("/v1/get_user_portfolio_value" /* GetUserPortfolioValue */, request);
24166
24329
  return response;
24167
24330
  };
24331
+ /**
24332
+ * getUserRewardsValueHistory.
24333
+ *
24334
+ * @param request - See {@link GetUserRewardsValueRequest}.
24335
+ */
24168
24336
  this.getUserRewardsValueHistory = async (request) => {
24169
24337
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24170
24338
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24172,6 +24340,11 @@ var Client = class _Client {
24172
24340
  const response = await this.sendGetJson("/v1/get_user_rewards_value" /* GetUserRewardsValue */, request);
24173
24341
  return response;
24174
24342
  };
24343
+ /**
24344
+ * getUserTradeStatsHistory.
24345
+ *
24346
+ * @param request - See {@link GetUserTradeStatsHistoryRequest}.
24347
+ */
24175
24348
  this.getUserTradeStatsHistory = async (request) => {
24176
24349
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24177
24350
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24179,10 +24352,20 @@ var Client = class _Client {
24179
24352
  const response = await this.sendGetJson("/v1/get_user_trade_stats" /* GetUserTradeStats */, request);
24180
24353
  return response;
24181
24354
  };
24355
+ /**
24356
+ * getUserAggregatedStats.
24357
+ *
24358
+ * @param request - See {@link GetUserAggregatedStatsRequest}.
24359
+ */
24182
24360
  this.getUserAggregatedStats = async (request) => {
24183
24361
  const response = await this.sendGetJson("/v1/get_user_aggregated_stats" /* GetUserAggregatedStats */, request);
24184
24362
  return response;
24185
24363
  };
24364
+ /**
24365
+ * getUserBoxRewardsStatsHistory.
24366
+ *
24367
+ * @param request - See {@link GetUserBoxRewardsStatsHistoryRequest}.
24368
+ */
24186
24369
  this.getUserBoxRewardsStatsHistory = async (request) => {
24187
24370
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24188
24371
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24190,6 +24373,11 @@ var Client = class _Client {
24190
24373
  const response = await this.sendGetJson("/v1/get_user_box_rewards_stats" /* GetUserBoxRewardsStats */, request);
24191
24374
  return response;
24192
24375
  };
24376
+ /**
24377
+ * getUserAggregatedBoxRewardsStats.
24378
+ *
24379
+ * @param request - See {@link GetUserAggregatedBoxRewardsStatsRequest}.
24380
+ */
24193
24381
  this.getUserAggregatedBoxRewardsStats = async (request) => {
24194
24382
  const response = await this.sendGetJson(
24195
24383
  "/v1/get_user_aggregated_box_rewards_stats" /* GetUserAggregatedBoxRewardsStats */,
@@ -24197,6 +24385,11 @@ var Client = class _Client {
24197
24385
  );
24198
24386
  return response;
24199
24387
  };
24388
+ /**
24389
+ * getUserReferralStatsHistory.
24390
+ *
24391
+ * @param request - See {@link GetUserReferralStatsHistoryRequest}.
24392
+ */
24200
24393
  this.getUserReferralStatsHistory = async (request) => {
24201
24394
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24202
24395
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24204,10 +24397,20 @@ var Client = class _Client {
24204
24397
  const response = await this.sendGetJson("/v1/get_user_referral_stats" /* GetUserReferralStats */, request);
24205
24398
  return response;
24206
24399
  };
24400
+ /**
24401
+ * getUserAggregatedReferralStats.
24402
+ *
24403
+ * @param request - See {@link GetUserAggregatedReferralStatsRequest}.
24404
+ */
24207
24405
  this.getUserAggregatedReferralStats = async (request) => {
24208
24406
  const response = await this.sendGetJson("/v1/get_user_aggregated_referral" /* GetUserAggregatedReferral */, request);
24209
24407
  return response;
24210
24408
  };
24409
+ /**
24410
+ * getUserClaimedKickbackHistory.
24411
+ *
24412
+ * @param request - See {@link GetUserClaimedKickbackHistoryRequest}.
24413
+ */
24211
24414
  this.getUserClaimedKickbackHistory = async (request) => {
24212
24415
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24213
24416
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24215,6 +24418,11 @@ var Client = class _Client {
24215
24418
  const response = await this.sendGetJson("/v1/get_user_claimed_kickback" /* GetUserClaimedKickback */, request);
24216
24419
  return response;
24217
24420
  };
24421
+ /**
24422
+ * getUserClaimedReferralKickbackHistory.
24423
+ *
24424
+ * @param request - See {@link GetUserClaimedReferralKickbackHistoryRequest}.
24425
+ */
24218
24426
  this.getUserClaimedReferralKickbackHistory = async (request) => {
24219
24427
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24220
24428
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24222,6 +24430,11 @@ var Client = class _Client {
24222
24430
  const response = await this.sendGetJson("/v1/get_user_claimed_referral" /* GetUserClaimedReferral */, request);
24223
24431
  return response;
24224
24432
  };
24433
+ /**
24434
+ * getUserTransfersHistory.
24435
+ *
24436
+ * @param request - See {@link GetUserTransferHistoryRequest}.
24437
+ */
24225
24438
  this.getUserTransfersHistory = async (request) => {
24226
24439
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24227
24440
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24229,6 +24442,11 @@ var Client = class _Client {
24229
24442
  const response = await this.sendGetJson("/v1/get_user_transfers" /* GetUserTransfers */, request);
24230
24443
  return response;
24231
24444
  };
24445
+ /**
24446
+ * getUserLiquidations.
24447
+ *
24448
+ * @param request - See {@link GetUserFullLiquidationsHistoryRequest}.
24449
+ */
24232
24450
  this.getUserLiquidations = async (request) => {
24233
24451
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24234
24452
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24236,6 +24454,11 @@ var Client = class _Client {
24236
24454
  const response = await this.sendGetJson("/v1/get_user_full_liquidations" /* GetUserFullLiquidations */, request);
24237
24455
  return response;
24238
24456
  };
24457
+ /**
24458
+ * getUserPartialLiquidations.
24459
+ *
24460
+ * @param request - See {@link GetUserPartialLiquidationsHistoryRequest}.
24461
+ */
24239
24462
  this.getUserPartialLiquidations = async (request) => {
24240
24463
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24241
24464
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24243,6 +24466,11 @@ var Client = class _Client {
24243
24466
  const response = await this.sendGetJson("/v1/get_user_partial_liquidations" /* GetUserPartialLiquidations */, request);
24244
24467
  return response;
24245
24468
  };
24469
+ /**
24470
+ * getBorrowLendHistoricalState.
24471
+ *
24472
+ * @param request - See {@link GetBorrowLendingHistoricalDataRequest}.
24473
+ */
24246
24474
  this.getBorrowLendHistoricalState = async (request) => {
24247
24475
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24248
24476
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24250,10 +24478,22 @@ var Client = class _Client {
24250
24478
  const response = await this.sendGetJson("/v1/get_borrow_lend_historical_data" /* GetBorrowLendHistoricalData */, request);
24251
24479
  return response;
24252
24480
  };
24481
+ /**
24482
+ * getBorrowLendAggregatedStats.
24483
+ *
24484
+ * @param request - See {@link GetBorrowLendingAggregatedStatsRequest}.
24485
+ */
24253
24486
  this.getBorrowLendAggregatedStats = async (request) => {
24254
24487
  const response = await this.sendGetJson("/v1/get_borrow_lend_aggregated_data" /* GetBorrowLendAggregatedData */, request);
24255
24488
  return response;
24256
24489
  };
24490
+ /**
24491
+ * getTokenStats.
24492
+ *
24493
+ * @param request - See {@link GetTokenStatsHistoryRequest}.
24494
+ *
24495
+ * @returns A promise that resolves to {@link GetTokenStatsHistoryResponse}.
24496
+ */
24257
24497
  this.getTokenStats = async (request) => {
24258
24498
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24259
24499
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24261,28 +24501,64 @@ var Client = class _Client {
24261
24501
  const response = await this.sendGetJson("/v1/get_tokens_stats" /* GetTokensStats */, request);
24262
24502
  return response;
24263
24503
  };
24504
+ /**
24505
+ * getTokenAggregatedStats.
24506
+ *
24507
+ * @param request - See {@link GetTokenAggregatedStatsRequest}.
24508
+ *
24509
+ * @returns A promise that resolves to {@link GetTokenAggregatedStatsResponse}.
24510
+ */
24264
24511
  this.getTokenAggregatedStats = async (request) => {
24265
24512
  const response = await this.sendGetJson("/v1/get_tokens_aggregated_stats" /* GetTokensAggregatedStats */, request);
24266
24513
  return response;
24267
24514
  };
24515
+ /**
24516
+ * checkReferralCode.
24517
+ *
24518
+ * @param request - See {@link CheckReferralCodeRequest}.
24519
+ *
24520
+ * @returns A promise that resolves to {@link CheckReferralCodeResponse}.
24521
+ */
24268
24522
  this.checkReferralCode = async (request) => {
24269
24523
  const response = await this.sendGetJson("/v1/check_referral_code" /* CheckReferralCode */, request);
24270
24524
  return response;
24271
24525
  };
24526
+ /**
24527
+ * getServicesStatus.
24528
+ *
24529
+ * @returns Service health status data. See {@link GetServicesStatusResponse}.
24530
+ */
24272
24531
  this.getServicesStatus = async () => {
24273
24532
  const response = await this.sendGetJson(
24274
24533
  "/v1/services_status" /* ServicesStatus */
24275
24534
  );
24276
24535
  return response;
24277
24536
  };
24537
+ /**
24538
+ * getUserVaultDeposits.
24539
+ *
24540
+ * @param request - See {@link GetUserDepositsRequest}.
24541
+ */
24278
24542
  this.getUserVaultDeposits = async (request) => {
24279
24543
  const response = await this.sendGetJson("/v1/get_user_vault_deposits" /* GetUserVaultDeposits */, request);
24280
24544
  return response;
24281
24545
  };
24546
+ /**
24547
+ * getUserVaultWithdraws.
24548
+ *
24549
+ * @param request - See {@link GetUserWithdrawalsRequest}.
24550
+ */
24282
24551
  this.getUserVaultWithdraws = async (request) => {
24283
24552
  const response = await this.sendGetJson("/v1/get_user_vault_withdrawals" /* GetUserVaultWithdrawals */, request);
24284
24553
  return response;
24285
24554
  };
24555
+ /**
24556
+ * getVaultHistoricalData.
24557
+ *
24558
+ * @param request - See {@link GetVaultHistoricalDataRequest}.
24559
+ *
24560
+ * @returns A promise that resolves to {@link GetVaultHistoricalDataResponse}.
24561
+ */
24286
24562
  this.getVaultHistoricalData = async (request) => {
24287
24563
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24288
24564
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24290,6 +24566,13 @@ var Client = class _Client {
24290
24566
  const response = await this.sendGetJson("/v1/get_vault_historical_data" /* GetVaultHistoricalData */, request);
24291
24567
  return response;
24292
24568
  };
24569
+ /**
24570
+ * getHistoricalIndexPrices.
24571
+ *
24572
+ * @param request - See {@link GetIndexPriceHistoryRequest}.
24573
+ *
24574
+ * @returns A promise that resolves to {@link GetIndexPriceHistoryResponse}.
24575
+ */
24293
24576
  this.getHistoricalIndexPrices = async (request) => {
24294
24577
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24295
24578
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24297,16 +24580,35 @@ var Client = class _Client {
24297
24580
  const response = await this.sendGetJson("/v1/get_index_price_history" /* GetIndexPriceHistory */, request);
24298
24581
  return response;
24299
24582
  };
24583
+ /**
24584
+ * getUserAggregatedVaultStats.
24585
+ *
24586
+ * @param request - See {@link GetUserAggregatedVaultStatsRequest}.
24587
+ *
24588
+ * @returns A promise that resolves to {@link GetUserAggregatedVaultStatsResponse}.
24589
+ */
24300
24590
  this.getUserAggregatedVaultStats = async (request) => {
24301
24591
  const response = await this.sendGetJson("/v1/get_user_aggregated_vault_stats" /* GetUserAggregatedVaultStats */, request);
24302
24592
  return response;
24303
24593
  };
24594
+ /**
24595
+ * getIndexerStatus.
24596
+ *
24597
+ * @returns Indexer status payload. See {@link GetIndexerStatusResponse}.
24598
+ */
24304
24599
  this.getIndexerStatus = async () => {
24305
24600
  const response = await this.sendGetJson(
24306
24601
  "/v1/get_indexer_status" /* GetIndexerStatus */
24307
24602
  );
24308
24603
  return response;
24309
24604
  };
24605
+ /**
24606
+ * getVaultHistoricalDeposits.
24607
+ *
24608
+ * @param request - See {@link GetVaultDepositsRequest}.
24609
+ *
24610
+ * @returns A promise that resolves to {@link GetVaultDepositsResponse}.
24611
+ */
24310
24612
  this.getVaultHistoricalDeposits = async (request) => {
24311
24613
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24312
24614
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24314,6 +24616,13 @@ var Client = class _Client {
24314
24616
  const response = await this.sendGetJson("/v1/get_vault_deposits" /* GetVaultDeposits */, request);
24315
24617
  return response;
24316
24618
  };
24619
+ /**
24620
+ * getVaultWithdrawals.
24621
+ *
24622
+ * @param request - See {@link GetVaultWithdrawalsRequest}.
24623
+ *
24624
+ * @returns A promise that resolves to {@link GetVaultWithdrawalsResponse}.
24625
+ */
24317
24626
  this.getVaultWithdrawals = async (request) => {
24318
24627
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24319
24628
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24321,6 +24630,13 @@ var Client = class _Client {
24321
24630
  const response = await this.sendGetJson("/v1/get_vault_withdrawals" /* GetVaultWithdrawals */, request);
24322
24631
  return response;
24323
24632
  };
24633
+ /**
24634
+ * getUserBoxesHistory.
24635
+ *
24636
+ * @param request - See {@link GetUserBoxesHistoryRequest}.
24637
+ *
24638
+ * @returns A promise that resolves to {@link GetUserBoxesHistoryResponse}.
24639
+ */
24324
24640
  this.getUserBoxesHistory = async (request) => {
24325
24641
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24326
24642
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24328,10 +24644,24 @@ var Client = class _Client {
24328
24644
  const response = await this.sendGetJson("/v1/get_user_boxes_history" /* GetUserBoxesHistory */, request);
24329
24645
  return response;
24330
24646
  };
24647
+ /**
24648
+ * getUserRequiredVolumeForReferral.
24649
+ *
24650
+ * @param request - See {@link GetUserVolumeForReferralRequest}.
24651
+ *
24652
+ * @returns A promise that resolves to {@link GetUserVolumeForReferralResponse}.
24653
+ */
24331
24654
  this.getUserRequiredVolumeForReferral = async (request) => {
24332
24655
  const response = await this.sendGetJson("/v1/get_required_volume_for_referral" /* GetUserVolumeForReferral */, request);
24333
24656
  return response;
24334
24657
  };
24658
+ /**
24659
+ * getUserPointsHistory.
24660
+ *
24661
+ * @param request - See {@link GetUserPointsHistoryRequest}.
24662
+ *
24663
+ * @returns A promise that resolves to {@link GetUserPointsHistoryResponse}.
24664
+ */
24335
24665
  this.getUserPointsHistory = async (request) => {
24336
24666
  if (request.olderTimestampMs && request.newerTimestampMs && request.olderTimestampMs > request.newerTimestampMs) {
24337
24667
  throw new Error("olderTimestampMs must be lower than newerTimestampMs");
@@ -24339,29 +24669,65 @@ var Client = class _Client {
24339
24669
  const response = await this.sendGetJson("/v1/get_user_points_history" /* GetUserPointsHistory */, request);
24340
24670
  return response;
24341
24671
  };
24672
+ /**
24673
+ * getAllVaultsIds.
24674
+ *
24675
+ * @returns All vault identifiers available from the API. See {@link GetAllVaultsIdsResponse}.
24676
+ */
24342
24677
  this.getAllVaultsIds = async () => {
24343
24678
  const response = await this.sendGetJson(
24344
24679
  "/v1/get_all_vaults_ids" /* GetAllVaultsIds */
24345
24680
  );
24346
24681
  return response;
24347
24682
  };
24683
+ /**
24684
+ * getUserPersonalPointsRanking.
24685
+ *
24686
+ * @param request - See {@link GetUserPersonalPointsRankingRequest}.
24687
+ *
24688
+ * @returns A promise that resolves to {@link GetUserPersonalPointsRankingResponse}.
24689
+ */
24348
24690
  this.getUserPersonalPointsRanking = async (request) => {
24349
24691
  const response = await this.sendGetJson("/v1/get_user_personal_points_ranking" /* GetUserPersonalPointsRanking */, request);
24350
24692
  return response;
24351
24693
  };
24694
+ /**
24695
+ * getTopPointsRanking.
24696
+ *
24697
+ * @returns Leaderboard data ordered by points. See {@link GetTopPointsRankingResponse}.
24698
+ */
24352
24699
  this.getTopPointsRanking = async () => {
24353
24700
  const response = await this.sendGetJson("/v1/get_top_points_ranking" /* GetTopPointsRanking */);
24354
24701
  return response;
24355
24702
  };
24703
+ /**
24704
+ * getAccountValueRanking.
24705
+ *
24706
+ * @param request - See {@link GetAccountValueRankingRequest}.
24707
+ *
24708
+ * @returns A promise that resolves to {@link GetAccountValueRankingResponse}.
24709
+ */
24356
24710
  this.getAccountValueRanking = async (request) => {
24357
24711
  const response = await this.sendGetJson("/v1/get_account_value_ranking" /* GetAccountValueRanking */, request);
24358
24712
  return response;
24359
24713
  };
24714
+ /**
24715
+ * getUserAccountValueRanking.
24716
+ *
24717
+ * @param request - See {@link GetUserAccountValueRankingRequest}.
24718
+ *
24719
+ * @returns A promise that resolves to {@link GetUserAccountValueRankingResponse}.
24720
+ */
24360
24721
  this.getUserAccountValueRanking = async (request) => {
24361
24722
  const response = await this.sendGetJson("/v1/get_user_account_value_ranking" /* GetUserAccountValueRanking */, request);
24362
24723
  return response;
24363
24724
  };
24364
24725
  // Meta
24726
+ /**
24727
+ * getTime.
24728
+ *
24729
+ * @returns Current server time string.
24730
+ */
24365
24731
  this.getTime = async () => {
24366
24732
  const response = await this.sendGetJson("/time" /* Time */);
24367
24733
  return response.time;
@@ -24383,6 +24749,14 @@ var Client = class _Client {
24383
24749
  this.timeout = config.timeout || 5e3;
24384
24750
  this._pingIntervalMs = config.pingIntervalMs || 3e4;
24385
24751
  }
24752
+ /**
24753
+ * init.
24754
+ *
24755
+ * @param connection - Aptos connection instance. See {@link Aptos}.
24756
+ * @param config - Client configuration options. See {@link ClientConfig}.
24757
+
24758
+ * @returns A promise that resolves to {@link Client}.
24759
+ */
24386
24760
  static async init(connection, config = {}) {
24387
24761
  const id = config.chainId || await connection.getChainId();
24388
24762
  const client = new _Client(connection, { ...config, chainId: id });
@@ -24394,9 +24768,10 @@ var Client = class _Client {
24394
24768
  /**
24395
24769
  * Create a new Client instance
24396
24770
  *
24397
- * @param connection - Aptos connection instance
24398
- * @param config - Client configuration options
24399
- * @returns Promise<Client>
24771
+ * @param connection - Aptos connection instance. See {@link Aptos}.
24772
+ * @param config - Optional client config object. See {@link ClientConfig}.
24773
+ *
24774
+ * @returns A promise that resolves to {@link Client}.
24400
24775
  *
24401
24776
  * @example
24402
24777
  * // Create a testnet client (default)
@@ -24423,36 +24798,76 @@ var Client = class _Client {
24423
24798
  static async create(connection, config = {}) {
24424
24799
  return _Client.init(connection, config);
24425
24800
  }
24801
+ /**
24802
+ * setApiKey.
24803
+ *
24804
+ * @param apiKey - See {@link Account}.
24805
+ */
24426
24806
  async setApiKey(apiKey) {
24427
24807
  this._apiKey = apiKey;
24428
24808
  this._apiKeySequenceNumber = await this.fetchApiKeySequenceNumber();
24429
24809
  this._sequenceNumberManager = new AccountSequenceNumber(this._aptos, this._apiKey);
24430
24810
  await this._sequenceNumberManager.initialize();
24431
24811
  }
24812
+ /**
24813
+ * getContractAddress.
24814
+ *
24815
+ * @returns The configured contract address.
24816
+ */
24432
24817
  getContractAddress() {
24433
24818
  return this._contractAddress;
24434
24819
  }
24820
+ /**
24821
+ * getApiKeySequenceNumber.
24822
+ *
24823
+ * @returns The next API key sequence number or null when unavailable.
24824
+ */
24435
24825
  getApiKeySequenceNumber() {
24436
24826
  return this._sequenceNumberManager.nextSequenceNumber();
24437
24827
  }
24828
+ /**
24829
+ * fetchApiKeySequenceNumber.
24830
+ *
24831
+ * @returns The on-chain API key sequence number.
24832
+ */
24438
24833
  async fetchApiKeySequenceNumber() {
24439
24834
  const accInfo = await this._aptos.getAccountInfo({
24440
24835
  accountAddress: this._apiKey.accountAddress
24441
24836
  });
24442
- return Number(await accInfo.sequence_number);
24837
+ return BigInt(accInfo.sequence_number);
24443
24838
  }
24839
+ /**
24840
+ * setTxParams.
24841
+ *
24842
+ * @param params - See {@link TxParams}.
24843
+ */
24444
24844
  setTxParams(params) {
24445
24845
  this._maxGas = params.maxGas;
24446
24846
  this._gasUnitPrice = params.gasUnitPrice;
24447
24847
  this._expirationTimestampDelay = params.expirationTimestampSecs;
24448
24848
  }
24449
24849
  //////////////////////////////////////// Websocket functions
24850
+ /**
24851
+ * _wsLog.
24852
+ *
24853
+ * @param args -
24854
+ */
24450
24855
  _wsLog(...args) {
24451
24856
  if (this.wsDebug) console.log("[WS]", ...args);
24452
24857
  }
24858
+ /**
24859
+ * setWsDebugActive.
24860
+ *
24861
+ * @param active - See boolean.
24862
+ */
24453
24863
  setWsDebugActive(active) {
24454
24864
  this.wsDebug = active;
24455
24865
  }
24866
+ /**
24867
+ * connectWebSocket.
24868
+ *
24869
+ * @returns A promise that resolves when WebSocket initialization is complete.
24870
+ */
24456
24871
  async connectWebSocket() {
24457
24872
  if (this._ws) {
24458
24873
  console.warn("WebSocket is already connected");
@@ -24468,6 +24883,12 @@ var Client = class _Client {
24468
24883
  throw new Error(`Failed to connect WebSocket: ${error}`);
24469
24884
  }
24470
24885
  }
24886
+ /**
24887
+ * _initWebSocket.
24888
+ *
24889
+ * @param url -
24890
+ * @param timeout -
24891
+ */
24471
24892
  _initWebSocket(url, timeout) {
24472
24893
  return new Promise((resolve, reject) => {
24473
24894
  const wsUrl = `${url.replace("http", "ws").replace("https", "wss")}` + "/v1/ws" /* Ws */;
@@ -24536,6 +24957,11 @@ var Client = class _Client {
24536
24957
  this._wsLog("Error:", error);
24537
24958
  };
24538
24959
  }
24960
+ /**
24961
+ * disconnectWebSocket.
24962
+ *
24963
+ * @returns A promise that resolves when cleanup and close actions are finished.
24964
+ */
24539
24965
  async disconnectWebSocket() {
24540
24966
  if (!this._ws) {
24541
24967
  console.warn("WebSocket is not connected");
@@ -24561,6 +24987,13 @@ var Client = class _Client {
24561
24987
  this._wsLog("isWebSocketConnected:", alive, "lastPong:", Date.now() - this._lastPongAt, "ms ago");
24562
24988
  return alive;
24563
24989
  }
24990
+ /**
24991
+ * sendWsMessage.
24992
+ *
24993
+ * @param message - See {@link WsCommand}.
24994
+
24995
+ * @returns A promise that resolves to {@link WsMessage}.
24996
+ */
24564
24997
  sendWsMessage(message) {
24565
24998
  if (!this._ws) throw new Error("WebSocket is not connected");
24566
24999
  return new Promise((resolve, reject) => {
@@ -24588,6 +25021,13 @@ var Client = class _Client {
24588
25021
  this._ws?.send(JSON.stringify(message));
24589
25022
  });
24590
25023
  }
25024
+ /**
25025
+ * subscribeIndexPricesUpdates.
25026
+ *
25027
+ * @param callback - Callback invoked for oracle updates. See {@link WsOracleUpdates}.
25028
+
25029
+ * @returns A promise that resolves to an unsubscribe function.
25030
+ */
24591
25031
  async subscribeIndexPricesUpdates(callback) {
24592
25032
  const command = {
24593
25033
  type: "SubscribeOracle",
@@ -24598,6 +25038,11 @@ var Client = class _Client {
24598
25038
  await this.sendWsMessage(command);
24599
25039
  return this.unsubscribeIndexPricesUpdates;
24600
25040
  }
25041
+ /**
25042
+ * unsubscribeIndexPricesUpdates.
25043
+ *
25044
+ * @returns A promise that resolves to a completed unsubscribe flow.
25045
+ */
24601
25046
  async unsubscribeIndexPricesUpdates() {
24602
25047
  const command = {
24603
25048
  type: "UnsubscribeOracle",
@@ -24607,6 +25052,13 @@ var Client = class _Client {
24607
25052
  const topic = getTopicFromCommand(command);
24608
25053
  this._subscriptions.delete(topic);
24609
25054
  }
25055
+ /**
25056
+ * subscribeBorrowLendingUpdates.
25057
+ *
25058
+ * @param callback - Callback invoked for borrow-lending updates. See {@link WsBorrowLendUpdate}.
25059
+
25060
+ * @returns A promise that resolves to an unsubscribe function.
25061
+ */
24610
25062
  async subscribeBorrowLendingUpdates(callback) {
24611
25063
  const command = {
24612
25064
  type: "SubscribeBorrowLend",
@@ -24617,6 +25069,11 @@ var Client = class _Client {
24617
25069
  await this.sendWsMessage(command);
24618
25070
  return this.unsubscribeIndexPricesUpdates;
24619
25071
  }
25072
+ /**
25073
+ * unsubscribeBorrowLendingUpdates.
25074
+ *
25075
+ * @returns A promise that resolves to a completed unsubscribe flow.
25076
+ */
24620
25077
  async unsubscribeBorrowLendingUpdates() {
24621
25078
  const command = {
24622
25079
  type: "UnsubscribeBorrowLend",
@@ -24626,6 +25083,13 @@ var Client = class _Client {
24626
25083
  const topic = getTopicFromCommand(command);
24627
25084
  this._subscriptions.delete(topic);
24628
25085
  }
25086
+ /**
25087
+ * subscribeBoxOpeningUpdates.
25088
+ *
25089
+ * @param callback - Callback invoked for box-opening updates. See {@link WsBoxOpeningUpdate}.
25090
+
25091
+ * @returns A promise that resolves to an unsubscribe function.
25092
+ */
24629
25093
  async subscribeBoxOpeningUpdates(callback) {
24630
25094
  const command = {
24631
25095
  type: "SubscribeBoxes",
@@ -24636,6 +25100,11 @@ var Client = class _Client {
24636
25100
  await this.sendWsMessage(command);
24637
25101
  return this.unsubscribeBoxOpeningUpdates;
24638
25102
  }
25103
+ /**
25104
+ * unsubscribeBoxOpeningUpdates.
25105
+ *
25106
+ * @returns A promise that resolves to a completed unsubscribe flow.
25107
+ */
24639
25108
  async unsubscribeBoxOpeningUpdates() {
24640
25109
  const command = {
24641
25110
  type: "UnsubscribeBoxes",
@@ -24645,6 +25114,13 @@ var Client = class _Client {
24645
25114
  const topic = getTopicFromCommand(command);
24646
25115
  this._subscriptions.delete(topic);
24647
25116
  }
25117
+ /**
25118
+ * subscribeLiquidationUpdates.
25119
+ *
25120
+ * @param callback - Callback invoked for liquidation updates. See {@link WsLiquidationUpdate}.
25121
+
25122
+ * @returns A promise that resolves to an unsubscribe function.
25123
+ */
24648
25124
  async subscribeLiquidationUpdates(callback) {
24649
25125
  const command = {
24650
25126
  type: "SubscribeLiquidations",
@@ -24655,6 +25131,11 @@ var Client = class _Client {
24655
25131
  await this.sendWsMessage(command);
24656
25132
  return this.unsubscribeLiquidationUpdates;
24657
25133
  }
25134
+ /**
25135
+ * unsubscribeLiquidationUpdates.
25136
+ *
25137
+ * @returns A promise that resolves to a completed unsubscribe flow.
25138
+ */
24658
25139
  async unsubscribeLiquidationUpdates() {
24659
25140
  const command = {
24660
25141
  type: "UnsubscribeLiquidations",
@@ -24664,6 +25145,14 @@ var Client = class _Client {
24664
25145
  const topic = getTopicFromCommand(command);
24665
25146
  this._subscriptions.delete(topic);
24666
25147
  }
25148
+ /**
25149
+ * subscribeUserUpdates.
25150
+ *
25151
+ * @param userId - See string.
25152
+ * @param callback - Callback invoked for user updates. See {@link WsUserUpdates}.
25153
+
25154
+ * @returns A promise that resolves to an unsubscribe function.
25155
+ */
24667
25156
  async subscribeUserUpdates(userId, callback) {
24668
25157
  const command = {
24669
25158
  type: "SubscribeUser",
@@ -24674,6 +25163,11 @@ var Client = class _Client {
24674
25163
  await this.sendWsMessage(command);
24675
25164
  return () => this.unsubscribeUserUpdates(userId);
24676
25165
  }
25166
+ /**
25167
+ * unsubscribeUserUpdates.
25168
+ *
25169
+ * @param userId - See string.
25170
+ */
24677
25171
  async unsubscribeUserUpdates(userId) {
24678
25172
  const command = {
24679
25173
  type: "UnsubscribeUser",
@@ -24683,6 +25177,14 @@ var Client = class _Client {
24683
25177
  const topic = getTopicFromCommand(command);
24684
25178
  this._subscriptions.delete(topic);
24685
25179
  }
25180
+ /**
25181
+ * subscribePerpMarketUpdates.
25182
+ *
25183
+ * @param market - See string.
25184
+ * @param callback - Callback invoked for perpetual market updates. See {@link WsPerpMarketUpdates}.
25185
+
25186
+ * @returns A promise that resolves to an unsubscribe function.
25187
+ */
24686
25188
  async subscribePerpMarketUpdates(market, callback) {
24687
25189
  const command = {
24688
25190
  type: "SubscribePerpMarket",
@@ -24693,6 +25195,11 @@ var Client = class _Client {
24693
25195
  await this.sendWsMessage(command);
24694
25196
  return () => this.unsubscribePerpMarketUpdates(market);
24695
25197
  }
25198
+ /**
25199
+ * unsubscribePerpMarketUpdates.
25200
+ *
25201
+ * @param market - See string.
25202
+ */
24696
25203
  async unsubscribePerpMarketUpdates(market) {
24697
25204
  const command = {
24698
25205
  type: "UnsubscribePerpMarket",
@@ -24702,6 +25209,14 @@ var Client = class _Client {
24702
25209
  const topic = getTopicFromCommand(command);
24703
25210
  this._subscriptions.delete(topic);
24704
25211
  }
25212
+ /**
25213
+ * subscribeSpotMarketUpdates.
25214
+ *
25215
+ * @param market - See string.
25216
+ * @param callback - Callback invoked for spot market updates. See {@link WsSpotMarketUpdates}.
25217
+
25218
+ * @returns A promise that resolves to an unsubscribe function.
25219
+ */
24705
25220
  async subscribeSpotMarketUpdates(market, callback) {
24706
25221
  const command = {
24707
25222
  type: "SubscribeSpotMarket",
@@ -24712,6 +25227,11 @@ var Client = class _Client {
24712
25227
  await this.sendWsMessage(command);
24713
25228
  return () => this.unsubscribeSpotMarketUpdates(market);
24714
25229
  }
25230
+ /**
25231
+ * unsubscribeSpotMarketUpdates.
25232
+ *
25233
+ * @param market - See string.
25234
+ */
24715
25235
  async unsubscribeSpotMarketUpdates(market) {
24716
25236
  const command = {
24717
25237
  type: "UnsubscribeSpotMarket",
@@ -24722,6 +25242,12 @@ var Client = class _Client {
24722
25242
  this._subscriptions.delete(topic);
24723
25243
  }
24724
25244
  /////////////////////////////////// Functions which needs to be signed by user and sent to blockchain
25245
+ /**
25246
+ * createUser.
25247
+ *
25248
+ * @param params - See {@link CreateUserParams}.
25249
+ * @returns A promise that resolves to the user creation payload bundle.
25250
+ */
24725
25251
  async createUser(params) {
24726
25252
  const apiKey = generateApiKey();
24727
25253
  const abi = this._abis.CreateUserABI;
@@ -24755,6 +25281,12 @@ var Client = class _Client {
24755
25281
  apiKey
24756
25282
  };
24757
25283
  }
25284
+ /**
25285
+ * createUserPayload.
25286
+ *
25287
+ * @param params - See {@link CreateUserParams}.
25288
+ * @returns A promise that resolves to an object with the unsigned payload and generated API key. See {@link AnyTransactionPayloadInstance}.
25289
+ */
24758
25290
  async createUserPayload(params) {
24759
25291
  const apiKey = generateApiKey();
24760
25292
  const abi = this._abis.CreateUserABI;
@@ -24775,6 +25307,11 @@ var Client = class _Client {
24775
25307
  apiKey
24776
25308
  };
24777
25309
  }
25310
+ /**
25311
+ * addApiKey.
25312
+ *
25313
+ * @param params - See {@link AddApiKeyParams}.
25314
+ */
24778
25315
  async addApiKey(params) {
24779
25316
  const abi = this._abis.AddApiKeyABI;
24780
25317
  return await generateTransactionPayload({
@@ -24790,6 +25327,11 @@ var Client = class _Client {
24790
25327
  functionArguments: [params.userId, params.expiration]
24791
25328
  });
24792
25329
  }
25330
+ /**
25331
+ * depositTokenPayload.
25332
+ *
25333
+ * @param params - See {@link DepositTokenParams}.
25334
+ */
24793
25335
  async depositTokenPayload(params) {
24794
25336
  const abi = this._abis.DepositTokenABI;
24795
25337
  return await generateTransactionPayload({
@@ -24805,6 +25347,14 @@ var Client = class _Client {
24805
25347
  functionArguments: [params.userId, params.amount, params.tokenAddress]
24806
25348
  });
24807
25349
  }
25350
+ /**
25351
+ * Creates the transaction payload for withdrawing a token.
25352
+ *
25353
+ * @param params - Withdraw request parameters.
25354
+ * See {@link WithdrawTokenParams}.
25355
+ * @returns The generated transaction payload. See
25356
+ * {@link AnyTransactionPayloadInstance}.
25357
+ */
24808
25358
  async withdrawTokenPayload(params) {
24809
25359
  const abi = this._abis.WithdrawTokenABI;
24810
25360
  return await generateTransactionPayload({
@@ -24827,6 +25377,11 @@ var Client = class _Client {
24827
25377
  ]
24828
25378
  });
24829
25379
  }
25380
+ /**
25381
+ * removeApiKeySigner.
25382
+ *
25383
+ * @param params - See {@link RemoveApiKeySignerParams}.
25384
+ */
24830
25385
  async removeApiKeySigner(params) {
24831
25386
  const abi = this._abis.RemoveApiKeySignerABI;
24832
25387
  return await generateTransactionPayload({
@@ -24842,6 +25397,11 @@ var Client = class _Client {
24842
25397
  functionArguments: [params.apiKeys, params.userId]
24843
25398
  });
24844
25399
  }
25400
+ /**
25401
+ * addApiCredits.
25402
+ *
25403
+ * @param params - See {@link AddApiCreditsParams}.
25404
+ */
24845
25405
  async addApiCredits(params) {
24846
25406
  const abi = this._abis.AddCreditsABI;
24847
25407
  return await generateTransactionPayload({
@@ -24858,8 +25418,18 @@ var Client = class _Client {
24858
25418
  });
24859
25419
  }
24860
25420
  // Helper function to submit sponsored transaction
25421
+ /**
25422
+ * createAndSubmitTransaction.
25423
+ *
25424
+ * @param aptosPayload - See {@link AnyTransactionPayloadInstance}.
25425
+
25426
+ * @returns A promise that resolves to {@link SubmitSponsoredTransactionResponse}.
25427
+ */
24861
25428
  async createAndSubmitTransaction(aptosPayload) {
24862
25429
  const sequenceNumber = await this.getApiKeySequenceNumber();
25430
+ if (sequenceNumber === null) {
25431
+ throw new Error("Unable to determine a valid API key sequence number");
25432
+ }
24863
25433
  const rawTx = new RawTransaction(
24864
25434
  AccountAddress.from(this._apiKey.accountAddress),
24865
25435
  BigInt(sequenceNumber),
@@ -24879,13 +25449,37 @@ var Client = class _Client {
24879
25449
  });
24880
25450
  return await this.submitSponsoredTransaction(tx, signature);
24881
25451
  }
25452
+ /**
25453
+ * createOpenBoxesMessage.
25454
+ *
25455
+ * @param boxId - See string.
25456
+ * @param amount - See string.
25457
+ * @param userId - See string.
25458
+ * @param apiKey - See string.
25459
+
25460
+ * @returns The generated box-open message.
25461
+ */
24882
25462
  createOpenBoxesMessage(boxId, amount, userId, apiKey) {
24883
25463
  return `[Neony Exchange]: Open box, id:${boxId}, amount:${amount}, user_id:${userId}, api_key:${apiKey}`;
24884
25464
  }
25465
+ /**
25466
+ * openBoxes.
25467
+ *
25468
+ * @param params - See {@link OpenBoxesRequest}.
25469
+
25470
+ * @returns A promise that resolves to {@link OpenBoxesResponse}.
25471
+ */
24885
25472
  async openBoxes(params) {
24886
25473
  const response = await this.sendPostJson(params, "/v1/open_boxes" /* OpenBoxes */);
24887
25474
  return response;
24888
25475
  }
25476
+ /**
25477
+ * removeApiKey.
25478
+ *
25479
+ * @param params - See {@link RemoveApiKeyParams}.
25480
+
25481
+ * @returns A promise that resolves to {@link SubmitSponsoredTransactionResponse}.
25482
+ */
24889
25483
  async removeApiKey(params) {
24890
25484
  const abi = this._abis.RemoveApiKeyABI;
24891
25485
  const aptosPayload = await generateTransactionPayload({
@@ -24902,6 +25496,11 @@ var Client = class _Client {
24902
25496
  });
24903
25497
  return await this.createAndSubmitTransaction(aptosPayload);
24904
25498
  }
25499
+ /**
25500
+ * setAliasName.
25501
+ *
25502
+ * @param params - See {@link SetAliasNameParams}.
25503
+ */
24905
25504
  async setAliasName(params) {
24906
25505
  const abi = this._abis.SetAliasNameABI;
24907
25506
  const aptosPayload = await generateTransactionPayload({
@@ -24918,6 +25517,11 @@ var Client = class _Client {
24918
25517
  });
24919
25518
  return await this.createAndSubmitTransaction(aptosPayload);
24920
25519
  }
25520
+ /**
25521
+ * placePerpLimitOrder.
25522
+ *
25523
+ * @param params - See {@link PlacePerpOrderParams}.
25524
+ */
24921
25525
  async placePerpLimitOrder(params) {
24922
25526
  const abi = this._abis.PlacePerpLimitOrderABI;
24923
25527
  const aptosPayload = await generateTransactionPayload({
@@ -24942,6 +25546,11 @@ var Client = class _Client {
24942
25546
  });
24943
25547
  return await this.createAndSubmitTransaction(aptosPayload);
24944
25548
  }
25549
+ /**
25550
+ * placePerpMarketOrder.
25551
+ *
25552
+ * @param params - See {@link PlacePerpOrderParams}.
25553
+ */
24945
25554
  async placePerpMarketOrder(params) {
24946
25555
  const abi = this._abis.PlacePerpMarketOrderABI;
24947
25556
  const aptosPayload = await generateTransactionPayload({
@@ -24966,6 +25575,11 @@ var Client = class _Client {
24966
25575
  return await this.createAndSubmitTransaction(aptosPayload);
24967
25576
  }
24968
25577
  ////////// Spot orders (ABI-based)
25578
+ /**
25579
+ * placeSpotLimitOrder.
25580
+ *
25581
+ * @param params - See {@link PlaceSpotOrderParams}.
25582
+ */
24969
25583
  async placeSpotLimitOrder(params) {
24970
25584
  const abi = this._abis.PlaceSpotLimitOrderABI;
24971
25585
  const aptosPayload = await generateTransactionPayload({
@@ -24989,6 +25603,11 @@ var Client = class _Client {
24989
25603
  });
24990
25604
  return await this.createAndSubmitTransaction(aptosPayload);
24991
25605
  }
25606
+ /**
25607
+ * placeSpotMarketOrder.
25608
+ *
25609
+ * @param params - See {@link PlaceSpotOrderParams}.
25610
+ */
24992
25611
  async placeSpotMarketOrder(params) {
24993
25612
  const abi = this._abis.PlaceSpotMarketOrderABI;
24994
25613
  const aptosPayload = await generateTransactionPayload({
@@ -25012,6 +25631,11 @@ var Client = class _Client {
25012
25631
  });
25013
25632
  return await this.createAndSubmitTransaction(aptosPayload);
25014
25633
  }
25634
+ /**
25635
+ * changeSpotOrderPrice.
25636
+ *
25637
+ * @param params - See {@link ChangeSpotOrderParams}.
25638
+ */
25015
25639
  async changeSpotOrderPrice(params) {
25016
25640
  const abi = this._abis.ChangeSpotOrderABI;
25017
25641
  const aptosPayload = await generateTransactionPayload({
@@ -25035,6 +25659,11 @@ var Client = class _Client {
25035
25659
  });
25036
25660
  return await this.createAndSubmitTransaction(aptosPayload);
25037
25661
  }
25662
+ /**
25663
+ * cancelSpotOrders.
25664
+ *
25665
+ * @param params - See {@link CancelSpotOrdersParams}.
25666
+ */
25038
25667
  async cancelSpotOrders(params) {
25039
25668
  const abi = this._abis.CancelSpotOrdersABI;
25040
25669
  const aptosPayload = await generateTransactionPayload({
@@ -25051,6 +25680,11 @@ var Client = class _Client {
25051
25680
  });
25052
25681
  return await this.createAndSubmitTransaction(aptosPayload);
25053
25682
  }
25683
+ /**
25684
+ * placeTriggerOrder.
25685
+ *
25686
+ * @param params - See {@link PlacePerpTriggerOrderParams}.
25687
+ */
25054
25688
  async placeTriggerOrder(params) {
25055
25689
  const abi = this._abis.PlacePerpTriggerOrderABI;
25056
25690
  const aptosPayload = await generateTransactionPayload({
@@ -25079,6 +25713,11 @@ var Client = class _Client {
25079
25713
  });
25080
25714
  return await this.createAndSubmitTransaction(aptosPayload);
25081
25715
  }
25716
+ /**
25717
+ * changePerpOrderPrice.
25718
+ *
25719
+ * @param params - See {@link ChangePerpOrderParams}.
25720
+ */
25082
25721
  async changePerpOrderPrice(params) {
25083
25722
  const abi = this._abis.ChangePerpOrderABI;
25084
25723
  const aptosPayload = await generateTransactionPayload({
@@ -25103,6 +25742,11 @@ var Client = class _Client {
25103
25742
  });
25104
25743
  return await this.createAndSubmitTransaction(aptosPayload);
25105
25744
  }
25745
+ /**
25746
+ * cancelPerpOrders.
25747
+ *
25748
+ * @param params - See {@link CancelPerpOrdersParams}.
25749
+ */
25106
25750
  async cancelPerpOrders(params) {
25107
25751
  const abi = this._abis.CancelPerpOrdersABI;
25108
25752
  const aptosPayload = await generateTransactionPayload({
@@ -25119,6 +25763,11 @@ var Client = class _Client {
25119
25763
  });
25120
25764
  return await this.createAndSubmitTransaction(aptosPayload);
25121
25765
  }
25766
+ /**
25767
+ * cancelAllPerpOrders.
25768
+ *
25769
+ * @param params - See {@link CancelAllPerpOrdersParams}.
25770
+ */
25122
25771
  async cancelAllPerpOrders(params) {
25123
25772
  const abi = this._abis.CancelAllPerpOrdersABI;
25124
25773
  const aptosPayload = await generateTransactionPayload({
@@ -25135,6 +25784,11 @@ var Client = class _Client {
25135
25784
  });
25136
25785
  return await this.createAndSubmitTransaction(aptosPayload);
25137
25786
  }
25787
+ /**
25788
+ * cancelAllSpotOrders.
25789
+ *
25790
+ * @param params - See {@link CancelAllSpotOrdersParams}.
25791
+ */
25138
25792
  async cancelAllSpotOrders(params) {
25139
25793
  const abi = this._abis.CancelAllSpotOrdersABI;
25140
25794
  const aptosPayload = await generateTransactionPayload({
@@ -25151,6 +25805,11 @@ var Client = class _Client {
25151
25805
  });
25152
25806
  return await this.createAndSubmitTransaction(aptosPayload);
25153
25807
  }
25808
+ /**
25809
+ * setAutolend.
25810
+ *
25811
+ * @param params - See {@link SetAutolendParams}.
25812
+ */
25154
25813
  async setAutolend(params) {
25155
25814
  const abi = this._abis.SetAutolendABI;
25156
25815
  const aptosPayload = await generateTransactionPayload({
@@ -25167,6 +25826,11 @@ var Client = class _Client {
25167
25826
  });
25168
25827
  return await this.createAndSubmitTransaction(aptosPayload);
25169
25828
  }
25829
+ /**
25830
+ * depositToVault.
25831
+ *
25832
+ * @param params - See {@link DepositToVaultParams}.
25833
+ */
25170
25834
  async depositToVault(params) {
25171
25835
  const abi = this._abis.DepositToVaultABI;
25172
25836
  const aptosPayload = await generateTransactionPayload({
@@ -25183,6 +25847,11 @@ var Client = class _Client {
25183
25847
  });
25184
25848
  return await this.createAndSubmitTransaction(aptosPayload);
25185
25849
  }
25850
+ /**
25851
+ * withdrawFromVault.
25852
+ *
25853
+ * @param params - See {@link WithdrawFromVaultParams}.
25854
+ */
25186
25855
  async withdrawFromVault(params) {
25187
25856
  const abi = this._abis.WithdrawFromVaultABI;
25188
25857
  const aptosPayload = await generateTransactionPayload({
@@ -25204,6 +25873,11 @@ var Client = class _Client {
25204
25873
  });
25205
25874
  return await this.createAndSubmitTransaction(aptosPayload);
25206
25875
  }
25876
+ /**
25877
+ * redeemToken.
25878
+ *
25879
+ * @param params - See {@link RedeemTokenParams}.
25880
+ */
25207
25881
  async redeemToken(params) {
25208
25882
  const abi = this._abis.RedeemTokenABI;
25209
25883
  const aptosPayload = await generateTransactionPayload({
@@ -25225,6 +25899,11 @@ var Client = class _Client {
25225
25899
  });
25226
25900
  return await this.createAndSubmitTransaction(aptosPayload);
25227
25901
  }
25902
+ /**
25903
+ * lendToken.
25904
+ *
25905
+ * @param params - See {@link LendTokenParams}.
25906
+ */
25228
25907
  async lendToken(params) {
25229
25908
  const abi = this._abis.LendTokenABI;
25230
25909
  const aptosPayload = await generateTransactionPayload({
@@ -25246,6 +25925,11 @@ var Client = class _Client {
25246
25925
  });
25247
25926
  return await this.createAndSubmitTransaction(aptosPayload);
25248
25927
  }
25928
+ /**
25929
+ * claimReferralFees.
25930
+ *
25931
+ * @param params - See {@link ClaimReferralFeesParams}.
25932
+ */
25249
25933
  async claimReferralFees(params) {
25250
25934
  const abi = this._abis.ClaimReferralFeesABI;
25251
25935
  const aptosPayload = await generateTransactionPayload({
@@ -25262,6 +25946,11 @@ var Client = class _Client {
25262
25946
  });
25263
25947
  return await this.createAndSubmitTransaction(aptosPayload);
25264
25948
  }
25949
+ /**
25950
+ * claimKickbackFee.
25951
+ *
25952
+ * @param params - See {@link ClaimKickbackFeeParams}.
25953
+ */
25265
25954
  async claimKickbackFee(params) {
25266
25955
  const abi = this._abis.ClaimKickbackFeeABI;
25267
25956
  const aptosPayload = await generateTransactionPayload({
@@ -25278,6 +25967,11 @@ var Client = class _Client {
25278
25967
  });
25279
25968
  return await this.createAndSubmitTransaction(aptosPayload);
25280
25969
  }
25970
+ /**
25971
+ * transferToUser.
25972
+ *
25973
+ * @param params - See {@link TransferToUserParams}.
25974
+ */
25281
25975
  async transferToUser(params) {
25282
25976
  const abi = this._abis.TransferToUserABI;
25283
25977
  const aptosPayload = await generateTransactionPayload({
@@ -25301,6 +25995,11 @@ var Client = class _Client {
25301
25995
  });
25302
25996
  return await this.createAndSubmitTransaction(aptosPayload);
25303
25997
  }
25998
+ /**
25999
+ * withdrawToken.
26000
+ *
26001
+ * @param params - See {@link WithdrawTokenParams}.
26002
+ */
25304
26003
  async withdrawToken(params) {
25305
26004
  const abi = this._abis.WithdrawTokenABI;
25306
26005
  const aptosPayload = await generateTransactionPayload({
@@ -25324,6 +26023,11 @@ var Client = class _Client {
25324
26023
  });
25325
26024
  return await this.createAndSubmitTransaction(aptosPayload);
25326
26025
  }
26026
+ /**
26027
+ * replaceMultipleOrders.
26028
+ *
26029
+ * @param params - See {@link ReplaceMultipleOrdersParams}.
26030
+ */
25327
26031
  async replaceMultipleOrders(params) {
25328
26032
  const isBids = params.orders.map((order) => order.isBid);
25329
26033
  const prices = params.orders.map((order) => order.price);
@@ -25344,6 +26048,11 @@ var Client = class _Client {
25344
26048
  });
25345
26049
  return await this.createAndSubmitTransaction(aptosPayload);
25346
26050
  }
26051
+ /**
26052
+ * replaceMultipleSpotOrders.
26053
+ *
26054
+ * @param params - See {@link ReplaceMultipleSpotOrdersParams}.
26055
+ */
25347
26056
  async replaceMultipleSpotOrders(params) {
25348
26057
  const isBids = params.orders.map((order) => order.isBid);
25349
26058
  const prices = params.orders.map((order) => order.price);
@@ -25364,6 +26073,11 @@ var Client = class _Client {
25364
26073
  });
25365
26074
  return await this.createAndSubmitTransaction(aptosPayload);
25366
26075
  }
26076
+ /**
26077
+ * placeMultiplePerpOrders.
26078
+ *
26079
+ * @param params - See {@link PlaceMultiplePerpOrdersParams}.
26080
+ */
25367
26081
  async placeMultiplePerpOrders(params) {
25368
26082
  const markets = params.perpOrders.map((order) => order.market);
25369
26083
  const isBids = params.perpOrders.map((order) => order.isBid);
@@ -25394,6 +26108,11 @@ var Client = class _Client {
25394
26108
  });
25395
26109
  return await this.createAndSubmitTransaction(aptosPayload);
25396
26110
  }
26111
+ /**
26112
+ * placeMultipleSpotOrders.
26113
+ *
26114
+ * @param params - See {@link PlaceMultipleSpotOrdersParams}.
26115
+ */
25397
26116
  async placeMultipleSpotOrders(params) {
25398
26117
  const markets = params.spotOrders.map((order) => order.marketName);
25399
26118
  const uniqueMarkets = new Set(markets);
@@ -25420,6 +26139,11 @@ var Client = class _Client {
25420
26139
  });
25421
26140
  return await this.createAndSubmitTransaction(aptosPayload);
25422
26141
  }
26142
+ /**
26143
+ * claimDeposit.
26144
+ *
26145
+ * @param params - See {@link ClaimDepositParams}.
26146
+ */
25423
26147
  async claimDeposit(params) {
25424
26148
  const abi = this._abis.ClaimDepositABI;
25425
26149
  const aptosPayload = await generateTransactionPayload({
@@ -25436,6 +26160,11 @@ var Client = class _Client {
25436
26160
  });
25437
26161
  return await this.createAndSubmitTransaction(aptosPayload);
25438
26162
  }
26163
+ /**
26164
+ * setReferralCode.
26165
+ *
26166
+ * @param params - See {@link SetReferralCodeParams}.
26167
+ */
25439
26168
  async setReferralCode(params) {
25440
26169
  const abi = this._abis.SetReferralCodeABI;
25441
26170
  const aptosPayload = await generateTransactionPayload({
@@ -25452,6 +26181,11 @@ var Client = class _Client {
25452
26181
  });
25453
26182
  return await this.createAndSubmitTransaction(aptosPayload);
25454
26183
  }
26184
+ /**
26185
+ * tokenizeUserVaultInvestment.
26186
+ *
26187
+ * @param params - See {@link TokenizeUserVaultInvestmentParams}.
26188
+ */
25455
26189
  async tokenizeUserVaultInvestment(params) {
25456
26190
  const abi = this._abis.TokenizeUserVaultInvestmentABI;
25457
26191
  const aptosPayload = await generateTransactionPayload({
@@ -25503,12 +26237,26 @@ import {
25503
26237
  SimpleTransaction as SimpleTransaction2
25504
26238
  } from "@aptos-labs/ts-sdk";
25505
26239
  var TestFaucet = class _TestFaucet extends client_default {
26240
+ /** Creates a `TestFaucet` instance.
26241
+ * @param connection -
26242
+ * @param config -
26243
+ */
25506
26244
  constructor(connection, config = {}) {
25507
26245
  super(connection, config);
25508
26246
  }
26247
+ /**
26248
+ * Creates and initializes a faucet helper with websocket disabled by default.
26249
+ *
26250
+ * @param connection - Aptos client connected to the target network.
26251
+ * @param config - Optional client config.
26252
+
26253
+ * @param configOrNetworkMode -
26254
+ * @param enableWs -
26255
+ */
25509
26256
  static async create(connection, config = {}) {
25510
- return new _TestFaucet(connection, { enableWs: false, ...config });
26257
+ return new _TestFaucet(connection, { ...config, enableWs: false });
25511
26258
  }
26259
+ /** Builds the initialize-faucet payload (testnet only). */
25512
26260
  async initFaucetPayload() {
25513
26261
  const abi = this._abis.FaucetEntrypointsABI;
25514
26262
  if (!abi) {
@@ -25527,6 +26275,7 @@ var TestFaucet = class _TestFaucet extends client_default {
25527
26275
  functionArguments: []
25528
26276
  });
25529
26277
  }
26278
+ /** Submits the faucet initialization transaction. */
25530
26279
  async initFaucet() {
25531
26280
  const payload = await this.initFaucetPayload();
25532
26281
  const tx = new SimpleTransaction2(
@@ -25542,6 +26291,11 @@ var TestFaucet = class _TestFaucet extends client_default {
25542
26291
  });
25543
26292
  return await this.submitSponsoredTransaction(tx, signature);
25544
26293
  }
26294
+ /** Builds the mint payload for test tokens (testnet only).
26295
+ * @param receiver -
26296
+ * @param token -
26297
+ * @param amount -
26298
+ */
25545
26299
  async mintTokenPayload(receiver, token, amount) {
25546
26300
  const abi = this._abis.FaucetEntrypointsABI;
25547
26301
  if (!abi) {
@@ -25560,6 +26314,13 @@ var TestFaucet = class _TestFaucet extends client_default {
25560
26314
  functionArguments: [receiver, token, amount]
25561
26315
  });
25562
26316
  }
26317
+ /**
26318
+ * Mints testnet tokens to an on-chain recipient.
26319
+ *
26320
+ * @param receiver - Recipient address.
26321
+ * @param token - Token symbol.
26322
+ * @param amount - Mint amount.
26323
+ */
25563
26324
  async mintToken(receiver, token, amount) {
25564
26325
  const payload = await this.mintTokenPayload(receiver, token, amount);
25565
26326
  const tx = new SimpleTransaction2(
@@ -25589,11 +26350,9 @@ export {
25589
26350
  ExchangeProxies,
25590
26351
  GLOBAL_DENOMINATOR,
25591
26352
  MAINNET_CONFIG,
25592
- Network2 as Network,
25593
26353
  OrderSide,
25594
26354
  OrderStatus,
25595
26355
  OrderType,
25596
- Status,
25597
26356
  TESTNET_CONFIG,
25598
26357
  TestFaucet,
25599
26358
  TradeRole,
@@ -25609,6 +26368,7 @@ export {
25609
26368
  getTopicFromCommand,
25610
26369
  getTopicFromMessage,
25611
26370
  nowInMiliseconds,
26371
+ nowInMilliseconds,
25612
26372
  parseEntryFunctionAbi,
25613
26373
  sleep,
25614
26374
  toSystemValue