ccxt 4.4.82 → 4.4.86

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 (145) hide show
  1. package/README.md +6 -9
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +6 -17
  4. package/dist/cjs/src/abstract/bittrade.js +9 -0
  5. package/dist/cjs/src/apex.js +2 -1
  6. package/dist/cjs/src/ascendex.js +189 -155
  7. package/dist/cjs/src/base/Exchange.js +15 -2
  8. package/dist/cjs/src/bequant.js +1 -1
  9. package/dist/cjs/src/bitget.js +6 -7
  10. package/dist/cjs/src/bitmart.js +1 -1
  11. package/dist/cjs/src/bitrue.js +14 -35
  12. package/dist/cjs/src/bitso.js +33 -0
  13. package/dist/cjs/src/bitstamp.js +33 -0
  14. package/dist/cjs/src/bittrade.js +2049 -0
  15. package/dist/cjs/src/blofin.js +154 -13
  16. package/dist/cjs/src/btcbox.js +25 -5
  17. package/dist/cjs/src/bybit.js +16 -40
  18. package/dist/cjs/src/cex.js +2 -4
  19. package/dist/cjs/src/coinbase.js +58 -46
  20. package/dist/cjs/src/coinbaseexchange.js +142 -32
  21. package/dist/cjs/src/coincatch.js +14 -67
  22. package/dist/cjs/src/coinex.js +29 -32
  23. package/dist/cjs/src/coinlist.js +16 -15
  24. package/dist/cjs/src/coinmetro.js +22 -11
  25. package/dist/cjs/src/coinone.js +8 -10
  26. package/dist/cjs/src/coinsph.js +126 -1
  27. package/dist/cjs/src/cryptocom.js +111 -1
  28. package/dist/cjs/src/cryptomus.js +43 -89
  29. package/dist/cjs/src/delta.js +76 -36
  30. package/dist/cjs/src/deribit.js +4 -5
  31. package/dist/cjs/src/derive.js +46 -10
  32. package/dist/cjs/src/ellipx.js +175 -79
  33. package/dist/cjs/src/gate.js +1 -1
  34. package/dist/cjs/src/gemini.js +3 -5
  35. package/dist/cjs/src/hitbtc.js +56 -69
  36. package/dist/cjs/src/hollaex.js +107 -49
  37. package/dist/cjs/src/htx.js +20 -44
  38. package/dist/cjs/src/hyperliquid.js +6 -6
  39. package/dist/cjs/src/kraken.js +29 -24
  40. package/dist/cjs/src/kucoinfutures.js +6 -0
  41. package/dist/cjs/src/lbank.js +1 -1
  42. package/dist/cjs/src/mexc.js +2 -2
  43. package/dist/cjs/src/ndax.js +25 -24
  44. package/dist/cjs/src/okcoin.js +12 -31
  45. package/dist/cjs/src/okx.js +9 -0
  46. package/dist/cjs/src/onetrading.js +9 -6
  47. package/dist/cjs/src/oxfun.js +42 -114
  48. package/dist/cjs/src/paradex.js +124 -4
  49. package/dist/cjs/src/pro/binance.js +32 -33
  50. package/dist/cjs/src/pro/bithumb.js +5 -3
  51. package/dist/cjs/src/pro/bittrade.js +605 -0
  52. package/dist/cjs/src/pro/kraken.js +289 -79
  53. package/dist/cjs/src/pro/luno.js +6 -5
  54. package/dist/cjs/src/pro/mexc.js +304 -7
  55. package/dist/cjs/src/pro/poloniex.js +6 -2
  56. package/examples/js/cli.js +127 -13
  57. package/js/ccxt.d.ts +8 -20
  58. package/js/ccxt.js +6 -14
  59. package/js/src/abstract/blofin.d.ts +8 -0
  60. package/js/src/abstract/btcbox.d.ts +1 -0
  61. package/js/src/abstract/myokx.d.ts +2 -0
  62. package/js/src/abstract/okx.d.ts +2 -0
  63. package/js/src/apex.js +2 -1
  64. package/js/src/ascendex.d.ts +2 -0
  65. package/js/src/ascendex.js +189 -155
  66. package/js/src/base/Exchange.d.ts +15 -1
  67. package/js/src/base/Exchange.js +15 -2
  68. package/js/src/base/types.d.ts +3 -0
  69. package/js/src/bequant.js +1 -1
  70. package/js/src/bitget.js +6 -7
  71. package/js/src/bitmart.js +1 -1
  72. package/js/src/bitrue.js +14 -35
  73. package/js/src/bitso.js +33 -0
  74. package/js/src/bitstamp.js +33 -0
  75. package/js/src/{huobijp.d.ts → bittrade.d.ts} +29 -29
  76. package/js/src/{huobijp.js → bittrade.js} +35 -35
  77. package/js/src/blofin.d.ts +42 -2
  78. package/js/src/blofin.js +154 -13
  79. package/js/src/btcbox.js +25 -5
  80. package/js/src/bybit.js +16 -40
  81. package/js/src/cex.js +2 -4
  82. package/js/src/coinbase.js +58 -46
  83. package/js/src/coinbaseexchange.js +142 -32
  84. package/js/src/coincatch.js +14 -67
  85. package/js/src/coinex.js +28 -29
  86. package/js/src/coinlist.js +16 -15
  87. package/js/src/coinmetro.js +22 -11
  88. package/js/src/coinone.js +8 -10
  89. package/js/src/coinsph.d.ts +10 -1
  90. package/js/src/coinsph.js +126 -1
  91. package/js/src/cryptocom.d.ts +10 -1
  92. package/js/src/cryptocom.js +111 -1
  93. package/js/src/cryptomus.js +43 -89
  94. package/js/src/delta.js +76 -36
  95. package/js/src/deribit.js +4 -5
  96. package/js/src/derive.js +46 -10
  97. package/js/src/ellipx.d.ts +2 -3
  98. package/js/src/ellipx.js +175 -80
  99. package/js/src/gate.js +1 -1
  100. package/js/src/gemini.js +3 -5
  101. package/js/src/hitbtc.js +56 -69
  102. package/js/src/hollaex.js +107 -49
  103. package/js/src/htx.js +20 -44
  104. package/js/src/hyperliquid.js +6 -6
  105. package/js/src/kraken.js +29 -24
  106. package/js/src/kucoinfutures.d.ts +1 -0
  107. package/js/src/kucoinfutures.js +6 -0
  108. package/js/src/lbank.js +1 -1
  109. package/js/src/mexc.js +2 -2
  110. package/js/src/ndax.js +25 -24
  111. package/js/src/okcoin.js +12 -31
  112. package/js/src/okx.js +9 -0
  113. package/js/src/onetrading.js +9 -6
  114. package/js/src/oxfun.js +42 -114
  115. package/js/src/paradex.d.ts +12 -1
  116. package/js/src/paradex.js +124 -4
  117. package/js/src/pro/binance.d.ts +26 -26
  118. package/js/src/pro/binance.js +32 -33
  119. package/js/src/pro/bithumb.js +5 -3
  120. package/js/src/pro/{huobijp.d.ts → bittrade.d.ts} +6 -6
  121. package/js/src/pro/{huobijp.js → bittrade.js} +7 -7
  122. package/js/src/pro/kraken.d.ts +7 -6
  123. package/js/src/pro/kraken.js +290 -80
  124. package/js/src/pro/luno.js +6 -5
  125. package/js/src/pro/mexc.d.ts +58 -0
  126. package/js/src/pro/mexc.js +304 -7
  127. package/js/src/pro/poloniex.d.ts +1 -1
  128. package/js/src/pro/poloniex.js +6 -2
  129. package/package.json +1 -1
  130. package/js/src/abstract/bl3p.d.ts +0 -22
  131. package/js/src/abstract/huobijp.js +0 -11
  132. package/js/src/abstract/idex.d.ts +0 -29
  133. package/js/src/abstract/idex.js +0 -11
  134. package/js/src/abstract/kuna.d.ts +0 -185
  135. package/js/src/abstract/kuna.js +0 -11
  136. package/js/src/bl3p.d.ts +0 -116
  137. package/js/src/bl3p.js +0 -552
  138. package/js/src/idex.d.ts +0 -312
  139. package/js/src/idex.js +0 -1961
  140. package/js/src/kuna.d.ts +0 -335
  141. package/js/src/kuna.js +0 -2006
  142. package/js/src/pro/idex.d.ts +0 -81
  143. package/js/src/pro/idex.js +0 -720
  144. /package/js/src/abstract/{huobijp.d.ts → bittrade.d.ts} +0 -0
  145. /package/js/src/abstract/{bl3p.js → bittrade.js} +0 -0
@@ -377,24 +377,35 @@ class coinmetro extends coinmetro$1 {
377
377
  const currency = response[i];
378
378
  const id = this.safeString(currency, 'symbol');
379
379
  const code = this.safeCurrencyCode(id);
380
- const withdraw = this.safeValue(currency, 'canWithdraw');
381
- const deposit = this.safeValue(currency, 'canDeposit');
382
- const canTrade = this.safeValue(currency, 'canTrade');
383
- const active = canTrade ? withdraw : true;
384
- const minAmount = this.safeNumber(currency, 'minQty');
380
+ const typeRaw = this.safeString(currency, 'type');
381
+ let type = undefined;
382
+ if (typeRaw === 'coin' || typeRaw === 'token' || typeRaw === 'erc20') {
383
+ type = 'crypto';
384
+ }
385
+ else if (typeRaw === 'fiat') {
386
+ type = 'fiat';
387
+ }
388
+ const precisionDigits = this.safeString2(currency, 'digits', 'notabeneDecimals');
385
389
  result[code] = this.safeCurrencyStructure({
386
390
  'id': id,
387
391
  'code': code,
388
392
  'name': code,
393
+ 'type': type,
389
394
  'info': currency,
390
- 'active': active,
391
- 'deposit': deposit,
392
- 'withdraw': withdraw,
395
+ 'active': this.safeBool(currency, 'canTrade'),
396
+ 'deposit': this.safeBool(currency, 'canDeposit'),
397
+ 'withdraw': this.safeBool(currency, 'canWithdraw'),
393
398
  'fee': undefined,
394
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'digits'))),
399
+ 'precision': this.parseNumber(this.parsePrecision(precisionDigits)),
395
400
  'limits': {
396
- 'amount': { 'min': minAmount, 'max': undefined },
397
- 'withdraw': { 'min': undefined, 'max': undefined },
401
+ 'amount': {
402
+ 'min': this.safeNumber(currency, 'minQty'),
403
+ 'max': undefined,
404
+ },
405
+ 'withdraw': {
406
+ 'min': undefined,
407
+ 'max': undefined,
408
+ },
398
409
  },
399
410
  'networks': {},
400
411
  });
@@ -296,18 +296,16 @@ class coinone extends coinone$1 {
296
296
  for (let i = 0; i < currencies.length; i++) {
297
297
  const entry = currencies[i];
298
298
  const id = this.safeString(entry, 'symbol');
299
- const name = this.safeString(entry, 'name');
300
299
  const code = this.safeCurrencyCode(id);
301
- const withdrawStatus = this.safeString(entry, 'withdraw_status', '');
302
- const depositStatus = this.safeString(entry, 'deposit_status', '');
303
- const isWithdrawEnabled = withdrawStatus === 'normal';
304
- const isDepositEnabled = depositStatus === 'normal';
305
- result[code] = {
300
+ const isWithdrawEnabled = this.safeString(entry, 'withdraw_status', '') === 'normal';
301
+ const isDepositEnabled = this.safeString(entry, 'deposit_status', '') === 'normal';
302
+ const type = (code !== 'KRW') ? 'crypto' : 'fiat';
303
+ result[code] = this.safeCurrencyStructure({
306
304
  'id': id,
307
305
  'code': code,
308
306
  'info': entry,
309
- 'name': name,
310
- 'active': isWithdrawEnabled && isDepositEnabled,
307
+ 'name': this.safeString(entry, 'name'),
308
+ 'active': undefined,
311
309
  'deposit': isDepositEnabled,
312
310
  'withdraw': isWithdrawEnabled,
313
311
  'fee': this.safeNumber(entry, 'withdrawal_fee'),
@@ -323,8 +321,8 @@ class coinone extends coinone$1 {
323
321
  },
324
322
  },
325
323
  'networks': {},
326
- 'type': 'crypto',
327
- };
324
+ 'type': type,
325
+ });
328
326
  }
329
327
  return result;
330
328
  }
@@ -57,7 +57,7 @@ class coinsph extends coinsph$1 {
57
57
  'fetchClosedOrders': true,
58
58
  'fetchCrossBorrowRate': false,
59
59
  'fetchCrossBorrowRates': false,
60
- 'fetchCurrencies': false,
60
+ 'fetchCurrencies': true,
61
61
  'fetchDeposit': undefined,
62
62
  'fetchDepositAddress': true,
63
63
  'fetchDepositAddresses': false,
@@ -483,6 +483,131 @@ class coinsph extends coinsph$1 {
483
483
  },
484
484
  });
485
485
  }
486
+ /**
487
+ * @method
488
+ * @name coinsph#fetchCurrencies
489
+ * @description fetches all available currencies on an exchange
490
+ * @see https://docs.coins.ph/rest-api/#all-coins-information-user_data
491
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
492
+ * @returns {object} an associative dictionary of currencies
493
+ */
494
+ async fetchCurrencies(params = {}) {
495
+ if (!this.checkRequiredCredentials(false)) {
496
+ return undefined;
497
+ }
498
+ const response = await this.privateGetOpenapiWalletV1ConfigGetall(params);
499
+ //
500
+ // [
501
+ // {
502
+ // "coin": "PHP",
503
+ // "name": "PHP",
504
+ // "depositAllEnable": false,
505
+ // "withdrawAllEnable": false,
506
+ // "free": "0",
507
+ // "locked": "0",
508
+ // "transferPrecision": "2",
509
+ // "transferMinQuantity": "0",
510
+ // "networkList": [],
511
+ // "legalMoney": true
512
+ // },
513
+ // {
514
+ // "coin": "USDT",
515
+ // "name": "USDT",
516
+ // "depositAllEnable": true,
517
+ // "withdrawAllEnable": true,
518
+ // "free": "0",
519
+ // "locked": "0",
520
+ // "transferPrecision": "8",
521
+ // "transferMinQuantity": "0",
522
+ // "networkList": [
523
+ // {
524
+ // "addressRegex": "^0x[0-9a-fA-F]{40}$",
525
+ // "memoRegex": " ",
526
+ // "network": "ETH",
527
+ // "name": "Ethereum (ERC20)",
528
+ // "depositEnable": true,
529
+ // "minConfirm": "12",
530
+ // "unLockConfirm": "-1",
531
+ // "withdrawDesc": "",
532
+ // "withdrawEnable": true,
533
+ // "withdrawFee": "6",
534
+ // "withdrawIntegerMultiple": "0.000001",
535
+ // "withdrawMax": "500000",
536
+ // "withdrawMin": "10",
537
+ // "sameAddress": false
538
+ // },
539
+ // {
540
+ // "addressRegex": "^T[0-9a-zA-Z]{33}$",
541
+ // "memoRegex": "",
542
+ // "network": "TRX",
543
+ // "name": "TRON",
544
+ // "depositEnable": true,
545
+ // "minConfirm": "19",
546
+ // "unLockConfirm": "-1",
547
+ // "withdrawDesc": "",
548
+ // "withdrawEnable": true,
549
+ // "withdrawFee": "3",
550
+ // "withdrawIntegerMultiple": "0.000001",
551
+ // "withdrawMax": "1000000",
552
+ // "withdrawMin": "20",
553
+ // "sameAddress": false
554
+ // }
555
+ // ],
556
+ // "legalMoney": false
557
+ // }
558
+ // ]
559
+ //
560
+ const result = {};
561
+ for (let i = 0; i < response.length; i++) {
562
+ const entry = response[i];
563
+ const id = this.safeString(entry, 'coin');
564
+ const code = this.safeCurrencyCode(id);
565
+ const isFiat = this.safeBool(entry, 'isLegalMoney');
566
+ const networkList = this.safeList(entry, 'networkList', []);
567
+ const networks = {};
568
+ for (let j = 0; j < networkList.length; j++) {
569
+ const networkItem = networkList[j];
570
+ const network = this.safeString(networkItem, 'network');
571
+ const networkCode = this.networkIdToCode(network);
572
+ networks[networkCode] = {
573
+ 'info': networkItem,
574
+ 'id': network,
575
+ 'network': networkCode,
576
+ 'active': undefined,
577
+ 'deposit': this.safeBool(networkItem, 'depositEnable'),
578
+ 'withdraw': this.safeBool(networkItem, 'withdrawEnable'),
579
+ 'fee': this.safeNumber(networkItem, 'withdrawFee'),
580
+ 'precision': this.safeNumber(networkItem, 'withdrawIntegerMultiple'),
581
+ 'limits': {
582
+ 'withdraw': {
583
+ 'min': this.safeNumber(networkItem, 'withdrawMin'),
584
+ 'max': this.safeNumber(networkItem, 'withdrawMax'),
585
+ },
586
+ 'deposit': {
587
+ 'min': undefined,
588
+ 'max': undefined,
589
+ },
590
+ },
591
+ };
592
+ }
593
+ result[code] = this.safeCurrencyStructure({
594
+ 'id': id,
595
+ 'name': this.safeString(entry, 'name'),
596
+ 'code': code,
597
+ 'type': isFiat ? 'fiat' : 'crypto',
598
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(entry, 'transferPrecision'))),
599
+ 'info': entry,
600
+ 'active': undefined,
601
+ 'deposit': this.safeBool(entry, 'depositAllEnable'),
602
+ 'withdraw': this.safeBool(entry, 'withdrawAllEnable'),
603
+ 'networks': networks,
604
+ 'fee': undefined,
605
+ 'fees': undefined,
606
+ 'limits': {},
607
+ });
608
+ }
609
+ return result;
610
+ }
486
611
  calculateRateLimiterCost(api, method, path, params, config = {}) {
487
612
  if (('noSymbol' in config) && !('symbol' in params)) {
488
613
  return config['noSymbol'];
@@ -51,7 +51,7 @@ class cryptocom extends cryptocom$1 {
51
51
  'fetchClosedOrders': 'emulated',
52
52
  'fetchCrossBorrowRate': false,
53
53
  'fetchCrossBorrowRates': false,
54
- 'fetchCurrencies': false,
54
+ 'fetchCurrencies': true,
55
55
  'fetchDepositAddress': true,
56
56
  'fetchDepositAddresses': false,
57
57
  'fetchDepositAddressesByNetwork': true,
@@ -508,6 +508,116 @@ class cryptocom extends cryptocom$1 {
508
508
  },
509
509
  });
510
510
  }
511
+ /**
512
+ * @method
513
+ * @name cryptocom#fetchCurrencies
514
+ * @description fetches all available currencies on an exchange
515
+ * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-currency-networks
516
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
517
+ * @returns {object} an associative dictionary of currencies
518
+ */
519
+ async fetchCurrencies(params = {}) {
520
+ // this endpoint requires authentication
521
+ if (!this.checkRequiredCredentials(false)) {
522
+ return undefined;
523
+ }
524
+ const response = await this.v1PrivatePostPrivateGetCurrencyNetworks(params);
525
+ //
526
+ // {
527
+ // "id": "1747502328559",
528
+ // "method": "private/get-currency-networks",
529
+ // "code": "0",
530
+ // "result": {
531
+ // "update_time": "1747502281000",
532
+ // "currency_map": {
533
+ // "USDT": {
534
+ // "full_name": "Tether USD",
535
+ // "default_network": "ETH",
536
+ // "network_list": [
537
+ // {
538
+ // "network_id": "ETH",
539
+ // "withdrawal_fee": "10.00000000",
540
+ // "withdraw_enabled": true,
541
+ // "min_withdrawal_amount": "20.0",
542
+ // "deposit_enabled": true,
543
+ // "confirmation_required": "32"
544
+ // },
545
+ // {
546
+ // "network_id": "CRONOS",
547
+ // "withdrawal_fee": "0.18000000",
548
+ // "withdraw_enabled": true,
549
+ // "min_withdrawal_amount": "0.36",
550
+ // "deposit_enabled": true,
551
+ // "confirmation_required": "15"
552
+ // },
553
+ // {
554
+ // "network_id": "SOL",
555
+ // "withdrawal_fee": "5.31000000",
556
+ // "withdraw_enabled": true,
557
+ // "min_withdrawal_amount": "10.62",
558
+ // "deposit_enabled": true,
559
+ // "confirmation_required": "1"
560
+ // }
561
+ // ]
562
+ // }
563
+ // }
564
+ // }
565
+ // }
566
+ //
567
+ const resultData = this.safeDict(response, 'result', {});
568
+ const currencyMap = this.safeDict(resultData, 'currency_map', {});
569
+ const keys = Object.keys(currencyMap);
570
+ const result = {};
571
+ for (let i = 0; i < keys.length; i++) {
572
+ const key = keys[i];
573
+ const currency = currencyMap[key];
574
+ const id = key;
575
+ const code = this.safeCurrencyCode(id);
576
+ const networks = {};
577
+ const chains = this.safeList(currency, 'network_list', []);
578
+ for (let j = 0; j < chains.length; j++) {
579
+ const chain = chains[j];
580
+ const networkId = this.safeString(chain, 'network_id');
581
+ const network = this.networkIdToCode(networkId);
582
+ networks[network] = {
583
+ 'info': chain,
584
+ 'id': networkId,
585
+ 'network': network,
586
+ 'active': undefined,
587
+ 'deposit': this.safeBool(chain, 'deposit_enabled', false),
588
+ 'withdraw': this.safeBool(chain, 'withdraw_enabled', false),
589
+ 'fee': this.safeNumber(chain, 'withdrawal_fee'),
590
+ 'precision': undefined,
591
+ 'limits': {
592
+ 'withdraw': {
593
+ 'min': this.safeNumber(chain, 'min_withdrawal_amount'),
594
+ 'max': undefined,
595
+ },
596
+ },
597
+ };
598
+ }
599
+ result[code] = this.safeCurrencyStructure({
600
+ 'info': currency,
601
+ 'id': id,
602
+ 'code': code,
603
+ 'name': this.safeString(currency, 'full_name'),
604
+ 'active': undefined,
605
+ 'deposit': undefined,
606
+ 'withdraw': undefined,
607
+ 'fee': undefined,
608
+ 'precision': undefined,
609
+ 'limits': {
610
+ 'amount': {
611
+ 'min': undefined,
612
+ 'max': undefined,
613
+ },
614
+ },
615
+ 'type': 'crypto',
616
+ 'networks': networks,
617
+ });
618
+ }
619
+ return result;
620
+ }
511
621
  /**
512
622
  * @method
513
623
  * @name cryptocom#fetchMarkets
@@ -365,41 +365,9 @@ class cryptomus extends cryptomus$1 {
365
365
  const coins = this.safeList(response, 'result');
366
366
  const result = {};
367
367
  for (let i = 0; i < coins.length; i++) {
368
- const currency = coins[i];
369
- const currencyId = this.safeString(currency, 'currency_code');
368
+ const networkEntry = coins[i];
369
+ const currencyId = this.safeString(networkEntry, 'currency_code');
370
370
  const code = this.safeCurrencyCode(currencyId);
371
- const allowWithdraw = this.safeBool(currency, 'can_withdraw');
372
- const allowDeposit = this.safeBool(currency, 'can_deposit');
373
- const isActive = allowWithdraw && allowDeposit;
374
- const networkId = this.safeString(currency, 'network_code');
375
- const networksById = this.safeDict(this.options, 'networksById');
376
- const networkName = this.safeString(networksById, networkId, networkId);
377
- const minWithdraw = this.safeNumber(currency, 'min_withdraw');
378
- const maxWithdraw = this.safeNumber(currency, 'max_withdraw');
379
- const minDeposit = this.safeNumber(currency, 'min_deposit');
380
- const maxDeposit = this.safeNumber(currency, 'max_deposit');
381
- const network = {
382
- 'id': networkId,
383
- 'network': networkName,
384
- 'limits': {
385
- 'withdraw': {
386
- 'min': minWithdraw,
387
- 'max': maxWithdraw,
388
- },
389
- 'deposit': {
390
- 'min': minDeposit,
391
- 'max': maxDeposit,
392
- },
393
- },
394
- 'active': isActive,
395
- 'deposit': allowDeposit,
396
- 'withdraw': allowWithdraw,
397
- 'fee': undefined,
398
- 'precision': undefined,
399
- 'info': currency,
400
- };
401
- const networks = {};
402
- networks[networkName] = network;
403
371
  if (!(code in result)) {
404
372
  result[code] = {
405
373
  'id': currencyId,
@@ -407,70 +375,56 @@ class cryptomus extends cryptomus$1 {
407
375
  'precision': undefined,
408
376
  'type': undefined,
409
377
  'name': undefined,
410
- 'active': isActive,
411
- 'deposit': allowDeposit,
412
- 'withdraw': allowWithdraw,
378
+ 'active': undefined,
379
+ 'deposit': undefined,
380
+ 'withdraw': undefined,
413
381
  'fee': undefined,
414
382
  'limits': {
415
383
  'withdraw': {
416
- 'min': minWithdraw,
417
- 'max': maxWithdraw,
384
+ 'min': undefined,
385
+ 'max': undefined,
418
386
  },
419
387
  'deposit': {
420
- 'min': minDeposit,
421
- 'max': maxDeposit,
388
+ 'min': undefined,
389
+ 'max': undefined,
422
390
  },
423
391
  },
424
- 'networks': networks,
425
- 'info': currency,
392
+ 'networks': {},
393
+ 'info': {},
426
394
  };
427
395
  }
428
- else {
429
- const parsed = result[code];
430
- const parsedNetworks = this.safeDict(parsed, 'networks');
431
- parsed['networks'] = this.extend(parsedNetworks, networks);
432
- if (isActive) {
433
- parsed['active'] = true;
434
- parsed['deposit'] = true;
435
- parsed['withdraw'] = true;
436
- }
437
- else {
438
- if (allowWithdraw) {
439
- parsed['withdraw'] = true;
440
- }
441
- if (allowDeposit) {
442
- parsed['deposit'] = true;
443
- }
444
- }
445
- const parsedLimits = this.safeDict(parsed, 'limits');
446
- const withdrawLimits = {
447
- 'min': undefined,
448
- 'max': undefined,
449
- };
450
- const parsedWithdrawLimits = this.safeDict(parsedLimits, 'withdraw', withdrawLimits);
451
- const depositLimits = {
452
- 'min': undefined,
453
- 'max': undefined,
454
- };
455
- const parsedDepositLimits = this.safeDict(parsedLimits, 'deposit', depositLimits);
456
- if (minWithdraw) {
457
- withdrawLimits['min'] = parsedWithdrawLimits['min'] ? Math.min(parsedWithdrawLimits['min'], minWithdraw) : minWithdraw;
458
- }
459
- if (maxWithdraw) {
460
- withdrawLimits['max'] = parsedWithdrawLimits['max'] ? Math.max(parsedWithdrawLimits['max'], maxWithdraw) : maxWithdraw;
461
- }
462
- if (minDeposit) {
463
- depositLimits['min'] = parsedDepositLimits['min'] ? Math.min(parsedDepositLimits['min'], minDeposit) : minDeposit;
464
- }
465
- if (maxDeposit) {
466
- depositLimits['max'] = parsedDepositLimits['max'] ? Math.max(parsedDepositLimits['max'], maxDeposit) : maxDeposit;
467
- }
468
- const limits = {
469
- 'withdraw': withdrawLimits,
470
- 'deposit': depositLimits,
471
- };
472
- parsed['limits'] = limits;
473
- }
396
+ const networkId = this.safeString(networkEntry, 'network_code');
397
+ const networkCode = this.networkIdToCode(networkId);
398
+ result[code]['networks'][networkCode] = {
399
+ 'id': networkId,
400
+ 'network': networkCode,
401
+ 'limits': {
402
+ 'withdraw': {
403
+ 'min': this.safeNumber(networkEntry, 'min_withdraw'),
404
+ 'max': this.safeNumber(networkEntry, 'max_withdraw'),
405
+ },
406
+ 'deposit': {
407
+ 'min': this.safeNumber(networkEntry, 'min_deposit'),
408
+ 'max': this.safeNumber(networkEntry, 'max_deposit'),
409
+ },
410
+ },
411
+ 'active': undefined,
412
+ 'deposit': this.safeBool(networkEntry, 'can_withdraw'),
413
+ 'withdraw': this.safeBool(networkEntry, 'can_deposit'),
414
+ 'fee': undefined,
415
+ 'precision': undefined,
416
+ 'info': networkEntry,
417
+ };
418
+ // add entry in info
419
+ const info = this.safeList(result[code], 'info', []);
420
+ info.push(networkEntry);
421
+ result[code]['info'] = info;
422
+ }
423
+ // only after all entries are formed in currencies, restructure each entry
424
+ const allKeys = Object.keys(result);
425
+ for (let i = 0; i < allKeys.length; i++) {
426
+ const code = allKeys[i];
427
+ result[code] = this.safeCurrencyStructure(result[code]); // this is needed after adding network entry
474
428
  }
475
429
  return result;
476
430
  }