ccxt 4.2.39 → 4.2.41

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.
Files changed (57) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1140 -341
  3. package/dist/ccxt.browser.min.js +2 -2
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ascendex.js +28 -24
  6. package/dist/cjs/src/base/Exchange.js +14 -14
  7. package/dist/cjs/src/binance.js +561 -168
  8. package/dist/cjs/src/bingx.js +271 -25
  9. package/dist/cjs/src/bitforex.js +2 -2
  10. package/dist/cjs/src/bitget.js +13 -2
  11. package/dist/cjs/src/bybit.js +3 -1
  12. package/dist/cjs/src/coinbase.js +8 -6
  13. package/dist/cjs/src/coinbasepro.js +1 -0
  14. package/dist/cjs/src/coinlist.js +9 -7
  15. package/dist/cjs/src/coinmetro.js +2 -1
  16. package/dist/cjs/src/currencycom.js +1 -1
  17. package/dist/cjs/src/htx.js +1 -1
  18. package/dist/cjs/src/krakenfutures.js +126 -2
  19. package/dist/cjs/src/mexc.js +44 -44
  20. package/dist/cjs/src/okx.js +9 -15
  21. package/dist/cjs/src/phemex.js +1 -0
  22. package/dist/cjs/src/pro/bitmart.js +38 -20
  23. package/dist/cjs/src/pro/bybit.js +5 -5
  24. package/dist/cjs/src/pro/cex.js +1 -1
  25. package/dist/cjs/src/pro/gemini.js +1 -1
  26. package/js/ccxt.d.ts +1 -1
  27. package/js/ccxt.js +1 -1
  28. package/js/src/abstract/bingx.d.ts +4 -0
  29. package/js/src/abstract/coinbasepro.d.ts +1 -0
  30. package/js/src/ascendex.js +28 -24
  31. package/js/src/base/Exchange.d.ts +8 -8
  32. package/js/src/base/Exchange.js +14 -14
  33. package/js/src/binance.d.ts +1 -1
  34. package/js/src/binance.js +561 -168
  35. package/js/src/bingx.d.ts +2 -0
  36. package/js/src/bingx.js +271 -25
  37. package/js/src/bitforex.js +2 -2
  38. package/js/src/bitget.js +13 -2
  39. package/js/src/bybit.js +3 -1
  40. package/js/src/coinbase.js +8 -6
  41. package/js/src/coinbasepro.js +1 -0
  42. package/js/src/coinlist.js +9 -7
  43. package/js/src/coinmetro.js +2 -1
  44. package/js/src/currencycom.js +1 -1
  45. package/js/src/htx.js +1 -1
  46. package/js/src/krakenfutures.d.ts +2 -0
  47. package/js/src/krakenfutures.js +126 -2
  48. package/js/src/mexc.js +44 -44
  49. package/js/src/okx.js +9 -15
  50. package/js/src/phemex.js +1 -0
  51. package/js/src/pro/bitmart.d.ts +2 -0
  52. package/js/src/pro/bitmart.js +38 -20
  53. package/js/src/pro/bybit.d.ts +1 -1
  54. package/js/src/pro/bybit.js +5 -5
  55. package/js/src/pro/cex.js +1 -1
  56. package/js/src/pro/gemini.js +1 -1
  57. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -177,7 +177,7 @@ var woo$1 = require('./src/pro/woo.js');
177
177
 
178
178
  //-----------------------------------------------------------------------------
179
179
  // this is updated by vss.js when building
180
- const version = '4.2.39';
180
+ const version = '4.2.41';
181
181
  Exchange["default"].ccxtVersion = version;
182
182
  const exchanges = {
183
183
  'ace': ace,
@@ -274,11 +274,14 @@ class ascendex extends ascendex$1 {
274
274
  'fillResponseFromRequest': true,
275
275
  },
276
276
  'networks': {
277
- 'BSC': 'BEP20 (BSC)',
277
+ 'BSC': 'BEP20 ' + '(BSC)',
278
278
  'ARB': 'arbitrum',
279
279
  'SOL': 'Solana',
280
280
  'AVAX': 'avalanche C chain',
281
281
  'OMNI': 'Omni',
282
+ 'TRC': 'TRC20',
283
+ 'TRX': 'TRC20',
284
+ 'ERC': 'ERC20',
282
285
  },
283
286
  'networksById': {
284
287
  'BEP20 (BSC)': 'BSC',
@@ -286,6 +289,16 @@ class ascendex extends ascendex$1 {
286
289
  'Solana': 'SOL',
287
290
  'avalanche C chain': 'AVAX',
288
291
  'Omni': 'OMNI',
292
+ 'TRC20': 'TRC20',
293
+ 'ERC20': 'ERC20',
294
+ 'GO20': 'GO20',
295
+ 'BEP2': 'BEP2',
296
+ 'Bitcoin': 'BTC',
297
+ 'Bitcoin ABC': 'BCH',
298
+ 'Litecoin': 'LTC',
299
+ 'Matic Network': 'MATIC',
300
+ 'xDai': 'STAKE',
301
+ 'Akash': 'AKT',
289
302
  },
290
303
  },
291
304
  'exceptions': {
@@ -2375,8 +2388,8 @@ class ascendex extends ascendex$1 {
2375
2388
  const tag = this.safeString(depositAddress, tagId);
2376
2389
  this.checkAddress(address);
2377
2390
  const code = (currency === undefined) ? undefined : currency['code'];
2378
- const chainName = this.safeString(depositAddress, 'chainName');
2379
- const network = this.safeNetwork(chainName);
2391
+ const chainName = this.safeString(depositAddress, 'blockchain');
2392
+ const network = this.networkIdToCode(chainName, code);
2380
2393
  return {
2381
2394
  'currency': code,
2382
2395
  'address': address,
@@ -2386,20 +2399,7 @@ class ascendex extends ascendex$1 {
2386
2399
  };
2387
2400
  }
2388
2401
  safeNetwork(networkId) {
2389
- const networksById = {
2390
- 'TRC20': 'TRC20',
2391
- 'ERC20': 'ERC20',
2392
- 'GO20': 'GO20',
2393
- 'BEP2': 'BEP2',
2394
- 'BEP20 (BSC)': 'BEP20',
2395
- 'Bitcoin': 'BTC',
2396
- 'Bitcoin ABC': 'BCH',
2397
- 'Litecoin': 'LTC',
2398
- 'Matic Network': 'MATIC',
2399
- 'Solana': 'SOL',
2400
- 'xDai': 'STAKE',
2401
- 'Akash': 'AKT',
2402
- };
2402
+ const networksById = this.safeDict(this.options, 'networksById');
2403
2403
  return this.safeString(networksById, networkId, networkId);
2404
2404
  }
2405
2405
  async fetchDepositAddress(code, params = {}) {
@@ -2407,16 +2407,20 @@ class ascendex extends ascendex$1 {
2407
2407
  * @method
2408
2408
  * @name ascendex#fetchDepositAddress
2409
2409
  * @description fetch the deposit address for a currency associated with this account
2410
+ * @see https://ascendex.github.io/ascendex-pro-api/#query-deposit-addresses
2410
2411
  * @param {string} code unified currency code
2411
2412
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2413
+ * @param {string} [params.network] unified network code for deposit chain
2412
2414
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
2413
2415
  */
2414
2416
  await this.loadMarkets();
2415
2417
  const currency = this.currency(code);
2416
- const chainName = this.safeString(params, 'chainName');
2417
- params = this.omit(params, 'chainName');
2418
+ const networkCode = this.safeString2(params, 'network', 'chainName');
2419
+ const networkId = this.networkCodeToId(networkCode);
2420
+ params = this.omit(params, ['chainName']);
2418
2421
  const request = {
2419
2422
  'asset': currency['id'],
2423
+ 'blockchain': networkId,
2420
2424
  };
2421
2425
  const response = await this.v1PrivateGetWalletDepositAddress(this.extend(request, params));
2422
2426
  //
@@ -2452,22 +2456,22 @@ class ascendex extends ascendex$1 {
2452
2456
  // }
2453
2457
  // }
2454
2458
  //
2455
- const data = this.safeValue(response, 'data', {});
2456
- const addresses = this.safeValue(data, 'address', []);
2459
+ const data = this.safeDict(response, 'data', {});
2460
+ const addresses = this.safeList(data, 'address', []);
2457
2461
  const numAddresses = addresses.length;
2458
2462
  let address = undefined;
2459
2463
  if (numAddresses > 1) {
2460
2464
  const addressesByChainName = this.indexBy(addresses, 'chainName');
2461
- if (chainName === undefined) {
2465
+ if (networkId === undefined) {
2462
2466
  const chainNames = Object.keys(addressesByChainName);
2463
2467
  const chains = chainNames.join(', ');
2464
2468
  throw new errors.ArgumentsRequired(this.id + ' fetchDepositAddress() returned more than one address, a chainName parameter is required, one of ' + chains);
2465
2469
  }
2466
- address = this.safeValue(addressesByChainName, chainName, {});
2470
+ address = this.safeDict(addressesByChainName, networkId, {});
2467
2471
  }
2468
2472
  else {
2469
2473
  // first address
2470
- address = this.safeValue(addresses, 0, {});
2474
+ address = this.safeDict(addresses, 0, {});
2471
2475
  }
2472
2476
  const result = this.parseDepositAddress(address, currency);
2473
2477
  return this.extend(result, {
@@ -3196,14 +3196,14 @@ class Exchange {
3196
3196
  }
3197
3197
  defaultNetworkCode(currencyCode) {
3198
3198
  let defaultNetworkCode = undefined;
3199
- const defaultNetworks = this.safeValue(this.options, 'defaultNetworks', {});
3199
+ const defaultNetworks = this.safeDict(this.options, 'defaultNetworks', {});
3200
3200
  if (currencyCode in defaultNetworks) {
3201
3201
  // if currency had set its network in "defaultNetworks", use it
3202
3202
  defaultNetworkCode = defaultNetworks[currencyCode];
3203
3203
  }
3204
3204
  else {
3205
3205
  // otherwise, try to use the global-scope 'defaultNetwork' value (even if that network is not supported by currency, it doesn't make any problem, this will be just used "at first" if currency supports this network at all)
3206
- const defaultNetwork = this.safeValue(this.options, 'defaultNetwork');
3206
+ const defaultNetwork = this.safeDict(this.options, 'defaultNetwork');
3207
3207
  if (defaultNetwork !== undefined) {
3208
3208
  defaultNetworkCode = defaultNetwork;
3209
3209
  }
@@ -3708,14 +3708,14 @@ class Exchange {
3708
3708
  throw new errors.NotSupported(this.id + ' fetchStatus() is not supported yet');
3709
3709
  }
3710
3710
  async fetchFundingFee(code, params = {}) {
3711
- const warnOnFetchFundingFee = this.safeValue(this.options, 'warnOnFetchFundingFee', true);
3711
+ const warnOnFetchFundingFee = this.safeBool(this.options, 'warnOnFetchFundingFee', true);
3712
3712
  if (warnOnFetchFundingFee) {
3713
3713
  throw new errors.NotSupported(this.id + ' fetchFundingFee() method is deprecated, it will be removed in July 2022, please, use fetchTransactionFee() or set exchange.options["warnOnFetchFundingFee"] = false to suppress this warning');
3714
3714
  }
3715
3715
  return await this.fetchTransactionFee(code, params);
3716
3716
  }
3717
3717
  async fetchFundingFees(codes = undefined, params = {}) {
3718
- const warnOnFetchFundingFees = this.safeValue(this.options, 'warnOnFetchFundingFees', true);
3718
+ const warnOnFetchFundingFees = this.safeBool(this.options, 'warnOnFetchFundingFees', true);
3719
3719
  if (warnOnFetchFundingFees) {
3720
3720
  throw new errors.NotSupported(this.id + ' fetchFundingFees() method is deprecated, it will be removed in July 2022. Please, use fetchTransactionFees() or set exchange.options["warnOnFetchFundingFees"] = false to suppress this warning');
3721
3721
  }
@@ -3766,7 +3766,7 @@ class Exchange {
3766
3766
  throw new errors.NotSupported(this.id + ' fetchIsolatedBorrowRate() is not supported yet');
3767
3767
  }
3768
3768
  const borrowRates = await this.fetchIsolatedBorrowRates(params);
3769
- const rate = this.safeValue(borrowRates, symbol);
3769
+ const rate = this.safeDict(borrowRates, symbol);
3770
3770
  if (rate === undefined) {
3771
3771
  throw new errors.ExchangeError(this.id + ' fetchIsolatedBorrowRate() could not find the borrow rate for market symbol ' + symbol);
3772
3772
  }
@@ -3827,7 +3827,7 @@ class Exchange {
3827
3827
  }
3828
3828
  handleMarketTypeAndParams(methodName, market = undefined, params = {}) {
3829
3829
  const defaultType = this.safeString2(this.options, 'defaultType', 'type', 'spot');
3830
- const methodOptions = this.safeValue(this.options, methodName);
3830
+ const methodOptions = this.safeDict(this.options, methodName);
3831
3831
  let methodType = defaultType;
3832
3832
  if (methodOptions !== undefined) {
3833
3833
  if (typeof methodOptions === 'string') {
@@ -3863,7 +3863,7 @@ class Exchange {
3863
3863
  }
3864
3864
  // if it was not defined in market object
3865
3865
  if (subType === undefined) {
3866
- const values = this.handleOptionAndParams(undefined, methodName, 'subType', defaultValue); // no need to re-test params here
3866
+ const values = this.handleOptionAndParams({}, methodName, 'subType', defaultValue); // no need to re-test params here
3867
3867
  subType = values[0];
3868
3868
  }
3869
3869
  }
@@ -3919,7 +3919,7 @@ class Exchange {
3919
3919
  const market = this.market(symbol);
3920
3920
  symbol = market['symbol'];
3921
3921
  const tickers = await this.fetchTickers([symbol], params);
3922
- const ticker = this.safeValue(tickers, symbol);
3922
+ const ticker = this.safeDict(tickers, symbol);
3923
3923
  if (ticker === undefined) {
3924
3924
  throw new errors.NullResponse(this.id + ' fetchTickers() could not find a ticker for ' + symbol);
3925
3925
  }
@@ -3956,7 +3956,7 @@ class Exchange {
3956
3956
  return order['status'];
3957
3957
  }
3958
3958
  async fetchUnifiedOrder(order, params = {}) {
3959
- return await this.fetchOrder(this.safeValue(order, 'id'), this.safeValue(order, 'symbol'), params);
3959
+ return await this.fetchOrder(this.safeString(order, 'id'), this.safeString(order, 'symbol'), params);
3960
3960
  }
3961
3961
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
3962
3962
  throw new errors.NotSupported(this.id + ' createOrder() is not supported yet');
@@ -4226,7 +4226,7 @@ class Exchange {
4226
4226
  throw new errors.NotSupported(this.id + ' cancelAllOrdersWs() is not supported yet');
4227
4227
  }
4228
4228
  async cancelUnifiedOrder(order, params = {}) {
4229
- return this.cancelOrder(this.safeValue(order, 'id'), this.safeValue(order, 'symbol'), params);
4229
+ return this.cancelOrder(this.safeString(order, 'id'), this.safeString(order, 'symbol'), params);
4230
4230
  }
4231
4231
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4232
4232
  if (this.has['fetchOpenOrders'] && this.has['fetchClosedOrders']) {
@@ -4718,7 +4718,7 @@ class Exchange {
4718
4718
  return result;
4719
4719
  }
4720
4720
  isTriggerOrder(params) {
4721
- const isTrigger = this.safeValue2(params, 'trigger', 'stop');
4721
+ const isTrigger = this.safeBool2(params, 'trigger', 'stop');
4722
4722
  if (isTrigger) {
4723
4723
  params = this.omit(params, ['trigger', 'stop']);
4724
4724
  }
@@ -4734,7 +4734,7 @@ class Exchange {
4734
4734
  * @returns {boolean} true if a post only order, false otherwise
4735
4735
  */
4736
4736
  const timeInForce = this.safeStringUpper(params, 'timeInForce');
4737
- let postOnly = this.safeValue2(params, 'postOnly', 'post_only', false);
4737
+ let postOnly = this.safeBool2(params, 'postOnly', 'post_only', false);
4738
4738
  // we assume timeInForce is uppercase from safeStringUpper (params, 'timeInForce')
4739
4739
  const ioc = timeInForce === 'IOC';
4740
4740
  const fok = timeInForce === 'FOK';
@@ -4928,7 +4928,7 @@ class Exchange {
4928
4928
  * @param {string} account key for account name in this.options['accountsByType']
4929
4929
  * @returns the exchange specific account name or the isolated margin id for transfers
4930
4930
  */
4931
- const accountsByType = this.safeValue(this.options, 'accountsByType', {});
4931
+ const accountsByType = this.safeDict(this.options, 'accountsByType', {});
4932
4932
  const lowercaseAccount = account.toLowerCase();
4933
4933
  if (lowercaseAccount in accountsByType) {
4934
4934
  return accountsByType[lowercaseAccount];
@@ -5405,7 +5405,7 @@ class Exchange {
5405
5405
  return input;
5406
5406
  }
5407
5407
  handleUntilOption(key, request, params, multiplier = 1) {
5408
- const until = this.safeValue2(params, 'until', 'till');
5408
+ const until = this.safeInteger2(params, 'until', 'till');
5409
5409
  if (until !== undefined) {
5410
5410
  request[key] = this.parseToInt(until * multiplier);
5411
5411
  params = this.omit(params, ['until', 'till']);