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
@@ -1531,6 +1531,7 @@ class kucoinfutures extends kucoinfutures$1 {
1531
1531
  * @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
1532
1532
  * @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
1533
1533
  * @param {float} [params.cost] the cost of the order in units of USDT
1534
+ * @param {string} [params.marginMode] 'cross' or 'isolated', default is 'isolated'
1534
1535
  * ----------------- Exchange Specific Parameters -----------------
1535
1536
  * @param {float} [params.leverage] Leverage size of the order (mandatory param in request, default is 1)
1536
1537
  * @param {string} [params.clientOid] client order id, defaults to uuid if not passed
@@ -1634,6 +1635,11 @@ class kucoinfutures extends kucoinfutures$1 {
1634
1635
  'type': type,
1635
1636
  'leverage': 1,
1636
1637
  };
1638
+ const marginModeUpper = this.safeStringUpper(params, 'marginMode');
1639
+ if (marginModeUpper !== undefined) {
1640
+ params = this.omit(params, 'marginMode');
1641
+ request['marginMode'] = marginModeUpper;
1642
+ }
1637
1643
  const cost = this.safeString(params, 'cost');
1638
1644
  params = this.omit(params, 'cost');
1639
1645
  if (cost !== undefined) {
@@ -876,7 +876,7 @@ class lbank extends lbank$1 {
876
876
  if (market['swap']) {
877
877
  return this.parseOrderBook(orderbook, market['symbol'], timestamp, 'bids', 'asks', 'price', 'volume');
878
878
  }
879
- return this.parseOrderBook(orderbook, market['symbol'], timestamp);
879
+ return this.parseOrderBook(orderbook, market['symbol'], timestamp, 'bids', 'asks', 1, 0);
880
880
  }
881
881
  parseTrade(trade, market = undefined) {
882
882
  //
@@ -1087,7 +1087,6 @@ class mexc extends mexc$1 {
1087
1087
  const currency = response[i];
1088
1088
  const id = this.safeString(currency, 'coin');
1089
1089
  const code = this.safeCurrencyCode(id);
1090
- const name = this.safeString(currency, 'name');
1091
1090
  const networks = {};
1092
1091
  const chains = this.safeValue(currency, 'networkList', []);
1093
1092
  for (let j = 0; j < chains.length; j++) {
@@ -1109,13 +1108,14 @@ class mexc extends mexc$1 {
1109
1108
  'max': this.safeString(chain, 'withdrawMax'),
1110
1109
  },
1111
1110
  },
1111
+ 'contract': this.safeString(chain, 'contract'),
1112
1112
  };
1113
1113
  }
1114
1114
  result[code] = this.safeCurrencyStructure({
1115
1115
  'info': currency,
1116
1116
  'id': id,
1117
1117
  'code': code,
1118
- 'name': name,
1118
+ 'name': this.safeString(currency, 'name'),
1119
1119
  'active': undefined,
1120
1120
  'deposit': undefined,
1121
1121
  'withdraw': undefined,
@@ -452,45 +452,45 @@ class ndax extends ndax$1 {
452
452
  };
453
453
  const response = await this.publicGetGetProducts(this.extend(request, params));
454
454
  //
455
- // [
456
- // {
457
- // "OMSId":1,
458
- // "ProductId":1,
459
- // "Product":"BTC",
460
- // "ProductFullName":"Bitcoin",
461
- // "ProductType":"CryptoCurrency",
462
- // "DecimalPlaces":8,
463
- // "TickSize":0.0000000100000000000000000000,
464
- // "NoFees":false,
465
- // "IsDisabled":false,
466
- // "MarginEnabled":false
467
- // },
468
- // ]
455
+ // [
456
+ // {
457
+ // "OMSId": "1",
458
+ // "ProductId": "1",
459
+ // "Product": "BTC",
460
+ // "ProductFullName": "Bitcoin",
461
+ // "MasterDataUniqueProductSymbol": "",
462
+ // "ProductType": "CryptoCurrency",
463
+ // "DecimalPlaces": "8",
464
+ // "TickSize": "0.0000000100000000000000000000",
465
+ // "DepositEnabled": true,
466
+ // "WithdrawEnabled": true,
467
+ // "NoFees": false,
468
+ // "IsDisabled": false,
469
+ // "MarginEnabled": false
470
+ // },
471
+ // ...
469
472
  //
470
473
  const result = {};
471
474
  for (let i = 0; i < response.length; i++) {
472
475
  const currency = response[i];
473
476
  const id = this.safeString(currency, 'ProductId');
474
- const name = this.safeString(currency, 'ProductFullName');
477
+ const code = this.safeCurrencyCode(this.safeString(currency, 'Product'));
475
478
  const ProductType = this.safeString(currency, 'ProductType');
476
479
  let type = (ProductType === 'NationalCurrency') ? 'fiat' : 'crypto';
477
480
  if (ProductType === 'Unknown') {
478
481
  // such currency is just a blanket entry
479
482
  type = 'other';
480
483
  }
481
- const code = this.safeCurrencyCode(this.safeString(currency, 'Product'));
482
- const isDisabled = this.safeValue(currency, 'IsDisabled');
483
- const active = !isDisabled;
484
- result[code] = {
484
+ result[code] = this.safeCurrencyStructure({
485
485
  'id': id,
486
- 'name': name,
486
+ 'name': this.safeString(currency, 'ProductFullName'),
487
487
  'code': code,
488
488
  'type': type,
489
489
  'precision': this.safeNumber(currency, 'TickSize'),
490
490
  'info': currency,
491
- 'active': active,
492
- 'deposit': undefined,
493
- 'withdraw': undefined,
491
+ 'active': !this.safeBool(currency, 'IsDisabled'),
492
+ 'deposit': this.safeBool(currency, 'DepositEnabled'),
493
+ 'withdraw': this.safeBool(currency, 'WithdrawEnabled'),
494
494
  'fee': undefined,
495
495
  'limits': {
496
496
  'amount': {
@@ -503,7 +503,8 @@ class ndax extends ndax$1 {
503
503
  },
504
504
  },
505
505
  'networks': {},
506
- };
506
+ 'margin': this.safeBool(currency, 'MarginEnabled'),
507
+ });
507
508
  }
508
509
  return result;
509
510
  }
@@ -826,49 +826,30 @@ class okcoin extends okcoin$1 {
826
826
  }
827
827
  else {
828
828
  const response = await this.privateGetAssetCurrencies(params);
829
- const data = this.safeValue(response, 'data', []);
829
+ const data = this.safeList(response, 'data', []);
830
830
  const result = {};
831
831
  const dataByCurrencyId = this.groupBy(data, 'ccy');
832
832
  const currencyIds = Object.keys(dataByCurrencyId);
833
833
  for (let i = 0; i < currencyIds.length; i++) {
834
834
  const currencyId = currencyIds[i];
835
- const currency = this.safeCurrency(currencyId);
836
- const code = currency['code'];
835
+ const code = this.safeCurrencyCode(currencyId);
837
836
  const chains = dataByCurrencyId[currencyId];
838
837
  const networks = {};
839
- let currencyActive = false;
840
- let depositEnabled = false;
841
- let withdrawEnabled = false;
842
- let maxPrecision = undefined;
843
838
  for (let j = 0; j < chains.length; j++) {
844
839
  const chain = chains[j];
845
- const canDeposit = this.safeValue(chain, 'canDep');
846
- depositEnabled = (canDeposit) ? canDeposit : depositEnabled;
847
- const canWithdraw = this.safeValue(chain, 'canWd');
848
- withdrawEnabled = (canWithdraw) ? canWithdraw : withdrawEnabled;
849
- const canInternal = this.safeValue(chain, 'canInternal');
850
- const active = (canDeposit && canWithdraw && canInternal) ? true : false;
851
- currencyActive = (active) ? active : currencyActive;
852
840
  const networkId = this.safeString(chain, 'chain');
853
841
  if ((networkId !== undefined) && (networkId.indexOf('-') >= 0)) {
854
842
  const parts = networkId.split('-');
855
843
  const chainPart = this.safeString(parts, 1, networkId);
856
844
  const networkCode = this.networkIdToCode(chainPart);
857
- const precision = this.parsePrecision(this.safeString(chain, 'wdTickSz'));
858
- if (maxPrecision === undefined) {
859
- maxPrecision = precision;
860
- }
861
- else {
862
- maxPrecision = Precise["default"].stringMin(maxPrecision, precision);
863
- }
864
845
  networks[networkCode] = {
865
846
  'id': networkId,
866
847
  'network': networkCode,
867
- 'active': active,
868
- 'deposit': canDeposit,
869
- 'withdraw': canWithdraw,
848
+ 'active': undefined,
849
+ 'deposit': this.safeBool(chain, 'canDep'),
850
+ 'withdraw': this.safeBool(chain, 'canWd'),
870
851
  'fee': this.safeNumber(chain, 'minFee'),
871
- 'precision': this.parseNumber(precision),
852
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'wdTickSz'))),
872
853
  'limits': {
873
854
  'withdraw': {
874
855
  'min': this.safeNumber(chain, 'minWd'),
@@ -880,16 +861,16 @@ class okcoin extends okcoin$1 {
880
861
  }
881
862
  }
882
863
  const firstChain = this.safeValue(chains, 0);
883
- result[code] = {
864
+ result[code] = this.safeCurrencyStructure({
884
865
  'info': chains,
885
866
  'code': code,
886
867
  'id': currencyId,
887
868
  'name': this.safeString(firstChain, 'name'),
888
- 'active': currencyActive,
889
- 'deposit': depositEnabled,
890
- 'withdraw': withdrawEnabled,
869
+ 'active': undefined,
870
+ 'deposit': undefined,
871
+ 'withdraw': undefined,
891
872
  'fee': undefined,
892
- 'precision': this.parseNumber(maxPrecision),
873
+ 'precision': undefined,
893
874
  'limits': {
894
875
  'amount': {
895
876
  'min': undefined,
@@ -897,7 +878,7 @@ class okcoin extends okcoin$1 {
897
878
  },
898
879
  },
899
880
  'networks': networks,
900
- };
881
+ });
901
882
  }
902
883
  return result;
903
884
  }
@@ -363,6 +363,7 @@ class okx extends okx$1 {
363
363
  'account/spot-manual-borrow-repay': 10,
364
364
  'account/set-auto-repay': 4,
365
365
  'account/spot-borrow-repay-history': 4,
366
+ 'account/move-positions-history': 10,
366
367
  // subaccount
367
368
  'users/subaccount/list': 10,
368
369
  'account/subaccount/balances': 10 / 3,
@@ -500,6 +501,7 @@ class okx extends okx$1 {
500
501
  'account/fixed-loan/manual-reborrow': 5,
501
502
  'account/fixed-loan/repay-borrowing-order': 5,
502
503
  'account/bills-history-archive': 72000,
504
+ 'account/move-positions': 10,
503
505
  // subaccount
504
506
  'users/subaccount/modify-apikey': 10,
505
507
  'asset/subaccount/transfer': 10,
@@ -966,6 +968,13 @@ class okx extends okx$1 {
966
968
  '70010': errors.BadRequest,
967
969
  '70013': errors.BadRequest,
968
970
  '70016': errors.BadRequest,
971
+ '70060': errors.BadRequest,
972
+ '70061': errors.BadRequest,
973
+ '70062': errors.BadRequest,
974
+ '70064': errors.BadRequest,
975
+ '70065': errors.BadRequest,
976
+ '70066': errors.BadRequest,
977
+ '70067': errors.BadRequest,
969
978
  '1009': errors.BadRequest,
970
979
  '4001': errors.AuthenticationError,
971
980
  '4002': errors.BadRequest,
@@ -392,9 +392,12 @@ class onetrading extends onetrading$1 {
392
392
  //
393
393
  // [
394
394
  // {
395
- // "code":"BEST",
396
- // "precision":8
397
- // }
395
+ // "code": "USDT",
396
+ // "precision": 6,
397
+ // "unified_cryptoasset_id": 825,
398
+ // "name": "Tether USDt",
399
+ // "collateral_percentage": 0
400
+ // },
398
401
  // ]
399
402
  //
400
403
  const result = {};
@@ -402,10 +405,10 @@ class onetrading extends onetrading$1 {
402
405
  const currency = response[i];
403
406
  const id = this.safeString(currency, 'code');
404
407
  const code = this.safeCurrencyCode(id);
405
- result[code] = {
408
+ result[code] = this.safeCurrencyStructure({
406
409
  'id': id,
407
410
  'code': code,
408
- 'name': undefined,
411
+ 'name': this.safeString(currency, 'name'),
409
412
  'info': currency,
410
413
  'active': undefined,
411
414
  'fee': undefined,
@@ -417,7 +420,7 @@ class onetrading extends onetrading$1 {
417
420
  'withdraw': { 'min': undefined, 'max': undefined },
418
421
  },
419
422
  'networks': {},
420
- };
423
+ });
421
424
  }
422
425
  return result;
423
426
  }
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var oxfun$1 = require('./abstract/oxfun.js');
4
- var Precise = require('./base/Precise.js');
5
4
  var errors = require('./base/errors.js');
6
5
  var number = require('./base/functions/number.js');
7
6
  var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
@@ -599,66 +598,7 @@ class oxfun extends oxfun$1 {
599
598
  // "minDeposit": "0.00010",
600
599
  // "minWithdrawal": "0.00010"
601
600
  // },
602
- // {
603
- // "network": "Arbitrum",
604
- // "tokenId": "0xba0Dda8762C24dA9487f5FA026a9B64b695A07Ea",
605
- // "transactionPrecision": "18",
606
- // "isWithdrawalFeeChargedToUser": true,
607
- // "canDeposit": true,
608
- // "canWithdraw": true,
609
- // "minDeposit": "0.00010",
610
- // "minWithdrawal": "0.00010"
611
- // },
612
- // {
613
- // "network": "Ethereum",
614
- // "tokenId": "0xba0Dda8762C24dA9487f5FA026a9B64b695A07Ea",
615
- // "transactionPrecision": "18",
616
- // "isWithdrawalFeeChargedToUser": true,
617
- // "canDeposit": true,
618
- // "canWithdraw": true,
619
- // "minDeposit": "0.00010",
620
- // "minWithdrawal": "0.00010"
621
- // },
622
- // {
623
- // "network": "Arbitrum",
624
- // "tokenId": "0x78a0A62Fba6Fb21A83FE8a3433d44C73a4017A6f",
625
- // "transactionPrecision": "18",
626
- // "isWithdrawalFeeChargedToUser": true,
627
- // "canDeposit": true,
628
- // "canWithdraw": false,
629
- // "minDeposit": "0.00010",
630
- // "minWithdrawal": "0.00010"
631
- // },
632
- // {
633
- // "network": "Avalanche",
634
- // "tokenId": "0x78a0A62Fba6Fb21A83FE8a3433d44C73a4017A6f",
635
- // "transactionPrecision": "18",
636
- // "isWithdrawalFeeChargedToUser": true,
637
- // "canDeposit": true,
638
- // "canWithdraw": false,
639
- // "minDeposit": "0.00010",
640
- // "minWithdrawal": "0.00010"
641
- // },
642
- // {
643
- // "network": "Solana",
644
- // "tokenId": "DV3845GEAVXfwpyVGGgWbqBVCtzHdCXNCGfcdboSEuZz",
645
- // "transactionPrecision": "8",
646
- // "isWithdrawalFeeChargedToUser": true,
647
- // "canDeposit": true,
648
- // "canWithdraw": true,
649
- // "minDeposit": "0.00010",
650
- // "minWithdrawal": "0.00010"
651
- // },
652
- // {
653
- // "network": "Ethereum",
654
- // "tokenId": "0x78a0A62Fba6Fb21A83FE8a3433d44C73a4017A6f",
655
- // "transactionPrecision": "18",
656
- // "isWithdrawalFeeChargedToUser": true,
657
- // "canDeposit": true,
658
- // "canWithdraw": false,
659
- // "minDeposit": "0.00010",
660
- // "minWithdrawal": "0.00010"
661
- // }
601
+ // ...
662
602
  // ]
663
603
  // },
664
604
  // {
@@ -708,79 +648,67 @@ class oxfun extends oxfun$1 {
708
648
  const parts = fullId.split('.');
709
649
  const id = parts[0];
710
650
  const code = this.safeCurrencyCode(id);
711
- let networks = {};
651
+ if (!(code in result)) {
652
+ result[code] = {
653
+ 'id': id,
654
+ 'code': code,
655
+ 'precision': undefined,
656
+ 'type': undefined,
657
+ 'name': undefined,
658
+ 'active': undefined,
659
+ 'deposit': undefined,
660
+ 'withdraw': undefined,
661
+ 'fee': undefined,
662
+ 'limits': {
663
+ 'withdraw': {
664
+ 'min': undefined,
665
+ 'max': undefined,
666
+ },
667
+ 'deposit': {
668
+ 'min': undefined,
669
+ 'max': undefined,
670
+ },
671
+ },
672
+ 'networks': {},
673
+ 'info': [],
674
+ };
675
+ }
712
676
  const chains = this.safeList(currency, 'networkList', []);
713
- let currencyMaxPrecision = undefined;
714
- let currencyDepositEnabled = undefined;
715
- let currencyWithdrawEnabled = undefined;
716
677
  for (let j = 0; j < chains.length; j++) {
717
678
  const chain = chains[j];
718
679
  const networkId = this.safeString(chain, 'network');
719
680
  const networkCode = this.networkIdToCode(networkId);
720
- const deposit = this.safeBool(chain, 'canDeposit');
721
- const withdraw = this.safeBool(chain, 'canWithdraw');
722
- const active = (deposit && withdraw);
723
- const minDeposit = this.safeString(chain, 'minDeposit');
724
- const minWithdrawal = this.safeString(chain, 'minWithdrawal');
725
- const precision = this.parsePrecision(this.safeString(chain, 'transactionPrecision'));
726
- networks[networkCode] = {
681
+ result[code]['networks'][networkCode] = {
727
682
  'id': networkId,
728
683
  'network': networkCode,
729
684
  'margin': undefined,
730
- 'deposit': deposit,
731
- 'withdraw': withdraw,
732
- 'active': active,
685
+ 'deposit': this.safeBool(chain, 'canDeposit'),
686
+ 'withdraw': this.safeBool(chain, 'canWithdraw'),
687
+ 'active': undefined,
733
688
  'fee': undefined,
734
- 'precision': this.parseNumber(precision),
689
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'transactionPrecision'))),
735
690
  'limits': {
736
691
  'deposit': {
737
- 'min': minDeposit,
692
+ 'min': this.safeNumber(chain, 'minDeposit'),
738
693
  'max': undefined,
739
694
  },
740
695
  'withdraw': {
741
- 'min': minWithdrawal,
696
+ 'min': this.safeNumber(chain, 'minWithdrawal'),
742
697
  'max': undefined,
743
698
  },
744
699
  },
745
700
  'info': chain,
746
701
  };
747
- if ((currencyDepositEnabled === undefined) || deposit) {
748
- currencyDepositEnabled = deposit;
749
- }
750
- if ((currencyWithdrawEnabled === undefined) || withdraw) {
751
- currencyWithdrawEnabled = withdraw;
752
- }
753
- if ((currencyMaxPrecision === undefined) || Precise["default"].stringGt(currencyMaxPrecision, precision)) {
754
- currencyMaxPrecision = precision;
755
- }
756
- }
757
- if (code in result) {
758
- // checking for specific ids as USDC.ARB
759
- networks = this.extend(result[code]['networks'], networks);
760
702
  }
761
- result[code] = {
762
- 'id': id,
763
- 'code': code,
764
- 'name': undefined,
765
- 'type': undefined,
766
- 'active': undefined,
767
- 'deposit': currencyDepositEnabled,
768
- 'withdraw': currencyWithdrawEnabled,
769
- 'fee': undefined,
770
- 'precision': this.parseNumber(currencyMaxPrecision),
771
- 'limits': {
772
- 'amount': {
773
- 'min': undefined,
774
- 'max': undefined,
775
- },
776
- 'withdraw': {
777
- 'min': undefined,
778
- 'max': undefined,
779
- },
780
- },
781
- 'networks': networks,
782
- 'info': currency,
783
- };
703
+ const infos = this.safeList(result[code], 'info', []);
704
+ infos.push(currency);
705
+ result[code]['info'] = infos;
706
+ }
707
+ // only after all entries are formed in currencies, restructure each entry
708
+ const allKeys = Object.keys(result);
709
+ for (let i = 0; i < allKeys.length; i++) {
710
+ const code = allKeys[i];
711
+ result[code] = this.safeCurrencyStructure(result[code]); // this is needed after adding network entry
784
712
  }
785
713
  return result;
786
714
  }