ccxt 4.4.85 → 4.4.87

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 (115) hide show
  1. package/README.md +18 -7
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +16 -9
  4. package/dist/cjs/src/abstract/bittrade.js +9 -0
  5. package/dist/cjs/src/abstract/modetrade.js +9 -0
  6. package/dist/cjs/src/ascendex.js +189 -155
  7. package/dist/cjs/src/base/Exchange.js +10 -8
  8. package/dist/cjs/src/bequant.js +1 -1
  9. package/dist/cjs/src/binance.js +1 -1
  10. package/dist/cjs/src/bitget.js +5 -4
  11. package/dist/cjs/src/bitmart.js +1 -1
  12. package/dist/cjs/src/bitteam.js +31 -0
  13. package/dist/cjs/src/bittrade.js +2049 -0
  14. package/dist/cjs/src/coinbase.js +2 -6
  15. package/dist/cjs/src/coinmetro.js +5 -1
  16. package/dist/cjs/src/deribit.js +4 -5
  17. package/dist/cjs/src/derive.js +4 -5
  18. package/dist/cjs/src/ellipx.js +2 -3
  19. package/dist/cjs/src/gate.js +92 -76
  20. package/dist/cjs/src/hollaex.js +107 -49
  21. package/dist/cjs/src/htx.js +30 -52
  22. package/dist/cjs/src/hyperliquid.js +36 -20
  23. package/dist/cjs/src/kraken.js +5 -8
  24. package/dist/cjs/src/mexc.js +2 -2
  25. package/dist/cjs/src/modetrade.js +2839 -0
  26. package/dist/cjs/src/ndax.js +25 -24
  27. package/dist/cjs/src/okcoin.js +12 -31
  28. package/dist/cjs/src/okx.js +104 -2
  29. package/dist/cjs/src/okxus.js +53 -0
  30. package/dist/cjs/src/onetrading.js +9 -6
  31. package/dist/cjs/src/oxfun.js +42 -114
  32. package/dist/cjs/src/paradex.js +10 -1
  33. package/dist/cjs/src/phemex.js +4 -6
  34. package/dist/cjs/src/poloniex.js +181 -170
  35. package/dist/cjs/src/pro/binance.js +1 -0
  36. package/dist/cjs/src/pro/bittrade.js +605 -0
  37. package/dist/cjs/src/pro/luno.js +6 -5
  38. package/dist/cjs/src/pro/mexc.js +3 -0
  39. package/dist/cjs/src/pro/modetrade.js +1334 -0
  40. package/dist/cjs/src/pro/okxus.js +38 -0
  41. package/dist/cjs/src/probit.js +18 -51
  42. package/dist/cjs/src/timex.js +5 -10
  43. package/dist/cjs/src/vertex.js +3 -4
  44. package/dist/cjs/src/whitebit.js +41 -11
  45. package/dist/cjs/src/woo.js +101 -77
  46. package/dist/cjs/src/woofipro.js +24 -21
  47. package/dist/cjs/src/xt.js +36 -44
  48. package/js/ccxt.d.ts +20 -11
  49. package/js/ccxt.js +14 -8
  50. package/js/src/abstract/modetrade.d.ts +122 -0
  51. package/js/src/abstract/myokx.d.ts +2 -0
  52. package/js/src/abstract/okx.d.ts +2 -0
  53. package/js/src/abstract/okxus.d.ts +352 -0
  54. package/js/src/abstract/okxus.js +11 -0
  55. package/js/src/ascendex.d.ts +2 -0
  56. package/js/src/ascendex.js +189 -155
  57. package/js/src/base/Exchange.js +10 -8
  58. package/js/src/bequant.js +1 -1
  59. package/js/src/binance.js +1 -1
  60. package/js/src/bitget.js +5 -4
  61. package/js/src/bitmart.js +1 -1
  62. package/js/src/bitteam.js +31 -0
  63. package/js/src/{huobijp.d.ts → bittrade.d.ts} +29 -29
  64. package/js/src/{huobijp.js → bittrade.js} +35 -35
  65. package/js/src/coinbase.js +2 -6
  66. package/js/src/coinmetro.js +5 -1
  67. package/js/src/deribit.js +4 -5
  68. package/js/src/derive.js +4 -3
  69. package/js/src/ellipx.d.ts +1 -1
  70. package/js/src/ellipx.js +3 -5
  71. package/js/src/gate.js +92 -76
  72. package/js/src/hollaex.js +107 -49
  73. package/js/src/htx.js +30 -52
  74. package/js/src/hyperliquid.js +36 -20
  75. package/js/src/kraken.js +5 -8
  76. package/js/src/mexc.js +2 -2
  77. package/js/src/modetrade.d.ts +475 -0
  78. package/js/src/modetrade.js +2840 -0
  79. package/js/src/ndax.js +25 -24
  80. package/js/src/okcoin.js +12 -31
  81. package/js/src/okx.d.ts +24 -1
  82. package/js/src/okx.js +104 -2
  83. package/js/src/okxus.d.ts +4 -0
  84. package/js/src/okxus.js +54 -0
  85. package/js/src/onetrading.js +9 -6
  86. package/js/src/oxfun.js +42 -114
  87. package/js/src/paradex.js +10 -1
  88. package/js/src/phemex.js +4 -6
  89. package/js/src/poloniex.d.ts +2 -0
  90. package/js/src/poloniex.js +181 -170
  91. package/js/src/pro/binance.js +1 -0
  92. package/js/src/pro/{huobijp.d.ts → bittrade.d.ts} +6 -6
  93. package/js/src/pro/{huobijp.js → bittrade.js} +7 -7
  94. package/js/src/pro/luno.js +6 -5
  95. package/js/src/pro/mexc.js +3 -0
  96. package/js/src/pro/modetrade.d.ts +155 -0
  97. package/js/src/pro/modetrade.js +1335 -0
  98. package/js/src/pro/okxus.d.ts +4 -0
  99. package/js/src/pro/okxus.js +39 -0
  100. package/js/src/probit.js +18 -51
  101. package/js/src/timex.js +5 -10
  102. package/js/src/vertex.js +3 -4
  103. package/js/src/whitebit.js +42 -11
  104. package/js/src/woo.d.ts +2 -0
  105. package/js/src/woo.js +101 -77
  106. package/js/src/woofipro.d.ts +2 -1
  107. package/js/src/woofipro.js +24 -21
  108. package/js/src/xt.js +36 -44
  109. package/package.json +1 -1
  110. package/js/src/abstract/kuna.d.ts +0 -185
  111. package/js/src/kuna.d.ts +0 -335
  112. package/js/src/kuna.js +0 -2006
  113. /package/js/src/abstract/{huobijp.d.ts → bittrade.d.ts} +0 -0
  114. /package/js/src/abstract/{huobijp.js → bittrade.js} +0 -0
  115. /package/js/src/abstract/{kuna.js → modetrade.js} +0 -0
package/js/src/gate.js CHANGED
@@ -111,7 +111,7 @@ export default class gate extends Exchange {
111
111
  'fetchCurrencies': true,
112
112
  'fetchDepositAddress': true,
113
113
  'fetchDepositAddresses': false,
114
- 'fetchDepositAddressesByNetwork': false,
114
+ 'fetchDepositAddressesByNetwork': true,
115
115
  'fetchDeposits': true,
116
116
  'fetchDepositWithdrawFee': 'emulated',
117
117
  'fetchDepositWithdrawFees': true,
@@ -720,6 +720,16 @@ export default class gate extends Exchange {
720
720
  },
721
721
  'networksById': {
722
722
  'OPETH': 'OP',
723
+ 'ETH': 'ERC20',
724
+ 'ERC20': 'ERC20',
725
+ 'TRX': 'TRC20',
726
+ 'TRC20': 'TRC20',
727
+ 'HT': 'HRC20',
728
+ 'HECO': 'HRC20',
729
+ 'BSC': 'BEP20',
730
+ 'BEP20': 'BEP20',
731
+ 'POLYGON': 'MATIC',
732
+ 'POL': 'MATIC',
723
733
  },
724
734
  'timeInForce': {
725
735
  'GTC': 'gtc',
@@ -1216,6 +1226,9 @@ export default class gate extends Exchange {
1216
1226
  if (this.options['adjustForTimeDifference']) {
1217
1227
  await this.loadTimeDifference();
1218
1228
  }
1229
+ if (this.checkRequiredCredentials(false)) {
1230
+ await this.loadUnifiedStatus();
1231
+ }
1219
1232
  const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
1220
1233
  let rawPromises = [
1221
1234
  this.fetchContractMarkets(params),
@@ -1829,88 +1842,93 @@ export default class gate extends Exchange {
1829
1842
  if (apiBackup !== undefined) {
1830
1843
  return undefined;
1831
1844
  }
1832
- if (this.checkRequiredCredentials(false)) {
1833
- await this.loadUnifiedStatus();
1834
- }
1835
1845
  const response = await this.publicSpotGetCurrencies(params);
1836
1846
  //
1837
- // [
1838
- // {
1839
- // "currency": "USDT_ETH",
1840
- // "name": "Tether",
1841
- // "delisted": false,
1842
- // "withdraw_disabled": false,
1843
- // "withdraw_delayed": false,
1844
- // "deposit_disabled": false,
1845
- // "trade_disabled": true,
1846
- // "chain": "ETH"
1847
- // },
1848
- // ]
1847
+ // [
1848
+ // {
1849
+ // "currency": "USDT",
1850
+ // "name": "Tether",
1851
+ // "delisted": false,
1852
+ // "withdraw_disabled": false,
1853
+ // "withdraw_delayed": false,
1854
+ // "deposit_disabled": false,
1855
+ // "trade_disabled": false,
1856
+ // "fixed_rate": "",
1857
+ // "chain": "ETH",
1858
+ // "chains": [
1859
+ // {
1860
+ // "name": "ETH",
1861
+ // "addr": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
1862
+ // "withdraw_disabled": false,
1863
+ // "withdraw_delayed": false,
1864
+ // "deposit_disabled": false
1865
+ // },
1866
+ // {
1867
+ // "name": "ARBEVM",
1868
+ // "addr": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
1869
+ // "withdraw_disabled": false,
1870
+ // "withdraw_delayed": false,
1871
+ // "deposit_disabled": false
1872
+ // },
1873
+ // {
1874
+ // "name": "BSC",
1875
+ // "addr": "0x55d398326f99059fF775485246999027B3197955",
1876
+ // "withdraw_disabled": false,
1877
+ // "withdraw_delayed": false,
1878
+ // "deposit_disabled": false
1879
+ // },
1880
+ // ]
1881
+ // },
1882
+ // ]
1849
1883
  //
1850
1884
  const indexedCurrencies = this.indexBy(response, 'currency');
1851
1885
  const result = {};
1852
1886
  for (let i = 0; i < response.length; i++) {
1853
1887
  const entry = response[i];
1854
1888
  const currencyId = this.safeString(entry, 'currency');
1855
- const parts = currencyId.split('_');
1856
- const partFirst = this.safeString(parts, 0);
1857
- // if there's an underscore then the second part is always the chain name (except the _OLD suffix)
1858
- const currencyName = currencyId.endsWith('_OLD') ? currencyId : partFirst;
1859
- const withdrawDisabled = this.safeBool(entry, 'withdraw_disabled', false);
1860
- const depositDisabled = this.safeBool(entry, 'deposit_disabled', false);
1861
- const tradeDisabled = this.safeBool(entry, 'trade_disabled', false);
1862
- const precision = this.parseNumber('0.0001'); // temporary safe default, because no value provided from API
1863
- const code = this.safeCurrencyCode(currencyName);
1889
+ const code = this.safeCurrencyCode(currencyId);
1864
1890
  // check leveraged tokens (e.g. BTC3S, ETH5L)
1865
- let isLeveragedToken = false;
1866
- if (currencyId.endsWith('3S') || currencyId.endsWith('3L') || currencyId.endsWith('5S') || currencyId.endsWith('5L')) {
1867
- const realCurrencyId = currencyId.slice(0, -2);
1868
- if (realCurrencyId in indexedCurrencies) {
1869
- isLeveragedToken = true;
1870
- }
1871
- }
1872
- const type = isLeveragedToken ? 'leveraged' : 'crypto';
1873
- // some networks are null, they are mostly obsolete & unsupported dead tokens, so we can default their networkId to their tokenname
1874
- const networkId = this.safeString(entry, 'chain', currencyId);
1875
- const networkCode = this.networkIdToCode(networkId, code);
1876
- const networkEntry = {
1877
- 'info': entry,
1878
- 'id': networkId,
1879
- 'network': networkCode,
1880
- 'limits': {
1881
- 'deposit': {
1882
- 'min': undefined,
1883
- 'max': undefined,
1884
- },
1885
- 'withdraw': {
1886
- 'min': undefined,
1887
- 'max': undefined,
1891
+ const type = this.isLeveragedCurrency(currencyId, true, indexedCurrencies) ? 'leveraged' : 'crypto';
1892
+ const chains = this.safeList(entry, 'chains', []);
1893
+ const networks = {};
1894
+ for (let j = 0; j < chains.length; j++) {
1895
+ const chain = chains[j];
1896
+ const networkId = this.safeString(chain, 'name');
1897
+ const networkCode = this.networkIdToCode(networkId);
1898
+ networks[networkCode] = {
1899
+ 'info': chain,
1900
+ 'id': networkId,
1901
+ 'network': networkCode,
1902
+ 'active': undefined,
1903
+ 'deposit': !this.safeBool(chain, 'deposit_disabled'),
1904
+ 'withdraw': !this.safeBool(chain, 'withdraw_disabled'),
1905
+ 'fee': undefined,
1906
+ 'precision': this.parseNumber('0.0001'),
1907
+ 'limits': {
1908
+ 'deposit': {
1909
+ 'min': undefined,
1910
+ 'max': undefined,
1911
+ },
1912
+ 'withdraw': {
1913
+ 'min': undefined,
1914
+ 'max': undefined,
1915
+ },
1888
1916
  },
1889
- },
1890
- 'active': !tradeDisabled,
1891
- 'deposit': !depositDisabled,
1892
- 'withdraw': !withdrawDisabled,
1893
- 'fee': undefined,
1894
- 'precision': precision,
1895
- };
1896
- // check if first entry for the specific currency
1897
- if (!(code in result)) {
1898
- result[code] = {
1899
- 'id': currencyName,
1900
- 'lowerCaseId': currencyName.toLowerCase(),
1901
- 'code': code,
1902
- 'type': type,
1903
- 'precision': precision,
1904
- 'limits': undefined,
1905
- 'networks': {},
1906
- 'info': [], // will be filled below
1907
1917
  };
1908
1918
  }
1909
- result[code]['networks'][networkCode] = networkEntry;
1910
- const info = this.safeList(result[code], 'info', []);
1911
- info.push(entry);
1912
- result[code]['info'] = info;
1913
- result[code] = this.safeCurrencyStructure(result[code]); // this is needed after adding network entry
1919
+ result[code] = this.safeCurrencyStructure({
1920
+ 'id': currencyId,
1921
+ 'code': code,
1922
+ 'name': this.safeString(entry, 'name'),
1923
+ 'type': type,
1924
+ 'active': !this.safeBool(entry, 'delisted'),
1925
+ 'deposit': !this.safeBool(entry, 'deposit_disabled'),
1926
+ 'withdraw': !this.safeBool(entry, 'withdraw_disabled'),
1927
+ 'fee': undefined,
1928
+ 'networks': networks,
1929
+ 'precision': this.parseNumber('0.0001'),
1930
+ 'info': entry,
1931
+ });
1914
1932
  }
1915
1933
  return result;
1916
1934
  }
@@ -2182,9 +2200,7 @@ export default class gate extends Exchange {
2182
2200
  const chains = this.safeValue(response, 'multichain_addresses', []);
2183
2201
  const currencyId = this.safeString(response, 'currency');
2184
2202
  currency = this.safeCurrency(currencyId, currency);
2185
- const parsed = this.parseDepositAddresses(chains, [currency['code']], false, {
2186
- 'currency': currency['id'],
2187
- });
2203
+ const parsed = this.parseDepositAddresses(chains, undefined, false);
2188
2204
  return this.indexBy(parsed, 'network');
2189
2205
  }
2190
2206
  /**
@@ -2202,8 +2218,8 @@ export default class gate extends Exchange {
2202
2218
  let networkCode = undefined;
2203
2219
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
2204
2220
  const chainsIndexedById = await this.fetchDepositAddressesByNetwork(code, params);
2205
- const selectedNetworkId = this.selectNetworkCodeFromUnifiedNetworks(code, networkCode, chainsIndexedById);
2206
- return chainsIndexedById[selectedNetworkId];
2221
+ const selectedNetworkIdOrCode = this.selectNetworkCodeFromUnifiedNetworks(code, networkCode, chainsIndexedById);
2222
+ return chainsIndexedById[selectedNetworkIdOrCode];
2207
2223
  }
2208
2224
  parseDepositAddress(depositAddress, currency = undefined) {
2209
2225
  //
package/js/src/hollaex.js CHANGED
@@ -287,6 +287,14 @@ export default class hollaex extends Exchange {
287
287
  'BNB': 'bnb',
288
288
  'MATIC': 'matic',
289
289
  },
290
+ 'networksById': {
291
+ 'eth': 'ERC20',
292
+ 'ETH': 'ERC20',
293
+ 'ERC20': 'ERC20',
294
+ 'trx': 'TRC20',
295
+ 'TRX': 'TRC20',
296
+ 'TRC20': 'TRC20',
297
+ },
290
298
  },
291
299
  });
292
300
  }
@@ -417,66 +425,116 @@ export default class hollaex extends Exchange {
417
425
  async fetchCurrencies(params = {}) {
418
426
  const response = await this.publicGetConstants(params);
419
427
  //
420
- // {
421
- // "coins":{
422
- // "bch":{
423
- // "id":4,
424
- // "fullname":"Bitcoin Cash",
425
- // "symbol":"bch",
426
- // "active":true,
427
- // "verified":true,
428
- // "allow_deposit":true,
429
- // "allow_withdrawal":true,
430
- // "withdrawal_fee":0.0002,
431
- // "min":0.001,
432
- // "max":100000,
433
- // "increment_unit":0.001,
434
- // "logo":"https://bitholla.s3.ap-northeast-2.amazonaws.com/icon/BCH-hollaex-asset-01.svg",
435
- // "code":"bch",
436
- // "is_public":true,
437
- // "meta":{},
438
- // "estimated_price":null,
439
- // "description":null,
440
- // "type":"blockchain",
441
- // "network":null,
442
- // "standard":null,
443
- // "issuer":"HollaEx",
444
- // "withdrawal_fees":null,
445
- // "created_at":"2019-08-09T10:45:43.367Z",
446
- // "updated_at":"2021-12-13T03:08:32.372Z",
447
- // "created_by":1,
448
- // "owner_id":1
449
- // },
428
+ // {
429
+ // "coins": {
430
+ // "usdt": {
431
+ // "id": "6",
432
+ // "fullname": "USD Tether",
433
+ // "symbol": "usdt",
434
+ // "active": true,
435
+ // "verified": true,
436
+ // "allow_deposit": true,
437
+ // "allow_withdrawal": true,
438
+ // "withdrawal_fee": "20",
439
+ // "min": "1",
440
+ // "max": "10000000",
441
+ // "increment_unit": "0.0001",
442
+ // "logo": "https://hollaex-resources.s3.ap-southeast-1.amazonaws.com/icons/usdt.svg",
443
+ // "code": "usdt",
444
+ // "is_public": true,
445
+ // "meta": {
446
+ // "color": "#27a17a",
447
+ // "website": "https://tether.to",
448
+ // "explorer": "https://blockchair.com/tether",
449
+ // "decimal_points": "6"
450
+ // },
451
+ // "estimated_price": "1",
452
+ // "description": "<p>Tether (USDT) is a stablecoin pegged 1:1 to the US dollar. It is a digital currency that aims to maintain its value while allowing for fast and secure transfer of funds. It was the first stablecoin, and is the most widely used due stablecoin due to its stability and low volatility compared to other cryptocurrencies. It was launched in 2014 by Tether Limited.</p>",
453
+ // "type": "blockchain",
454
+ // "network": "eth,trx,bnb,matic",
455
+ // "standard": "",
456
+ // "issuer": "HollaEx",
457
+ // "withdrawal_fees": {
458
+ // "bnb": {
459
+ // "value": "0.8",
460
+ // "active": true,
461
+ // "symbol": "usdt"
462
+ // },
463
+ // "eth": {
464
+ // "value": "1.5",
465
+ // "active": true,
466
+ // "symbol": "usdt"
467
+ // },
468
+ // "trx": {
469
+ // "value": "4",
470
+ // "active": true,
471
+ // "symbol": "usdt"
472
+ // },
473
+ // "matic": {
474
+ // "value": "0.3",
475
+ // "active": true,
476
+ // "symbol": "usdt"
477
+ // }
478
+ // },
479
+ // "display_name": null,
480
+ // "deposit_fees": null,
481
+ // "is_risky": false,
482
+ // "market_cap": "144568098696.29",
483
+ // "category": "stable",
484
+ // "created_at": "2019-08-09T10:45:43.367Z",
485
+ // "updated_at": "2025-03-25T17:12:37.970Z",
486
+ // "created_by": "168",
487
+ // "owner_id": "1"
488
+ // },
450
489
  // },
451
490
  // "network":"https://api.hollaex.network"
452
491
  // }
453
492
  //
454
- const coins = this.safeValue(response, 'coins', {});
493
+ const coins = this.safeDict(response, 'coins', {});
455
494
  const keys = Object.keys(coins);
456
495
  const result = {};
457
496
  for (let i = 0; i < keys.length; i++) {
458
497
  const key = keys[i];
459
498
  const currency = coins[key];
460
499
  const id = this.safeString(currency, 'symbol');
461
- const numericId = this.safeInteger(currency, 'id');
462
500
  const code = this.safeCurrencyCode(id);
463
- const name = this.safeString(currency, 'fullname');
464
- const depositEnabled = this.safeValue(currency, 'allow_deposit');
465
- const withdrawEnabled = this.safeValue(currency, 'allow_withdrawal');
466
- const isActive = this.safeValue(currency, 'active');
467
- const active = isActive && depositEnabled && withdrawEnabled;
468
- const fee = this.safeNumber(currency, 'withdrawal_fee');
469
- const withdrawalLimits = this.safeValue(currency, 'withdrawal_limits', []);
470
- result[code] = {
501
+ const withdrawalLimits = this.safeList(currency, 'withdrawal_limits', []);
502
+ const rawType = this.safeString(currency, 'type');
503
+ const type = (rawType === 'blockchain') ? 'crypto' : 'other';
504
+ const rawNetworks = this.safeDict(currency, 'withdrawal_fees', {});
505
+ const networks = {};
506
+ const networkIds = Object.keys(rawNetworks);
507
+ for (let j = 0; j < networkIds.length; j++) {
508
+ const networkId = networkIds[j];
509
+ const networkEntry = this.safeDict(rawNetworks, networkId);
510
+ const networkCode = this.networkIdToCode(networkId);
511
+ networks[networkCode] = {
512
+ 'id': networkId,
513
+ 'network': networkCode,
514
+ 'active': this.safeBool(networkEntry, 'active'),
515
+ 'deposit': undefined,
516
+ 'withdraw': undefined,
517
+ 'fee': this.safeNumber(networkEntry, 'value'),
518
+ 'precision': undefined,
519
+ 'limits': {
520
+ 'withdraw': {
521
+ 'min': undefined,
522
+ 'max': undefined,
523
+ },
524
+ },
525
+ 'info': networkEntry,
526
+ };
527
+ }
528
+ result[code] = this.safeCurrencyStructure({
471
529
  'id': id,
472
- 'numericId': numericId,
530
+ 'numericId': this.safeInteger(currency, 'id'),
473
531
  'code': code,
474
532
  'info': currency,
475
- 'name': name,
476
- 'active': active,
477
- 'deposit': depositEnabled,
478
- 'withdraw': withdrawEnabled,
479
- 'fee': fee,
533
+ 'name': this.safeString(currency, 'fullname'),
534
+ 'active': this.safeBool(currency, 'active'),
535
+ 'deposit': this.safeBool(currency, 'allow_deposit'),
536
+ 'withdraw': this.safeBool(currency, 'allow_withdrawal'),
537
+ 'fee': this.safeNumber(currency, 'withdrawal_fee'),
480
538
  'precision': this.safeNumber(currency, 'increment_unit'),
481
539
  'limits': {
482
540
  'amount': {
@@ -488,9 +546,9 @@ export default class hollaex extends Exchange {
488
546
  'max': this.safeValue(withdrawalLimits, 0),
489
547
  },
490
548
  },
491
- 'networks': {},
492
- 'type': 'crypto',
493
- };
549
+ 'networks': networks,
550
+ 'type': type,
551
+ });
494
552
  }
495
553
  return result;
496
554
  }
package/js/src/htx.js CHANGED
@@ -3436,9 +3436,8 @@ export default class htx extends Exchange {
3436
3436
  // }
3437
3437
  // ]
3438
3438
  // }
3439
- // }
3440
3439
  //
3441
- const data = this.safeValue(response, 'data', []);
3440
+ const data = this.safeList(response, 'data', []);
3442
3441
  const result = {};
3443
3442
  this.options['networkChainIdsByNames'] = {};
3444
3443
  this.options['networkNamesByChainIds'] = {};
@@ -3446,19 +3445,11 @@ export default class htx extends Exchange {
3446
3445
  const entry = data[i];
3447
3446
  const currencyId = this.safeString(entry, 'currency');
3448
3447
  const code = this.safeCurrencyCode(currencyId);
3449
- this.options['networkChainIdsByNames'][code] = {};
3450
- const chains = this.safeValue(entry, 'chains', []);
3451
- const networks = {};
3452
- const instStatus = this.safeString(entry, 'instStatus');
3453
3448
  const assetType = this.safeString(entry, 'assetType');
3454
3449
  const type = assetType === '1' ? 'crypto' : 'fiat';
3455
- const currencyActive = instStatus === 'normal';
3456
- let minPrecision = undefined;
3457
- let minDeposit = undefined;
3458
- let minWithdraw = undefined;
3459
- let maxWithdraw = undefined;
3460
- let deposit = false;
3461
- let withdraw = false;
3450
+ this.options['networkChainIdsByNames'][code] = {};
3451
+ const chains = this.safeList(entry, 'chains', []);
3452
+ const networks = {};
3462
3453
  for (let j = 0; j < chains.length; j++) {
3463
3454
  const chainEntry = chains[j];
3464
3455
  const uniqueChainId = this.safeString(chainEntry, 'chain'); // i.e. usdterc20, trc20usdt ...
@@ -3466,49 +3457,34 @@ export default class htx extends Exchange {
3466
3457
  this.options['networkChainIdsByNames'][code][title] = uniqueChainId;
3467
3458
  this.options['networkNamesByChainIds'][uniqueChainId] = title;
3468
3459
  const networkCode = this.networkIdToCode(uniqueChainId);
3469
- minDeposit = this.safeNumber(chainEntry, 'minDepositAmt');
3470
- minWithdraw = this.safeNumber(chainEntry, 'minWithdrawAmt');
3471
- maxWithdraw = this.safeNumber(chainEntry, 'maxWithdrawAmt');
3472
- const withdrawStatus = this.safeString(chainEntry, 'withdrawStatus');
3473
- const depositStatus = this.safeString(chainEntry, 'depositStatus');
3474
- const withdrawEnabled = (withdrawStatus === 'allowed');
3475
- const depositEnabled = (depositStatus === 'allowed');
3476
- withdraw = (withdrawEnabled) ? withdrawEnabled : withdraw;
3477
- deposit = (depositEnabled) ? depositEnabled : deposit;
3478
- const active = withdrawEnabled && depositEnabled;
3479
- const precision = this.parsePrecision(this.safeString(chainEntry, 'withdrawPrecision'));
3480
- if (precision !== undefined) {
3481
- minPrecision = (minPrecision === undefined) ? precision : Precise.stringMin(precision, minPrecision);
3482
- }
3483
- const fee = this.safeNumber(chainEntry, 'transactFeeWithdraw');
3484
3460
  networks[networkCode] = {
3485
3461
  'info': chainEntry,
3486
3462
  'id': uniqueChainId,
3487
3463
  'network': networkCode,
3488
3464
  'limits': {
3489
3465
  'deposit': {
3490
- 'min': minDeposit,
3466
+ 'min': this.safeNumber(chainEntry, 'minDepositAmt'),
3491
3467
  'max': undefined,
3492
3468
  },
3493
3469
  'withdraw': {
3494
- 'min': minWithdraw,
3495
- 'max': maxWithdraw,
3470
+ 'min': this.safeNumber(chainEntry, 'minWithdrawAmt'),
3471
+ 'max': this.safeNumber(chainEntry, 'maxWithdrawAmt'),
3496
3472
  },
3497
3473
  },
3498
- 'active': active,
3499
- 'deposit': depositEnabled,
3500
- 'withdraw': withdrawEnabled,
3501
- 'fee': fee,
3502
- 'precision': this.parseNumber(precision),
3474
+ 'active': undefined,
3475
+ 'deposit': this.safeString(chainEntry, 'depositStatus') === 'allowed',
3476
+ 'withdraw': this.safeString(chainEntry, 'withdrawStatus') === 'allowed',
3477
+ 'fee': this.safeNumber(chainEntry, 'transactFeeWithdraw'),
3478
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(chainEntry, 'withdrawPrecision'))),
3503
3479
  };
3504
3480
  }
3505
- result[code] = {
3481
+ result[code] = this.safeCurrencyStructure({
3506
3482
  'info': entry,
3507
3483
  'code': code,
3508
3484
  'id': currencyId,
3509
- 'active': currencyActive,
3510
- 'deposit': deposit,
3511
- 'withdraw': withdraw,
3485
+ 'active': this.safeString(entry, 'instStatus') === 'normal',
3486
+ 'deposit': undefined,
3487
+ 'withdraw': undefined,
3512
3488
  'fee': undefined,
3513
3489
  'name': undefined,
3514
3490
  'type': type,
@@ -3518,17 +3494,17 @@ export default class htx extends Exchange {
3518
3494
  'max': undefined,
3519
3495
  },
3520
3496
  'withdraw': {
3521
- 'min': minWithdraw,
3522
- 'max': maxWithdraw,
3497
+ 'min': undefined,
3498
+ 'max': undefined,
3523
3499
  },
3524
3500
  'deposit': {
3525
3501
  'min': undefined,
3526
3502
  'max': undefined,
3527
3503
  },
3528
3504
  },
3529
- 'precision': this.parseNumber(minPrecision),
3505
+ 'precision': undefined,
3530
3506
  'networks': networks,
3531
- };
3507
+ });
3532
3508
  }
3533
3509
  return result;
3534
3510
  }
@@ -4567,6 +4543,8 @@ export default class htx extends Exchange {
4567
4543
  const request = {};
4568
4544
  let marketType = undefined;
4569
4545
  [marketType, params] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
4546
+ let subType = undefined;
4547
+ [subType, params] = this.handleSubTypeAndParams('fetchOpenOrders', market, params, 'linear');
4570
4548
  let response = undefined;
4571
4549
  if (marketType === 'spot') {
4572
4550
  if (symbol !== undefined) {
@@ -4595,18 +4573,18 @@ export default class htx extends Exchange {
4595
4573
  response = await this.spotPrivateGetV1OrderOpenOrders(this.extend(request, params));
4596
4574
  }
4597
4575
  else {
4598
- if (symbol === undefined) {
4599
- throw new ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
4576
+ if (symbol !== undefined) {
4577
+ // throw new ArgumentsRequired (this.id + ' fetchOpenOrders() requires a symbol argument');
4578
+ request['contract_code'] = market['id'];
4600
4579
  }
4601
4580
  if (limit !== undefined) {
4602
4581
  request['page_size'] = limit;
4603
4582
  }
4604
- request['contract_code'] = market['id'];
4605
4583
  const trigger = this.safeBool2(params, 'stop', 'trigger');
4606
4584
  const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
4607
4585
  const trailing = this.safeBool(params, 'trailing', false);
4608
4586
  params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger']);
4609
- if (market['linear']) {
4587
+ if (subType === 'linear') {
4610
4588
  let marginMode = undefined;
4611
4589
  [marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
4612
4590
  marginMode = (marginMode === undefined) ? 'cross' : marginMode;
@@ -4639,8 +4617,8 @@ export default class htx extends Exchange {
4639
4617
  }
4640
4618
  }
4641
4619
  }
4642
- else if (market['inverse']) {
4643
- if (market['swap']) {
4620
+ else if (subType === 'inverse') {
4621
+ if (marketType === 'swap') {
4644
4622
  if (trigger) {
4645
4623
  response = await this.contractPrivatePostSwapApiV1SwapTriggerOpenorders(this.extend(request, params));
4646
4624
  }
@@ -4654,8 +4632,8 @@ export default class htx extends Exchange {
4654
4632
  response = await this.contractPrivatePostSwapApiV1SwapOpenorders(this.extend(request, params));
4655
4633
  }
4656
4634
  }
4657
- else if (market['future']) {
4658
- request['symbol'] = market['settleId'];
4635
+ else if (marketType === 'future') {
4636
+ request['symbol'] = this.safeString(market, 'settleId', 'usdt');
4659
4637
  if (trigger) {
4660
4638
  response = await this.contractPrivatePostApiV1ContractTriggerOpenorders(this.extend(request, params));
4661
4639
  }